aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Alexander <admin@m-a-styles.de>2013-02-19 12:45:08 +0100
committerMarc Alexander <admin@m-a-styles.de>2013-02-19 12:45:08 +0100
commit3cc4746ad3220910b6cbb17772ba594ae26e7c32 (patch)
tree6946cb4464f47762b684ac25c35fdd9bed7b1bcf
parenta9e0aea4b1587ac5ff6c94d2dc7e4d05c304423d (diff)
downloadforums-3cc4746ad3220910b6cbb17772ba594ae26e7c32.tar
forums-3cc4746ad3220910b6cbb17772ba594ae26e7c32.tar.gz
forums-3cc4746ad3220910b6cbb17772ba594ae26e7c32.tar.bz2
forums-3cc4746ad3220910b6cbb17772ba594ae26e7c32.tar.xz
forums-3cc4746ad3220910b6cbb17772ba594ae26e7c32.zip
[feature/avatars] Use "Main" as category for avatars in root of gallery
Before this change the whole avatar gallery path would show as category. Additionally, the avatars that were selected like that had an incorrect path and didn't show up correctly. With this patch it'll display "Main" as category and properly work. PHPBBB3-10018
-rw-r--r--phpBB/includes/avatar/driver/local.php14
-rw-r--r--phpBB/language/en/common.php1
2 files changed, 9 insertions, 6 deletions
diff --git a/phpBB/includes/avatar/driver/local.php b/phpBB/includes/avatar/driver/local.php
index 7237c745d6..f4bcd4ce74 100644
--- a/phpBB/includes/avatar/driver/local.php
+++ b/phpBB/includes/avatar/driver/local.php
@@ -38,7 +38,7 @@ class phpbb_avatar_driver_local extends phpbb_avatar_driver
*/
public function prepare_form($request, $template, $user, $row, &$error)
{
- $avatar_list = $this->get_avatar_list();
+ $avatar_list = $this->get_avatar_list($user);
$category = $request->variable('avatar_local_cat', '');
foreach ($avatar_list as $cat => $null)
@@ -116,7 +116,7 @@ class phpbb_avatar_driver_local extends phpbb_avatar_driver
*/
public function process_form($request, $template, $user, $row, &$error)
{
- $avatar_list = $this->get_avatar_list();
+ $avatar_list = $this->get_avatar_list($user);
$category = $request->variable('avatar_local_cat', '');
$file = $request->variable('avatar_local_file', '');
@@ -134,7 +134,7 @@ class phpbb_avatar_driver_local extends phpbb_avatar_driver
}
return array(
- 'avatar' => $category . '/' . $file,
+ 'avatar' => ($category != $user->lang['MAIN']) ? $category . '/' . $file : $file,
'avatar_width' => $avatar_list[$category][urldecode($file)]['width'],
'avatar_height' => $avatar_list[$category][urldecode($file)]['height'],
);
@@ -144,9 +144,11 @@ class phpbb_avatar_driver_local extends phpbb_avatar_driver
* Get a list of avatars that are locally available
* Results get cached for 24 hours (86400 seconds)
*
+ * @param phpbb_user $user User object
+ *
* @return array Array containing the locally available avatars
*/
- protected function get_avatar_list()
+ protected function get_avatar_list($user)
{
$avatar_list = ($this->cache == null) ? false : $this->cache->get('avatar_local_list');
@@ -172,9 +174,9 @@ class phpbb_avatar_driver_local extends phpbb_avatar_driver
{
$dims = array(0, 0);
}
- $cat = str_replace("$path/", '', $file_path);
+ $cat = ($path == $file_path) ? $user->lang['MAIN'] : str_replace("$path/", '', $file_path);
$avatar_list[$cat][$image] = array(
- 'file' => rawurlencode($cat) . '/' . rawurlencode($image),
+ 'file' => ($cat != $user->lang['MAIN']) ? rawurlencode($cat) . '/' . rawurlencode($image) : rawurlencode($image),
'filename' => rawurlencode($image),
'name' => ucfirst(str_replace('_', ' ', preg_replace('#^(.*)\..*$#', '\1', $image))),
'width' => $dims[0],
diff --git a/phpBB/language/en/common.php b/phpBB/language/en/common.php
index 6c723a5060..7758d0af16 100644
--- a/phpBB/language/en/common.php
+++ b/phpBB/language/en/common.php
@@ -358,6 +358,7 @@ $lang = array_merge($lang, array(
'LOGOUT_USER' => 'Logout [ %s ]',
'LOG_ME_IN' => 'Remember me',
+ 'MAIN' => 'Main',
'MARK' => 'Mark',
'MARK_ALL' => 'Mark all',
'MARK_FORUMS_READ' => 'Mark forums read',