post.php: follow max_body_op and min_body_op

This commit is contained in:
Zankaria 2024-11-27 22:12:51 +01:00
parent 4c1ac32bda
commit f100d8fcda

View file

@ -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) {
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']);
}