summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Foster <savetheinternet@tinyboard.org>2013-07-16 08:50:39 -0400
committerMichael Foster <savetheinternet@tinyboard.org>2013-07-16 08:50:39 -0400
commitaadb57f2a2db9210468f25d7dcd45d561ef6ad54 (patch)
treee1c8663bc1577258a8061c84f705b7bba6c8f0a9
parentc8f30550af861b95a1f475069ad8d10960a613b2 (diff)
More ban stuff: Show whether or not user has "seen" a ban yet in the ban list and on IP address pages. Purge useless expired ban records.
-rw-r--r--inc/functions.php10
-rw-r--r--templates/mod/ban_list.html8
-rw-r--r--templates/mod/view_ip.html10
3 files changed, 28 insertions, 0 deletions
diff --git a/inc/functions.php b/inc/functions.php
index 8d6e0a2d..40a2c1fe 100644
--- a/inc/functions.php
+++ b/inc/functions.php
@@ -654,6 +654,16 @@ function checkBan($board = 0) {
displayBan($ban);
}
+
+ // I'm not sure where else to put this. It doesn't really matter where; it just needs to be called every now and then to keep the ban list tidy.
+ purge_bans();
+}
+
+// No reason to keep expired bans in the database (except those that haven't been viewed yet)
+function purge_bans() {
+ $query = prepare("DELETE FROM `bans` WHERE `expires` IS NOT NULL AND `expires` < :time AND `seen` = 1");
+ $query->bindValue(':time', time());
+ $query->execute() or error(db_error($query));
}
function threadLocked($id) {
diff --git a/templates/mod/ban_list.html b/templates/mod/ban_list.html
index 2edb9cdf..f8826ade 100644
--- a/templates/mod/ban_list.html
+++ b/templates/mod/ban_list.html
@@ -10,6 +10,7 @@
<th>{% trans 'Set' %}</th>
<th>{% trans 'Duration' %}</th>
<th>{% trans 'Expires' %}</th>
+ <th>{% trans 'Seen' %}</th>
<th>{% trans 'Staff' %}</th>
</tr>
{% for ban in bans %}
@@ -59,6 +60,13 @@
{% endif %}
</td>
<td>
+ {% if ban.seen %}
+ {% trans 'Yes' %}
+ {% else %}
+ {% trans 'No' %}
+ {% endif %}
+ </td>
+ <td>
{% if ban.username %}
{% if mod|hasPermission(config.mod.view_banstaff) %}
<a href="?/new_PM/{{ ban.username|e }}">{{ ban.username|e }}</a>
diff --git a/templates/mod/view_ip.html b/templates/mod/view_ip.html
index 562a0140..e2dad7af 100644
--- a/templates/mod/view_ip.html
+++ b/templates/mod/view_ip.html
@@ -137,6 +137,16 @@
</td>
</tr>
<tr>
+ <th>{% trans 'Seen' %}</th>
+ <td>
+ {% if ban.seen %}
+ {% trans 'Yes' %}
+ {% else %}
+ {% trans 'No' %}
+ {% endif %}
+ </td>
+ </tr>
+ <tr>
<th>{% trans 'Staff' %}</th>
<td>
{% if ban.username %}