From 79adb305a3272e2ac303d8e5f8639c844297dd48 Mon Sep 17 00:00:00 2001 From: Trevor Slocum Date: Thu, 15 Apr 2021 21:30:31 -0700 Subject: [PATCH] Fix approval when clearing reports --- imgboard.php | 12 ++++++------ inc/database/flatfile.php | 4 ++-- inc/database/mysql.php | 4 ++-- inc/database/mysqli.php | 4 ++-- inc/database/pdo.php | 4 ++-- inc/database/sqlite.php | 4 ++-- inc/database/sqlite3.php | 4 ++-- 7 files changed, 18 insertions(+), 18 deletions(-) diff --git a/imgboard.php b/imgboard.php index 2815b8a..fb40542 100644 --- a/imgboard.php +++ b/imgboard.php @@ -39,11 +39,11 @@ while (ob_get_level() > 0) { } function fancyDie($message, $go_back=1) { - $back = 'Click here to go back'; + $go_back_text = 'Click here to go back'; if (function_exists('__')) { - $back = __('Click here to go back'); + $go_back_text = __('Click here to go back'); } - die('
' . $message . '


- ' . $back . ' -'); + die('
' . $message . '


- ' . $go_back_text . ' -'); } if (!file_exists('settings.php')) { @@ -573,7 +573,7 @@ if (!isset($_GET['delete']) && !isset($_GET['manage']) && (isset($_POST['name']) fancyDie(__('Sorry, an invalid post identifier was sent. Please go back, refresh the page, and try again.')); } - if ($post['moderated'] == 1) { + if ($post['moderated'] == 2) { fancyDie(__('Moderators have determined that post does not break any rules.')); } @@ -974,7 +974,7 @@ EOF; if ($_GET['approve'] > 0) { $post = postByID($_GET['approve']); if ($post) { - approvePostByID($post['id']); + approvePostByID($post['id'], 1); $thread_id = $post['parent'] == TINYIB_NEWTHREAD ? $post['id'] : $post['parent']; if (strtolower($post['email']) != 'sage' && (TINYIB_MAXREPLIES == 0 || numRepliesToThreadByID($thread_id) <= TINYIB_MAXREPLIES)) { @@ -1034,7 +1034,7 @@ EOF; if ($_GET['clearreports'] > 0) { $post = postByID($_GET['clearreports']); if ($post) { - approvePostByID($post['id']); + approvePostByID($post['id'], 2); deleteReportsByPost($post['id']); manageLogAction(__('Approved') . ' ' . postLink('>>' . $post['id'])); diff --git a/inc/database/flatfile.php b/inc/database/flatfile.php index 2e003ba..9afd463 100644 --- a/inc/database/flatfile.php +++ b/inc/database/flatfile.php @@ -259,11 +259,11 @@ function insertPost($newpost) { return $GLOBALS['db']->insertWithAutoId(POSTS_FILE, POST_ID, $post); } -function approvePostByID($id) { +function approvePostByID($id, $moderated) { $rows = $GLOBALS['db']->selectWhere(POSTS_FILE, new SimpleWhereClause(POST_ID, '=', $id, INTEGER_COMPARISON), 1); if (count($rows) > 0) { foreach ($rows as $post) { - $post[POST_MODERATED] = 1; + $post[POST_MODERATED] = $moderated; $GLOBALS['db']->updateRowById(POSTS_FILE, POST_ID, $post); } } diff --git a/inc/database/mysql.php b/inc/database/mysql.php index 866c182..d7a8480 100644 --- a/inc/database/mysql.php +++ b/inc/database/mysql.php @@ -173,8 +173,8 @@ function insertPost($post) { return mysql_insert_id(); } -function approvePostByID($id) { - mysql_query("UPDATE `" . TINYIB_DBPOSTS . "` SET `moderated` = 1 WHERE `id` = " . $id . " LIMIT 1"); +function approvePostByID($id, $moderated) { + mysql_query("UPDATE `" . TINYIB_DBPOSTS . "` SET `moderated` = $moderated WHERE `id` = " . $id . " LIMIT 1"); } function bumpThreadByID($id) { diff --git a/inc/database/mysqli.php b/inc/database/mysqli.php index 567cd24..e75afc4 100644 --- a/inc/database/mysqli.php +++ b/inc/database/mysqli.php @@ -199,9 +199,9 @@ function insertPost($post) { return mysqli_insert_id($link); } -function approvePostByID($id) { +function approvePostByID($id, $moderated) { global $link; - mysqli_query($link, "UPDATE `" . TINYIB_DBPOSTS . "` SET `moderated` = 1 WHERE `id` = " . $id . " LIMIT 1"); + mysqli_query($link, "UPDATE `" . TINYIB_DBPOSTS . "` SET `moderated` = " . $moderated . " WHERE `id` = " . $id . " LIMIT 1"); } function bumpThreadByID($id) { diff --git a/inc/database/pdo.php b/inc/database/pdo.php index 5e1df85..6bc0766 100644 --- a/inc/database/pdo.php +++ b/inc/database/pdo.php @@ -159,8 +159,8 @@ function insertPost($post) { return $dbh->lastInsertId(); } -function approvePostByID($id) { - pdoQuery("UPDATE " . TINYIB_DBPOSTS . " SET moderated = 1 WHERE id = ?", array($id)); +function approvePostByID($id, $moderated) { + pdoQuery("UPDATE " . TINYIB_DBPOSTS . " SET moderated = ? WHERE id = ?", array($id, $moderated)); } function bumpThreadByID($id) { diff --git a/inc/database/sqlite.php b/inc/database/sqlite.php index c1b8346..a45bacf 100644 --- a/inc/database/sqlite.php +++ b/inc/database/sqlite.php @@ -151,8 +151,8 @@ function insertPost($post) { return sqlite_last_insert_rowid($GLOBALS["db"]); } -function approvePostByID($id) { - sqlite_query($GLOBALS["db"], "UPDATE " . TINYIB_DBPOSTS . " SET moderated = 1 WHERE id = " . $id); +function approvePostByID($id, $moderated) { + sqlite_query($GLOBALS["db"], "UPDATE " . TINYIB_DBPOSTS . " SET moderated = " . $moderated . " WHERE id = " . $id); } function bumpThreadByID($id) { diff --git a/inc/database/sqlite3.php b/inc/database/sqlite3.php index b0c3953..aea036e 100644 --- a/inc/database/sqlite3.php +++ b/inc/database/sqlite3.php @@ -175,9 +175,9 @@ function insertPost($post) { return $db->lastInsertRowID(); } -function approvePostByID($id) { +function approvePostByID($id, $moderated) { global $db; - $db->exec("UPDATE " . TINYIB_DBPOSTS . " SET moderated = 1 WHERE id = " . $id); + $db->exec("UPDATE " . TINYIB_DBPOSTS . " SET moderated = " . $moderated . " WHERE id = " . $id); } function bumpThreadByID($id) {