From b9761f116dd6a656f764883267dea0ef293fc18c Mon Sep 17 00:00:00 2001 From: Crizzo Date: Mon, 12 Sep 2016 21:17:58 +0200 Subject: [PATCH 1/3] [ticket/14780] Correct if sentence to let group setting overwrite global PHPBB3-14780 --- phpBB/includes/functions_privmsgs.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/functions_privmsgs.php b/phpBB/includes/functions_privmsgs.php index 69c3dad9e6..a614bd0cca 100644 --- a/phpBB/includes/functions_privmsgs.php +++ b/phpBB/includes/functions_privmsgs.php @@ -2162,7 +2162,7 @@ function phpbb_get_max_setting_from_group(\phpbb\db\driver\driver_interface $db, $max_setting = (int) $row['max_setting']; $min_setting = (int) $row['min_setting']; - return ($min_setting > 0) ? $max_setting : 0; + return ($min_setting > 0) ? $min_setting : $max_setting; } /** From 53ead1e926de81c9437767c067d01f6e6ebe68b0 Mon Sep 17 00:00:00 2001 From: Crizzo Date: Thu, 15 Sep 2016 21:58:21 +0200 Subject: [PATCH 2/3] [ticket/14780] Fixes array with exspected results in test-function PHPBB3-14780 --- tests/functions_privmsgs/get_max_setting_from_group_test.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/functions_privmsgs/get_max_setting_from_group_test.php b/tests/functions_privmsgs/get_max_setting_from_group_test.php index 3eb7866802..fbabf1222a 100644 --- a/tests/functions_privmsgs/get_max_setting_from_group_test.php +++ b/tests/functions_privmsgs/get_max_setting_from_group_test.php @@ -33,12 +33,12 @@ class phpbb_functions_privmsgs_get_max_setting_from_group_test extends phpbb_dat static public function get_max_setting_from_group_data() { return array( - array(1, 0, 'message_limit'), + array(1, 2, 'message_limit'), array(2, 2, 'message_limit'), array(3, 0, 'message_limit'), array(4, 0, 'message_limit'), array(5, 2, 'message_limit'), - array(1, 0, 'max_recipients'), + array(1, 4, 'max_recipients'), array(2, 4, 'max_recipients'), array(3, 0, 'max_recipients'), array(4, 5, 'max_recipients'), From 29b1b95226574bc2b47723d9445ad2ac7a437e99 Mon Sep 17 00:00:00 2001 From: Crizzo Date: Thu, 15 Sep 2016 22:44:34 +0200 Subject: [PATCH 3/3] [ticket/14780] Only use $max_setting in this function PHPBB3-14780 --- phpBB/includes/functions_privmsgs.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/phpBB/includes/functions_privmsgs.php b/phpBB/includes/functions_privmsgs.php index a614bd0cca..412e911bc0 100644 --- a/phpBB/includes/functions_privmsgs.php +++ b/phpBB/includes/functions_privmsgs.php @@ -2151,7 +2151,7 @@ function phpbb_get_max_setting_from_group(\phpbb\db\driver\driver_interface $db, } // Get maximum number of allowed recipients - $sql = 'SELECT MIN(g.group_' . $setting . ') as min_setting, MAX(g.group_' . $setting . ') as max_setting + $sql = 'SELECT MAX(g.group_' . $setting . ') as max_setting FROM ' . GROUPS_TABLE . ' g, ' . USER_GROUP_TABLE . ' ug WHERE ug.user_id = ' . (int) $user_id . ' AND ug.user_pending = 0 @@ -2160,9 +2160,8 @@ function phpbb_get_max_setting_from_group(\phpbb\db\driver\driver_interface $db, $row = $db->sql_fetchrow($result); $db->sql_freeresult($result); $max_setting = (int) $row['max_setting']; - $min_setting = (int) $row['min_setting']; - return ($min_setting > 0) ? $min_setting : $max_setting; + return $max_setting; } /**