From b49fe85345acd5a13771fc067b43f263ac68ab81 Mon Sep 17 00:00:00 2001 From: 8chan Date: Thu, 26 Feb 2015 01:10:00 -0800 Subject: [PATCH 1/3] =?UTF-8?q?(=20=CD=A1=C2=B0=20=CD=9C=CA=96=20=CD=A1?= =?UTF-8?q?=C2=B0)=20Allow=20board=20owners=20to=20enable=20Zalgo=20text?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- inc/8chan-mod-pages.php | 2 ++ settings.php | 1 + templates/mod/settings.html | 1 + 3 files changed, 4 insertions(+) diff --git a/inc/8chan-mod-pages.php b/inc/8chan-mod-pages.php index 337112aa..9d1479bd 100644 --- a/inc/8chan-mod-pages.php +++ b/inc/8chan-mod-pages.php @@ -448,6 +448,7 @@ FLAGS; $poster_ids = isset($_POST['poster_ids']) ? 'true' : 'false'; $show_sages = isset($_POST['show_sages']) ? 'true' : 'false'; $auto_unicode = isset($_POST['auto_unicode']) ? 'true' : 'false'; + $strip_combining_chars = isset($_POST['strip_combining_chars']) ? 'true' : 'false'; $allow_roll = isset($_POST['allow_roll']) ? 'true' : 'false'; $image_reject_repost = isset($_POST['image_reject_repost']) ? 'true' : 'false'; $early_404 = isset($_POST['early_404']) ? 'true' : 'false'; @@ -549,6 +550,7 @@ OEKAKI; \$config['poster_ids'] = $poster_ids; \$config['show_sages'] = $show_sages; \$config['auto_unicode'] = $auto_unicode; +\$config['strip_combining_chars'] = $strip_combining_chars; \$config['allow_roll'] = $allow_roll; \$config['image_reject_repost'] = $image_reject_repost; \$config['early_404'] = $early_404; diff --git a/settings.php b/settings.php index f50da306..f6f6b7f8 100644 --- a/settings.php +++ b/settings.php @@ -19,6 +19,7 @@ $safe_config['disable_images'] = $config['disable_images']; $safe_config['poster_ids'] = $config['poster_ids']; $safe_config['show_sages'] = $config['show_sages']; $safe_config['auto_unicode'] = $config['auto_unicode']; +$safe_config['strip_combining_chars'] = $config['strip_combining_chars']; $safe_config['allow_roll'] = $config['allow_roll']; $safe_config['image_reject_repost'] = $config['image_reject_repost']; $safe_config['early_404'] = $config['early_404']; diff --git a/templates/mod/settings.html b/templates/mod/settings.html index 9427cd9e..db53a887 100644 --- a/templates/mod/settings.html +++ b/templates/mod/settings.html @@ -34,6 +34,7 @@ {% trans %}Poster ID's{% endtrans %} {% trans %}Display SAGE! after saged posts{% endtrans %} {% trans %}Automatically convert ... to …{% endtrans %} + {% trans %}Disallow combining characters ("Zalgo", Vietnamese text){% endtrans %} {% trans %}No index{% endtrans %}
{% trans %}Hide from boards index
and do not index in search engines{% endtrans %}
{% trans %}Archive my board on 8archive.moe{% endtrans %}
{% trans %}This archives your board on 8archive.moe if you opt in{% endtrans %} {% trans %}[code] tags{% endtrans %} From 2f04aefdf5bc6f835fcba6dfac4030885f8073b6 Mon Sep 17 00:00:00 2001 From: 8chan Date: Thu, 26 Feb 2015 01:12:12 -0800 Subject: [PATCH 2/3] Re-enable antibot system, disable hash expiration & unicode --- inc/anti-bot.php | 4 +++- inc/config.php | 2 +- inc/instance-config.php | 2 ++ post.php | 6 +++--- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/inc/anti-bot.php b/inc/anti-bot.php index 59f5351f..74f377c2 100644 --- a/inc/anti-bot.php +++ b/inc/anti-bot.php @@ -197,7 +197,7 @@ function _create_antibot($board, $thread) { if (!isset($purged_old_antispam)) { $purged_old_antispam = true; - query('DELETE FROM ``antispam`` WHERE `expires` < UNIX_TIMESTAMP()') or error(db_error()); + //query('DELETE FROM ``antispam`` WHERE `expires` < UNIX_TIMESTAMP()') or error(db_error()); } if ($thread) @@ -276,6 +276,8 @@ function checkSpam(array $extra_salt = array()) { } function incrementSpamHash($hash) { + if ($hash === true) return; + $query = prepare('UPDATE ``antispam`` SET `passed` = `passed` + 1 WHERE `hash` = :hash'); $query->bindValue(':hash', $hash); $query->execute() or error(db_error($query)); diff --git a/inc/config.php b/inc/config.php index ce6f31bd..1531d807 100644 --- a/inc/config.php +++ b/inc/config.php @@ -1089,7 +1089,7 @@ $config['error']['image_hard_limit'] = _('Thread has reached its maximum image limit.'); $config['error']['nopost'] = _('You didn\'t make a post.'); $config['error']['flood'] = _('Flood detected; Post discarded.'); - $config['error']['spam'] = _('Your request looks automated; Post discarded.'); + $config['error']['spam'] = _('Your request looks automated; Post discarded. Try refreshing the page.'); $config['error']['unoriginal'] = _('Unoriginal content!'); $config['error']['muted'] = _('Unoriginal content! You have been muted for %d seconds.'); $config['error']['youaremuted'] = _('You are muted! Expires in %d seconds.'); diff --git a/inc/instance-config.php b/inc/instance-config.php index 41407f0b..44d38f33 100644 --- a/inc/instance-config.php +++ b/inc/instance-config.php @@ -203,6 +203,8 @@ $config['mask_db_error'] = true; $config['ban_appeals'] = true; $config['show_sages'] = false; $config['katex'] = false; +$config['enable_antibot'] = true; +$config['spam']['unicode'] = false; // 8chan specific mod pages require '8chan-mod-pages.php'; diff --git a/post.php b/post.php index f1e75b33..b303f536 100644 --- a/post.php +++ b/post.php @@ -283,11 +283,11 @@ elseif (isset($_POST['post'])) { error($config['error']['noaccess']); } - /*if (!$post['mod']) { + if (!$post['mod']) { $post['antispam_hash'] = checkSpam(array($board['uri'], isset($post['thread']) ? $post['thread'] : ($config['try_smarter'] && isset($_POST['page']) ? 0 - (int)$_POST['page'] : null))); - if ($post['antispam_hash'] === true) + if ($post['antispam_hash'] === true && $config['enable_antibot']) error($config['error']['spam']); - }*/ + } if ($config['robot_enable'] && $config['robot_mute']) { checkMute(); From 03419dc7701b785cb056df8575d01e55138fcfe6 Mon Sep 17 00:00:00 2001 From: 8chan Date: Thu, 26 Feb 2015 01:13:07 -0800 Subject: [PATCH 3/3] markup() would erroneously set $board on x-board ref --- inc/functions.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/inc/functions.php b/inc/functions.php index 2470a4a6..dc28421d 100755 --- a/inc/functions.php +++ b/inc/functions.php @@ -1911,8 +1911,11 @@ function markup(&$body, $track_cites = false, $op = false) { } // Restore old board - if ($board['uri'] != $tmp_board) + if (!$tmp_board) { + unset($GLOBALS['board']); + } elseif ($board['uri'] != $tmp_board) { openBoard($tmp_board); + } foreach ($cites as $matches) { $_board = $matches[2][0];