summaryrefslogtreecommitdiff
path: root/inc/filters.php
diff options
context:
space:
mode:
authorczaks <marcin@6irc.net>2014-07-28 04:12:19 +0200
committerczaks <marcin@6irc.net>2014-07-28 04:12:19 +0200
commita01f8e9e117fccf3425abc46f23f340caa3d4957 (patch)
tree913e4df73df8c9f047e49fa1d141578dde13ea5f /inc/filters.php
parent50091e28a978d8244520156272fdb2ef4b792e70 (diff)
actually allow for a log-only filter
Diffstat (limited to 'inc/filters.php')
-rw-r--r--inc/filters.php10
1 files changed, 5 insertions, 5 deletions
diff --git a/inc/filters.php b/inc/filters.php
index 0117853f..5071353a 100644
--- a/inc/filters.php
+++ b/inc/filters.php
@@ -16,10 +16,10 @@ class Filter {
$this->$key = $value;
}
- public function match(array $post, $condition, $match) {
+ public function match($condition, $match) {
$condition = strtolower($condition);
- $this->post = $post;
+ $post = &$this->post;
switch($condition) {
case 'custom':
@@ -127,8 +127,7 @@ class Filter {
$query->bindValue(':body', "Autoban message: ".$this->post['body']);
$query->execute() or error(db_error($query));
}
-
- switch($this->action) {
+ if (isset ($this->action)) switch($this->action) {
case 'reject':
error(isset($this->message) ? $this->message : 'Posting throttled by filter.');
case 'ban':
@@ -156,13 +155,14 @@ class Filter {
}
public function check(array $post) {
+ $this->post = $post;
foreach ($this->condition as $condition => $value) {
if ($condition[0] == '!') {
$NOT = true;
$condition = substr($condition, 1);
} else $NOT = false;
- if ($this->match($post, $condition, $value) == $NOT)
+ if ($this->match($condition, $value) == $NOT)
return false;
}
return true;