diff --git a/inc/instance-config.php b/inc/instance-config.php index c1dea2c3..1f245faa 100644 --- a/inc/instance-config.php +++ b/inc/instance-config.php @@ -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'][] = 'We have not been served any secret court orders and are not under any gag orders.'; - $config['footer'][] = 'Contribute to 8chan.co development at github'; $config['footer'][] = 'To make a DMCA request or report illegal content, please email admin@8chan.co.'; $config['search']['enable'] = true; @@ -169,6 +168,27 @@ $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( array(