1
0
mirror of https://github.com/vichan-devel/vichan.git synced 2025-02-21 13:09:41 +01:00

First spam settings in ?/settings

This commit is contained in:
8chan 2014-12-31 22:32:26 -08:00
parent 04afbe904d
commit 0f3a65a984
2 changed files with 26 additions and 4 deletions

View File

@ -398,6 +398,7 @@ FLAGS;
$auto_unicode = isset($_POST['auto_unicode']) ? 'true' : 'false'; $auto_unicode = isset($_POST['auto_unicode']) ? 'true' : 'false';
$allow_roll = isset($_POST['allow_roll']) ? 'true' : 'false'; $allow_roll = isset($_POST['allow_roll']) ? 'true' : 'false';
$image_reject_repost = isset($_POST['image_reject_repost']) ? 'true' : 'false'; $image_reject_repost = isset($_POST['image_reject_repost']) ? 'true' : 'false';
$early_404 = isset($_POST['early_404']) ? 'true' : 'false';
$allow_delete = isset($_POST['allow_delete']) ? 'true' : 'false'; $allow_delete = isset($_POST['allow_delete']) ? 'true' : 'false';
$allow_flash = isset($_POST['allow_flash']) ? '$config[\'allowed_ext_files\'][] = \'swf\';' : ''; $allow_flash = isset($_POST['allow_flash']) ? '$config[\'allowed_ext_files\'][] = \'swf\';' : '';
$allow_pdf = isset($_POST['allow_pdf']) ? '$config[\'allowed_ext_files\'][] = \'pdf\';' : ''; $allow_pdf = isset($_POST['allow_pdf']) ? '$config[\'allowed_ext_files\'][] = \'pdf\';' : '';
@ -408,6 +409,7 @@ FLAGS;
$force_subject_op = isset($_POST['force_subject_op']) ? 'true' : 'false'; $force_subject_op = isset($_POST['force_subject_op']) ? 'true' : 'false';
$oekaki_js = <<<OEKAKI $oekaki_js = <<<OEKAKI
\$config['additional_javascript'][] = 'js/jquery-ui.custom.min.js'; \$config['additional_javascript'][] = 'js/jquery-ui.custom.min.js';
\$config['additional_javascript'][] = 'js/wPaint/lib/wColorPicker.min.js'; \$config['additional_javascript'][] = 'js/wPaint/lib/wColorPicker.min.js';
@ -440,16 +442,30 @@ OEKAKI;
$replace = ''; $replace = '';
if (isset($_POST['replace'])) { if (isset($_POST['replace'])) {
if (sizeof($_POST['replace']) > 200 || sizeof($_POST['with']) > 200) {
error(_('Sorry, max 200 wordfilters allowed.'));
}
if (count($_POST['replace']) == count($_POST['with'])) { if (count($_POST['replace']) == count($_POST['with'])) {
foreach ($_POST['replace'] as $i => $r ) { foreach ($_POST['replace'] as $i => $r ) {
if ($r !== '') { if ($r !== '') {
$w = $_POST['with'][$i]; $w = $_POST['with'][$i];
if (strlen($w) > 255) {
error(sprintf(_('Sorry, %s is too long. Max replacement is 255 characters', utf8tohtml($w))));
}
$replace .= '$config[\'wordfilters\'][] = array(base64_decode(\'' . base64_encode($r) . '\'), base64_decode(\'' . base64_encode($w) . '\'));'; $replace .= '$config[\'wordfilters\'][] = array(base64_decode(\'' . base64_encode($r) . '\'), base64_decode(\'' . base64_encode($w) . '\'));';
} }
} }
} }
} }
if (isset($_POST['hour_max_threads']) && in_array($_POST['hour_max_threads'], ['10', '25', '50', '100'])) {
$hour_max_threads = $_POST['hour_max_threads'];
} else {
$hour_max_threads = 'false';
}
if (!(strlen($title) < 40)) if (!(strlen($title) < 40))
error('Invalid title'); error('Invalid title');
if (!(strlen($subtitle) < 200)) if (!(strlen($subtitle) < 200))
@ -477,6 +493,7 @@ OEKAKI;
\$config['auto_unicode'] = $auto_unicode; \$config['auto_unicode'] = $auto_unicode;
\$config['allow_roll'] = $allow_roll; \$config['allow_roll'] = $allow_roll;
\$config['image_reject_repost'] = $image_reject_repost; \$config['image_reject_repost'] = $image_reject_repost;
\$config['early_404'] = $early_404;
\$config['allow_delete'] = $allow_delete; \$config['allow_delete'] = $allow_delete;
\$config['anonymous'] = base64_decode('$anonymous'); \$config['anonymous'] = base64_decode('$anonymous');
\$config['blotter'] = base64_decode('$blotter'); \$config['blotter'] = base64_decode('$blotter');
@ -484,6 +501,7 @@ OEKAKI;
\$config['default_stylesheet'] = array('Custom', \$config['stylesheets']['Custom']); \$config['default_stylesheet'] = array('Custom', \$config['stylesheets']['Custom']);
\$config['captcha']['enabled'] = $captcha; \$config['captcha']['enabled'] = $captcha;
\$config['force_subject_op'] = $force_subject_op; \$config['force_subject_op'] = $force_subject_op;
\$config['hour_max_threads'] = $hour_max_threads;
$code_tags $katex $oekaki $replace $multiimage $allow_flash $allow_pdf $user_flags $code_tags $katex $oekaki $replace $multiimage $allow_flash $allow_pdf $user_flags
if (\$config['disable_images']) if (\$config['disable_images'])
\$config['max_pages'] = 10000; \$config['max_pages'] = 10000;
@ -529,6 +547,7 @@ EOT;
file_write($b.'/rules.txt', $_POST['rules']); file_write($b.'/rules.txt', $_POST['rules']);
$_config = $config; $_config = $config;
unset($config['wordfilters']);
// Faster than openBoard and bypasses cache...we're trusting the PHP output // Faster than openBoard and bypasses cache...we're trusting the PHP output
// to be safe enough to run with every request, we can eval it here. // to be safe enough to run with every request, we can eval it here.
@ -560,10 +579,6 @@ EOT;
$rules = @file_get_contents($board['uri'] . '/rules.txt'); $rules = @file_get_contents($board['uri'] . '/rules.txt');
$css = @file_get_contents('stylesheets/board/' . $board['uri'] . '.css'); $css = @file_get_contents('stylesheets/board/' . $board['uri'] . '.css');
openBoard($b);
rebuildThemes('bans');
if ($config['cache']['enabled']) if ($config['cache']['enabled'])
cache::delete('board_' . $board['uri']); cache::delete('board_' . $board['uri']);
cache::delete('all_boards'); cache::delete('all_boards');

