From dd1ae575c94740646e6326b8b68a5d65a6bf6ec3 Mon Sep 17 00:00:00 2001 From: Trevor Slocum Date: Wed, 5 May 2021 22:24:07 -0700 Subject: [PATCH] Support setting keywords to hide posts when used --- imgboard.php | 8 ++++++++ inc/html.php | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/imgboard.php b/imgboard.php index 0edf629..6806678 100644 --- a/imgboard.php +++ b/imgboard.php @@ -342,6 +342,7 @@ if (!isset($_GET['delete']) && !isset($_GET['manage']) && (isset($_POST['name']) $post['password'] = ($_POST['password'] != '') ? hashData($_POST['password']) : ''; } + $hide_post = false; $report_post = false; foreach (array($post['name'], $post['email'], $post['subject'], $post['message']) as $field) { $keyword = checkKeywords($field); @@ -354,6 +355,9 @@ if (!isset($_GET['delete']) && !isset($_GET['manage']) && (isset($_POST['name']) case 'report': $report_post = true; break; + case 'hide': + $hide_post = true; + break; case 'delete': fancyDie(__('Your post contains a blocked keyword.')); case 'ban0': @@ -509,6 +513,10 @@ if (!isset($_GET['delete']) && !isset($_GET['manage']) && (isset($_POST['name']) checkAutoHide($post); } + if ($hide_post) { + approvePostByID($post['id'], 0); + } + if ($post['moderated'] == '1') { if (TINYIB_ALWAYSNOKO || strtolower($post['email']) == 'noko') { $redirect = 'res/' . ($post['parent'] == TINYIB_NEWTHREAD ? $post['id'] : $post['parent']) . '.html#' . $post['id']; diff --git a/inc/html.php b/inc/html.php index d615b5d..93ddab2 100644 --- a/inc/html.php +++ b/inc/html.php @@ -1413,6 +1413,7 @@ EOF; $return .= ''; } $return .= ''; + $return .= ''; $return .= ''; $return .= ''; $return .= ''; @@ -1439,6 +1440,9 @@ function manageKeywordsTable() { case 'report': $action = __('Report'); break; + case 'hide': + $action = __('Hide until approved'); + break; case 'delete': $action = __('Delete'); break;