remove IP bans by ID

git-svn-id: file:///home/shish/svn/shimmie2/branches/branch_2.1@549 7f39781d-f577-437e-ae19-be835c7a54ca
This commit is contained in:
shish 2007-10-21 23:33:08 +00:00
parent 749ed3b587
commit d7c0427868
2 changed files with 9 additions and 9 deletions

View File

@ -2,10 +2,10 @@
// RemoveIPBanEvent {{{
class RemoveIPBanEvent extends Event {
var $ip;
var $id;
public function RemoveIPBanEvent($ip) {
$this->ip = $ip;
public function RemoveIPBanEvent($id) {
$this->id = $id;
}
}
// }}}
@ -53,8 +53,8 @@ class IPBan extends Extension {
}
}
else if($event->get_arg(0) == "remove") {
if(isset($_POST['ip'])) {
send_event(new RemoveIPBanEvent($_POST['ip']));
if(isset($_POST['id'])) {
send_event(new RemoveIPBanEvent($_POST['id']));
global $page;
$page->set_mode("redirect");
@ -69,7 +69,7 @@ class IPBan extends Extension {
}
if(is_a($event, 'RemoveIPBanEvent')) {
$this->remove_ip_ban($event->ip);
$this->remove_ip_ban($event->id);
}
if(is_a($event, 'AdminBuildingEvent')) {
@ -131,9 +131,9 @@ class IPBan extends Extension {
array($ip, $reason, $end));
}
public function remove_ip_ban($ip) {
public function remove_ip_ban($id) {
global $database;
$database->Execute("DELETE FROM bans WHERE ip = ?", array($ip));
$database->Execute("DELETE FROM bans WHERE id = ?", array($id));
}
// }}}
}

View File

@ -21,7 +21,7 @@ class IPBanTheme extends Themelet {
<td>{$ban['end']}</td>
<td>
<form action='".make_link("ip_ban/remove")."' method='POST'>
<input type='hidden' name='ip' value='{$ban['ip']}'>
<input type='hidden' name='id' value='{$ban['id']}'>
<input type='submit' value='Remove'>
</form>
</td>