diff options
| author | Michael Save <savetheinternet@tinyboard.org> | 2012-04-19 22:40:11 +1000 |
|---|---|---|
| committer | Michael Save <savetheinternet@tinyboard.org> | 2012-04-19 22:40:11 +1000 |
| commit | 4891eae24eac73328ecdc9eb9c5c8a4ab1e9c346 (patch) | |
| tree | 4b75f1d57e9fe081822fb816ef5dc0d81c37e3a9 | |
| parent | 2de20b7e0a40785e869123478f47a3f747628272 (diff) | |
added filter/purge controls to ?/debug/antispam
| -rw-r--r-- | inc/mod/pages.php | 27 | ||||
| -rw-r--r-- | templates/mod/debug/antispam.html | 25 |
2 files changed, 47 insertions, 5 deletions
diff --git a/inc/mod/pages.php b/inc/mod/pages.php index e388c509..541a7c23 100644 --- a/inc/mod/pages.php +++ b/inc/mod/pages.php @@ -435,7 +435,7 @@ function mod_user($uid) { return; } - if (hasPermission($config['mod']['change_password']) && $uid == $mod['id'] && isset($_POST['password'])) { + if (hasPermission($config['dmod']['change_password']) && $uid == $mod['id'] && isset($_POST['password'])) { if ($_POST['password'] != '') { $query = prepare('UPDATE `mods` SET `password` = SHA1(:password) WHERE `id` = :id'); $query->bindValue(':id', $uid); @@ -749,15 +749,34 @@ function mod_report_dismiss($id, $all = false) { } function mod_debug_antispam() { + global $pdo, $config; + $args = array(); - $query = query('SELECT COUNT(*) FROM `antispam`') or error(db_error()); + if (isset($_POST['board'], $_POST['thread'])) { + $where = '`board` = ' . $pdo->quote($_POST['board']); + if($_POST['thread'] != '') + $where .= ' AND `thread` = ' . $pdo->quote($_POST['thread']); + + if (isset($_POST['purge'])) { + $query = prepare('UPDATE `antispam` SET `expires` = UNIX_TIMESTAMP() + :expires WHERE' . $where); + $query->bindValue(':expires', $config['spam']['hidden_inputs_expire']); + $query->execute() or error(db_error()); + } + + $args['board'] = $_POST['board']; + $args['thread'] = $_POST['thread']; + } else { + $where = ''; + } + + $query = query('SELECT COUNT(*) FROM `antispam`' . ($where ? " WHERE $where" : '')) or error(db_error()); $args['total'] = number_format($query->fetchColumn(0)); - $query = query('SELECT COUNT(*) FROM `antispam` WHERE `expires` IS NOT NULL') or error(db_error()); + $query = query('SELECT COUNT(*) FROM `antispam` WHERE `expires` IS NOT NULL' . ($where ? " AND $where" : '')) or error(db_error()); $args['expiring'] = number_format($query->fetchColumn(0)); - $query = query('SELECT * FROM `antispam` /* WHERE `passed` > 0 */ ORDER BY `passed` DESC LIMIT 25') or error(db_error()); + $query = query('SELECT * FROM `antispam` ' . ($where ? "WHERE $where" : '') . ' ORDER BY `passed` DESC LIMIT 40') or error(db_error()); $args['top'] = $query->fetchAll(PDO::FETCH_ASSOC); mod_page("Debug: Anti-spam", 'mod/debug/antispam.html', $args); diff --git a/templates/mod/debug/antispam.html b/templates/mod/debug/antispam.html index c3e70859..99331ed3 100644 --- a/templates/mod/debug/antispam.html +++ b/templates/mod/debug/antispam.html @@ -19,7 +19,9 @@ {% else %} - {% endif %}</td> - <td>{{ hash.hash }}</td> + <td> + <small>{{ hash.hash|upper }}</small> + </td> <td> <span title="{{ hash.created|date(config.post_date) }}">{{ hash.created|ago }} ago</span> </td> @@ -40,3 +42,24 @@ Total: <strong>{{ total }}</strong> (<strong>{{ expiring }}</strong> set to expire) </p> +<form method="post" action="?/debug/antispam"> + <table class="modlog" style="width:1%;white-space:nowrap;margin:auto"> + <tr> + <th>Board</th> + <th>Thread</th> + <th></th> + </tr> + <tr> + <td> + <input type="text" name="board" style="width:90px" value="{{ board }}"> + </td> + <td> + <input type="text" name="thread" style="width:90px" value="{{ thread }}"> + </td> + <td> + <input type="submit" name="filter" value="Filter"> + <input type="submit" name="purge" value="Purge"> + </td> + </tr> + </table> +</form> |
