mirror of
https://github.com/vichan-devel/vichan.git
synced 2024-11-28 09:20:58 +01:00
New board option: Max newlines limit
This commit is contained in:
parent
f7f046bf13
commit
8a05c2c122
@ -544,6 +544,17 @@ FLAGS;
|
||||
$reply_limit = 250;
|
||||
}
|
||||
|
||||
if (isset($_POST['max_newlines'])) {
|
||||
$mn = (int)$_POST['max_newlines'];
|
||||
if ($mn < 20 || $mn > 300) {
|
||||
$max_newlines = 0;
|
||||
} else {
|
||||
$max_newlines = $mn;
|
||||
}
|
||||
} else {
|
||||
$max_newlines = $mn;
|
||||
}
|
||||
|
||||
if (!(strlen($title) < 40))
|
||||
error('Invalid title');
|
||||
if (!(strlen($subtitle) < 200))
|
||||
@ -587,6 +598,7 @@ FLAGS;
|
||||
\$config['hour_max_threads'] = $hour_max_threads;
|
||||
\$config['reply_limit'] = $reply_limit;
|
||||
\$config['max_pages'] = $max_pages;
|
||||
\$config['max_newlines'] = $max_newlines;
|
||||
\$config['oekaki'] = $oekaki;
|
||||
$code_tags $katex $replace $multiimage $allow_flash $allow_pdf $user_flags
|
||||
if (\$config['disable_images'])
|
||||
|
@ -473,6 +473,8 @@
|
||||
|
||||
// Maximum post body length.
|
||||
$config['max_body'] = 1800;
|
||||
// Maximum number of newlines. (0 for unlimited)
|
||||
$config['max_newlines'] = 0;
|
||||
// Maximum number of post body lines to show on the index page.
|
||||
$config['body_truncate'] = 15;
|
||||
// Maximum number of characters to show on the index page.
|
||||
|
8
post.php
8
post.php
@ -584,6 +584,14 @@ elseif (isset($_POST['post'])) {
|
||||
error(sprintf($config['error']['toolong'], 'password'));
|
||||
|
||||
wordfilters($post['body']);
|
||||
|
||||
if ($config['max_newlines'] > 0) {
|
||||
preg_match_all("/\n/", $post['body'], $nlmatches);
|
||||
|
||||
if (isset($nlmatches[0]) && sizeof($nlmatches[0]) > $config['max_newlines'])
|
||||
error(sprintf(_('Your post contains too many lines. This board only allows %d maximum.'), $config['max_newlines']));
|
||||
}
|
||||
|
||||
|
||||
$post['body'] = escape_markup_modifiers($post['body']);
|
||||
|
||||
|
@ -52,6 +52,7 @@
|
||||
<tr><th>{% trans %}Enable CAPTCHA for thread creation only{% endtrans %}<br/><span class="unimportant">Users must solve a CAPTCHA in order to create new threads,<br>but do not have to solve a CAPTCHA in order to post replies.</span></th><td><input type="checkbox" name="new_thread_capt" {% if config.new_thread_capt %}checked{% endif %}></td></tr>
|
||||
<tr><th>{% trans %}Public bans{% endtrans %}<br><span class="unimportant">{% trans %}Displays your bans for the public{% endtrans %}</span></th><td><input type="checkbox" name="public_bans" {% if board.public_bans %}checked{% endif %}></td></tr>
|
||||
<tr><th>{% trans %}Public action log{% endtrans %}<br><span class="unimportant">{% trans %}Displays all actions to the public{% endtrans %}</span></th><td><select name="public_logs"><option value="0" {% if board.public_logs == 0 %}selected{% endif %}>None</option><option value="1" {% if board.public_logs == 1 %}selected{% endif %}>Full log of all actions</option><option value="2" {% if board.public_logs == 2 %}selected{% endif %}>Full log of all actions, no usernames</option></td></tr>
|
||||
<tr><th>{% trans %}Max number of newlines per post{% endtrans %}</th><td><select name="max_newlines"><option value="0" {% if config.max_newlines == 0 %}selected{% endif %}>unlimited</option>{% for i in range(20, 300) %}<option value="{{ i }}" {% if config.max_newlines == i %}selected{% endif %}>{{ i }}</option>{% endfor %}</select></td></tr>
|
||||
<tr><th>{% trans %}Page count{% endtrans %}</th><td><select name="max_pages">{% for i in range(2, 25) %}<option value="{{ i }}" {% if config.max_pages == i %}selected{% endif %}>{{ i }}</option>{% endfor %}</select></td></tr>
|
||||
<tr><th>{% trans %}Bump limit{% endtrans %}</th><td><select name="reply_limit">{% for i in range(250, 750, 25) %}<option value="{{ i }}" {% if config.reply_limit == i %}selected{% endif %}>{{ i }}</option>{% endfor %}</select></td></tr>
|
||||
<tr><th>{% trans %}Language{% endtrans %}<br/><span class="unimportant">{% trans %}Read this page for more information about contributing translations:<br><a href="/translation.html">Translation tutorial</a> or use <a href="https://www.transifex.com/projects/p/infinity/">Transifex</a>{% endtrans %}</span></th><td>
|
||||
|
Loading…
Reference in New Issue
Block a user