diff --git a/inc/config.php b/inc/config.php index 457385aa..b6f18d87 100644 --- a/inc/config.php +++ b/inc/config.php @@ -1611,8 +1611,6 @@ $config['mod']['report_dismiss'] = JANITOR; // Dismiss all abuse reports by an IP $config['mod']['report_dismiss_ip'] = JANITOR; - // Dismiss all abuse reports for a post - $config['mod']['report_dismiss_post'] = JANITOR; // View list of bans $config['mod']['view_banlist'] = MOD; // View the username of the mod who made a ban diff --git a/inc/mod/pages.php b/inc/mod/pages.php index d9bd26be..91f013fc 100644 --- a/inc/mod/pages.php +++ b/inc/mod/pages.php @@ -2377,8 +2377,7 @@ function mod_reports() { 'config' => $config, 'mod' => $mod, 'token' => make_secure_link_token('reports/' . $report['id'] . '/dismiss'), - 'token_all' => make_secure_link_token('reports/' . $report['id'] . '/dismiss&all'), - 'token_post' => make_secure_link_token('reports/'. $report['id'] . '/dismiss&post'), + 'token_all' => make_secure_link_token('reports/' . $report['id'] . '/dismissall') )); // Bug fix for https://github.com/savetheinternet/Tinyboard/issues/21 @@ -2403,7 +2402,7 @@ function mod_reports() { mod_page(sprintf('%s (%d)', _('Report queue'), $count), $config['file_mod_reports'], array('reports' => $body, 'count' => $count)); } -function mod_report_dismiss($id, $action) { +function mod_report_dismiss($id, $all = false) { global $config; $query = prepare("SELECT `post`, `board`, `ip` FROM ``reports`` WHERE `id` = :id"); @@ -2416,35 +2415,27 @@ function mod_report_dismiss($id, $action) { } else error($config['error']['404']); - switch($action){ - case '&post': - if (!hasPermission($config['mod']['report_dismiss_post'], $board)) - error($config['error']['noaccess']); - - $query = prepare("DELETE FROM ``reports`` WHERE `post` = :post"); - $query->bindValue(':post', $post); - modLog("Dismissed all reports for post #{$id}", $board); - case '&all': - if (!hasPermission($config['mod']['report_dismiss_ip'], $board)) - error($config['error']['noaccess']); - - $query = prepare("DELETE FROM ``reports`` WHERE `ip` = :ip"); - $query->bindValue(':ip', $ip); - $cip = cloak_ip($ip); - modLog("Dismissed all reports by $cip"); - break; - case '': - default: - if (!hasPermission($config['mod']['report_dismiss'], $board)) - error($config['error']['noaccess']); - - $query = prepare("DELETE FROM ``reports`` WHERE `id` = :id"); - $query->bindValue(':id', $id); - modLog("Dismissed a report for post #{$id}", $board); - break; + if (!$all && !hasPermission($config['mod']['report_dismiss'], $board)) + error($config['error']['noaccess']); + + if ($all && !hasPermission($config['mod']['report_dismiss_ip'], $board)) + error($config['error']['noaccess']); + + if ($all) { + $query = prepare("DELETE FROM ``reports`` WHERE `ip` = :ip"); + $query->bindValue(':ip', $ip); + } else { + $query = prepare("DELETE FROM ``reports`` WHERE `id` = :id"); + $query->bindValue(':id', $id); } $query->execute() or error(db_error($query)); + $cip = cloak_ip($ip); + if ($all) + modLog("Dismissed all reports by $cip"); + else + modLog("Dismissed a report for post #{$post} (#{$id})", $board); + header('Location: ?/reports', true, $config['redirect_http']); } diff --git a/mod.php b/mod.php index 94e419ef..282fc666 100644 --- a/mod.php +++ b/mod.php @@ -55,7 +55,7 @@ $pages = array( '/rebuild' => 'secure_POST rebuild', // rebuild static files '/reports' => 'reports', // report queue - '/reports/(\d+)/dismiss(&all|&post)?' => 'secure report_dismiss', // dismiss a report + '/reports/(\d+)/dismiss(all)?' => 'secure report_dismiss', // dismiss a report '/IP/([\w.:]+)' => 'secure_POST ip', // view ip address '/IP/([\w.:]+)/remove_note/(\d+)' => 'secure ip_remove_note', // remove note from ip address diff --git a/templates/mod/report.html b/templates/mod/report.html index d5d691d9..1229596a 100644 --- a/templates/mod/report.html +++ b/templates/mod/report.html @@ -17,15 +17,9 @@ {% endif %} {% if mod|hasPermission(config.mod.report_dismiss_ip, report.board) %} {% if mod|hasPermission(config.mod.report_dismiss, report.board) %} - |  + | {% endif %} - Dismiss+ - {% endif %} - {% if mod|hasPermission(config.mod.report_dismiss_post, report.board) %} - {% if mod|hasPermission(config.mod.report_dismiss, report.board) %} - |  - {% endif %} - Dismiss Post + Dismiss+ {% endif %} {% endif %}