From 47f2caff6b3f05f6703e359bf4712bd69d23c04c Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sun, 10 Nov 2013 22:19:06 +0100 Subject: [PATCH 1/2] [ticket/11525] Fix doc blocks PHPBB3-11525 --- phpBB/phpbb/avatar/manager.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/phpBB/phpbb/avatar/manager.php b/phpBB/phpbb/avatar/manager.php index f2bb1a5dbe..90cd83898f 100644 --- a/phpBB/phpbb/avatar/manager.php +++ b/phpBB/phpbb/avatar/manager.php @@ -180,8 +180,8 @@ class manager /** * Strip out user_, group_, or other prefixes from array keys * - * @param array $row User data or group data - * @param string $prefix Prefix of data keys + * @param array $row User data or group data + * @param string $prefix Prefix of data keys (e.g. user), should not include the trailing underscore * * @return array User data or group data with keys that have been * stripped from the preceding "user_" or "group_" @@ -205,8 +205,11 @@ class manager /** * Strip prepending user_ or group_ prefix from key * - * @param string Array key - * @return void + * @param string $key Array key + * @param string $null Parameter is ignored by the function, just required by the array_walk + * @param string $prefix Prefix that should be stripped off from the keys (e.g. user) + * Should not include the trailing underscore + * @return null */ static protected function strip_prefix(&$key, $null, $prefix) { From aa84f7de04b0efdf871d75694aee60e5ecf37f56 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sun, 10 Nov 2013 23:07:07 +0100 Subject: [PATCH 2/2] [ticket/11525] Prefix id parameter with 'g' again when its a group avatar PHPBB3-11525 --- phpBB/phpbb/avatar/manager.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/phpBB/phpbb/avatar/manager.php b/phpBB/phpbb/avatar/manager.php index 90cd83898f..9f6a5fb089 100644 --- a/phpBB/phpbb/avatar/manager.php +++ b/phpBB/phpbb/avatar/manager.php @@ -183,8 +183,9 @@ class manager * @param array $row User data or group data * @param string $prefix Prefix of data keys (e.g. user), should not include the trailing underscore * - * @return array User data or group data with keys that have been - * stripped from the preceding "user_" or "group_" + * @return array User or group data with keys that have been + * stripped from the preceding "user_" or "group_" + * Also the group id is prefixed with g, when the prefix group is removed. */ static public function clean_row($row, $prefix = '') { @@ -198,8 +199,14 @@ class manager $values = array_values($row); array_walk($keys, array('\phpbb\avatar\manager', 'strip_prefix'), $prefix); + $row = array_combine($keys, $values); - return array_combine($keys, $values); + if ($prefix == 'group') + { + $row['id'] = 'g' . $row['id']; + } + + return $row; } /**