Ban&Delete page can now also post to spamnoticer
This commit is contained in:
parent
a0fc3956fe
commit
3ed80a4cd3
|
@ -1805,24 +1805,39 @@ function mod_ban_post(string $board, $delete, $post_num, $token = false) {
|
|||
$po = new Post($post, '?/', false);
|
||||
}
|
||||
|
||||
$will_ban = true;
|
||||
$will_delete = true;
|
||||
$will_spamnoticer = isset($_POST['spamnoticer']);
|
||||
|
||||
require_once 'inc/spamnoticer.php';
|
||||
|
||||
if (isset($_POST['spamnoticer'])) {
|
||||
if ($will_spamnoticer) {
|
||||
$spamnoticer_info = parse_spamnoticer_content_fields($_POST, $po);
|
||||
$spamnoticer_result = addToSpamNoticer($config, $po, $board, $spamnoticer_info);
|
||||
echo $spamnoticer_result;
|
||||
echo json_encode(
|
||||
array(
|
||||
"spamnoticer_info" => $spamnoticer_info,
|
||||
"board" => $board,
|
||||
"po" => $po
|
||||
)
|
||||
);
|
||||
die();
|
||||
return;
|
||||
|
||||
if ($spamnoticer_info->ban_content) {
|
||||
$spamnoticer_result = addToSpamNoticer(
|
||||
$config,
|
||||
$po,
|
||||
$board,
|
||||
$spamnoticer_info);
|
||||
}
|
||||
|
||||
if (isset($_POST['new_ban'], $_POST['reason'], $_POST['length'], $_POST['board'])) {
|
||||
$will_ban = $spamnoticer_info->ban;
|
||||
$will_delete = $spamnoticer_info->delete;
|
||||
}
|
||||
|
||||
$will_ban = $will_ban &&
|
||||
isset(
|
||||
$_POST['new_ban'],
|
||||
$_POST['reason'],
|
||||
$_POST['length'],
|
||||
$_POST['board']);
|
||||
|
||||
$will_delete = isset($_POST['delete']) && (int) $_POST['delete'];
|
||||
|
||||
$has_public_message = isset($_POST['public_message'], $_POST['message']);
|
||||
|
||||
if ($will_ban) {
|
||||
require_once 'inc/mod/ban.php';
|
||||
|
||||
if (isset($_POST['ip']))
|
||||
|
@ -1831,7 +1846,7 @@ function mod_ban_post(string $board, $delete, $post_num, $token = false) {
|
|||
Bans::new_ban($_POST['ip'], $_POST['reason'], $_POST['length'], $_POST['board'] == '*' ? false : $_POST['board'],
|
||||
false, $config['ban_show_post'] ? $post : false);
|
||||
|
||||
if (isset($_POST['public_message'], $_POST['message'])) {
|
||||
if ($has_public_message) {
|
||||
// public ban message
|
||||
$length_english = Bans::parse_time($_POST['length']) ? 'for ' . until(Bans::parse_time($_POST['length'])) : 'permanently';
|
||||
$_POST['message'] = preg_replace('/[\r\n]/', '', $_POST['message']);
|
||||
|
@ -1846,7 +1861,10 @@ function mod_ban_post(string $board, $delete, $post_num, $token = false) {
|
|||
modLog("Attached a public ban message to post #{$post_num}: " . utf8tohtml($_POST['message']));
|
||||
buildThread($thread ? $thread : $post_num);
|
||||
buildIndex();
|
||||
} elseif (isset($_POST['delete']) && (int) $_POST['delete']) {
|
||||
}
|
||||
}
|
||||
|
||||
if ($will_delete && !$has_public_message) {
|
||||
// Delete post
|
||||
if ($config['autotagging']){
|
||||
$query = prepare(sprintf("SELECT * FROM ``posts_%s`` WHERE id = :id", $board));
|
||||
|
@ -1868,6 +1886,7 @@ function mod_ban_post(string $board, $delete, $post_num, $token = false) {
|
|||
$subject = $mypost["subject"];
|
||||
$filehash = $mypost["filehash"];
|
||||
$mypost['files'] = $mypost['files'] ? json_decode($mypost['files']) : array();
|
||||
|
||||
// For each file append file name
|
||||
for ($file_count = 0; $file_count < $mypost["num_files"];$file_count++){
|
||||
$filename .= $mypost['files'][$file_count]->name . "\r\n";
|
||||
|
@ -1900,6 +1919,7 @@ function mod_ban_post(string $board, $delete, $post_num, $token = false) {
|
|||
rebuildThemes('post-delete', $board);
|
||||
}
|
||||
|
||||
if ($will_ban || $will_delete || $will_spamnoticer) {
|
||||
if(isset($_POST['thread'])) {
|
||||
// Redirect to thread
|
||||
header('Location: ?/' . sprintf($config['board_path'], $board) . $config['dir']['res'] . str_replace('%d', $_POST['thread'], $config['file_page']), true, $config['redirect_http']);
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
{% if spamnoticer %}
|
||||
[<input class="ban_form--content_file_chkbox" type="checkbox" name="file_is_spam_{{ file.file }}" id="file_is_spam_{{ file.file }}" checked>
|
||||
<label class="ban_form--content_file_chkbox_lbl" for="file_is_spam_{{ file.file }}">Is spam</label>]
|
||||
[<input class="ban_form--content_file_chkbox" type="checkbox" name="file_is_illegal_{{ file.file }}" id="file_is_illegal_{{ file.file }}" checked>
|
||||
[<input class="ban_form--content_file_chkbox" type="checkbox" name="file_is_illegal_{{ file.file }}" id="file_is_illegal_{{ file.file }}">
|
||||
<label class="ban_form--content_file_chkbox_lbl" for="file_is_illegal_{{ file.file }}">Is illegal</label>]
|
||||
{% endif %}
|
||||
{% include "post/image_identification.html" %}
|
||||
|
|
Loading…
Reference in New Issue