From d04e0d2caaa3fe8a0578189fbeac4542c3ef98b7 Mon Sep 17 00:00:00 2001 From: RealAngeleno Date: Sat, 20 May 2023 14:45:26 -0700 Subject: [PATCH 1/3] Update config.php --- inc/config.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/inc/config.php b/inc/config.php index bf227b08..6aa37e0b 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. From 727e8723f03da7876887b1a01ec0012b86f2cd99 Mon Sep 17 00:00:00 2001 From: RealAngeleno Date: Sat, 20 May 2023 15:37:25 -0700 Subject: [PATCH 2/3] add too many lines --- inc/config.php | 1 + 1 file changed, 1 insertion(+) diff --git a/inc/config.php b/inc/config.php index 6aa37e0b..f3e687a3 100644 --- a/inc/config.php +++ b/inc/config.php @@ -1129,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.'); From bb59e907b18d1137aa1ea93348fab47181f9eb59 Mon Sep 17 00:00:00 2001 From: RealAngeleno Date: Sat, 20 May 2023 15:38:40 -0700 Subject: [PATCH 3/3] allow posts to be discarded for too many lines --- post.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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')); }