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);
|
$po = new Post($post, '?/', false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$will_ban = true;
|
||||||
|
$will_delete = true;
|
||||||
|
$will_spamnoticer = isset($_POST['spamnoticer']);
|
||||||
|
|
||||||
require_once 'inc/spamnoticer.php';
|
require_once 'inc/spamnoticer.php';
|
||||||
|
|
||||||
if (isset($_POST['spamnoticer'])) {
|
if ($will_spamnoticer) {
|
||||||
$spamnoticer_info = parse_spamnoticer_content_fields($_POST, $po);
|
$spamnoticer_info = parse_spamnoticer_content_fields($_POST, $po);
|
||||||
$spamnoticer_result = addToSpamNoticer($config, $po, $board, $spamnoticer_info);
|
|
||||||
echo $spamnoticer_result;
|
if ($spamnoticer_info->ban_content) {
|
||||||
echo json_encode(
|
$spamnoticer_result = addToSpamNoticer(
|
||||||
array(
|
$config,
|
||||||
"spamnoticer_info" => $spamnoticer_info,
|
$po,
|
||||||
"board" => $board,
|
$board,
|
||||||
"po" => $po
|
$spamnoticer_info);
|
||||||
)
|
|
||||||
);
|
|
||||||
die();
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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';
|
require_once 'inc/mod/ban.php';
|
||||||
|
|
||||||
if (isset($_POST['ip']))
|
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'],
|
Bans::new_ban($_POST['ip'], $_POST['reason'], $_POST['length'], $_POST['board'] == '*' ? false : $_POST['board'],
|
||||||
false, $config['ban_show_post'] ? $post : false);
|
false, $config['ban_show_post'] ? $post : false);
|
||||||
|
|
||||||
if (isset($_POST['public_message'], $_POST['message'])) {
|
if ($has_public_message) {
|
||||||
// public ban message
|
// public ban message
|
||||||
$length_english = Bans::parse_time($_POST['length']) ? 'for ' . until(Bans::parse_time($_POST['length'])) : 'permanently';
|
$length_english = Bans::parse_time($_POST['length']) ? 'for ' . until(Bans::parse_time($_POST['length'])) : 'permanently';
|
||||||
$_POST['message'] = preg_replace('/[\r\n]/', '', $_POST['message']);
|
$_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']));
|
modLog("Attached a public ban message to post #{$post_num}: " . utf8tohtml($_POST['message']));
|
||||||
buildThread($thread ? $thread : $post_num);
|
buildThread($thread ? $thread : $post_num);
|
||||||
buildIndex();
|
buildIndex();
|
||||||
} elseif (isset($_POST['delete']) && (int) $_POST['delete']) {
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($will_delete && !$has_public_message) {
|
||||||
// Delete post
|
// Delete post
|
||||||
if ($config['autotagging']){
|
if ($config['autotagging']){
|
||||||
$query = prepare(sprintf("SELECT * FROM ``posts_%s`` WHERE id = :id", $board));
|
$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"];
|
$subject = $mypost["subject"];
|
||||||
$filehash = $mypost["filehash"];
|
$filehash = $mypost["filehash"];
|
||||||
$mypost['files'] = $mypost['files'] ? json_decode($mypost['files']) : array();
|
$mypost['files'] = $mypost['files'] ? json_decode($mypost['files']) : array();
|
||||||
|
|
||||||
// For each file append file name
|
// For each file append file name
|
||||||
for ($file_count = 0; $file_count < $mypost["num_files"];$file_count++){
|
for ($file_count = 0; $file_count < $mypost["num_files"];$file_count++){
|
||||||
$filename .= $mypost['files'][$file_count]->name . "\r\n";
|
$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);
|
rebuildThemes('post-delete', $board);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($will_ban || $will_delete || $will_spamnoticer) {
|
||||||
if(isset($_POST['thread'])) {
|
if(isset($_POST['thread'])) {
|
||||||
// Redirect to 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']);
|
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 %}
|
{% if spamnoticer %}
|
||||||
[<input class="ban_form--content_file_chkbox" type="checkbox" name="file_is_spam_{{ file.file }}" id="file_is_spam_{{ file.file }}" checked>
|
[<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>]
|
<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>]
|
<label class="ban_form--content_file_chkbox_lbl" for="file_is_illegal_{{ file.file }}">Is illegal</label>]
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% include "post/image_identification.html" %}
|
{% include "post/image_identification.html" %}
|
||||||
|
|
Loading…
Reference in New Issue