diff --git a/inc/config.php b/inc/config.php index bf227b08..f3e687a3 100644 --- a/inc/config.php +++ b/inc/config.php @@ -495,6 +495,8 @@ // Maximum post body length. $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. $config['body_truncate'] = 15; // 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_body'] = _('The body was too long.'); $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']['toomanyimages'] = _('You have attempted to upload too many images!'); $config['error']['nomove'] = _('The server failed to handle your upload.'); diff --git a/post.php b/post.php index 01a4d80c..f14d55b7 100644 --- a/post.php +++ b/post.php @@ -728,8 +728,10 @@ if (isset($_POST['delete'])) { error(sprintf($config['error']['toolong'], 'email')); if (mb_strlen($post['subject']) > 100) 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']); + if (!$mod && substr_count($post['body'], "\n") >= $config['max_lines']) + error($config['error']['toomanylines']); if (mb_strlen($post['password']) > 20) error(sprintf($config['error']['toolong'], 'password')); }