Browse Source

Add option for minimum required OP length

(Conflicts with lainchan and clean-up by Discomrade)
main
Equus 7 years ago
committed by -
parent
commit
d5e132b899
  1. 8
      inc/config.php
  2. 8
      post.php

8
inc/config.php

@ -499,6 +499,8 @@
$config['max_body'] = 1800;
// Minimum post body length.
$config['min_body'] = 0;
// Minimum post body length for OPs.
$config['min_body_op'] = 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.
@ -1139,8 +1141,10 @@
$config['error']['bot'] = _('You look like a bot.');
$config['error']['referer'] = _('Your browser sent an invalid or no HTTP referer.');
$config['error']['toolong'] = _('The %s field was too long.');
$config['error']['toolong_body'] = _('The body was too long.');
$config['error']['tooshort_body'] = _('The body was too short or empty.');
$config['error']['toolong_body'] = _('Post can\'t be longer than %d characters long.');
$config['error']['tooshort_body'] = _('Post must be at least %d characters long.');
$config['error']['tooshort_body_op'] = _('OP must be at least %d characters long.');
$config['error']['no_body'] = _('The body was too short or empty.');
$config['error']['noimage'] = _('You must upload an image.');
$config['error']['toomanyimages'] = _('You have attempted to upload too many images!');
$config['error']['nomove'] = _('The server failed to handle your upload.');

8
post.php

@ -601,7 +601,7 @@ if (isset($_POST['delete'])) {
if (!($post['has_file'] || isset($post['embed'])) || (($post['op'] && $config['force_body_op']) || (!$post['op'] && $config['force_body']))) {
$stripped_whitespace = preg_replace('/[\s]/u', '', $post['body']);
if ($stripped_whitespace == '') {
error($config['error']['tooshort_body']);
error($config['error']['no_body']);
}
}
@ -743,9 +743,11 @@ if (isset($_POST['delete'])) {
if (mb_strlen($post['subject']) > 100)
error(sprintf($config['error']['toolong'], 'subject'));
if (!$mod && mb_strlen($post['body']) > $config['max_body'])
error($config['error']['toolong_body']);
error(sprintf($config['error']['toolong_body'], $config['max_body']));
if (!$mod && mb_strlen($post['body']) > 0 && (mb_strlen($post['body']) < $config['min_body']))
error($config['error']['tooshort_body']);
error(sprintf($config['error']['tooshort_body'], $config['min_body']));
if (mb_strlen($post['body']) < $config['min_body_op'] && $post['op'])
error(sprintf($config['error']['tooshort_body_op'], $config['min_body_op']));
if (mb_strlen($post['password']) > 20)
error(sprintf($config['error']['toolong'], 'password'));
}

Loading…
Cancel
Save