1
0
mirror of https://github.com/vichan-devel/vichan.git synced 2024-11-29 01:34:31 +01:00

Update $config['try_smarter']. Should be working now.

This commit is contained in:
Michael Foster 2013-08-03 17:42:34 -04:00
parent e9ebf724fe
commit ad5570ada2
4 changed files with 21 additions and 7 deletions

View File

@ -262,7 +262,8 @@
'recaptcha_challenge_field', 'recaptcha_challenge_field',
'recaptcha_response_field', 'recaptcha_response_field',
'spoiler', 'spoiler',
'quick-reply' 'quick-reply',
'page'
); );
// Enable reCaptcha to make spam even harder. Rarely necessary. // Enable reCaptcha to make spam even harder. Rarely necessary.

View File

@ -841,11 +841,14 @@ function post(array $post) {
} }
function bumpThread($id) { function bumpThread($id) {
global $board; global $config, $board, $build_pages;
if (event('bump', $id)) if (event('bump', $id))
return true; return true;
if ($config['try_smarter'])
$build_pages[] = thread_find_page($id);
$query = prepare(sprintf("UPDATE ``posts_%s`` SET `bump` = :time WHERE `id` = :id AND `thread` IS NULL", $board['uri'])); $query = prepare(sprintf("UPDATE ``posts_%s`` SET `bump` = :time WHERE `id` = :id AND `thread` IS NULL", $board['uri']));
$query->bindValue(':time', time(), PDO::PARAM_INT); $query->bindValue(':time', time(), PDO::PARAM_INT);
$query->bindValue(':id', $id, PDO::PARAM_INT); $query->bindValue(':id', $id, PDO::PARAM_INT);
@ -1274,6 +1277,7 @@ function buildIndex() {
global $board, $config, $build_pages; global $board, $config, $build_pages;
$pages = getPages(); $pages = getPages();
if (!$config['try_smarter'])
$antibot = create_antibot($board['uri']); $antibot = create_antibot($board['uri']);
for ($page = 1; $page <= $config['max_pages']; $page++) { for ($page = 1; $page <= $config['max_pages']; $page++) {
@ -1285,8 +1289,11 @@ function buildIndex() {
if (!$content) if (!$content)
break; break;
if ($config['try_smarter']) {
$antibot = create_antibot($board['uri'], 0 - $page);
$content['current_page'] = $page;
}
$antibot->reset(); $antibot->reset();
$content['pages'] = $pages; $content['pages'] = $pages;
$content['pages'][$page-1]['selected'] = true; $content['pages'][$page-1]['selected'] = true;
$content['btn'] = getPageButtons($content['pages']); $content['btn'] = getPageButtons($content['pages']);

View File

@ -216,7 +216,7 @@ if (isset($_POST['delete'])) {
} }
if (!$post['mod']) { if (!$post['mod']) {
$post['antispam_hash'] = checkSpam(array($board['uri'], isset($post['thread']) && !($config['quick_reply'] && isset($_POST['quick-reply'])) ? $post['thread'] : null)); $post['antispam_hash'] = checkSpam(array($board['uri'], isset($post['thread']) && !($config['quick_reply'] && isset($_POST['quick-reply'])) ? $post['thread'] : ($config['try_smarter'] && isset($_POST['page']) ? 0 - (int)$_POST['page'] : null)));
if ($post['antispam_hash'] === true) if ($post['antispam_hash'] === true)
error($config['error']['spam']); error($config['error']['spam']);
} }
@ -594,12 +594,15 @@ if (isset($_POST['delete'])) {
} }
} }
buildThread($post['op'] ? $id : $post['thread']);
if (!$post['op'] && strtolower($post['email']) != 'sage' && !$thread['sage'] && ($config['reply_limit'] == 0 || $numposts['replies']+1 < $config['reply_limit'])) { if (!$post['op'] && strtolower($post['email']) != 'sage' && !$thread['sage'] && ($config['reply_limit'] == 0 || $numposts['replies']+1 < $config['reply_limit'])) {
bumpThread($post['thread']); bumpThread($post['thread']);
} }
buildThread($post['op'] ? $id : $post['thread']);
if ($config['try_smarter'] && $post['op'])
$build_pages = range(1, $config['max_pages']);
if ($post['op']) if ($post['op'])
clean(); clean();

View File

@ -4,6 +4,9 @@
{{ antibot.html() }} {{ antibot.html() }}
<input type="hidden" name="board" value="{{ board.uri }}"> <input type="hidden" name="board" value="{{ board.uri }}">
{{ antibot.html() }} {{ antibot.html() }}
{% if current_page %}
<input type="hidden" name="page" value="{{ current_page }}">
{% endif %}
{% if mod %}<input type="hidden" name="mod" value="1">{% endif %} {% if mod %}<input type="hidden" name="mod" value="1">{% endif %}
<table> <table>
{% if not config.field_disable_name or (mod and post.mod|hasPermission(config.mod.bypass_field_disable, board.uri)) %}<tr> {% if not config.field_disable_name or (mod and post.mod|hasPermission(config.mod.bypass_field_disable, board.uri)) %}<tr>