Support setting keywords to hide posts when used

This commit is contained in:
Trevor Slocum 2021-05-05 22:24:07 -07:00
parent cff26e609d
commit dd1ae575c9
2 changed files with 12 additions and 0 deletions

View File

@ -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'];

View File

@ -1413,6 +1413,7 @@ EOF;
$return .= '<option value="report"' . ($v_action == 'report' ? ' selected' : '') . '>' . __('Report') . '</option>';
}
$return .= '<option value="delete"' . ($v_action == 'delete' ? ' selected' : '') . '>' . __('Delete') . '</option>';
$return .= '<option value="hide"' . ($v_action == 'hide' ? ' selected' : '') . '>' . __('Hide until approved') . '</option>';
$return .= '<option value="ban1h"' . ($v_action == 'ban1h' ? ' selected' : '') . '>' . __('Delete and ban for 1 hour') . '</option>';
$return .= '<option value="ban1d"' . ($v_action == 'ban1d' ? ' selected' : '') . '>' . __('Delete and ban for 1 day') . '</option>';
$return .= '<option value="ban2d"' . ($v_action == 'ban2d' ? ' selected' : '') . '>' . __('Delete and ban for 2 days') . '</option>';
@ -1439,6 +1440,9 @@ function manageKeywordsTable() {
case 'report':
$action = __('Report');
break;
case 'hide':
$action = __('Hide until approved');
break;
case 'delete':
$action = __('Delete');
break;