post.php: check different body length values for op

This commit is contained in:
Zankaria 2024-11-27 21:28:25 +01:00
parent eb480975cd
commit 531e246e28

View file

@ -1231,11 +1231,19 @@ function handle_post()
if (mb_strlen($post['subject']) > 100) {
error(sprintf($config['error']['toolong'], 'subject'));
}
if (!$mod && mb_strlen($post['body']) > $config['max_body']) {
error($config['error']['toolong_body']);
}
if (!$mod && mb_strlen($post['body']) > 0 && (mb_strlen($post['body']) < $config['min_body'])) {
error($config['error']['tooshort_body']);
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']);
if ($body_mb_len > 0 && $body_mb_len < $min_body) {
error($config['error']['tooshort_body']);
}
if ($body_mb_len > $max_body) {
error($config['error']['toolong_body']);
}
}
if (mb_strlen($post['password']) > 20) {
error(sprintf($config['error']['toolong'], 'password'));