1
0
mirror of https://github.com/vichan-devel/vichan.git synced 2024-11-24 07:30:10 +01:00

Merge pull request #572 from vichan-devel/RealAngeleno-patch-4

allow posts to be discarded for containing too many lines
This commit is contained in:
RealAngeleno 2023-05-20 15:40:20 -07:00 committed by GitHub
commit 77f4684a6b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View File

@ -495,6 +495,8 @@
// Maximum post body length. // Maximum post body length.
$config['max_body'] = 1800; $config['max_body'] = 1800;
// Maximum number of lines allowed in a post.
$config['max_lines'] = 100;
// Maximum number of post body lines to show on the index page. // Maximum number of post body lines to show on the index page.
$config['body_truncate'] = 15; $config['body_truncate'] = 15;
// Maximum number of characters to show on the index page. // Maximum number of characters to show on the index page.
@ -1127,6 +1129,7 @@
$config['error']['toolong'] = _('The %s field was too long.'); $config['error']['toolong'] = _('The %s field was too long.');
$config['error']['toolong_body'] = _('The body 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']['tooshort_body'] = _('The body was too short or empty.');
$config['error']['toomanylines'] = _('Your post contains too many lines!');
$config['error']['noimage'] = _('You must upload an image.'); $config['error']['noimage'] = _('You must upload an image.');
$config['error']['toomanyimages'] = _('You have attempted to upload too many images!'); $config['error']['toomanyimages'] = _('You have attempted to upload too many images!');
$config['error']['nomove'] = _('The server failed to handle your upload.'); $config['error']['nomove'] = _('The server failed to handle your upload.');

View File

@ -728,8 +728,10 @@ if (isset($_POST['delete'])) {
error(sprintf($config['error']['toolong'], 'email')); error(sprintf($config['error']['toolong'], 'email'));
if (mb_strlen($post['subject']) > 100) if (mb_strlen($post['subject']) > 100)
error(sprintf($config['error']['toolong'], 'subject')); error(sprintf($config['error']['toolong'], 'subject'));
if (!$mod && mb_strlen($post['body']) > $config['max_body']) if (!$mod && substr_count($post['body']) > $config['max_body'])
error($config['error']['toolong_body']); error($config['error']['toolong_body']);
if (!$mod && substr_count($post['body'], "\n") >= $config['max_lines'])
error($config['error']['toomanylines']);
if (mb_strlen($post['password']) > 20) if (mb_strlen($post['password']) > 20)
error(sprintf($config['error']['toolong'], 'password')); error(sprintf($config['error']['toolong'], 'password'));
} }