forked from GithubBackups/vichan
Hour max threads filter
This commit is contained in:
parent
2be8988284
commit
aa5d0e6e4b
@ -160,7 +160,6 @@
|
|||||||
|
|
||||||
$config['footer'][] = 'All posts on 8chan.co are the responsibility of the individual poster and not the administration of 8chan.co, pursuant to 47 U.S.C. § 230.';
|
$config['footer'][] = 'All posts on 8chan.co are the responsibility of the individual poster and not the administration of 8chan.co, pursuant to 47 U.S.C. § 230.';
|
||||||
$config['footer'][] = 'We have not been served any secret court orders and are not under any gag orders.';
|
$config['footer'][] = 'We have not been served any secret court orders and are not under any gag orders.';
|
||||||
$config['footer'][] = 'Contribute to 8chan.co development at <a href="https://github.com/ctrlcctrlv/8chan">github</a>';
|
|
||||||
$config['footer'][] = 'To make a DMCA request or report illegal content, please email <a href="mailto:admin@8chan.co">admin@8chan.co</a>.';
|
$config['footer'][] = 'To make a DMCA request or report illegal content, please email <a href="mailto:admin@8chan.co">admin@8chan.co</a>.';
|
||||||
|
|
||||||
$config['search']['enable'] = true;
|
$config['search']['enable'] = true;
|
||||||
@ -169,6 +168,27 @@
|
|||||||
|
|
||||||
$config['wordfilters'][] = array('\rule', ''); // 'true' means it's a regular expression
|
$config['wordfilters'][] = array('\rule', ''); // 'true' means it's a regular expression
|
||||||
|
|
||||||
|
$config['hour_max_threads'] = false;
|
||||||
|
$config['filters'][] = array(
|
||||||
|
'condition' => array(
|
||||||
|
'custom' => function($post) {
|
||||||
|
global $config, $board;
|
||||||
|
if (!$config['hour_max_threads']) return false;
|
||||||
|
|
||||||
|
if ($post['op']) {
|
||||||
|
$query = prepare(sprintf('SELECT COUNT(*) AS `count` FROM ``posts_%s`` WHERE `thread` IS NULL AND FROM_UNIXTIME(`time`) > DATE_SUB(NOW(), INTERVAL 1 HOUR);', $board['uri']));
|
||||||
|
$query->bindValue(':ip', $_SERVER['REMOTE_ADDR']);
|
||||||
|
$query->execute() or error(db_error($query));
|
||||||
|
$r = $query->fetch(PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
|
return ($r['count'] > $config['hour_max_threads']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
),
|
||||||
|
'action' => 'reject',
|
||||||
|
'message' => sprintf(_('On this board, to prevent raids only %d threads can be made per hour. Please try again later, or post in an existing thread.'), $config['hour_max_threads'])
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
$config['embedding'] = array(
|
$config['embedding'] = array(
|
||||||
array(
|
array(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user