Browse Source

Add sticky threads

json
Trevor Slocum 7 years ago
parent
commit
cd90c9caf9
  1. 16
      imgboard.php
  2. 100
      inc/database_flatfile.php
  3. 8
      inc/database_mysql.php
  4. 9
      inc/database_mysqli.php
  5. 8
      inc/database_pdo.php
  6. 11
      inc/database_sqlite.php
  7. 2
      inc/flatfile/flatfile.php
  8. 4
      inc/functions.php
  9. 22
      inc/html.php
  10. BIN
      sticky.png

16
imgboard.php

@ -445,7 +445,7 @@ if (isset($_POST['message']) || isset($_POST['file'])) { @@ -445,7 +445,7 @@ if (isset($_POST['message']) || isset($_POST['file'])) {
foreach ($threads as $thread) {
$posts = postsInThreadByID($thread['id']);
foreach ($posts as $post) {
mysqli_query($link, "INSERT INTO `" . TINYIB_DBPOSTS . "` (`id`, `parent`, `timestamp`, `bumped`, `ip`, `name`, `tripcode`, `email`, `nameblock`, `subject`, `message`, `password`, `file`, `file_hex`, `file_original`, `file_size`, `file_size_formatted`, `image_width`, `image_height`, `thumb`, `thumb_width`, `thumb_height`) VALUES (" . $post['id'] . ", " . $post['parent'] . ", " . time() . ", " . time() . ", '" . $_SERVER['REMOTE_ADDR'] . "', '" . mysqli_real_escape_string($link, $post['name']) . "', '" . mysqli_real_escape_string($link, $post['tripcode']) . "', '" . mysqli_real_escape_string($link, $post['email']) . "', '" . mysqli_real_escape_string($link, $post['nameblock']) . "', '" . mysqli_real_escape_string($link, $post['subject']) . "', '" . mysqli_real_escape_string($link, $post['message']) . "', '" . mysqli_real_escape_string($link, $post['password']) . "', '" . $post['file'] . "', '" . $post['file_hex'] . "', '" . mysqli_real_escape_string($link, $post['file_original']) . "', " . $post['file_size'] . ", '" . $post['file_size_formatted'] . "', " . $post['image_width'] . ", " . $post['image_height'] . ", '" . $post['thumb'] . "', " . $post['thumb_width'] . ", " . $post['thumb_height'] . ")");
mysqli_query($link, "INSERT INTO `" . TINYIB_DBPOSTS . "` (`id`, `parent`, `timestamp`, `bumped`, `ip`, `name`, `tripcode`, `email`, `nameblock`, `subject`, `message`, `password`, `file`, `file_hex`, `file_original`, `file_size`, `file_size_formatted`, `image_width`, `image_height`, `thumb`, `thumb_width`, `thumb_height`, `stickied`) VALUES (" . $post['id'] . ", " . $post['parent'] . ", " . time() . ", " . time() . ", '" . $_SERVER['REMOTE_ADDR'] . "', '" . mysqli_real_escape_string($link, $post['name']) . "', '" . mysqli_real_escape_string($link, $post['tripcode']) . "', '" . mysqli_real_escape_string($link, $post['email']) . "', '" . mysqli_real_escape_string($link, $post['nameblock']) . "', '" . mysqli_real_escape_string($link, $post['subject']) . "', '" . mysqli_real_escape_string($link, $post['message']) . "', '" . mysqli_real_escape_string($link, $post['password']) . "', '" . $post['file'] . "', '" . $post['file_hex'] . "', '" . mysqli_real_escape_string($link, $post['file_original']) . "', " . $post['file_size'] . ", '" . $post['file_size_formatted'] . "', " . $post['image_width'] . ", " . $post['image_height'] . ", '" . $post['thumb'] . "', " . $post['thumb_width'] . ", " . $post['thumb_height'] . ", " . $post['stickied'] . ")");
$max_id = max($max_id, $post['id']);
}
}
@ -526,6 +526,20 @@ if (isset($_POST['message']) || isset($_POST['file'])) { @@ -526,6 +526,20 @@ if (isset($_POST['message']) || isset($_POST['file'])) {
$onload = manageOnLoad('moderate');
$text .= manageModeratePostForm();
}
} elseif (isset($_GET['sticky']) && isset($_GET['setsticky'])) {
if ($_GET['sticky'] > 0) {
$post = postByID($_GET['sticky']);
if ($post && $post['parent'] == TINYIB_NEWTHREAD) {
stickyThreadByID($post['id'], (intval($_GET['setsticky'])));
threadUpdated($post['id']);
$text .= manageInfo('Thread No.' . $post['id'] . ' ' . (intval($_GET['setsticky']) == 1 ? 'stickied' : 'un-stickied') . '.');
} else {
fancyDie("Sorry, there doesn't appear to be a thread with that ID.");
}
} else {
fancyDie("Form data was lost. Please go back and try again.");
}
} elseif (isset($_GET["rawpost"])) {
$onload = manageOnLoad("rawpost");
$text .= manageRawPostForm();

100
inc/database_flatfile.php

@ -27,6 +27,7 @@ define('POST_IMAGE_HEIGHT', 18); @@ -27,6 +27,7 @@ define('POST_IMAGE_HEIGHT', 18);
define('POST_THUMB', 19);
define('POST_THUMB_WIDTH', 20);
define('POST_THUMB_HEIGHT', 21);
define('POST_STICKIED', 22);
# Ban Structure
define('BANS_FILE', '.bans');
@ -59,33 +60,43 @@ function threadExistsByID($id) { @@ -59,33 +60,43 @@ function threadExistsByID($id) {
function insertPost($newpost) {
$post = array();
$post[POST_ID] = '0';
$post[POST_PARENT] = $newpost['parent'];
$post[POST_TIMESTAMP] = time();
$post[POST_BUMPED] = time();
$post[POST_IP] = $newpost['ip'];
$post[POST_NAME] = $newpost['name'];
$post[POST_TRIPCODE] = $newpost['tripcode'];
$post[POST_EMAIL] = $newpost['email'];
$post[POST_NAMEBLOCK] = $newpost['nameblock'];
$post[POST_SUBJECT] = $newpost['subject'];
$post[POST_MESSAGE] = $newpost['message'];
$post[POST_PASSWORD] = $newpost['password'];
$post[POST_FILE] = $newpost['file'];
$post[POST_FILE_HEX] = $newpost['file_hex'];
$post[POST_FILE_ORIGINAL] = $newpost['file_original'];
$post[POST_FILE_SIZE] = $newpost['file_size'];
$post[POST_ID] = '0';
$post[POST_PARENT] = $newpost['parent'];
$post[POST_TIMESTAMP] = time();
$post[POST_BUMPED] = time();
$post[POST_IP] = $newpost['ip'];
$post[POST_NAME] = $newpost['name'];
$post[POST_TRIPCODE] = $newpost['tripcode'];
$post[POST_EMAIL] = $newpost['email'];
$post[POST_NAMEBLOCK] = $newpost['nameblock'];
$post[POST_SUBJECT] = $newpost['subject'];
$post[POST_MESSAGE] = $newpost['message'];
$post[POST_PASSWORD] = $newpost['password'];
$post[POST_FILE] = $newpost['file'];
$post[POST_FILE_HEX] = $newpost['file_hex'];
$post[POST_FILE_ORIGINAL] = $newpost['file_original'];
$post[POST_FILE_SIZE] = $newpost['file_size'];
$post[POST_FILE_SIZE_FORMATTED] = $newpost['file_size_formatted'];
$post[POST_IMAGE_WIDTH] = $newpost['image_width'];
$post[POST_IMAGE_HEIGHT] = $newpost['image_height'];
$post[POST_THUMB] = $newpost['thumb'];
$post[POST_THUMB_WIDTH] = $newpost['thumb_width'];
$post[POST_THUMB_HEIGHT] = $newpost['thumb_height'];
$post[POST_THUMB_HEIGHT] = $newpost['thumb_height'];
$post[POST_IMAGE_WIDTH] = $newpost['image_width'];
$post[POST_IMAGE_HEIGHT] = $newpost['image_height'];
$post[POST_THUMB] = $newpost['thumb'];
$post[POST_THUMB_WIDTH] = $newpost['thumb_width'];
$post[POST_THUMB_HEIGHT] = $newpost['thumb_height'];
$post[POST_STICKIED] = $newpost['stickied'];
return $GLOBALS['db']->insertWithAutoId(POSTS_FILE, POST_ID, $post);
}
function stickyThreadByID($id, $setsticky) {
$rows = $GLOBALS['db']->selectWhere(POSTS_FILE, new SimpleWhereClause(POST_ID, '=', $id, INTEGER_COMPARISON), 1);
if (count($rows) > 0) {
foreach ($rows as $post) {
$post[POST_STICKIED] = intval($setsticky);
$GLOBALS['db']->updateRowById(POSTS_FILE, POST_ID, $post);
}
}
}
function bumpThreadByID($id) {
$rows = $GLOBALS['db']->selectWhere(POSTS_FILE, new SimpleWhereClause(POST_ID, '=', $id, INTEGER_COMPARISON), 1);
if (count($rows) > 0) {
@ -105,28 +116,29 @@ function convertPostsToSQLStyle($posts, $singlepost = false) { @@ -105,28 +116,29 @@ function convertPostsToSQLStyle($posts, $singlepost = false) {
$newposts = array();
foreach ($posts as $oldpost) {
$post = newPost();
$post['id'] = $oldpost[POST_ID];
$post['parent'] = $oldpost[POST_PARENT];
$post['timestamp'] = $oldpost[POST_TIMESTAMP];
$post['bumped'] = $oldpost[POST_BUMPED];
$post['ip'] = $oldpost[POST_IP];
$post['name'] = $oldpost[POST_NAME];
$post['tripcode'] = $oldpost[POST_TRIPCODE];
$post['email'] = $oldpost[POST_EMAIL];
$post['nameblock'] = $oldpost[POST_NAMEBLOCK];
$post['subject'] = $oldpost[POST_SUBJECT];
$post['message'] = $oldpost[POST_MESSAGE];
$post['password'] = $oldpost[POST_PASSWORD];
$post['file'] = $oldpost[POST_FILE];
$post['file_hex'] = $oldpost[POST_FILE_HEX];
$post['file_original'] = $oldpost[POST_FILE_ORIGINAL];
$post['file_size'] = $oldpost[POST_FILE_SIZE];
$post['id'] = $oldpost[POST_ID];
$post['parent'] = $oldpost[POST_PARENT];
$post['timestamp'] = $oldpost[POST_TIMESTAMP];
$post['bumped'] = $oldpost[POST_BUMPED];
$post['ip'] = $oldpost[POST_IP];
$post['name'] = $oldpost[POST_NAME];
$post['tripcode'] = $oldpost[POST_TRIPCODE];
$post['email'] = $oldpost[POST_EMAIL];
$post['nameblock'] = $oldpost[POST_NAMEBLOCK];
$post['subject'] = $oldpost[POST_SUBJECT];
$post['message'] = $oldpost[POST_MESSAGE];
$post['password'] = $oldpost[POST_PASSWORD];
$post['file'] = $oldpost[POST_FILE];
$post['file_hex'] = $oldpost[POST_FILE_HEX];
$post['file_original'] = $oldpost[POST_FILE_ORIGINAL];
$post['file_size'] = $oldpost[POST_FILE_SIZE];
$post['file_size_formatted'] = $oldpost[POST_FILE_SIZE_FORMATTED];
$post['image_width'] = $oldpost[POST_IMAGE_WIDTH];
$post['image_height'] = $oldpost[POST_IMAGE_HEIGHT];
$post['thumb'] = $oldpost[POST_THUMB];
$post['thumb_width'] = $oldpost[POST_THUMB_WIDTH];
$post['thumb_height'] = $oldpost[POST_THUMB_HEIGHT];
$post['image_width'] = $oldpost[POST_IMAGE_WIDTH];
$post['image_height'] = $oldpost[POST_IMAGE_HEIGHT];
$post['thumb'] = $oldpost[POST_THUMB];
$post['thumb_width'] = $oldpost[POST_THUMB_WIDTH];
$post['thumb_height'] = $oldpost[POST_THUMB_HEIGHT];
$post['stickied'] = isset($oldpost[POST_STICKIED]) ? $oldpost[POST_STICKIED] : 0;
if ($post['parent'] == '') {
$post['parent'] = TINYIB_NEWTHREAD;
@ -141,7 +153,7 @@ function convertPostsToSQLStyle($posts, $singlepost = false) { @@ -141,7 +153,7 @@ function convertPostsToSQLStyle($posts, $singlepost = false) {
}
function allThreads() {
$rows = $GLOBALS['db']->selectWhere(POSTS_FILE, new SimpleWhereClause(POST_PARENT, '=', 0, INTEGER_COMPARISON), -1, new OrderBy(POST_BUMPED, DESCENDING, INTEGER_COMPARISON));
$rows = $GLOBALS['db']->selectWhere(POSTS_FILE, new SimpleWhereClause(POST_PARENT, '=', 0, INTEGER_COMPARISON), -1, array(new OrderBy(POST_STICKIED, DESCENDING, INTEGER_COMPARISON), new OrderBy(POST_BUMPED, DESCENDING, INTEGER_COMPARISON)));
return convertPostsToSQLStyle($rows);
}

8
inc/database_mysql.php

@ -54,6 +54,10 @@ function approvePostByID($id) { @@ -54,6 +54,10 @@ function approvePostByID($id) {
mysql_query("UPDATE `" . TINYIB_DBPOSTS . "` SET `moderated` = 1 WHERE `id` = " . $id . " LIMIT 1");
}
function stickyThreadByID($id, $setsticky) {
mysql_query("UPDATE `" . TINYIB_DBPOSTS . "` SET `stickied` = '" . mysql_real_escape_string($setsticky) . "' WHERE `id` = " . $id . " LIMIT 1");
}
function bumpThreadByID($id) {
mysql_query("UPDATE `" . TINYIB_DBPOSTS . "` SET `bumped` = " . time() . " WHERE `id` = " . $id . " LIMIT 1");
}
@ -64,7 +68,7 @@ function countThreads() { @@ -64,7 +68,7 @@ function countThreads() {
function allThreads() {
$threads = array();
$result = mysql_query("SELECT * FROM `" . TINYIB_DBPOSTS . "` WHERE `parent` = 0 AND `moderated` = 1 ORDER BY `bumped` DESC");
$result = mysql_query("SELECT * FROM `" . TINYIB_DBPOSTS . "` WHERE `parent` = 0 AND `moderated` = 1 ORDER BY `stickied` DESC, `bumped` DESC");
if ($result) {
while ($thread = mysql_fetch_assoc($result)) {
$threads[] = $thread;
@ -131,7 +135,7 @@ function deletePostByID($id) { @@ -131,7 +135,7 @@ function deletePostByID($id) {
function trimThreads() {
if (TINYIB_MAXTHREADS > 0) {
$result = mysql_query("SELECT `id` FROM `" . TINYIB_DBPOSTS . "` WHERE `parent` = 0 AND `moderated` = 1 ORDER BY `bumped` DESC LIMIT " . TINYIB_MAXTHREADS . ", 10");
$result = mysql_query("SELECT `id` FROM `" . TINYIB_DBPOSTS . "` WHERE `parent` = 0 AND `moderated` = 1 ORDER BY `stickied` DESC, `bumped` DESC LIMIT " . TINYIB_MAXTHREADS . ", 10");
if ($result) {
while ($post = mysql_fetch_assoc($result)) {
deletePostByID($post['id']);

9
inc/database_mysqli.php

@ -59,6 +59,11 @@ function approvePostByID($id) { @@ -59,6 +59,11 @@ function approvePostByID($id) {
mysqli_query($link, "UPDATE `" . TINYIB_DBPOSTS . "` SET `moderated` = 1 WHERE `id` = " . $id . " LIMIT 1");
}
function stickyThreadByID($id, $setsticky) {
global $link;
mysqli_query($link, "UPDATE `" . TINYIB_DBPOSTS . "` SET `stickied` = '" . mysqli_real_escape_string($link, $setsticky) . "' WHERE `id` = " . $id . " LIMIT 1");
}
function bumpThreadByID($id) {
global $link;
mysqli_query($link, "UPDATE `" . TINYIB_DBPOSTS . "` SET `bumped` = " . time() . " WHERE `id` = " . $id . " LIMIT 1");
@ -72,7 +77,7 @@ function countThreads() { @@ -72,7 +77,7 @@ function countThreads() {
function allThreads() {
global $link;
$threads = array();
$result = mysqli_query($link, "SELECT * FROM `" . TINYIB_DBPOSTS . "` WHERE `parent` = 0 AND `moderated` = 1 ORDER BY `bumped` DESC");
$result = mysqli_query($link, "SELECT * FROM `" . TINYIB_DBPOSTS . "` WHERE `parent` = 0 AND `moderated` = 1 ORDER BY `stickied` DESC, `bumped` DESC");
if ($result) {
while ($thread = mysqli_fetch_assoc($result)) {
$threads[] = $thread;
@ -145,7 +150,7 @@ function deletePostByID($id) { @@ -145,7 +150,7 @@ function deletePostByID($id) {
function trimThreads() {
global $link;
if (TINYIB_MAXTHREADS > 0) {
$result = mysqli_query($link, "SELECT `id` FROM `" . TINYIB_DBPOSTS . "` WHERE `parent` = 0 AND `moderated` = 1 ORDER BY `bumped` DESC LIMIT " . TINYIB_MAXTHREADS . ", 10");
$result = mysqli_query($link, "SELECT `id` FROM `" . TINYIB_DBPOSTS . "` WHERE `parent` = 0 AND `moderated` = 1 ORDER BY `stickied` DESC, `bumped` DESC LIMIT " . TINYIB_MAXTHREADS . ", 10");
if ($result) {
while ($post = mysqli_fetch_assoc($result)) {
deletePostByID($post['id']);

8
inc/database_pdo.php

@ -83,6 +83,10 @@ function approvePostByID($id) { @@ -83,6 +83,10 @@ function approvePostByID($id) {
pdoQuery("UPDATE " . TINYIB_DBPOSTS . " SET moderated = ? WHERE id = ?", array('1', $id));
}
function stickyThreadByID($id, $setsticky) {
pdoQuery("UPDATE " . TINYIB_DBPOSTS . " SET stickied = ? WHERE id = ?", array($setsticky, $id));
}
function bumpThreadByID($id) {
$now = time();
pdoQuery("UPDATE " . TINYIB_DBPOSTS . " SET bumped = ? WHERE id = ?", array($now, $id));
@ -95,7 +99,7 @@ function countThreads() { @@ -95,7 +99,7 @@ function countThreads() {
function allThreads() {
$threads = array();
$results = pdoQuery("SELECT * FROM " . TINYIB_DBPOSTS . " WHERE parent = 0 AND moderated = 1 ORDER BY bumped DESC");
$results = pdoQuery("SELECT * FROM " . TINYIB_DBPOSTS . " WHERE parent = 0 AND moderated = 1 ORDER BY stickied DESC, bumped DESC");
while ($row = $results->fetch()) {
$threads[] = $row;
}
@ -156,7 +160,7 @@ function deletePostByID($id) { @@ -156,7 +160,7 @@ function deletePostByID($id) {
function trimThreads() {
$limit = (int)TINYIB_MAXTHREADS;
if ($limit > 0) {
$results = pdoQuery("SELECT id FROM " . TINYIB_DBPOSTS . " WHERE parent = 0 AND moderated = 1 ORDER BY bumped LIMIT 100 OFFSET " . $limit
$results = pdoQuery("SELECT id FROM " . TINYIB_DBPOSTS . " WHERE parent = 0 AND moderated = 1 ORDER BY stickied DESC, bumped DESC LIMIT 100 OFFSET " . $limit
);
# old mysql, sqlite3: SELECT id FROM $table ORDER BY bumped LIMIT $limit,100
# mysql, postgresql, sqlite3: SELECT id FROM $table ORDER BY bumped LIMIT 100 OFFSET $limit

11
inc/database_sqlite.php

@ -52,6 +52,9 @@ if (sqlite_num_rows($result) == 0) { @@ -52,6 +52,9 @@ if (sqlite_num_rows($result) == 0) {
)");
}
// Add stickied column if it isn't present
sqlite_query($db, "ALTER TABLE " . TINYIB_DBPOSTS . " ADD COLUMN stickied INTEGER");
# Post Functions
function uniquePosts() {
return sqlite_fetch_single(sqlite_query($GLOBALS["db"], "SELECT COUNT(ip) FROM (SELECT DISTINCT ip FROM " . TINYIB_DBPOSTS . ")"));
@ -73,6 +76,10 @@ function insertPost($post) { @@ -73,6 +76,10 @@ function insertPost($post) {
return sqlite_last_insert_rowid($GLOBALS["db"]);
}
function stickyThreadByID($id, $setsticky) {
sqlite_query($GLOBALS["db"], "UPDATE " . TINYIB_DBPOSTS . " SET stickied = '" . sqlite_escape_string($setsticky) . "' WHERE id = " . $id);
}
function bumpThreadByID($id) {
sqlite_query($GLOBALS["db"], "UPDATE " . TINYIB_DBPOSTS . " SET bumped = " . time() . " WHERE id = " . $id);
}
@ -83,7 +90,7 @@ function countThreads() { @@ -83,7 +90,7 @@ function countThreads() {
function allThreads() {
$threads = array();
$result = sqlite_fetch_all(sqlite_query($GLOBALS["db"], "SELECT * FROM " . TINYIB_DBPOSTS . " WHERE parent = 0 ORDER BY bumped DESC"), SQLITE_ASSOC);
$result = sqlite_fetch_all(sqlite_query($GLOBALS["db"], "SELECT * FROM " . TINYIB_DBPOSTS . " WHERE parent = 0 ORDER BY stickied DESC, bumped DESC"), SQLITE_ASSOC);
foreach ($result as $thread) {
$threads[] = $thread;
}
@ -142,7 +149,7 @@ function deletePostByID($id) { @@ -142,7 +149,7 @@ function deletePostByID($id) {
function trimThreads() {
if (TINYIB_MAXTHREADS > 0) {
$result = sqlite_fetch_all(sqlite_query($GLOBALS["db"], "SELECT id FROM " . TINYIB_DBPOSTS . " WHERE parent = 0 ORDER BY bumped DESC LIMIT " . TINYIB_MAXTHREADS . ", 10"), SQLITE_ASSOC);
$result = sqlite_fetch_all(sqlite_query($GLOBALS["db"], "SELECT id FROM " . TINYIB_DBPOSTS . " WHERE parent = 0 ORDER BY stickied DESC, bumped DESC LIMIT " . TINYIB_MAXTHREADS . ", 10"), SQLITE_ASSOC);
foreach ($result as $post) {
deletePostByID($post['id']);
}

2
inc/flatfile/flatfile.php

@ -758,7 +758,7 @@ class Orderer { @@ -758,7 +758,7 @@ class Orderer {
if ($cmpfunc == DEFAULT_COMPARISON) {
$cmpfunc = STRING_COMPARISON;
}
$cmp = $orderBy->orderType * $cmpfunc($row1[$orderBy->field], $row2[$orderBy->field]);
$cmp = $orderBy->orderType * $cmpfunc(isset($row1[$orderBy->field]) ? $row1[$orderBy->field] : false, isset($row2[$orderBy->field]) ? $row2[$orderBy->field] : false);
if ($cmp == 0) {
if ($index == (count($this->orderByList) - 1))
return 0;

4
inc/functions.php

@ -187,8 +187,8 @@ function writePage($filename, $contents) { @@ -187,8 +187,8 @@ function writePage($filename, $contents) {
}
function fixLinksInRes($html) {
$search = array(' href="css/', ' src="js/', ' href="src/', ' href="thumb/', ' href="res/', ' href="imgboard.php', ' href="favicon.ico', 'src="thumb/', 'src="inc/', ' action="imgboard.php');
$replace = array(' href="../css/', ' src="../js/', ' href="../src/', ' href="../thumb/', ' href="../res/', ' href="../imgboard.php', ' href="../favicon.ico', 'src="../thumb/', 'src="../inc/', ' action="../imgboard.php');
$search = array(' href="css/', ' src="js/', ' href="src/', ' href="thumb/', ' href="res/', ' href="imgboard.php', ' href="favicon.ico', 'src="thumb/', 'src="inc/', 'src="sticky.png', ' action="imgboard.php');
$replace = array(' href="../css/', ' src="../js/', ' href="../src/', ' href="../thumb/', ' href="../res/', ' href="../imgboard.php', ' href="../favicon.ico', 'src="../thumb/', 'src="../inc/', 'src="../sticky.png', ' action="../imgboard.php');
return str_replace($search, $replace, $html);
}

22
inc/html.php

@ -91,6 +91,10 @@ function buildPost($post, $res) { @@ -91,6 +91,10 @@ function buildPost($post, $res) {
$reflink = "<a href=\"res/$threadid.html#{$post['id']}\">No.</a><a href=\"res/$threadid.html#q{$post['id']}\">{$post['id']}</a>";
}
if ($post["stickied"] == 1) {
$reflink .= ' <img src="sticky.png" alt="Stickied" title="Stickied" width="16" height="16">';
}
if (!isset($post["omitted"])) {
$post["omitted"] = 0;
}
@ -667,7 +671,23 @@ function manageModeratePost($post) { @@ -667,7 +671,23 @@ function manageModeratePost($post) {
$delete_info = ($post['parent'] == TINYIB_NEWTHREAD) ? 'This will delete the entire thread below.' : 'This will delete the post below.';
$post_or_thread = ($post['parent'] == TINYIB_NEWTHREAD) ? 'Thread' : 'Post';
$sticky_html = "";
if ($post["parent"] == TINYIB_NEWTHREAD) {
$sticky_set = $post['stickied'] == 1 ? '0' : '1';
$sticky_unsticky = $post['stickied'] == 1 ? 'Un-sticky' : 'Sticky';
$sticky_unsticky_help = $post['stickied'] == 1 ? 'Return this thread to a normal state.' : 'Keep this thread at the top of the board.';
$sticky_html = <<<EOF
<tr><td colspan="2">&nbsp;</td></tr>
<tr><td align="right" width="50%;">
<form method="get" action="?">
<input type="hidden" name="manage" value="">
<input type="hidden" name="sticky" value="${post['id']}">
<input type="hidden" name="setsticky" value="$sticky_set">
<input type="submit" value="$sticky_unsticky Thread" class="managebutton" style="width: 50%;">
</form>
</td><td><small>$sticky_unsticky_help</small></td></tr>
EOF;
$post_html = "";
$posts = postsInThreadByID($post["id"]);
foreach ($posts as $post_temp) {
@ -703,6 +723,8 @@ function manageModeratePost($post) { @@ -703,6 +723,8 @@ function manageModeratePost($post) {
</form>
</td><td><small>$ban_info</small></td></tr>
$sticky_html
</table>

BIN
sticky.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 527 B

Loading…
Cancel
Save