image_hash_ban whitespacing

git-svn-id: file:///home/shish/svn/shimmie2/trunk@759 7f39781d-f577-437e-ae19-be835c7a54ca
This commit is contained in:
shish 2008-04-06 16:47:05 +00:00
parent 7db7096b2e
commit 52639e6c3a

View file

@ -34,7 +34,6 @@ class Image_Hash_Ban extends Extension {
var $theme;
public function receive_event($event) {
if(is_null($this->theme)) $this->theme = get_theme_object("Image_Hash_Ban", "ImageBanTheme");
if(is_a($event, 'InitExtEvent')) {
@ -42,7 +41,6 @@ class Image_Hash_Ban extends Extension {
if($config->get_int("ext_imageban_version") < 1) {
$this->install();
}
}
if(is_a($event, 'DataUploadEvent')) {
@ -56,10 +54,8 @@ class Image_Hash_Ban extends Extension {
}
}
if(is_a($event, 'PageRequestEvent') && ($event->page_name == "image_hash_ban")) {
global $user;
if($user->is_admin()) {
if($event->user->is_admin()) {
if($event->get_arg(0) == "add") {
if(isset($_POST['hash']) && isset($_POST['reason'])) {
send_event(new AddImageHashBanEvent($_POST['hash'], $_POST['reason']));
@ -67,7 +63,6 @@ class Image_Hash_Ban extends Extension {
global $page;
$page->set_mode("redirect");
$page->set_redirect(make_link("admin"));
}
}
else if($event->get_arg(0) == "remove") {
@ -98,12 +93,9 @@ class Image_Hash_Ban extends Extension {
if(is_a($event, 'DisplayingImageEvent')) {
global $user;
if($user->is_admin()) {
$this->theme->display_image_banner($event->page, $event->image->hash);
}
}
}
protected function install() {
@ -129,14 +121,6 @@ class Image_Hash_Ban extends Extension {
else {return array();}
}
public function get_image_hash_ban($hash) {
global $database;
// yes, this is "? LIKE var", because ? is the thing with matching tokens
// actually, slow
// return $database->db->GetRow("SELECT * FROM bans WHERE ? LIKE ip AND date < now() AND (end > now() OR isnull(end))", array($ip));
return $database->db->GetRow("SELECT * FROM image_bans WHERE hash = ? AND date < now()", array($hash));
}
public function add_image_hash_ban($hash, $reason) {
global $database;
$database->Execute(