Spamnoticer - manual ban: check if files field is set

This commit is contained in:
towards-a-new-leftypol 2023-10-11 13:47:52 -04:00
parent 9d48a5bbe1
commit e25908d87e
1 changed files with 12 additions and 9 deletions

View File

@ -1756,18 +1756,21 @@ function mod_merge($originBoard, $postID) {
function parse_spamnoticer_content_fields($postData, $post): BanFormFieldsForSpamnoticer { function parse_spamnoticer_content_fields($postData, $post): BanFormFieldsForSpamnoticer {
$files_info = array(); $files_info = array();
foreach ($post->files as $file) {
$filename = $file->file;
$filekey = str_replace('.', '_', $filename); // because $_POST actually does the inverse of this when no one is asking it to. php is a fucking idiotic language
$fileSpamKey = "file_is_spam_$filekey"; if (isset($post->files) && is_array($post->files)) {
$fileIllegalKey = "file_is_illegal_$filekey"; foreach ($post->files as $file) {
$filename = $file->file;
$filekey = str_replace('.', '_', $filename); // because $_POST actually does the inverse of this when no one is asking it to. php is a fucking idiotic language
$is_spam = isset($postData[$fileSpamKey]); $fileSpamKey = "file_is_spam_$filekey";
$is_illegal = isset($postData[$fileIllegalKey]); $fileIllegalKey = "file_is_illegal_$filekey";
$fileInfo = new SpamNoticerBanFileInfo($filename, $is_illegal, $is_spam); $is_spam = isset($postData[$fileSpamKey]);
array_push($files_info, $fileInfo); $is_illegal = isset($postData[$fileIllegalKey]);
$fileInfo = new SpamNoticerBanFileInfo($filename, $is_illegal, $is_spam);
array_push($files_info, $fileInfo);
}
} }
$ban = isset($postData['checkbox-ban']); $ban = isset($postData['checkbox-ban']);