From cd90c9caf97c35a1c86bb9ba0b593b0c7c7e394a Mon Sep 17 00:00:00 2001 From: Trevor Slocum Date: Fri, 21 Aug 2015 00:45:01 -0700 Subject: [PATCH] Add sticky threads --- imgboard.php | 16 +++++- inc/database_flatfile.php | 100 +++++++++++++++++++++----------------- inc/database_mysql.php | 8 ++- inc/database_mysqli.php | 9 +++- inc/database_pdo.php | 8 ++- inc/database_sqlite.php | 11 ++++- inc/flatfile/flatfile.php | 2 +- inc/functions.php | 4 +- inc/html.php | 22 +++++++++ sticky.png | Bin 0 -> 527 bytes 10 files changed, 124 insertions(+), 56 deletions(-) create mode 100644 sticky.png diff --git a/imgboard.php b/imgboard.php index 10f0d7e..b533ce5 100644 --- a/imgboard.php +++ b/imgboard.php @@ -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'])) { $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(); diff --git a/inc/database_flatfile.php b/inc/database_flatfile.php index 7cdf590..fd0f5ba 100644 --- a/inc/database_flatfile.php +++ b/inc/database_flatfile.php @@ -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) { 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) { $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) { } 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); } diff --git a/inc/database_mysql.php b/inc/database_mysql.php index d7d5e16..66e5b13 100644 --- a/inc/database_mysql.php +++ b/inc/database_mysql.php @@ -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() { 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) { 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']); diff --git a/inc/database_mysqli.php b/inc/database_mysqli.php index cc8b692..fecba5f 100644 --- a/inc/database_mysqli.php +++ b/inc/database_mysqli.php @@ -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() { 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) { 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']); diff --git a/inc/database_pdo.php b/inc/database_pdo.php index ffe14d9..feb059b 100644 --- a/inc/database_pdo.php +++ b/inc/database_pdo.php @@ -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() { 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) { 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 diff --git a/inc/database_sqlite.php b/inc/database_sqlite.php index 5d886a3..712974a 100644 --- a/inc/database_sqlite.php +++ b/inc/database_sqlite.php @@ -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) { 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() { 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) { 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']); } diff --git a/inc/flatfile/flatfile.php b/inc/flatfile/flatfile.php index d94b66a..dd4c931 100644 --- a/inc/flatfile/flatfile.php +++ b/inc/flatfile/flatfile.php @@ -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; diff --git a/inc/functions.php b/inc/functions.php index 05ceb33..6b7751a 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -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); } diff --git a/inc/html.php b/inc/html.php index 8fc7488..9b24df9 100644 --- a/inc/html.php +++ b/inc/html.php @@ -91,6 +91,10 @@ function buildPost($post, $res) { $reflink = "No.{$post['id']}"; } + if ($post["stickied"] == 1) { + $reflink .= ' Stickied'; + } + if (!isset($post["omitted"])) { $post["omitted"] = 0; } @@ -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 = <<  + +
+ + + + +
+ $sticky_unsticky_help +EOF; + $post_html = ""; $posts = postsInThreadByID($post["id"]); foreach ($posts as $post_temp) { @@ -703,6 +723,8 @@ function manageModeratePost($post) { $ban_info + + $sticky_html diff --git a/sticky.png b/sticky.png new file mode 100644 index 0000000000000000000000000000000000000000..947c1a752af6f86fed4cd4f1947a668e357c111b GIT binary patch literal 527 zcmV+q0`UEbP)FpE4*;n&khT zfuRy;h%-S0kV3}hH&ETL&z~8d?%Bg28XWBY@&Erupu9UVE&%&oarW$h&v)-KeEIT) zf#b&y2Dh*Fuy$g)zgkXAFOVHhuf>fdQs@>#}8M{xC2!0X6LSj~({SOu(!9bSW_sG_*XW7`;82%GV%8U>f*ezYUv`kl5Hy_Af4Rphq?4WB*b?x5aEKD9XobR0W!~%nj0A@&CUP;1^~WOt}AL- RYP|pe002ovPDHLkV1h2??N$H) literal 0 HcmV?d00001