From cf7f96c0adf69e2073953ba223a9769ab8426669 Mon Sep 17 00:00:00 2001 From: vholmes Date: Wed, 15 Feb 2017 23:07:50 -0200 Subject: [PATCH 1/3] Prevents reports with too many characters --- inc/config.php | 1 + post.php | 3 +++ 2 files changed, 4 insertions(+) diff --git a/inc/config.php b/inc/config.php index 9190d233..7feb86da 100644 --- a/inc/config.php +++ b/inc/config.php @@ -1151,6 +1151,7 @@ $config['error']['nodelete'] = _('You didn\'t select anything to delete.'); $config['error']['nodeletethread'] = _('You are not allowed to delete threads.'); $config['error']['noreport'] = _('You didn\'t select anything to report.'); + $config['error']['invalidreport'] = _('The reason was too long.'); $config['error']['toomanyreports'] = _('You can\'t report that many posts at once.'); $config['error']['invalidpassword'] = _('Wrong password…'); $config['error']['invalidimg'] = _('Invalid image.'); diff --git a/post.php b/post.php index 38270c17..1388a821 100644 --- a/post.php +++ b/post.php @@ -319,6 +319,9 @@ function handle_report(){ if (empty($report)) error($config['error']['noreport']); + if (strlen($report) > 30) + error($config['error']['invalidreport']); + if (count($report) > $config['report_limit']) error($config['error']['toomanyreports']); From e2c769cb0f109120f096dea7d9f8375e751b626c Mon Sep 17 00:00:00 2001 From: discomrade Date: Mon, 12 Jul 2021 03:37:43 -0200 Subject: [PATCH 2/3] Give descriptive name to report too long error --- inc/config.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inc/config.php b/inc/config.php index 7feb86da..b5c8e1b2 100644 --- a/inc/config.php +++ b/inc/config.php @@ -1151,7 +1151,7 @@ $config['error']['nodelete'] = _('You didn\'t select anything to delete.'); $config['error']['nodeletethread'] = _('You are not allowed to delete threads.'); $config['error']['noreport'] = _('You didn\'t select anything to report.'); - $config['error']['invalidreport'] = _('The reason was too long.'); + $config['error']['toolongreport'] = _('The reason was too long.'); $config['error']['toomanyreports'] = _('You can\'t report that many posts at once.'); $config['error']['invalidpassword'] = _('Wrong password…'); $config['error']['invalidimg'] = _('Invalid image.'); From 1c0d712bc89410e8ff51289239517de0f73c40e9 Mon Sep 17 00:00:00 2001 From: discomrade Date: Mon, 12 Jul 2021 04:04:59 -0200 Subject: [PATCH 3/3] Fix https://github.com/vichan-devel/vichan/commit/387ebe9c0c211867a3037b9fb0756ea4db6c32bb , extract limit to variable --- inc/config.php | 3 +++ post.php | 4 ++-- templates/report_delete.html | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/inc/config.php b/inc/config.php index b5c8e1b2..63972d07 100644 --- a/inc/config.php +++ b/inc/config.php @@ -900,6 +900,9 @@ // Number of reports you can create at once. $config['report_limit'] = 3; + // Maximum character length of report. + $config['report_max_length'] = 50; + // Allow unfiltered HTML in board subtitle. This is useful for placing icons and links. $config['allow_subtitle_html'] = false; diff --git a/post.php b/post.php index 1388a821..5a2fa32e 100644 --- a/post.php +++ b/post.php @@ -319,8 +319,8 @@ function handle_report(){ if (empty($report)) error($config['error']['noreport']); - if (strlen($report) > 30) - error($config['error']['invalidreport']); + if (strlen($_POST['reason']) > $config['report_max_length']) + error($config['error']['reporttoolong']); if (count($report) > $config['report_limit']) error($config['error']['toomanyreports']); diff --git a/templates/report_delete.html b/templates/report_delete.html index b51534bf..453f9034 100644 --- a/templates/report_delete.html +++ b/templates/report_delete.html @@ -10,7 +10,7 @@
- +