View File

@ -58,6 +58,13 @@
<tr><th>{% trans %}Max images per post{% endtrans %}</th><td><select name="max_images">{% for i in 1..5 %}<option value="{{ i }}" {% if config.max_images == i %} selected {% endif %}>{{ i }}</option>{% endfor %}</select></td></tr> <tr><th>{% trans %}Max images per post{% endtrans %}</th><td><select name="max_images">{% for i in 1..5 %}<option value="{{ i }}" {% if config.max_images == i %} selected {% endif %}>{{ i }}</option>{% endfor %}</select></td></tr>
</table> </table>
<table>
<tr><th colspan="2"><strong>{% trans %}Spam settings{% endtrans %}</strong></th></tr>
<tr><th>{% trans %}Early 404{% endtrans %}<br><span class="unimportant">With this enabled, threads with less than 10 replies will 404 at page 5 instead of at page 15.<br>In effect, this makes it so that raiders have to put 10 replies in all their threads to slide an entire board.</span></th><td><input type="checkbox" name="early_404" {% if config.early_404 %}checked{% endif %}></td></tr>
<tr><th>{% trans %}Max threads per hour board-wide{% endtrans %}<br><span class="unimportant">Only allow X threads to be made per hour, regardless of poster<br>If a thread is deleted, it's not counted</span></th><td><select name="hour_max_threads"><option value="none">none</option>{% for i in ['10', '25', '50', '100'] %}<option value="{{ i }}" {% if config.hour_max_threads == i %} selected {% endif %}>{{ i }}</option>{% endfor %}</select></td></tr>
</table>
<p style="text-align:center"><a href="?/banners/{{board.uri}}">{% trans %}Edit board banners{% endtrans %}</a></p> <p style="text-align:center"><a href="?/banners/{{board.uri}}">{% trans %}Edit board banners{% endtrans %}</a></p>
<p style="text-align:center"><a href="?/flags/{{board.uri}}">{% trans %}Edit board flags{% endtrans %}</a></p> <p style="text-align:center"><a href="?/flags/{{board.uri}}">{% trans %}Edit board flags{% endtrans %}</a></p>
<p style="text-align:center"><a href="?/volunteers/{{board.uri}}">{% trans %}Edit board volunteers{% endtrans %}</a></p> <p style="text-align:center"><a href="?/volunteers/{{board.uri}}">{% trans %}Edit board volunteers{% endtrans %}</a></p>