aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/functions.php
diff options
context:
space:
mode:
authorMarc Alexander <admin@m-a-styles.de>2015-06-16 12:35:51 +0200
committerMarc Alexander <admin@m-a-styles.de>2015-06-16 12:35:51 +0200
commit80768b526bd3f7167703dad8be1b297bbb9cc3f7 (patch)
tree457fcc03f211840837913e004033074ee98b342b /phpBB/includes/functions.php
parentd5414592f102c1be9cd109d8250c5cced2a6c327 (diff)
parentdc9245dd7a5a13f67667df835957740b553d2313 (diff)
downloadforums-80768b526bd3f7167703dad8be1b297bbb9cc3f7.tar
forums-80768b526bd3f7167703dad8be1b297bbb9cc3f7.tar.gz
forums-80768b526bd3f7167703dad8be1b297bbb9cc3f7.tar.bz2
forums-80768b526bd3f7167703dad8be1b297bbb9cc3f7.tar.xz
forums-80768b526bd3f7167703dad8be1b297bbb9cc3f7.zip
Merge branch '3.1.x'
Conflicts: phpBB/phpbb/user_loader.php
Diffstat (limited to 'phpBB/includes/functions.php')
-rw-r--r--phpBB/includes/functions.php26
1 files changed, 24 insertions, 2 deletions
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index aeabe751aa..6a1a50952f 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -3987,10 +3987,11 @@ function phpbb_get_group_avatar($user_row, $alt = 'GROUP_AVATAR', $ignore_config
* @param array $row Row cleaned by \phpbb\avatar\manager::clean_row
* @param string $alt Optional language string for alt tag within image, can be a language key or text
* @param bool $ignore_config Ignores the config-setting, to be still able to view the avatar in the UCP
+* @param bool $lazy If true, will be lazy loaded (requires JS)
*
* @return string Avatar html
*/
-function phpbb_get_avatar($row, $alt, $ignore_config = false)
+function phpbb_get_avatar($row, $alt, $ignore_config = false, $lazy = false)
{
global $user, $config, $cache, $phpbb_root_path, $phpEx;
global $request;
@@ -4029,7 +4030,28 @@ function phpbb_get_avatar($row, $alt, $ignore_config = false)
if (!empty($avatar_data['src']))
{
- $html = '<img src="' . $avatar_data['src'] . '" ' .
+ if ($lazy)
+ {
+ // Determine board url - we may need it later
+ $board_url = generate_board_url() . '/';
+ // This path is sent with the base template paths in the assign_vars()
+ // call below. We need to correct it in case we are accessing from a
+ // controller because the web paths will be incorrect otherwise.
+ $phpbb_path_helper = $phpbb_container->get('path_helper');
+ $corrected_path = $phpbb_path_helper->get_web_root_path();
+
+ $web_path = (defined('PHPBB_USE_BOARD_URL_PATH') && PHPBB_USE_BOARD_URL_PATH) ? $board_url : $corrected_path;
+
+ $theme = "{$web_path}styles/" . rawurlencode($user->style['style_path']) . '/theme';
+
+ $src = 'src="' . $theme . '/images/no_avatar.gif" data-src="' . $avatar_data['src'] . '"';
+ }
+ else
+ {
+ $src = 'src="' . $avatar_data['src'] . '"';
+ }
+
+ $html = '<img class="avatar" ' . $src .
($avatar_data['width'] ? ('width="' . $avatar_data['width'] . '" ') : '') .
($avatar_data['height'] ? ('height="' . $avatar_data['height'] . '" ') : '') .
'alt="' . ((!empty($user->lang[$alt])) ? $user->lang[$alt] : $alt) . '" />';