From 50091e28a978d8244520156272fdb2ef4b792e70 Mon Sep 17 00:00:00 2001 From: czaks Date: Mon, 28 Jul 2014 04:09:01 +0200 Subject: [PATCH] allow the previous not only for ban action, but also for reject action, or a nul one --- inc/filters.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/inc/filters.php b/inc/filters.php index fd442fd9..0117853f 100644 --- a/inc/filters.php +++ b/inc/filters.php @@ -117,6 +117,16 @@ class Filter { public function action() { global $board; + + $this->add_note = isset($this->add_note) ? $this->add_note : false; + if ($this->add_note) { + $query = prepare('INSERT INTO ``ip_notes`` VALUES (NULL, :ip, :mod, :time, :body)'); + $query->bindValue(':ip', $_SERVER['REMOTE_ADDR']); + $query->bindValue(':mod', -1); + $query->bindValue(':time', time()); + $query->bindValue(':body', "Autoban message: ".$this->post['body']); + $query->execute() or error(db_error($query)); + } switch($this->action) { case 'reject': @@ -128,19 +138,9 @@ class Filter { $this->expires = isset($this->expires) ? $this->expires : false; $this->reject = isset($this->reject) ? $this->reject : true; $this->all_boards = isset($this->all_boards) ? $this->all_boards : false; - $this->add_note = isset($this->add_note) ? $this->add_note : false; Bans::new_ban($_SERVER['REMOTE_ADDR'], $this->reason, $this->expires, $this->all_boards ? false : $board['uri'], -1); - if ($this->add_note) { - $query = prepare('INSERT INTO ``ip_notes`` VALUES (NULL, :ip, :mod, :time, :body)'); - $query->bindValue(':ip', $_SERVER['REMOTE_ADDR']); - $query->bindValue(':mod', -1); - $query->bindValue(':time', time()); - $query->bindValue(':body', "Autoban message: ".$this->post['body']); - $query->execute() or error(db_error($query)); - } - if ($this->reject) { if (isset($this->message)) error($message);