Hopefully fix spam filter problems caused by noko 50 (thanks to savetheinternet)

This commit is contained in:
ctrlcctrlv 2013-08-27 23:44:59 +00:00
parent 97a56a7ec1
commit 753b67aa71

View File

@ -1756,6 +1756,7 @@ function buildThread($id, $return = false, $mod = false) {
error($config['error']['nonexistant']); error($config['error']['nonexistant']);
$hasnoko50 = $thread->postCount() >= $config['noko50_min']; $hasnoko50 = $thread->postCount() >= $config['noko50_min'];
$antibot = $mod || $return ? false : create_antibot($board['uri'], $id);
$body = Element('thread.html', array( $body = Element('thread.html', array(
'board' => $board, 'board' => $board,
@ -1766,7 +1767,7 @@ function buildThread($id, $return = false, $mod = false) {
'mod' => $mod, 'mod' => $mod,
'hasnoko50' => $hasnoko50, 'hasnoko50' => $hasnoko50,
'isnoko50' => false, 'isnoko50' => false,
'antibot' => $mod || $return ? false : create_antibot($board['uri'], $id), 'antibot' => $antibot,
'boardlist' => createBoardlist($mod), 'boardlist' => createBoardlist($mod),
'return' => ($mod ? '?' . $board['url'] . $config['file_index'] : $config['root'] . $board['dir'] . $config['file_index']) 'return' => ($mod ? '?' . $board['url'] . $config['file_index'] : $config['root'] . $board['dir'] . $config['file_index'])
)); ));
@ -1787,19 +1788,19 @@ function buildThread($id, $return = false, $mod = false) {
} else { } else {
$noko50fn = $board['dir'] . $config['dir']['res'] . sprintf($config['file_page50'], $id); $noko50fn = $board['dir'] . $config['dir']['res'] . sprintf($config['file_page50'], $id);
if ($hasnoko50 || file_exists($noko50fn)) { if ($hasnoko50 || file_exists($noko50fn)) {
buildThread50($id, $return, $mod, $thread); buildThread50($id, $return, $mod, $thread, $antibot);
} }
file_write($board['dir'] . $config['dir']['res'] . sprintf($config['file_page'], $id), $body); file_write($board['dir'] . $config['dir']['res'] . sprintf($config['file_page'], $id), $body);
} }
} }
function buildThread50($id, $return = false, $mod = false, $thread = null) { function buildThread50($id, $return = false, $mod = false, $thread = null, $antibot = false) {
global $board, $config, $build_pages; global $board, $config, $build_pages;
$id = round($id); $id = round($id);
if (event('build-thread', $id)) if ($antibot)
return; $antibot->reset();
if (!$thread) { if (!$thread) {
$query = prepare(sprintf("SELECT * FROM ``posts_%s`` WHERE (`thread` IS NULL AND `id` = :id) OR `thread` = :id ORDER BY `thread`,`id` DESC LIMIT :limit", $board['uri'])); $query = prepare(sprintf("SELECT * FROM ``posts_%s`` WHERE (`thread` IS NULL AND `id` = :id) OR `thread` = :id ORDER BY `thread`,`id` DESC LIMIT :limit", $board['uri']));
@ -1861,7 +1862,7 @@ function buildThread50($id, $return = false, $mod = false, $thread = null) {
'mod' => $mod, 'mod' => $mod,
'hasnoko50' => $hasnoko50, 'hasnoko50' => $hasnoko50,
'isnoko50' => true, 'isnoko50' => true,
'antibot' => $mod ? false : create_antibot($board['uri'], $id), 'antibot' => $mod ? false : ($antibot ? $antibot : create_antibot($board['uri'], $id)),
'boardlist' => createBoardlist($mod), 'boardlist' => createBoardlist($mod),
'return' => ($mod ? '?' . $board['url'] . $config['file_index'] : $config['root'] . $board['dir'] . $config['file_index']) 'return' => ($mod ? '?' . $board['url'] . $config['file_index'] : $config['root'] . $board['dir'] . $config['file_index'])
)); ));