From 08264ec3af0a372ae25a7ccbe318e939b76c30ba Mon Sep 17 00:00:00 2001 From: PayBas Date: Thu, 10 Jul 2014 17:54:08 +0200 Subject: [ticket/12838] Allow for extra columns in cache obtain_ranks() PHPBB3-12838 --- phpBB/phpbb/cache/service.php | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) (limited to 'phpBB/phpbb/cache') diff --git a/phpBB/phpbb/cache/service.php b/phpBB/phpbb/cache/service.php index d6bf150384..a86e8c31de 100644 --- a/phpBB/phpbb/cache/service.php +++ b/phpBB/phpbb/cache/service.php @@ -166,20 +166,21 @@ class service $ranks = array(); while ($row = $this->db->sql_fetchrow($result)) { - if ($row['rank_special']) + foreach ($row as $field => $data) { - $ranks['special'][$row['rank_id']] = array( - 'rank_title' => $row['rank_title'], - 'rank_image' => $row['rank_image'] - ); - } - else - { - $ranks['normal'][] = array( - 'rank_title' => $row['rank_title'], - 'rank_min' => $row['rank_min'], - 'rank_image' => $row['rank_image'] - ); + if ($field == 'rank_special' || ($row['rank_special'] && $field == 'rank_min')) + { + continue; + } + + if ($row['rank_special']) + { + $ranks['special'][$row['rank_id']][$field] = $data; + } + else + { + $ranks['normal'][$row['rank_id']][$field] = $data; + } } } $this->db->sql_freeresult($result); -- cgit v1.2.1 From d8d09e0df2729df000ac8384c48262f8b2d333ac Mon Sep 17 00:00:00 2001 From: PayBas Date: Thu, 7 Aug 2014 14:24:21 +0200 Subject: [ticket/12838] Simplify normal special rank array creation PHPBB3-12838 --- phpBB/phpbb/cache/service.php | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) (limited to 'phpBB/phpbb/cache') diff --git a/phpBB/phpbb/cache/service.php b/phpBB/phpbb/cache/service.php index a86e8c31de..b06462fcf0 100644 --- a/phpBB/phpbb/cache/service.php +++ b/phpBB/phpbb/cache/service.php @@ -166,21 +166,14 @@ class service $ranks = array(); while ($row = $this->db->sql_fetchrow($result)) { - foreach ($row as $field => $data) + if ($row['rank_special']) { - if ($field == 'rank_special' || ($row['rank_special'] && $field == 'rank_min')) - { - continue; - } - - if ($row['rank_special']) - { - $ranks['special'][$row['rank_id']][$field] = $data; - } - else - { - $ranks['normal'][$row['rank_id']][$field] = $data; - } + unset($row['rank_min']); + $ranks['special'][$row['rank_id']] = $row; + } + else + { + $ranks['normal'][$row['rank_id']] = $row; } } $this->db->sql_freeresult($result); -- cgit v1.2.1