Browse Source

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.

pull/40/head
Michael Foster 11 years ago
parent
commit
aadb57f2a2
  1. 10
      inc/functions.php
  2. 8
      templates/mod/ban_list.html
  3. 10
      templates/mod/view_ip.html

10
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) {

8
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 %}
@ -58,6 +59,13 @@
{% endif %}
{% endif %}
</td>
<td>
{% if ban.seen %}
{% trans 'Yes' %}
{% else %}
{% trans 'No' %}
{% endif %}
</td>
<td>
{% if ban.username %}
{% if mod|hasPermission(config.mod.view_banstaff) %}

10
templates/mod/view_ip.html

@ -136,6 +136,16 @@
{% endif %}
</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>

Loading…
Cancel
Save