1
0
mirror of https://github.com/vichan-devel/vichan.git synced 2025-01-19 01:24:05 +01:00

add hourly thread limit (from npfchan)

This commit is contained in:
RealAngeleno 2023-08-13 23:14:41 -07:00 committed by GitHub
parent 503e4e39d0
commit 997babeee0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3067,3 +3067,16 @@ function uncloak_mask($mask) {
return $mask;
}
function check_thread_limit($post) {
global $config, $board;
if (!isset($config['max_threads_per_hour']) || !$config['max_threads_per_hour']) 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->execute() or error(db_error($query));
$r = $query->fetch(PDO::FETCH_ASSOC);
return $r['count'] >= $config['max_threads_per_hour'];
}
}