Browse Source

filters: add option to log a message body in ip notes

pull/40/head
Marcin Łabanowski 10 years ago
parent
commit
29e71fa3ee
  1. 13
      inc/filters.php

13
inc/filters.php

@ -9,6 +9,7 @@ defined('TINYBOARD') or exit;
class Filter {
public $flood_check;
private $condition;
private $post;
public function __construct(array $arr) {
foreach ($arr as $key => $value)
@ -17,6 +18,8 @@ class Filter {
public function match(array $post, $condition, $match) {
$condition = strtolower($condition);
$this->post = $post;
switch($condition) {
case 'custom':
@ -125,8 +128,18 @@ 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))

Loading…
Cancel
Save