From ddbdde53abfb01d3dee3ff2256610fcdac12ce3e Mon Sep 17 00:00:00 2001 From: Crizzo Date: Sat, 15 Mar 2014 14:57:12 +0100 Subject: [PATCH 01/12] [ticket/9758] Adds global template variable CURRENT_USER_AVATAR PHPBB3-9758 --- phpBB/includes/functions.php | 87 +++++++++++++++++++ phpBB/includes/functions_compatibility.php | 2 +- phpBB/includes/functions_display.php | 86 ------------------ phpBB/includes/mcp/mcp_notes.php | 2 +- phpBB/includes/mcp/mcp_warn.php | 4 +- phpBB/includes/ucp/ucp_pm_viewmessage.php | 2 +- phpBB/includes/ucp/ucp_profile.php | 2 +- phpBB/memberlist.php | 7 +- .../prosilver/template/overall_header.html | 2 +- phpBB/styles/prosilver/theme/common.css | 7 ++ phpBB/viewtopic.php | 4 + 11 files changed, 111 insertions(+), 94 deletions(-) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 4d962db308..c6ae3828f5 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -4619,6 +4619,92 @@ function phpbb_build_hidden_fields_for_query_params($request, $exclude = null) return $hidden; } +/** +* Get user avatar +* +* @param array $user_row Row from the users table +* @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 +* +* @return string Avatar html +*/ +function phpbb_get_user_avatar($user_row, $alt = 'USER_AVATAR', $ignore_config = false) +{ + $row = \phpbb\avatar\manager::clean_row($user_row, 'user'); + return phpbb_get_avatar($row, $alt, $ignore_config); +} + +/** +* Get group avatar +* +* @param array $group_row Row from the groups table +* @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 +* +* @return string Avatar html +*/ +function phpbb_get_group_avatar($user_row, $alt = 'GROUP_AVATAR', $ignore_config = false) +{ + $row = \phpbb\avatar\manager::clean_row($user_row, 'group'); + return phpbb_get_avatar($row, $alt, $ignore_config); +} + +/** +* Get avatar +* +* @param array $row Row cleaned by \phpbb\avatar\driver\driver::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 +* +* @return string Avatar html +*/ +function phpbb_get_avatar($row, $alt, $ignore_config = false) +{ + global $user, $config, $cache, $phpbb_root_path, $phpEx; + global $request; + global $phpbb_container; + + if (!$config['allow_avatar'] && !$ignore_config) + { + return ''; + } + + $avatar_data = array( + 'src' => $row['avatar'], + 'width' => $row['avatar_width'], + 'height' => $row['avatar_height'], + ); + + $phpbb_avatar_manager = $phpbb_container->get('avatar.manager'); + $driver = $phpbb_avatar_manager->get_driver($row['avatar_type'], $ignore_config); + $html = ''; + + if ($driver) + { + $html = $driver->get_custom_html($user, $row, $alt); + if (!empty($html)) + { + return $html; + } + + $avatar_data = $driver->get_data($row, $ignore_config); + } + else + { + $avatar_data['src'] = ''; + } + + if (!empty($avatar_data['src'])) + { + $html = ''; + } + + return $html; +} + /** * Generate page header */ @@ -4830,6 +4916,7 @@ function page_header($page_title = '', $display_online_list = false, $item_id = // The following assigns all _common_ variables that may be used at any point in a template. $template->assign_vars(array( + 'CURRENT_USER_AVATAR' => phpbb_get_user_avatar($user->data), 'SITENAME' => $config['sitename'], 'SITE_DESCRIPTION' => $config['site_desc'], 'PAGE_TITLE' => $page_title, diff --git a/phpBB/includes/functions_compatibility.php b/phpBB/includes/functions_compatibility.php index 024c656267..e1539a5493 100644 --- a/phpBB/includes/functions_compatibility.php +++ b/phpBB/includes/functions_compatibility.php @@ -43,7 +43,7 @@ function get_user_avatar($avatar, $avatar_type, $avatar_width, $avatar_height, $ { global $phpbb_root_path, $phpEx; - include($phpbb_root_path . 'includes/functions_display.' . $phpEx); + include($phpbb_root_path . 'includes/functions.' . $phpEx); } return phpbb_get_avatar($row, $alt, $ignore_config); diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index cd2c9e5ae6..2b11d00f1e 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -1376,92 +1376,6 @@ function get_user_rank($user_rank, $user_posts, &$rank_title, &$rank_img, &$rank } } -/** -* Get user avatar -* -* @param array $user_row Row from the users table -* @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 -* -* @return string Avatar html -*/ -function phpbb_get_user_avatar($user_row, $alt = 'USER_AVATAR', $ignore_config = false) -{ - $row = \phpbb\avatar\manager::clean_row($user_row, 'user'); - return phpbb_get_avatar($row, $alt, $ignore_config); -} - -/** -* Get group avatar -* -* @param array $group_row Row from the groups table -* @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 -* -* @return string Avatar html -*/ -function phpbb_get_group_avatar($user_row, $alt = 'GROUP_AVATAR', $ignore_config = false) -{ - $row = \phpbb\avatar\manager::clean_row($user_row, 'group'); - return phpbb_get_avatar($row, $alt, $ignore_config); -} - -/** -* Get avatar -* -* @param array $row Row cleaned by \phpbb\avatar\driver\driver::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 -* -* @return string Avatar html -*/ -function phpbb_get_avatar($row, $alt, $ignore_config = false) -{ - global $user, $config, $cache, $phpbb_root_path, $phpEx; - global $request; - global $phpbb_container; - - if (!$config['allow_avatar'] && !$ignore_config) - { - return ''; - } - - $avatar_data = array( - 'src' => $row['avatar'], - 'width' => $row['avatar_width'], - 'height' => $row['avatar_height'], - ); - - $phpbb_avatar_manager = $phpbb_container->get('avatar.manager'); - $driver = $phpbb_avatar_manager->get_driver($row['avatar_type'], $ignore_config); - $html = ''; - - if ($driver) - { - $html = $driver->get_custom_html($user, $row, $alt); - if (!empty($html)) - { - return $html; - } - - $avatar_data = $driver->get_data($row, $ignore_config); - } - else - { - $avatar_data['src'] = ''; - } - - if (!empty($avatar_data['src'])) - { - $html = ''; - } - - return $html; -} - /** * Generate a list of archive types available for compressing attachments * diff --git a/phpBB/includes/mcp/mcp_notes.php b/phpBB/includes/mcp/mcp_notes.php index 28de8724be..9d32467f0f 100644 --- a/phpBB/includes/mcp/mcp_notes.php +++ b/phpBB/includes/mcp/mcp_notes.php @@ -176,7 +176,7 @@ class mcp_notes // Generate the appropriate user information for the user we are looking at if (!function_exists('phpbb_get_user_avatar')) { - include($phpbb_root_path . 'includes/functions_display.' . $phpEx); + include($phpbb_root_path . 'includes/functions.' . $phpEx); } $rank_title = $rank_img = ''; diff --git a/phpBB/includes/mcp/mcp_warn.php b/phpBB/includes/mcp/mcp_warn.php index d396d004dc..1d6c71e4c6 100644 --- a/phpBB/includes/mcp/mcp_warn.php +++ b/phpBB/includes/mcp/mcp_warn.php @@ -295,7 +295,7 @@ class mcp_warn // Generate the appropriate user information for the user we are looking at if (!function_exists('phpbb_get_user_avatar')) { - include($phpbb_root_path . 'includes/functions_display.' . $phpEx); + include($phpbb_root_path . 'includes/functions.' . $phpEx); } get_user_rank($user_row['user_rank'], $user_row['user_posts'], $rank_title, $rank_img, $rank_img_src); @@ -400,7 +400,7 @@ class mcp_warn // Generate the appropriate user information for the user we are looking at if (!function_exists('phpbb_get_user_avatar')) { - include($phpbb_root_path . 'includes/functions_display.' . $phpEx); + include($phpbb_root_path . 'includes/functions.' . $phpEx); } get_user_rank($user_row['user_rank'], $user_row['user_posts'], $rank_title, $rank_img, $rank_img_src); diff --git a/phpBB/includes/ucp/ucp_pm_viewmessage.php b/phpBB/includes/ucp/ucp_pm_viewmessage.php index b68389cba7..0249eee6af 100644 --- a/phpBB/includes/ucp/ucp_pm_viewmessage.php +++ b/phpBB/includes/ucp/ucp_pm_viewmessage.php @@ -340,7 +340,7 @@ function get_user_information($user_id, $user_row) if (!function_exists('phpbb_get_user_avatar')) { - include($phpbb_root_path . 'includes/functions_display.' . $phpEx); + include($phpbb_root_path . 'includes/functions.' . $phpEx); } $user_row['avatar'] = ($user->optionget('viewavatars')) ? phpbb_get_user_avatar($user_row) : ''; diff --git a/phpBB/includes/ucp/ucp_profile.php b/phpBB/includes/ucp/ucp_profile.php index 3772d56e28..a9dec4e2da 100644 --- a/phpBB/includes/ucp/ucp_profile.php +++ b/phpBB/includes/ucp/ucp_profile.php @@ -517,7 +517,7 @@ class ucp_profile case 'avatar': if (!function_exists('phpbb_get_user_avatar')) { - include($phpbb_root_path . 'includes/functions_display.' . $phpEx); + include($phpbb_root_path . 'includes/functions.' . $phpEx); } add_form_key('ucp_avatar'); diff --git a/phpBB/memberlist.php b/phpBB/memberlist.php index ba4a4372a5..905509a7f4 100644 --- a/phpBB/memberlist.php +++ b/phpBB/memberlist.php @@ -547,7 +547,12 @@ switch ($mode) $parse_flags = ($member['user_sig_bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES; $member['user_sig'] = generate_text_for_display($member['user_sig'], $member['user_sig_bbcode_uid'], $member['user_sig_bbcode_bitfield'], $parse_flags, true); } - + + if (!function_exists('phpbb_get_user_avatar')) + { + include($phpbb_root_path . 'includes/functions.' . $phpEx); + } + $poster_avatar = phpbb_get_user_avatar($member); // We need to check if the modules 'zebra' ('friends' & 'foes' mode), 'notes' ('user_notes' mode) and 'warn' ('warn_user' mode) are accessible to decide if we can display appropriate links diff --git a/phpBB/styles/prosilver/template/overall_header.html b/phpBB/styles/prosilver/template/overall_header.html index df02963e3c..59bf72b2e1 100644 --- a/phpBB/styles/prosilver/template/overall_header.html +++ b/phpBB/styles/prosilver/template/overall_header.html @@ -163,7 +163,7 @@ -
  • {L_LOGIN_LOGOUT}
  • +
  • {L_LOGIN_LOGOUT} {CURRENT_USER_AVATAR}
  • {L_REGISTER}
  • {L_MEMBERLIST}
  • diff --git a/phpBB/styles/prosilver/theme/common.css b/phpBB/styles/prosilver/theme/common.css index 50683c6808..f4a1ecb1e0 100644 --- a/phpBB/styles/prosilver/theme/common.css +++ b/phpBB/styles/prosilver/theme/common.css @@ -444,6 +444,13 @@ ul.linklist.bulletin li.no-bulletin:before { display: none !important; } +/* Avatar in overall_header.html */ +span.avatar-index img { + max-height: 25px; + vertical-align: top; + width: auto; +} + /* Dropdown menu ----------------------------------------*/ .dropdown-container { diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 61a28940b1..fe0b3dc384 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -16,6 +16,10 @@ $phpEx = substr(strrchr(__FILE__, '.'), 1); include($phpbb_root_path . 'common.' . $phpEx); include($phpbb_root_path . 'includes/functions_display.' . $phpEx); include($phpbb_root_path . 'includes/bbcode.' . $phpEx); +if (!function_exists('phpbb_get_user_avatar')) +{ + include($phpbb_root_path . 'includes/functions.' . $phpEx); +} // Start session management $user->session_begin(); From e149c266ce10177a45337392f63bdcc11e1af3b6 Mon Sep 17 00:00:00 2001 From: Crizzo Date: Sat, 15 Mar 2014 15:04:54 +0100 Subject: [PATCH 02/12] [ticket/9758] Changes class name of new "span" in overall_header.html PHPBB3-9758 --- phpBB/styles/prosilver/template/overall_header.html | 2 +- phpBB/styles/prosilver/theme/common.css | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/styles/prosilver/template/overall_header.html b/phpBB/styles/prosilver/template/overall_header.html index 59bf72b2e1..16ec9f6aea 100644 --- a/phpBB/styles/prosilver/template/overall_header.html +++ b/phpBB/styles/prosilver/template/overall_header.html @@ -163,7 +163,7 @@ -
  • {L_LOGIN_LOGOUT} {CURRENT_USER_AVATAR}
  • +
  • {L_LOGIN_LOGOUT} {CURRENT_USER_AVATAR}
  • {L_REGISTER}
  • {L_MEMBERLIST}
  • diff --git a/phpBB/styles/prosilver/theme/common.css b/phpBB/styles/prosilver/theme/common.css index f4a1ecb1e0..6665e605f3 100644 --- a/phpBB/styles/prosilver/theme/common.css +++ b/phpBB/styles/prosilver/theme/common.css @@ -445,7 +445,7 @@ ul.linklist.bulletin li.no-bulletin:before { } /* Avatar in overall_header.html */ -span.avatar-index img { +span.avatar-overall-header img { max-height: 25px; vertical-align: top; width: auto; From 0d4968f7356cc177a4a0921eef2853c343798110 Mon Sep 17 00:00:00 2001 From: Crizzo Date: Sat, 15 Mar 2014 15:18:04 +0100 Subject: [PATCH 03/12] [ticket/9758] Removed useless if-conditions to include functions.php PHPBB3-9758 --- phpBB/includes/functions_compatibility.php | 7 ------- phpBB/includes/mcp/mcp_notes.php | 4 ---- phpBB/includes/mcp/mcp_warn.php | 4 ---- phpBB/includes/ucp/ucp_pm_viewmessage.php | 5 ----- phpBB/includes/ucp/ucp_profile.php | 4 ---- phpBB/memberlist.php | 7 +------ phpBB/viewtopic.php | 4 ---- 7 files changed, 1 insertion(+), 34 deletions(-) diff --git a/phpBB/includes/functions_compatibility.php b/phpBB/includes/functions_compatibility.php index e1539a5493..164dd4cb99 100644 --- a/phpBB/includes/functions_compatibility.php +++ b/phpBB/includes/functions_compatibility.php @@ -39,13 +39,6 @@ function get_user_avatar($avatar, $avatar_type, $avatar_width, $avatar_height, $ 'avatar_height' => $avatar_height, ); - if (!function_exists('phpbb_get_avatar')) - { - global $phpbb_root_path, $phpEx; - - include($phpbb_root_path . 'includes/functions.' . $phpEx); - } - return phpbb_get_avatar($row, $alt, $ignore_config); } diff --git a/phpBB/includes/mcp/mcp_notes.php b/phpBB/includes/mcp/mcp_notes.php index 9d32467f0f..be8e09b0c3 100644 --- a/phpBB/includes/mcp/mcp_notes.php +++ b/phpBB/includes/mcp/mcp_notes.php @@ -174,10 +174,6 @@ class mcp_notes } // Generate the appropriate user information for the user we are looking at - if (!function_exists('phpbb_get_user_avatar')) - { - include($phpbb_root_path . 'includes/functions.' . $phpEx); - } $rank_title = $rank_img = ''; $avatar_img = phpbb_get_user_avatar($userrow); diff --git a/phpBB/includes/mcp/mcp_warn.php b/phpBB/includes/mcp/mcp_warn.php index 1d6c71e4c6..418bab4533 100644 --- a/phpBB/includes/mcp/mcp_warn.php +++ b/phpBB/includes/mcp/mcp_warn.php @@ -398,10 +398,6 @@ class mcp_warn } // Generate the appropriate user information for the user we are looking at - if (!function_exists('phpbb_get_user_avatar')) - { - include($phpbb_root_path . 'includes/functions.' . $phpEx); - } get_user_rank($user_row['user_rank'], $user_row['user_posts'], $rank_title, $rank_img, $rank_img_src); $avatar_img = phpbb_get_user_avatar($user_row); diff --git a/phpBB/includes/ucp/ucp_pm_viewmessage.php b/phpBB/includes/ucp/ucp_pm_viewmessage.php index 0249eee6af..715d99f168 100644 --- a/phpBB/includes/ucp/ucp_pm_viewmessage.php +++ b/phpBB/includes/ucp/ucp_pm_viewmessage.php @@ -338,11 +338,6 @@ function get_user_information($user_id, $user_row) } } - if (!function_exists('phpbb_get_user_avatar')) - { - include($phpbb_root_path . 'includes/functions.' . $phpEx); - } - $user_row['avatar'] = ($user->optionget('viewavatars')) ? phpbb_get_user_avatar($user_row) : ''; get_user_rank($user_row['user_rank'], $user_row['user_posts'], $user_row['rank_title'], $user_row['rank_image'], $user_row['rank_image_src']); diff --git a/phpBB/includes/ucp/ucp_profile.php b/phpBB/includes/ucp/ucp_profile.php index a9dec4e2da..76f8988fb9 100644 --- a/phpBB/includes/ucp/ucp_profile.php +++ b/phpBB/includes/ucp/ucp_profile.php @@ -515,10 +515,6 @@ class ucp_profile break; case 'avatar': - if (!function_exists('phpbb_get_user_avatar')) - { - include($phpbb_root_path . 'includes/functions.' . $phpEx); - } add_form_key('ucp_avatar'); diff --git a/phpBB/memberlist.php b/phpBB/memberlist.php index 905509a7f4..ba4a4372a5 100644 --- a/phpBB/memberlist.php +++ b/phpBB/memberlist.php @@ -547,12 +547,7 @@ switch ($mode) $parse_flags = ($member['user_sig_bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES; $member['user_sig'] = generate_text_for_display($member['user_sig'], $member['user_sig_bbcode_uid'], $member['user_sig_bbcode_bitfield'], $parse_flags, true); } - - if (!function_exists('phpbb_get_user_avatar')) - { - include($phpbb_root_path . 'includes/functions.' . $phpEx); - } - + $poster_avatar = phpbb_get_user_avatar($member); // We need to check if the modules 'zebra' ('friends' & 'foes' mode), 'notes' ('user_notes' mode) and 'warn' ('warn_user' mode) are accessible to decide if we can display appropriate links diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index fe0b3dc384..61a28940b1 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -16,10 +16,6 @@ $phpEx = substr(strrchr(__FILE__, '.'), 1); include($phpbb_root_path . 'common.' . $phpEx); include($phpbb_root_path . 'includes/functions_display.' . $phpEx); include($phpbb_root_path . 'includes/bbcode.' . $phpEx); -if (!function_exists('phpbb_get_user_avatar')) -{ - include($phpbb_root_path . 'includes/functions.' . $phpEx); -} // Start session management $user->session_begin(); From 9d568986ade8ae24bad3c57475b9420d743ecbb6 Mon Sep 17 00:00:00 2001 From: Crizzo Date: Sat, 15 Mar 2014 15:37:55 +0100 Subject: [PATCH 04/12] [ticket/9758] Error because of missing functions_display.php fixed PHPBB3-9758 --- phpBB/includes/mcp/mcp_warn.php | 5 +++-- phpBB/includes/ucp/ucp_pm_viewmessage.php | 5 +++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/mcp/mcp_warn.php b/phpBB/includes/mcp/mcp_warn.php index 418bab4533..0b6a49d9c7 100644 --- a/phpBB/includes/mcp/mcp_warn.php +++ b/phpBB/includes/mcp/mcp_warn.php @@ -293,9 +293,10 @@ class mcp_warn $message = generate_text_for_display($user_row['post_text'], $user_row['bbcode_uid'], $user_row['bbcode_bitfield'], $parse_flags, true); // Generate the appropriate user information for the user we are looking at - if (!function_exists('phpbb_get_user_avatar')) + + if (!function_exists('get_user_rank')) { - include($phpbb_root_path . 'includes/functions.' . $phpEx); + include($phpbb_root_path . 'includes/functions_display.' . $phpEx); } get_user_rank($user_row['user_rank'], $user_row['user_posts'], $rank_title, $rank_img, $rank_img_src); diff --git a/phpBB/includes/ucp/ucp_pm_viewmessage.php b/phpBB/includes/ucp/ucp_pm_viewmessage.php index 715d99f168..80974e752e 100644 --- a/phpBB/includes/ucp/ucp_pm_viewmessage.php +++ b/phpBB/includes/ucp/ucp_pm_viewmessage.php @@ -266,6 +266,11 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row) } } + if (!function_exists('phpbb_gen_download_links')) + { + include($phpbb_root_path . 'includes/functions_display.' . $phpEx); + } + // Display not already displayed Attachments for this post, we already parsed them. ;) if (isset($attachments) && sizeof($attachments)) { From ce1b4da59ec3e1c562ad50dac33c167068ac2093 Mon Sep 17 00:00:00 2001 From: Crizzo Date: Sat, 15 Mar 2014 15:56:04 +0100 Subject: [PATCH 05/12] [ticket/9758] Optimises the html code of avatar image in header PHPBB3-9758 --- phpBB/styles/prosilver/template/overall_header.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/styles/prosilver/template/overall_header.html b/phpBB/styles/prosilver/template/overall_header.html index 16ec9f6aea..84449efc14 100644 --- a/phpBB/styles/prosilver/template/overall_header.html +++ b/phpBB/styles/prosilver/template/overall_header.html @@ -163,7 +163,7 @@ -
  • {L_LOGIN_LOGOUT} {CURRENT_USER_AVATAR}
  • +
  • {L_LOGIN_LOGOUT} {CURRENT_USER_AVATAR}
  • {L_REGISTER}
  • {L_MEMBERLIST}
  • From aa6077c1508553c2ba14a4f220215984ede63ae1 Mon Sep 17 00:00:00 2001 From: Crizzo Date: Sat, 15 Mar 2014 16:01:40 +0100 Subject: [PATCH 06/12] [ticket/9758] Fixed bug in mcp_warn.php PHPBB3-9758 --- phpBB/includes/mcp/mcp_warn.php | 6 ++++-- phpBB/includes/ucp/ucp_pm_viewmessage.php | 5 +++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/mcp/mcp_warn.php b/phpBB/includes/mcp/mcp_warn.php index 0b6a49d9c7..768b7c991d 100644 --- a/phpBB/includes/mcp/mcp_warn.php +++ b/phpBB/includes/mcp/mcp_warn.php @@ -293,7 +293,6 @@ class mcp_warn $message = generate_text_for_display($user_row['post_text'], $user_row['bbcode_uid'], $user_row['bbcode_bitfield'], $parse_flags, true); // Generate the appropriate user information for the user we are looking at - if (!function_exists('get_user_rank')) { include($phpbb_root_path . 'includes/functions_display.' . $phpEx); @@ -399,7 +398,10 @@ class mcp_warn } // Generate the appropriate user information for the user we are looking at - + if (!function_exists('get_user_rank')) + { + include($phpbb_root_path . 'includes/functions_display.' . $phpEx); + } get_user_rank($user_row['user_rank'], $user_row['user_posts'], $rank_title, $rank_img, $rank_img_src); $avatar_img = phpbb_get_user_avatar($user_row); diff --git a/phpBB/includes/ucp/ucp_pm_viewmessage.php b/phpBB/includes/ucp/ucp_pm_viewmessage.php index 80974e752e..548aa2af3a 100644 --- a/phpBB/includes/ucp/ucp_pm_viewmessage.php +++ b/phpBB/includes/ucp/ucp_pm_viewmessage.php @@ -345,6 +345,11 @@ function get_user_information($user_id, $user_row) $user_row['avatar'] = ($user->optionget('viewavatars')) ? phpbb_get_user_avatar($user_row) : ''; + if (!function_exists('get_user_rank')) + { + include($phpbb_root_path . 'includes/functions_display.' . $phpEx); + } + get_user_rank($user_row['user_rank'], $user_row['user_posts'], $user_row['rank_title'], $user_row['rank_image'], $user_row['rank_image_src']); if ((!empty($user_row['user_allow_viewemail']) && $auth->acl_get('u_sendemail')) || $auth->acl_get('a_email')) From 175d83146e1485b4fcb92cd82bc9fc6cbf2ed4d1 Mon Sep 17 00:00:00 2001 From: Crizzo Date: Sun, 23 Mar 2014 15:39:09 +0100 Subject: [PATCH 07/12] [ticket/9758] Adding impr. for overall_header display of avatar and username PHPBB3-9758 --- phpBB/includes/functions.php | 3 ++- phpBB/styles/prosilver/template/overall_header.html | 3 ++- phpBB/styles/prosilver/theme/common.css | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index c6ae3828f5..c805a9fe67 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -4772,7 +4772,7 @@ function page_header($page_title = '', $display_online_list = false, $item_id = if ($user->data['user_id'] != ANONYMOUS) { $u_login_logout = append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=logout', true, $user->session_id); - $l_login_logout = sprintf($user->lang['LOGOUT_USER'], $user->data['username']); + $l_login_logout = sprintf($user->lang['LOGOUT'], $user->data['username']); } else { @@ -4946,6 +4946,7 @@ function page_header($page_title = '', $display_online_list = false, $item_id = 'SESSION_ID' => $user->session_id, 'ROOT_PATH' => $web_path, 'BOARD_URL' => $board_url, + 'USERNAME_FULL' => get_username_string('full', $user->data['user_id'], $user->data['username'], $user->data['user_colour']), 'L_LOGIN_LOGOUT' => $l_login_logout, 'L_INDEX' => ($config['board_index_text'] !== '') ? $config['board_index_text'] : $user->lang['FORUM_INDEX'], diff --git a/phpBB/styles/prosilver/template/overall_header.html b/phpBB/styles/prosilver/template/overall_header.html index 84449efc14..c9daccb4ff 100644 --- a/phpBB/styles/prosilver/template/overall_header.html +++ b/phpBB/styles/prosilver/template/overall_header.html @@ -89,6 +89,7 @@ +
  • {CURRENT_USER_AVATAR} {USERNAME_FULL}
  • {L_EMAIL_TOPIC}
  • {L_EMAIL_PM}
  • {L_PRINT_TOPIC}
  • @@ -163,7 +164,7 @@ -
  • {L_LOGIN_LOGOUT} {CURRENT_USER_AVATAR}
  • +
  • {L_LOGIN_LOGOUT}
  • {L_REGISTER}
  • {L_MEMBERLIST}
  • diff --git a/phpBB/styles/prosilver/theme/common.css b/phpBB/styles/prosilver/theme/common.css index 6665e605f3..3fbd6659d4 100644 --- a/phpBB/styles/prosilver/theme/common.css +++ b/phpBB/styles/prosilver/theme/common.css @@ -446,8 +446,9 @@ ul.linklist.bulletin li.no-bulletin:before { /* Avatar in overall_header.html */ span.avatar-overall-header img { + margin-bottom: 2px; max-height: 25px; - vertical-align: top; + vertical-align: middle; width: auto; } From d48d47c91689b8a058ceed1d5165585143f20e3d Mon Sep 17 00:00:00 2001 From: Crizzo Date: Sun, 23 Mar 2014 21:51:54 +0100 Subject: [PATCH 08/12] [ticket/9758] Removed the needless space after first ENDIF PHPBB3-9758 --- phpBB/styles/prosilver/template/overall_header.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/styles/prosilver/template/overall_header.html b/phpBB/styles/prosilver/template/overall_header.html index c9daccb4ff..8d566626f6 100644 --- a/phpBB/styles/prosilver/template/overall_header.html +++ b/phpBB/styles/prosilver/template/overall_header.html @@ -89,7 +89,7 @@ -
  • {CURRENT_USER_AVATAR} {USERNAME_FULL}
  • +
  • {CURRENT_USER_AVATAR} {USERNAME_FULL}
  • {L_EMAIL_TOPIC}
  • {L_EMAIL_PM}
  • {L_PRINT_TOPIC}
  • From 9568181b98a370b81c1683ecba36bf4f8a9ea697 Mon Sep 17 00:00:00 2001 From: Crizzo Date: Mon, 24 Mar 2014 20:57:25 +0100 Subject: [PATCH 09/12] [ticket/9758] Adds id and changes filter to fix travis CI test PHPBB3-9758 --- phpBB/styles/prosilver/template/overall_header.html | 2 +- tests/functional/auth_test.php | 4 ++-- tests/functional/notification_test.php | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/phpBB/styles/prosilver/template/overall_header.html b/phpBB/styles/prosilver/template/overall_header.html index 8d566626f6..b2f4b94524 100644 --- a/phpBB/styles/prosilver/template/overall_header.html +++ b/phpBB/styles/prosilver/template/overall_header.html @@ -89,7 +89,7 @@ -
  • {CURRENT_USER_AVATAR} {USERNAME_FULL}
  • +
  • {CURRENT_USER_AVATAR} {USERNAME_FULL}
  • {L_EMAIL_TOPIC}
  • {L_EMAIL_PM}
  • {L_PRINT_TOPIC}
  • diff --git a/tests/functional/auth_test.php b/tests/functional/auth_test.php index cfd85571b7..d3fed18094 100644 --- a/tests/functional/auth_test.php +++ b/tests/functional/auth_test.php @@ -18,7 +18,7 @@ class phpbb_functional_auth_test extends phpbb_functional_test_case // check for logout link $crawler = self::request('GET', 'index.php'); - $this->assertContains($this->lang('LOGOUT_USER', 'admin'), $crawler->filter('.navbar')->text()); + $this->assertContains($this->lang('LOGOUT', 'admin'), $crawler->filter('.navbar')->text()); } public function test_login_other() @@ -26,7 +26,7 @@ class phpbb_functional_auth_test extends phpbb_functional_test_case $this->create_user('anothertestuser'); $this->login('anothertestuser'); $crawler = self::request('GET', 'index.php'); - $this->assertContains('anothertestuser', $crawler->filter('.icon-logout')->text()); + $this->assertContains('anothertestuser', $crawler->filter('#username_logged_in')->text()); } /** diff --git a/tests/functional/notification_test.php b/tests/functional/notification_test.php index dd1b8ec981..9ae37842fe 100644 --- a/tests/functional/notification_test.php +++ b/tests/functional/notification_test.php @@ -60,7 +60,7 @@ class phpbb_functional_notification_test extends phpbb_functional_test_case $this->add_user_group('NEWLY_REGISTERED', array('notificationtestuser')); $this->login('notificationtestuser'); $crawler = self::request('GET', 'index.php'); - $this->assertContains('notificationtestuser', $crawler->filter('.icon-logout')->text()); + $this->assertContains('notificationtestuser', $crawler->filter('#username_logged_in')->text()); // Post a new post that needs approval $this->create_post(2, 1, 'Re: Welcome to phpBB3', 'This is a test [b]post[/b] posted by notificationtestuser.', array(), 'POST_STORED_MOD'); From 4f2a5120520aba766cb8a9e944e695213ec11b18 Mon Sep 17 00:00:00 2001 From: Crizzo Date: Tue, 25 Mar 2014 19:33:38 +0100 Subject: [PATCH 10/12] [ticket/9758] Slims the line 4775 in includes/functions.php PHPBB3-9758 --- phpBB/includes/functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index c805a9fe67..a554372c69 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -4772,7 +4772,7 @@ function page_header($page_title = '', $display_online_list = false, $item_id = if ($user->data['user_id'] != ANONYMOUS) { $u_login_logout = append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=logout', true, $user->session_id); - $l_login_logout = sprintf($user->lang['LOGOUT'], $user->data['username']); + $l_login_logout = $user->lang['LOGOUT']; } else { From cde4070b193cd8cce0d9fb3ffb7de8f3e3f5a08e Mon Sep 17 00:00:00 2001 From: Crizzo Date: Fri, 28 Mar 2014 14:19:05 +0100 Subject: [PATCH 11/12] [ticket/9758] Remove unnessary if-question for include functions_display PHPBB3-9758 --- phpBB/includes/ucp/ucp_pm_viewmessage.php | 5 ----- 1 file changed, 5 deletions(-) diff --git a/phpBB/includes/ucp/ucp_pm_viewmessage.php b/phpBB/includes/ucp/ucp_pm_viewmessage.php index 548aa2af3a..03064a31d3 100644 --- a/phpBB/includes/ucp/ucp_pm_viewmessage.php +++ b/phpBB/includes/ucp/ucp_pm_viewmessage.php @@ -266,11 +266,6 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row) } } - if (!function_exists('phpbb_gen_download_links')) - { - include($phpbb_root_path . 'includes/functions_display.' . $phpEx); - } - // Display not already displayed Attachments for this post, we already parsed them. ;) if (isset($attachments) && sizeof($attachments)) { From fa6c1044b8b11baf1d100f695e8b17457d26fd4a Mon Sep 17 00:00:00 2001 From: Crizzo Date: Sun, 30 Mar 2014 19:13:14 +0200 Subject: [PATCH 12/12] [ticket/9758] Clickable avatar in header and renamed class for avatar-img PHPBB3-9758 --- phpBB/includes/functions.php | 1 + phpBB/styles/prosilver/template/overall_header.html | 2 +- phpBB/styles/prosilver/theme/common.css | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index a554372c69..e3d3a904d2 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -4963,6 +4963,7 @@ function page_header($page_title = '', $display_online_list = false, $item_id = 'U_SITE_HOME' => $config['site_home_url'], 'U_REGISTER' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=register'), 'U_PROFILE' => append_sid("{$phpbb_root_path}ucp.$phpEx"), + 'U_USER_PROFILE' => get_username_string('profile', $user->data['user_id'], $user->data['username'], $user->data['user_colour']), 'U_MODCP' => append_sid("{$phpbb_root_path}mcp.$phpEx", false, true, $user->session_id), 'U_FAQ' => append_sid("{$phpbb_root_path}faq.$phpEx"), 'U_SEARCH_SELF' => append_sid("{$phpbb_root_path}search.$phpEx", 'search_id=egosearch'), diff --git a/phpBB/styles/prosilver/template/overall_header.html b/phpBB/styles/prosilver/template/overall_header.html index b2f4b94524..6a306b4baa 100644 --- a/phpBB/styles/prosilver/template/overall_header.html +++ b/phpBB/styles/prosilver/template/overall_header.html @@ -89,7 +89,7 @@ -
  • {CURRENT_USER_AVATAR} {USERNAME_FULL}
  • +
  • {CURRENT_USER_AVATAR} {USERNAME_FULL}
  • {L_EMAIL_TOPIC}
  • {L_EMAIL_PM}
  • {L_PRINT_TOPIC}
  • diff --git a/phpBB/styles/prosilver/theme/common.css b/phpBB/styles/prosilver/theme/common.css index 3fbd6659d4..298d310ab1 100644 --- a/phpBB/styles/prosilver/theme/common.css +++ b/phpBB/styles/prosilver/theme/common.css @@ -445,7 +445,7 @@ ul.linklist.bulletin li.no-bulletin:before { } /* Avatar in overall_header.html */ -span.avatar-overall-header img { +.header-avatar img { margin-bottom: 2px; max-height: 25px; vertical-align: middle;