allow ban for '1 week' etc instead of specifying end time
git-svn-id: file:///home/shish/svn/shimmie2/trunk@812 7f39781d-f577-437e-ae19-be835c7a54ca
This commit is contained in:
parent
ccde7b6cab
commit
62d0f3df7c
@ -55,7 +55,7 @@ class IPBan extends Extension {
|
|||||||
|
|
||||||
global $page;
|
global $page;
|
||||||
$page->set_mode("redirect");
|
$page->set_mode("redirect");
|
||||||
$page->set_redirect(make_link("admin"));
|
$page->set_redirect(make_link("ip_ban/list"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if($event->get_arg(0) == "remove") {
|
else if($event->get_arg(0) == "remove") {
|
||||||
@ -64,7 +64,7 @@ class IPBan extends Extension {
|
|||||||
|
|
||||||
global $page;
|
global $page;
|
||||||
$page->set_mode("redirect");
|
$page->set_mode("redirect");
|
||||||
$page->set_redirect(make_link("admin"));
|
$page->set_redirect(make_link("ip_ban/list"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if($event->get_arg(0) == "list") {
|
else if($event->get_arg(0) == "list") {
|
||||||
@ -146,9 +146,16 @@ class IPBan extends Extension {
|
|||||||
|
|
||||||
private function add_ip_ban($ip, $reason, $end, $user) {
|
private function add_ip_ban($ip, $reason, $end, $user) {
|
||||||
global $database;
|
global $database;
|
||||||
$database->Execute(
|
if(preg_match("/^\d+ (day|week|month)$/i", $end)) {
|
||||||
"INSERT INTO bans (ip, reason, date, end, banner_id) VALUES (?, ?, now(), ?, ?)",
|
$sql = "INSERT INTO bans (ip, reason, date, end, banner_id)
|
||||||
array($ip, $reason, $end, $user->id));
|
VALUES (?, ?, now(), now() + interval $end, ?)";
|
||||||
|
$database->Execute($sql, array($ip, $reason, $user->id));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$sql = "INSERT INTO bans (ip, reason, date, end, banner_id)
|
||||||
|
VALUES (?, ?, now(), ?, ?)";
|
||||||
|
$database->Execute($sql, array($ip, $reason, $end, $user->id));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function remove_ip_ban($id) {
|
private function remove_ip_ban($id) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user