From aadb57f2a2db9210468f25d7dcd45d561ef6ad54 Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Tue, 16 Jul 2013 08:50:39 -0400 Subject: 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. --- inc/functions.php | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'inc') 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) { -- cgit v1.3