From cc614e36b4135d5b8ac000bad8ed450df0e61ffe Mon Sep 17 00:00:00 2001 From: Michael Save Date: Mon, 16 Apr 2012 20:11:10 +1000 Subject: multiple improvements --- templates/mod/debug/antispam.html | 42 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 templates/mod/debug/antispam.html (limited to 'templates/mod/debug') diff --git a/templates/mod/debug/antispam.html b/templates/mod/debug/antispam.html new file mode 100644 index 00000000..af5354ed --- /dev/null +++ b/templates/mod/debug/antispam.html @@ -0,0 +1,42 @@ +

+ Most used (in active): +

+ + + + + + + + + + {% for hash in top %} + + + + + + + + + {% endfor %} +
BoardThreadHash (CRC32)CreatedExpiresPassed
{{ config.board_abbreviation|sprintf(hash.board) }} + {% if hash.thread %} + {{ hash.thread }} + {% else %} + - + {% endif %}{{ hash.hash }} + {{ hash.created|ago }} ago + + {% if hash.expires %} + + {{ hash.expires|until }} + + {% else %} + - + {% endif %} + {{ hash.passed }}
+

+ Total: {{ total }} ({{ expiring }} set to expire) +

+ -- cgit v1.3 From 2c47c2d994adfb71b0f938640e95592d7d1567ac Mon Sep 17 00:00:00 2001 From: Michael Save Date: Thu, 19 Apr 2012 01:37:31 +1000 Subject: CRC32 -> SHA1 --- templates/mod/debug/antispam.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'templates/mod/debug') diff --git a/templates/mod/debug/antispam.html b/templates/mod/debug/antispam.html index af5354ed..c3e70859 100644 --- a/templates/mod/debug/antispam.html +++ b/templates/mod/debug/antispam.html @@ -1,11 +1,11 @@

Most used (in active):

- +
- + -- cgit v1.3 From 4891eae24eac73328ecdc9eb9c5c8a4ab1e9c346 Mon Sep 17 00:00:00 2001 From: Michael Save Date: Thu, 19 Apr 2012 22:40:11 +1000 Subject: added filter/purge controls to ?/debug/antispam --- inc/mod/pages.php | 27 +++++++++++++++++++++++---- templates/mod/debug/antispam.html | 25 ++++++++++++++++++++++++- 2 files changed, 47 insertions(+), 5 deletions(-) (limited to 'templates/mod/debug') 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 %} - + @@ -40,3 +42,24 @@ Total: {{ total }} ({{ expiring }} set to expire)

+ +
Board ThreadHash (CRC32)Hash (SHA1) Created Expires Passed{{ hash.hash }} + {{ hash.hash|upper }} + {{ hash.created|ago }} ago
+ + + + + + + + + + +
BoardThread
+ + + + + + +
+ -- cgit v1.3 From f5b4bf93b0ca00bee22dec0222299352256e196c Mon Sep 17 00:00:00 2001 From: Michael Save Date: Sun, 22 Apr 2012 16:52:58 +1000 Subject: ?/debug/antispam formatting --- templates/mod/debug/antispam.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'templates/mod/debug') diff --git a/templates/mod/debug/antispam.html b/templates/mod/debug/antispam.html index 99331ed3..a846bc17 100644 --- a/templates/mod/debug/antispam.html +++ b/templates/mod/debug/antispam.html @@ -20,7 +20,7 @@ - {% endif %} - {{ hash.hash|upper }} + {{ hash.hash }} {{ hash.created|ago }} ago -- cgit v1.3