From 63fb6bea2799dd03fda330f08c79a8c30caa165b Mon Sep 17 00:00:00 2001 From: discomrade <83621080+discomrade@users.noreply.github.com> Date: Thu, 12 Jan 2023 06:57:49 -0100 Subject: [PATCH] Add default value for flood_cache The original code left flood_cache undefined, leading to errors in newer versions of PHP. See https://github.com/vichan-devel/vichan/issues/525 --- inc/config.php | 2 ++ inc/filters.php | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/inc/config.php b/inc/config.php index 8c4e21a4..6a20ee68 100644 --- a/inc/config.php +++ b/inc/config.php @@ -488,7 +488,9 @@ // outside the current board. This means that if you have a special flood condition for a specific board // (contained in a board configuration file) which has a flood-time greater than any of those in the // global configuration, you need to set the following variable to the maximum flood-time condition value. + // Set to -1 to disable. // $config['flood_cache'] = 60 * 60 * 24; // 24 hours + $config['flood_cache'] = -1; /* * ==================== diff --git a/inc/filters.php b/inc/filters.php index b4781958..76c0d268 100644 --- a/inc/filters.php +++ b/inc/filters.php @@ -192,7 +192,7 @@ function purge_flood_table() { // aware of flood filters in other board configurations. You can solve this problem by settings the // config variable $config['flood_cache'] (seconds). - if (isset($config['flood_cache'])) { + if ($config['flood_cache'] != -1) { $max_time = &$config['flood_cache']; } else { $max_time = 0;