|
@ -19,6 +19,7 @@ class Filter { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public function match($condition, $match) { |
|
|
public function match($condition, $match) { |
|
|
|
|
|
print_err("Filter condition: " . $condition); |
|
|
$condition = strtolower($condition); |
|
|
$condition = strtolower($condition); |
|
|
|
|
|
|
|
|
$post = &$this->post; |
|
|
$post = &$this->post; |
|
@ -75,6 +76,7 @@ class Filter { |
|
|
case 'flood-time-any': |
|
|
case 'flood-time-any': |
|
|
foreach ($this->flood_check as $flood_post) { |
|
|
foreach ($this->flood_check as $flood_post) { |
|
|
if (time() - $flood_post['time'] <= $match) { |
|
|
if (time() - $flood_post['time'] <= $match) { |
|
|
|
|
|
print_err("rejecting post with flood id: " . $flood_post['id']); |
|
|
return true; |
|
|
return true; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@ -235,6 +237,7 @@ function do_filters(array $post) { |
|
|
$has_flood = true; |
|
|
$has_flood = true; |
|
|
break; |
|
|
break; |
|
|
} else if ($filter['noip'] == true) { |
|
|
} else if ($filter['noip'] == true) { |
|
|
|
|
|
print_err("filters noip is true"); |
|
|
$noip = true; |
|
|
$noip = true; |
|
|
$find_time = time() - $filter['find-time']; |
|
|
$find_time = time() - $filter['find-time']; |
|
|
} |
|
|
} |
|
@ -263,11 +266,13 @@ function do_filters(array $post) { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
foreach ($config['filters'] as $filter_array) { |
|
|
foreach ($config['filters'] as $filter_array) { |
|
|
|
|
|
print_err("creating new filter, running check"); |
|
|
$filter = new Filter($filter_array); |
|
|
$filter = new Filter($filter_array); |
|
|
$filter->flood_check = $flood_check; |
|
|
$filter->flood_check = $flood_check; |
|
|
if ($filter->check($post)) |
|
|
if ($filter->check($post)) { |
|
|
$filter->action(); |
|
|
$filter->action(); |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
purge_flood_table(); |
|
|
purge_flood_table(); |
|
|
} |
|
|
} |
|
|