hide old bans by default (and make them work at all <_<;;)
This commit is contained in:
parent
a2e5ad707b
commit
1b77120699
@ -70,7 +70,8 @@ class IPBan implements Extension {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if($event->get_arg(0) == "list") {
|
else if($event->get_arg(0) == "list") {
|
||||||
$this->theme->display_bans($event->page, $this->get_bans());
|
$bans = (isset($_GET["all"])) ? $this->get_bans() : $this->get_active_bans();
|
||||||
|
$this->theme->display_bans($event->page, $bans);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -194,7 +195,8 @@ class IPBan implements Extension {
|
|||||||
SELECT bans.*, users.name as banner_name
|
SELECT bans.*, users.name as banner_name
|
||||||
FROM bans
|
FROM bans
|
||||||
JOIN users ON banner_id = users.id
|
JOIN users ON banner_id = users.id
|
||||||
ORDER BY end_timestamp, id");
|
ORDER BY end_timestamp, id
|
||||||
|
");
|
||||||
if($bans) {return $bans;}
|
if($bans) {return $bans;}
|
||||||
else {return array();}
|
else {return array();}
|
||||||
}
|
}
|
||||||
@ -202,8 +204,11 @@ class IPBan implements Extension {
|
|||||||
private function get_active_bans() {
|
private function get_active_bans() {
|
||||||
global $database;
|
global $database;
|
||||||
$bans = $database->get_all("
|
$bans = $database->get_all("
|
||||||
SELECT * FROM bans
|
SELECT bans.*, users.name as banner_name
|
||||||
WHERE (end_timestamp > now()) OR (end_timestamp IS NULL)
|
FROM bans
|
||||||
|
JOIN users ON banner_id = users.id
|
||||||
|
WHERE (end_timestamp > UNIX_TIMESTAMP(now())) OR (end_timestamp IS NULL)
|
||||||
|
ORDER BY end_timestamp, id
|
||||||
");
|
");
|
||||||
if($bans) {return $bans;}
|
if($bans) {return $bans;}
|
||||||
else {return array();}
|
else {return array();}
|
||||||
|
@ -34,7 +34,8 @@ class IPBanTheme extends Themelet {
|
|||||||
";
|
";
|
||||||
}
|
}
|
||||||
$html = "
|
$html = "
|
||||||
<table class='zebra'>
|
<a href='".make_link("ip_ban/list", "all=on")."'>Show All</a>
|
||||||
|
<p><table class='zebra'>
|
||||||
<thead><th>IP</th><th>Reason</th><th>By</th><th>Until</th><th>Action</th></thead>
|
<thead><th>IP</th><th>Reason</th><th>By</th><th>Until</th><th>Action</th></thead>
|
||||||
$h_bans
|
$h_bans
|
||||||
<tfoot><tr>
|
<tfoot><tr>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user