mirror of
https://github.com/vichan-devel/vichan.git
synced 2024-12-18 10:25:55 +01:00
actually allow for a log-only filter
This commit is contained in:
parent
50091e28a9
commit
a01f8e9e11
@ -16,10 +16,10 @@ class Filter {
|
|||||||
$this->$key = $value;
|
$this->$key = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function match(array $post, $condition, $match) {
|
public function match($condition, $match) {
|
||||||
$condition = strtolower($condition);
|
$condition = strtolower($condition);
|
||||||
|
|
||||||
$this->post = $post;
|
$post = &$this->post;
|
||||||
|
|
||||||
switch($condition) {
|
switch($condition) {
|
||||||
case 'custom':
|
case 'custom':
|
||||||
@ -127,8 +127,7 @@ class Filter {
|
|||||||
$query->bindValue(':body', "Autoban message: ".$this->post['body']);
|
$query->bindValue(':body', "Autoban message: ".$this->post['body']);
|
||||||
$query->execute() or error(db_error($query));
|
$query->execute() or error(db_error($query));
|
||||||
}
|
}
|
||||||
|
if (isset ($this->action)) switch($this->action) {
|
||||||
switch($this->action) {
|
|
||||||
case 'reject':
|
case 'reject':
|
||||||
error(isset($this->message) ? $this->message : 'Posting throttled by filter.');
|
error(isset($this->message) ? $this->message : 'Posting throttled by filter.');
|
||||||
case 'ban':
|
case 'ban':
|
||||||
@ -156,13 +155,14 @@ class Filter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function check(array $post) {
|
public function check(array $post) {
|
||||||
|
$this->post = $post;
|
||||||
foreach ($this->condition as $condition => $value) {
|
foreach ($this->condition as $condition => $value) {
|
||||||
if ($condition[0] == '!') {
|
if ($condition[0] == '!') {
|
||||||
$NOT = true;
|
$NOT = true;
|
||||||
$condition = substr($condition, 1);
|
$condition = substr($condition, 1);
|
||||||
} else $NOT = false;
|
} else $NOT = false;
|
||||||
|
|
||||||
if ($this->match($post, $condition, $value) == $NOT)
|
if ($this->match($condition, $value) == $NOT)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
Reference in New Issue
Block a user