From f100d8fcda52e42d51849c2e92baafba4def3c7b Mon Sep 17 00:00:00 2001 From: Zankaria Date: Wed, 27 Nov 2024 22:12:51 +0100 Subject: [PATCH] post.php: follow max_body_op and min_body_op --- post.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/post.php b/post.php index d1a7c75b..ebb1d474 100644 --- a/post.php +++ b/post.php @@ -1232,15 +1232,18 @@ function handle_post() error(sprintf($config['error']['toolong'], 'subject')); } if (!$mod) { - $min_body = $post['op'] ? $config['min_body_op'] : $config['min_body']; - $max_body = $post['op'] ? $config['max_body_op'] : $config['max_body']; - $body_mb_len = mb_strlen($post['body']); + $is_op = $post['op']; - if ($body_mb_len > 0 && $body_mb_len < $min_body) { - error($config['error']['tooshort_body']); + if (($is_op && $config['force_body_op']) || (!$is_op && $config['force_body'])) { + $min_body = $is_op ? $config['min_body_op'] : $config['min_body']; + + if ($body_mb_len < $min_body) { + error($config['error']['tooshort_body']); + } } + $max_body = $is_op ? $config['max_body_op'] : $config['max_body']; if ($body_mb_len > $max_body) { error($config['error']['toolong_body']); }