From c9cd0e1d914b779dfc6cb491b240d48fe2d4c9b0 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Thu, 16 Nov 2006 16:51:19 +0000 Subject: [PATCH] ok, change from doing the same logic all over again we call a function to do it for us. Also allow template designers to choose which method to use by just adding a fully compiled username string (profile link + user colour). This commit may introduce problems. git-svn-id: file:///svn/phpbb/trunk@6589 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions.php | 59 ++++++++++++++++++ phpBB/includes/functions_display.php | 14 ++--- phpBB/includes/functions_posting.php | 23 +++---- phpBB/includes/mcp/mcp_post.php | 8 ++- phpBB/includes/mcp/mcp_queue.php | 31 +++------- phpBB/includes/mcp/mcp_reports.php | 23 +++---- phpBB/includes/mcp/mcp_topic.php | 8 ++- phpBB/includes/ucp/ucp_main.php | 62 ++++++++++--------- phpBB/memberlist.php | 10 +-- phpBB/search.php | 22 ++++--- .../subSilver/template/forumlist_body.html | 9 +-- phpBB/styles/subSilver/template/mcp_post.html | 2 +- .../styles/subSilver/template/mcp_queue.html | 2 +- .../subSilver/template/mcp_reports.html | 2 +- .../styles/subSilver/template/mcp_topic.html | 2 +- .../subSilver/template/memberlist_body.html | 2 +- .../template/memberlist_leaders.html | 4 +- .../subSilver/template/posting_review.html | 2 +- .../template/posting_topic_review.html | 2 +- .../subSilver/template/search_results.html | 6 +- .../styles/subSilver/template/ucp_header.html | 4 +- .../template/ucp_main_bookmarks.html | 2 +- .../subSilver/template/ucp_main_front.html | 9 +-- .../template/ucp_main_subscribed.html | 4 +- .../subSilver/template/viewforum_body.html | 13 ++-- .../subSilver/template/viewtopic_body.html | 4 +- .../subSilver/template/viewtopic_print.html | 2 +- phpBB/ucp.php | 9 +-- phpBB/viewforum.php | 14 +++-- phpBB/viewtopic.php | 56 ++++++----------- 30 files changed, 213 insertions(+), 197 deletions(-) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 8119dc35f4..8021e0c6c2 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -2766,6 +2766,65 @@ function truncate_string($string, $max_length = 60, $allow_reply = true) return $string; } +/** +* Get username details for placing into templates. +* +* @param string $mode Can be profile (for getting an url to the profile), username (for obtaining the username), colour (for obtaining the user colour) or full (for obtaining a html string representing a coloured link to the users profile). +* @param int $user_id The users id +* @param string $username The users name +* @param string $username_colour The users colour +* @param string $guest_username optional field to specify the guest username. It will be used in favor of the GUEST language variable then. +* +* @return string A string consisting of what is wanted based on $mode. +*/ +function get_username_string($mode, $user_id, $username, $username_colour = '', $guest_username = false) +{ + global $phpbb_root_path, $phpEx, $user; + + $full_string = $profile_url = ''; + $username_colour = ($username_colour) ? '#' . $username_colour : ''; + + if ($guest_username === false) + { + $username = ($username) ? $username : $user->lang['GUEST']; + } + else + { + $username = ($user_id && $user_id != ANONYMOUS) ? $username : ((!empty($guest_username)) ? $guest_username : $user->lang['GUEST']); + } + + // Only show the link if not anonymous + if ($user_id && $user_id != ANONYMOUS) + { + $profile_url = append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . (int) $user_id); + $full_string = '' . $username . ''; + } + else + { + $profile_url = ''; + $full_string = ($username_colour) ? '' . $username . '' : $username; + } + + switch ($mode) + { + case 'profile': + return $profile_url; + break; + + case 'username': + return $username; + break; + + case 'colour': + return $username_colour; + break; + + case 'full': + default: + return $full_string; + break; + } +} /** * Wrapper for php's checkdnsrr function. diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index a4b893468a..5521829dda 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -309,16 +309,11 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod { $last_post_subject = $row['forum_last_post_subject']; $last_post_time = $user->format_date($row['forum_last_post_time']); - - $last_poster = ($row['forum_last_poster_name'] != '') ? $row['forum_last_poster_name'] : $user->lang['GUEST']; - $last_poster_colour = ($row['forum_last_poster_colour']) ? '#' . $row['forum_last_poster_colour'] : ''; - $last_poster_url = ($row['forum_last_poster_id'] == ANONYMOUS) ? '' : append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $row['forum_last_poster_id']); - $last_post_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id_last_post'] . '&p=' . $row['forum_last_post_id']) . '#p' . $row['forum_last_post_id']; } else { - $last_post_subject = $last_post_time = $last_poster = $last_poster_colour = $last_poster_url = $last_post_url = ''; + $last_post_subject = $last_post_time = $last_post_url = ''; } // Output moderator listing ... if applicable @@ -350,8 +345,9 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod 'SUBFORUMS' => $subforums_list, 'LAST_POST_SUBJECT' => censor_text($last_post_subject), 'LAST_POST_TIME' => $last_post_time, - 'LAST_POSTER' => $last_poster, - 'LAST_POSTER_COLOUR' => $last_poster_colour, + 'LAST_POSTER' => get_username_string('username', $row['forum_last_poster_id'], $row['forum_last_poster_name'], $row['forum_last_poster_colour']), + 'LAST_POSTER_COLOUR' => get_username_string('colour', $row['forum_last_poster_id'], $row['forum_last_poster_name'], $row['forum_last_poster_colour']), + 'LAST_POSTER_FULL' => get_username_string('full', $row['forum_last_poster_id'], $row['forum_last_poster_name'], $row['forum_last_poster_colour']), 'MODERATORS' => $moderators_list, 'L_SUBFORUM_STR' => $l_subforums, @@ -359,7 +355,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod 'L_MODERATOR_STR' => $l_moderator, 'U_VIEWFORUM' => ($row['forum_type'] != FORUM_LINK || ($row['forum_flags'] & FORUM_FLAG_LINK_TRACK)) ? append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $row['forum_id']) : $row['forum_link'], - 'U_LAST_POSTER' => $last_poster_url, + 'U_LAST_POSTER' => get_username_string('profile', $row['forum_last_poster_id'], $row['forum_last_poster_name'], $row['forum_last_poster_colour']), 'U_LAST_POST' => $last_post_url) ); } diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index b15466b487..407351a78d 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -890,20 +890,11 @@ function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id foreach ($rowset as $i => $row) { - $poster_id = $row['user_id']; - $poster = $row['username']; + $poster_id = $row['user_id']; + $post_subject = $row['post_subject']; + $message = censor_text($row['post_text']); + $message = str_replace("\n", '
', $message); - // Handle anon users posting with usernames - if ($poster_id == ANONYMOUS) - { - $poster = ($row['post_username']) ? $row['post_username'] : $user->lang['GUEST']; - $poster_rank = ($row['post_username']) ? $user->lang['GUEST'] : ''; - } - - $post_subject = $row['post_subject']; - $message = $row['post_text']; - $message = censor_text($message); - $message = str_replace("\n", '
', $message); $decoded_message = false; if ($show_quote_button && $auth->acl_get('f_reply', $forum_id)) @@ -925,7 +916,11 @@ function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id $post_subject = censor_text($post_subject); $template->assign_block_vars($mode . '_row', array( - 'POSTER_NAME' => $poster, + 'POST_AUTHOR_FULL' => get_username_string('full', $poster_id, $row['username'], $row['user_colour'], $row['post_username']), + 'POST_AUTHOR_COLOUR' => get_username_string('colour', $poster_id, $row['username'], $row['user_colour'], $row['post_username']), + 'POST_AUTHOR' => get_username_string('username', $poster_id, $row['username'], $row['user_colour'], $row['post_username']), + 'U_POST_AUTHOR' => get_username_string('profile', $poster_id, $row['username'], $row['user_colour'], $row['post_username']), + 'POST_SUBJECT' => $post_subject, 'MINI_POST_IMG' => $user->img('icon_post_target', $user->lang['POST']), 'POST_DATE' => $user->format_date($row['post_time']), diff --git a/phpBB/includes/mcp/mcp_post.php b/phpBB/includes/mcp/mcp_post.php index 201137a9a4..21ca7c11c3 100644 --- a/phpBB/includes/mcp/mcp_post.php +++ b/phpBB/includes/mcp/mcp_post.php @@ -91,7 +91,6 @@ function mcp_post_details($id, $mode, $action) // Set some vars $users_ary = $usernames_ary = array(); $post_id = $post_info['post_id']; - $poster = ($post_info['user_colour']) ? '' . $post_info['username'] . '' : $post_info['username']; // Process message, leave it uncensored $message = $post_info['post_text']; @@ -126,7 +125,6 @@ function mcp_post_details($id, $mode, $action) 'U_MCP_USER_NOTES' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=notes&mode=user_notes&u=' . $post_info['user_id']), 'U_MCP_WARN_USER' => ($auth->acl_getf_global('m_warn')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=warn&mode=warn_user&u=' . $post_info['user_id']) : '', 'U_VIEW_POST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $post_info['forum_id'] . '&p=' . $post_info['post_id'] . '#p' . $post_info['post_id']), - 'U_VIEW_PROFILE' => ($post_info['user_id'] != ANONYMOUS) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $post_info['user_id']) : '', 'U_VIEW_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $post_info['forum_id'] . '&t=' . $post_info['topic_id']), 'RETURN_TOPIC' => sprintf($user->lang['RETURN_TOPIC'], '", ''), @@ -136,7 +134,11 @@ function mcp_post_details($id, $mode, $action) 'EDIT_IMG' => $user->img('icon_post_edit', $user->lang['EDIT_POST']), 'SEARCH_IMG' => $user->img('icon_user_search', $user->lang['SEARCH']), - 'POSTER_NAME' => $poster, + 'POST_AUTHOR_FULL' => get_username_string('full', $post_info['user_id'], $post_info['username'], $post_info['user_colour'], $post_info['post_username']), + 'POST_AUTHOR_COLOUR' => get_username_string('colour', $post_info['user_id'], $post_info['username'], $post_info['user_colour'], $post_info['post_username']), + 'POST_AUTHOR' => get_username_string('username', $post_info['user_id'], $post_info['username'], $post_info['user_colour'], $post_info['post_username']), + 'U_POST_AUTHOR' => get_username_string('profile', $post_info['user_id'], $post_info['username'], $post_info['user_colour'], $post_info['post_username']), + 'POST_PREVIEW' => $message, 'POST_SUBJECT' => $post_info['post_subject'], 'POST_DATE' => $user->format_date($post_info['post_time']), diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php index 0f6fae18ee..a9301d2b64 100644 --- a/phpBB/includes/mcp/mcp_queue.php +++ b/phpBB/includes/mcp/mcp_queue.php @@ -99,14 +99,6 @@ class mcp_queue ); } - // Set some vars - if ($post_info['user_id'] == ANONYMOUS) - { - $poster = ($post_info['post_username']) ? $post_info['post_username'] : $user->lang['GUEST']; - } - - $poster = ($post_info['user_colour']) ? '' . $post_info['username'] . '' : $post_info['username']; - // Process message, leave it uncensored $message = $post_info['post_text']; $message = str_replace("\n", '
', $message); @@ -133,7 +125,6 @@ class mcp_queue 'U_MCP_USER_NOTES' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=notes&mode=user_notes&u=' . $post_info['user_id']), 'U_MCP_WARN_USER' => ($auth->acl_getf_global('m_warn')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=warn&mode=warn_user&u=' . $post_info['user_id']) : '', 'U_VIEW_POST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $post_info['forum_id'] . '&p=' . $post_info['post_id'] . '#p' . $post_info['post_id']), - 'U_VIEW_PROFILE' => ($post_info['user_id'] != ANONYMOUS) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $post_info['user_id']) : '', 'U_VIEW_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $post_info['forum_id'] . '&t=' . $post_info['topic_id']), 'RETURN_QUEUE' => sprintf($user->lang['RETURN_QUEUE'], '", ''), @@ -141,7 +132,11 @@ class mcp_queue 'UNAPPROVED_IMG' => $user->img('icon_topic_unapproved', $user->lang['POST_UNAPPROVED']), 'EDIT_IMG' => $user->img('icon_post_edit', $user->lang['EDIT_POST']), - 'POSTER_NAME' => $poster, + 'POST_AUTHOR_FULL' => get_username_string('full', $post_info['user_id'], $post_info['username'], $post_info['user_colour'], $post_info['post_username']), + 'POST_AUTHOR_COLOUR' => get_username_string('colour', $post_info['user_id'], $post_info['username'], $post_info['user_colour'], $post_info['post_username']), + 'POST_AUTHOR' => get_username_string('username', $post_info['user_id'], $post_info['username'], $post_info['user_colour'], $post_info['post_username']), + 'U_POST_AUTHOR' => get_username_string('profile', $post_info['user_id'], $post_info['username'], $post_info['user_colour'], $post_info['post_username']), + 'POST_PREVIEW' => $message, 'POST_SUBJECT' => $post_info['post_subject'], 'POST_DATE' => $user->format_date($post_info['post_time']), @@ -322,15 +317,6 @@ class mcp_queue foreach ($rowset as $row) { - if ($row['poster_id'] == ANONYMOUS) - { - $poster = (!empty($row['post_username'])) ? $row['post_username'] : $user->lang['GUEST']; - } - else - { - $poster = $row['username']; - } - $global_topic = ($row['forum_id']) ? false : true; if ($global_topic) { @@ -341,12 +327,15 @@ class mcp_queue 'U_VIEWFORUM' => (!$global_topic) ? append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $row['forum_id']) : '', 'U_VIEWPOST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&p=' . $row['post_id']) . (($mode == 'unapproved_posts') ? '#p' . $row['post_id'] : ''), 'U_VIEW_DETAILS' => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=queue&start=$start&mode=approve_details&f={$row['forum_id']}&p={$row['post_id']}" . (($mode == 'unapproved_topics') ? "&t={$row['topic_id']}" : '')), - 'U_VIEWPROFILE' => ($row['poster_id'] != ANONYMOUS) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $row['poster_id']) : '', + + 'POST_AUTHOR_FULL' => get_username_string('full', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']), + 'POST_AUTHOR_COLOUR' => get_username_string('colour', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']), + 'POST_AUTHOR' => get_username_string('username', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']), + 'U_POST_AUTHOR' => get_username_string('profile', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']), 'POST_ID' => $row['post_id'], 'FORUM_NAME' => (!$global_topic) ? $forum_names[$row['forum_id']] : $user->lang['GLOBAL_ANNOUNCEMENT'], 'POST_SUBJECT' => $row['post_subject'], - 'POSTER' => $poster, 'POST_TIME' => $user->format_date($row['post_time'])) ); } diff --git a/phpBB/includes/mcp/mcp_reports.php b/phpBB/includes/mcp/mcp_reports.php index ebd1295090..8fdc3ba7db 100755 --- a/phpBB/includes/mcp/mcp_reports.php +++ b/phpBB/includes/mcp/mcp_reports.php @@ -144,7 +144,6 @@ class mcp_reports 'U_MCP_WARN_REPORTER' => ($auth->acl_getf_global('m_warn')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=warn&mode=warn_user&u=' . $report['user_id']) : '', 'U_MCP_WARN_USER' => ($auth->acl_getf_global('m_warn')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=warn&mode=warn_user&u=' . $post_info['user_id']) : '', 'U_VIEW_POST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $post_info['forum_id'] . '&p=' . $post_info['post_id'] . '#p' . $post_info['post_id']), - 'U_VIEW_PROFILE' => ($post_info['user_id'] != ANONYMOUS) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $post_info['user_id']) : '', 'U_VIEW_REPORTER_PROFILE' => ($report['user_id'] != ANONYMOUS) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $report['user_id']) : '', 'U_VIEW_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $post_info['forum_id'] . '&t=' . $post_info['topic_id']), @@ -159,7 +158,11 @@ class mcp_reports 'REPORT_DATE' => $user->format_date($report['report_time']), 'REPORT_TEXT' => $report['report_text'], - 'POSTER_NAME' => $poster, + 'POST_AUTHOR_FULL' => get_username_string('full', $post_info['user_id'], $post_info['username'], $post_info['user_colour'], $post_info['post_username']), + 'POST_AUTHOR_COLOUR' => get_username_string('colour', $post_info['user_id'], $post_info['username'], $post_info['user_colour'], $post_info['post_username']), + 'POST_AUTHOR' => get_username_string('username', $post_info['user_id'], $post_info['username'], $post_info['user_colour'], $post_info['post_username']), + 'U_POST_AUTHOR' => get_username_string('profile', $post_info['user_id'], $post_info['username'], $post_info['user_colour'], $post_info['post_username']), + 'POST_PREVIEW' => $message, 'POST_SUBJECT' => $post_info['post_subject'], 'POST_DATE' => $user->format_date($post_info['post_time']), @@ -293,15 +296,6 @@ class mcp_reports $report_data = $rowset = array(); while ($row = $db->sql_fetchrow($result)) { - if ($row['poster_id'] == ANONYMOUS) - { - $poster = (!empty($row['post_username'])) ? $row['post_username'] : $user->lang['GUEST']; - } - else - { - $poster = $row['username']; - } - $global_topic = ($row['forum_id']) ? false : true; if ($global_topic) { @@ -312,11 +306,14 @@ class mcp_reports 'U_VIEWFORUM' => (!$global_topic) ? append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $row['forum_id']) : '', 'U_VIEWPOST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&p=' . $row['post_id']) . '#p' . $row['post_id'], 'U_VIEW_DETAILS' => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=reports&start=$start&mode=report_details&f={$row['forum_id']}&r={$row['report_id']}"), - 'U_VIEW_POSTER_PROFILE' => ($row['poster_id'] != ANONYMOUS) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $row['poster_id']) : '', 'U_VIEW_REPORTER_PROFILE' => ($row['reporter_id'] != ANONYMOUS) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $row['reporter_id']) : '', + 'POST_AUTHOR_FULL' => get_username_string('full', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']), + 'POST_AUTHOR_COLOUR' => get_username_string('colour', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']), + 'POST_AUTHOR' => get_username_string('username', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']), + 'U_POST_AUTHOR' => get_username_string('profile', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']), + 'FORUM_NAME' => (!$global_topic) ? $forum_data[$row['forum_id']]['forum_name'] : $user->lang['GLOBAL_ANNOUNCEMENT'], - 'POSTER' => $poster, 'POST_ID' => $row['post_id'], 'POST_SUBJECT' => $row['post_subject'], 'POST_TIME' => $user->format_date($row['post_time']), diff --git a/phpBB/includes/mcp/mcp_topic.php b/phpBB/includes/mcp/mcp_topic.php index 8be1af41ff..6bfbf6fdb2 100644 --- a/phpBB/includes/mcp/mcp_topic.php +++ b/phpBB/includes/mcp/mcp_topic.php @@ -105,8 +105,6 @@ function mcp_topic_view($id, $mode, $action) foreach ($rowset as $i => $row) { $has_unapproved_posts = false; - $poster = ($row['poster_id'] != ANONYMOUS) ? $row['username'] : ((!$row['post_username']) ? $user->lang['GUEST'] : $row['post_username']); - $poster = ($row['user_colour']) ? '' . $poster . '' : $poster; $message = $row['post_text']; $post_subject = ($row['post_subject'] != '') ? $row['post_subject'] : $topic_info['topic_title']; @@ -125,7 +123,11 @@ function mcp_topic_view($id, $mode, $action) } $template->assign_block_vars('postrow', array( - 'POSTER_NAME' => $poster, + 'POST_AUTHOR_FULL' => get_username_string('full', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']), + 'POST_AUTHOR_COLOUR' => get_username_string('colour', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']), + 'POST_AUTHOR' => get_username_string('username', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']), + 'U_POST_AUTHOR' => get_username_string('profile', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']), + 'POST_DATE' => $user->format_date($row['post_time']), 'POST_SUBJECT' => $post_subject, 'MESSAGE' => $message, diff --git a/phpBB/includes/ucp/ucp_main.php b/phpBB/includes/ucp/ucp_main.php index 1ef2eee30e..65da327b9c 100644 --- a/phpBB/includes/ucp/ucp_main.php +++ b/phpBB/includes/ucp/ucp_main.php @@ -125,14 +125,15 @@ class ucp_main } $template->assign_block_vars('topicrow', array( - 'FORUM_ID' => $forum_id, - 'TOPIC_ID' => $topic_id, - 'LAST_POST_SUBJECT' => $row['topic_last_post_subject'], - 'LAST_POST_TIME' => $user->format_date($row['topic_last_post_time']), - 'LAST_POST_AUTHOR' => ($row['topic_last_poster_id'] == ANONYMOUS) ? (($row['topic_last_poster_name'] != '') ? $row['topic_last_poster_name'] . ' ' : $user->lang['GUEST'] . ' ') : $row['topic_last_poster_name'], - 'LAST_POST_AUTHOR_COLOUR' => ($row['topic_last_poster_colour']) ? '#' . $row['topic_last_poster_colour'] : '', - 'TOPIC_TITLE' => censor_text($row['topic_title']), - 'TOPIC_TYPE' => $topic_type, + 'FORUM_ID' => $forum_id, + 'TOPIC_ID' => $topic_id, + 'LAST_POST_SUBJECT' => $row['topic_last_post_subject'], + 'LAST_POST_TIME' => $user->format_date($row['topic_last_post_time']), + 'LAST_POST_AUTHOR' => get_username_string('username', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']), + 'LAST_POST_AUTHOR_COLOUR' => get_username_string('colour', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']), + 'LAST_POST_AUTHOR_FULL' => get_username_string('full', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']), + 'TOPIC_TITLE' => censor_text($row['topic_title']), + 'TOPIC_TYPE' => $topic_type, 'LAST_POST_IMG' => $user->img('icon_topic_latest', 'VIEW_LATEST_POST'), 'NEWEST_POST_IMG' => $user->img('icon_topic_newest', 'VIEW_NEWEST_POST'), @@ -144,7 +145,7 @@ class ucp_main 'S_UNREAD' => $unread_topic, 'U_LAST_POST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$g_forum_id&t=$topic_id&p=" . $row['topic_last_post_id']) . '#p' . $row['topic_last_post_id'], - 'U_LAST_POST_AUTHOR' => ($row['topic_last_poster_id'] != ANONYMOUS) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $row['topic_last_poster_id']) : '', + 'U_LAST_POST_AUTHOR' => get_username_string('profile', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']), 'U_NEWEST_POST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$g_forum_id&t=$topic_id&view=unread") . '#unread', 'U_VIEW_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$g_forum_id&t=$topic_id")) ); @@ -290,16 +291,11 @@ class ucp_main if ($row['forum_last_post_id']) { $last_post_time = $user->format_date($row['forum_last_post_time']); - - $last_poster = ($row['forum_last_poster_name'] != '') ? $row['forum_last_poster_name'] : $user->lang['GUEST']; - $last_poster_colour = ($row['forum_last_poster_colour']) ? '#' . $row['forum_last_poster_colour'] : ''; - $last_poster_url = ($row['forum_last_poster_id'] == ANONYMOUS) ? '' : append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $row['forum_last_poster_id']); - $last_post_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&p=" . $row['forum_last_post_id']) . '#p' . $row['forum_last_post_id']; } else { - $last_post_time = $last_poster = $last_poster_url = $last_post_url = ''; + $last_post_time = $last_post_url = ''; } $template->assign_block_vars('forumrow', array( @@ -312,10 +308,12 @@ class ucp_main 'LAST_POST_IMG' => $user->img('icon_topic_latest', 'VIEW_LATEST_POST'), 'LAST_POST_SUBJECT' => $row['forum_last_post_subject'], 'LAST_POST_TIME' => $last_post_time, - 'LAST_POST_AUTHOR' => $last_poster, - 'LAST_POST_AUTHOR_COLOUR' => $last_poster_colour, - 'U_LAST_POST_AUTHOR' => $last_poster_url, + 'LAST_POST_AUTHOR' => get_username_string('username', $row['forum_last_poster_id'], $row['forum_last_poster_name'], $row['forum_last_poster_colour']), + 'LAST_POST_AUTHOR_COLOUR' => get_username_string('colour', $row['forum_last_poster_id'], $row['forum_last_poster_name'], $row['forum_last_poster_colour']), + 'LAST_POST_AUTHOR_FULL' => get_username_string('full', $row['forum_last_poster_id'], $row['forum_last_poster_name'], $row['forum_last_poster_colour']), + 'U_LAST_POST_AUTHOR' => get_username_string('profile', $row['forum_last_poster_id'], $row['forum_last_poster_name'], $row['forum_last_poster_colour']), + 'U_LAST_POST' => $last_post_url, 'U_VIEWFORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $row['forum_id'])) ); @@ -430,14 +428,16 @@ class ucp_main $template->assign_block_vars('topicrow', array( 'FORUM_ID' => $forum_id, 'TOPIC_ID' => $topic_id, - 'TOPIC_AUTHOR' => ($row['topic_first_poster_name']) ? $row['topic_first_poster_name'] : $user->lang['GUEST'], - 'TOPIC_AUTHOR_COLOUR' => ($row['topic_first_poster_colour']) ? '#' . $row['topic_first_poster_colour'] : '', + 'TOPIC_AUTHOR' => get_username_string('username', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), + 'TOPIC_AUTHOR_COLOUR' => get_username_string('colour', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), + 'TOPIC_AUTHOR_FULL' => get_username_string('full', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), 'FIRST_POST_TIME' => $user->format_date($row['topic_time']), 'LAST_POST_SUBJECT' => $row['topic_last_post_subject'], 'LAST_POST_TIME' => $user->format_date($row['topic_last_post_time']), 'LAST_VIEW_TIME' => $user->format_date($row['topic_last_view_time']), - 'LAST_POST_AUTHOR' => ($row['topic_last_poster_name'] != '') ? $row['topic_last_poster_name'] : $user->lang['GUEST'], - 'LAST_POST_AUTHOR_COLOUR' => ($row['topic_last_poster_colour']) ? '#' . $row['topic_last_poster_colour'] : '', + 'LAST_POST_AUTHOR' => get_username_string('username', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']), + 'LAST_POST_AUTHOR_COLOUR' => get_username_string('colour', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']), + 'LAST_POST_AUTHOR_FULL' => get_username_string('full', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']), 'PAGINATION' => topic_generate_pagination($replies, append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . (($row['forum_id']) ? $row['forum_id'] : $forum_id) . "&t=$topic_id")), 'REPLIES' => $replies, @@ -460,8 +460,8 @@ class ucp_main 'U_NEWEST_POST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id&view=unread") . '#unread', 'U_LAST_POST' => $view_topic_url . '&p=' . $row['topic_last_post_id'] . '#p' . $row['topic_last_post_id'], - 'U_LAST_POST_AUTHOR' => ($row['topic_last_poster_id'] != ANONYMOUS && $row['topic_last_poster_id']) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $row['topic_last_poster_id']) : '', - 'U_TOPIC_AUTHOR' => ($row['topic_poster'] != ANONYMOUS && $row['topic_poster']) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $row['topic_poster']) : '', + 'U_LAST_POST_AUTHOR' => get_username_string('profile', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']), + 'U_TOPIC_AUTHOR' => get_username_string('profile', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), 'U_VIEW_TOPIC' => $view_topic_url) ); } @@ -594,14 +594,16 @@ class ucp_main 'S_DELETED_TOPIC' => (!$row['topic_id']) ? true : false, 'S_GLOBAL_TOPIC' => (!$forum_id) ? true : false, - 'TOPIC_AUTHOR' => ($row['topic_first_poster_name']) ? $row['topic_first_poster_name'] : $user->lang['GUEST'], - 'TOPIC_AUTHOR_COLOUR' => ($row['topic_first_poster_colour']) ? '#' . $row['topic_first_poster_colour'] : '', + 'TOPIC_AUTHOR' => get_username_string('username', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), + 'TOPIC_AUTHOR_COLOUR' => get_username_string('colour', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), + 'TOPIC_AUTHOR_FULL' => get_username_string('full', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), 'FIRST_POST_TIME' => $user->format_date($row['topic_time']), 'LAST_POST_SUBJECT' => $row['topic_last_post_subject'], 'LAST_POST_TIME' => $user->format_date($row['topic_last_post_time']), 'LAST_VIEW_TIME' => $user->format_date($row['topic_last_view_time']), - 'LAST_POST_AUTHOR' => ($row['topic_last_poster_name'] != '') ? $row['topic_last_poster_name'] : $user->lang['GUEST'], - 'LAST_POST_AUTHOR_COLOUR' => ($row['topic_last_poster_colour']) ? '#' . $row['topic_last_poster_colour'] : '', + 'LAST_POST_AUTHOR' => get_username_string('username', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']), + 'LAST_POST_AUTHOR_COLOUR' => get_username_string('colour', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']), + 'LAST_POST_AUTHOR_FULL' => get_username_string('full', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']), 'PAGINATION' => topic_generate_pagination($replies, append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . (($row['forum_id']) ? $row['forum_id'] : $forum_id) . "&t=$topic_id")), 'POSTED_AT' => $user->format_date($row['topic_time']), @@ -612,8 +614,8 @@ class ucp_main 'LAST_POST_IMG' => $user->img('icon_topic_latest', 'VIEW_LATEST_POST'), 'U_LAST_POST' => $view_topic_url . '&p=' . $row['topic_last_post_id'] . '#p' . $row['topic_last_post_id'], - 'U_LAST_POST_AUTHOR' => ($row['topic_last_poster_id'] != ANONYMOUS && $row['topic_last_poster_id']) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $row['topic_last_poster_id']) : '', - 'U_TOPIC_AUTHOR' => ($row['topic_poster'] != ANONYMOUS && $row['topic_poster']) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $row['topic_poster']) : '', + 'U_LAST_POST_AUTHOR' => get_username_string('profile', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']), + 'U_TOPIC_AUTHOR' => get_username_string('profile', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), 'U_VIEW_TOPIC' => $view_topic_url, 'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id), 'U_MOVE_UP' => ($row['order_id'] != 1) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=main&mode=bookmarks&move_up=' . $row['order_id']) : '', diff --git a/phpBB/memberlist.php b/phpBB/memberlist.php index 50fa8e4954..fe0ddc8c27 100644 --- a/phpBB/memberlist.php +++ b/phpBB/memberlist.php @@ -224,9 +224,9 @@ switch ($mode) 'RANK_IMG' => $rank_img, 'RANK_IMG_SRC' => $rank_img_src, - 'U_GROUP' => $u_group, - 'U_VIEWPROFILE' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $row['user_id']), - 'U_PM' => ($config['allow_privmsg'] && $auth->acl_get('u_sendpm')) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&mode=compose&u=' . $row['user_id']) : '') + 'U_GROUP' => $u_group, + 'U_VIEW_PROFILE' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $row['user_id']), + 'U_PM' => ($config['allow_privmsg'] && $auth->acl_get('u_sendpm')) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&mode=compose&u=' . $row['user_id']) : '') ); } $db->sql_freeresult($result); @@ -1218,7 +1218,7 @@ switch ($mode) 'S_CUSTOM_PROFILE' => (isset($cp_row['row']) && sizeof($cp_row['row'])) ? true : false, 'S_GROUP_LEADER' => (isset($row['group_leader']) && $row['group_leader']) ? true : false, - 'U_VIEWPROFILE' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $user_id)) + 'U_VIEW_PROFILE' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $user_id)) ); if (isset($cp_row['row']) && sizeof($cp_row['row'])) @@ -1390,7 +1390,7 @@ function show_profile($data) 'JOINED' => $user->format_date($data['user_regdate']), 'VISITED' => (empty($last_visit)) ? ' - ' : $user->format_date($last_visit), 'POSTS' => ($data['user_posts']) ? $data['user_posts'] : 0, - 'WARNINGS' => isset($data['user_warnings']) ? $data['user_warnings'] : 0, + 'WARNINGS' => isset($data['user_warnings']) ? $data['user_warnings'] : 0, 'ONLINE_IMG' => (!$config['load_onlinetrack']) ? '' : (($online) ? $user->img('icon_user_online', 'ONLINE') : $user->img('icon_user_offline', 'OFFLINE')), 'S_ONLINE' => ($config['load_onlinetrack'] && $online) ? true : false, diff --git a/phpBB/search.php b/phpBB/search.php index 44ef053014..5cb2d5dc6e 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -728,14 +728,16 @@ if ($keywords || $author || $author_id || $search_id || $submit) $u_mcp_queue = ($topic_unapproved || $posts_unapproved) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&mode=' . (($topic_unapproved) ? 'approve_details' : 'unapproved_posts') . "&t=$result_topic_id", true, $user->session_id) : ''; $tpl_ary = array( - 'TOPIC_AUTHOR' => ($row['topic_first_poster_name']) ? $row['topic_first_poster_name'] : $user->lang['GUEST'], - 'TOPIC_AUTHOR_COLOUR' => ($row['topic_first_poster_colour']) ? '#' . $row['topic_first_poster_colour'] : '', + 'TOPIC_AUTHOR' => get_username_string('username', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), + 'TOPIC_AUTHOR_COLOUR' => get_username_string('colour', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), + 'TOPIC_AUTHOR_FULL' => get_username_string('full', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), 'FIRST_POST_TIME' => $user->format_date($row['topic_time']), 'LAST_POST_SUBJECT' => $row['topic_last_post_subject'], 'LAST_POST_TIME' => $user->format_date($row['topic_last_post_time']), 'LAST_VIEW_TIME' => $user->format_date($row['topic_last_view_time']), - 'LAST_POST_AUTHOR' => ($row['topic_last_poster_name'] != '') ? $row['topic_last_poster_name'] : $user->lang['GUEST'], - 'LAST_POST_AUTHOR_COLOUR' => ($row['topic_last_poster_colour']) ? '#' . $row['topic_last_poster_colour'] : '', + 'LAST_POST_AUTHOR' => get_username_string('username', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']), + 'LAST_POST_AUTHOR_COLOUR' => get_username_string('colour', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']), + 'LAST_POST_AUTHOR_FULL' => get_username_string('full', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']), 'PAGINATION' => topic_generate_pagination($replies, $view_topic_url), 'TOPIC_TYPE' => $topic_type, @@ -759,8 +761,8 @@ if ($keywords || $author || $author_id || $search_id || $submit) 'S_POSTS_UNAPPROVED' => $posts_unapproved, 'U_LAST_POST' => $view_topic_url . '&p=' . $row['topic_last_post_id'] . '#p' . $row['topic_last_post_id'], - 'U_LAST_POST_AUTHOR' => ($row['topic_last_poster_id'] != ANONYMOUS && $row['topic_last_poster_id']) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $row['topic_last_poster_id']) : '', - 'U_TOPIC_AUTHOR' => ($row['topic_poster'] != ANONYMOUS && $row['topic_poster']) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $row['topic_poster']) : '', + 'U_LAST_POST_AUTHOR' => get_username_string('profile', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']), + 'U_TOPIC_AUTHOR' => get_username_string('profile', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), 'U_NEWEST_POST' => $view_topic_url . '&view=unread#unread', 'U_MCP_REPORT' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports&mode=reports&t=' . $result_topic_id, true, $user->session_id), 'U_MCP_QUEUE' => $u_mcp_queue, @@ -828,9 +830,11 @@ if ($keywords || $author || $author_id || $search_id || $submit) } $tpl_ary = array( - 'POSTER_NAME' => ($row['poster_id'] == ANONYMOUS) ? ((!empty($row['post_username'])) ? $row['post_username'] : $user->lang['GUEST']) : $row['username'], - 'POSTER_COLOUR' => ($row['user_colour']) ? '#' . $row['user_colour'] : '', - 'U_PROFILE' => ($row['poster_id'] != ANONYMOUS) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $row['poster_id']) : '', + 'POST_AUTHOR_FULL' => get_username_string('full', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']), + 'POST_AUTHOR_COLOUR' => get_username_string('colour', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']), + 'POST_AUTHOR' => get_username_string('username', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']), + 'U_POST_AUTHOR' => get_username_string('profile', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']), + 'POST_SUBJECT' => $row['post_subject'], 'POST_DATE' => (!empty($row['post_time'])) ? $user->format_date($row['post_time']) : '', 'MESSAGE' => $message diff --git a/phpBB/styles/subSilver/template/forumlist_body.html b/phpBB/styles/subSilver/template/forumlist_body.html index 5d0108d1f9..f6ebc53cee 100644 --- a/phpBB/styles/subSilver/template/forumlist_body.html +++ b/phpBB/styles/subSilver/template/forumlist_body.html @@ -53,13 +53,8 @@

{forumrow.LAST_POST_TIME}

-

- - style="font-weight: bold; color: {forumrow.LAST_POSTER_COLOUR}">{forumrow.LAST_POSTER} - - {forumrow.LAST_POSTER} - - {LAST_POST_IMG} +

{forumrow.LAST_POSTER_FULL} + {LAST_POST_IMG}

{L_NO_POSTS}

diff --git a/phpBB/styles/subSilver/template/mcp_post.html b/phpBB/styles/subSilver/template/mcp_post.html index e4e8d38cab..d1d696de75 100644 --- a/phpBB/styles/subSilver/template/mcp_post.html +++ b/phpBB/styles/subSilver/template/mcp_post.html @@ -53,7 +53,7 @@ {L_POSTER}: - {POSTER_NAME}   [ {L_READ_PROFILE} | {L_VIEW_NOTES} | {L_WARN_USER} ] + style="color: {POST_AUTHOR_COLOUR}">{POST_AUTHOR}   [ {L_READ_PROFILE} | {L_VIEW_NOTES} | {L_WARN_USER} ] diff --git a/phpBB/styles/subSilver/template/mcp_queue.html b/phpBB/styles/subSilver/template/mcp_queue.html index c75c0403cd..4389daba63 100644 --- a/phpBB/styles/subSilver/template/mcp_queue.html +++ b/phpBB/styles/subSilver/template/mcp_queue.html @@ -20,7 +20,7 @@

{postrow.POST_SUBJECT}

{L_FORUM}: {postrow.FORUM_NAME}{postrow.FORUM_NAME} - {postrow.POSTER}{postrow.POSTER}
+ {postrow.POST_AUTHOR_FULL}
[ {L_VIEW_DETAILS} ] {postrow.POST_TIME} diff --git a/phpBB/styles/subSilver/template/mcp_reports.html b/phpBB/styles/subSilver/template/mcp_reports.html index 40c57ab076..bbf50ed371 100644 --- a/phpBB/styles/subSilver/template/mcp_reports.html +++ b/phpBB/styles/subSilver/template/mcp_reports.html @@ -21,7 +21,7 @@

{postrow.POST_SUBJECT}

{L_FORUM}: {postrow.FORUM_NAME}{postrow.FORUM_NAME} - {postrow.POSTER}{postrow.POSTER}
+ {postrow.POST_AUTHOR_FULL}
{postrow.POST_TIME} {postrow.REPORTER}{postrow.REPORTER} {postrow.REPORT_TIME}
diff --git a/phpBB/styles/subSilver/template/mcp_topic.html b/phpBB/styles/subSilver/template/mcp_topic.html index d0edb48470..027b92467b 100644 --- a/phpBB/styles/subSilver/template/mcp_topic.html +++ b/phpBB/styles/subSilver/template/mcp_topic.html @@ -72,7 +72,7 @@ - {postrow.POSTER_NAME} + {postrow.POST_AUTHOR_FULL} diff --git a/phpBB/styles/subSilver/template/memberlist_body.html b/phpBB/styles/subSilver/template/memberlist_body.html index 69701027b4..78b2896439 100644 --- a/phpBB/styles/subSilver/template/memberlist_body.html +++ b/phpBB/styles/subSilver/template/memberlist_body.html @@ -55,7 +55,7 @@ - + diff --git a/phpBB/styles/subSilver/template/memberlist_leaders.html b/phpBB/styles/subSilver/template/memberlist_leaders.html index 82009e1365..c3833beb2e 100644 --- a/phpBB/styles/subSilver/template/memberlist_leaders.html +++ b/phpBB/styles/subSilver/template/memberlist_leaders.html @@ -16,7 +16,7 @@ - + - + diff --git a/phpBB/styles/subSilver/template/posting_topic_review.html b/phpBB/styles/subSilver/template/posting_topic_review.html index 1c693ad3b4..d5ed8044d1 100644 --- a/phpBB/styles/subSilver/template/posting_topic_review.html +++ b/phpBB/styles/subSilver/template/posting_topic_review.html @@ -18,7 +18,7 @@ diff --git a/phpBB/styles/subSilver/template/search_results.html b/phpBB/styles/subSilver/template/search_results.html index 0579b3131d..e9c55027e4 100644 --- a/phpBB/styles/subSilver/template/search_results.html +++ b/phpBB/styles/subSilver/template/search_results.html @@ -51,12 +51,12 @@

{L_IN} {searchresults.FORUM_TITLE}

- + @@ -87,7 +87,7 @@ - +
 {memberrow.ROW_NUMBER}  style="color:#{memberrow.USER_COLOR}" href="{memberrow.U_VIEWPROFILE}">{memberrow.USERNAME} style="color:#{memberrow.USER_COLOR}" href="{memberrow.U_VIEW_PROFILE}">{memberrow.USERNAME}  {memberrow.JOINED}  {memberrow.POSTS} {memberrow.RANK_IMG}
style="color:#{admin.USER_COLOR}" href="{admin.U_VIEWPROFILE}">{admin.USERNAME} style="color:#{admin.USER_COLOR}" href="{admin.U_VIEW_PROFILE}">{admin.USERNAME}     @@ -39,7 +39,7 @@
style="color:#{mod.USER_COLOR}" href="{mod.U_VIEWPROFILE}">{mod.USERNAME} style="color:#{mod.USER_COLOR}" href="{mod.U_VIEW_PROFILE}">{mod.USERNAME} {L_ALL_FORUMS}    diff --git a/phpBB/styles/subSilver/template/posting_review.html b/phpBB/styles/subSilver/template/posting_review.html index 0f9335a557..3c964041a2 100644 --- a/phpBB/styles/subSilver/template/posting_review.html +++ b/phpBB/styles/subSilver/template/posting_review.html @@ -23,7 +23,7 @@ - +
- +

style="font-weight: bold; color: {searchresults.TOPIC_AUTHOR_COLOUR}">{searchresults.TOPIC_AUTHOR}{searchresults.TOPIC_AUTHOR}

{searchresults.TOPIC_AUTHOR_FULL}

{searchresults.TOPIC_REPLIES}

{searchresults.TOPIC_VIEWS}

{searchresults.LAST_POST_TIME}

-

style="font-weight: bold; color: {searchresults.LAST_POST_AUTHOR_COLOUR}">{searchresults.LAST_POST_AUTHOR}{searchresults.LAST_POST_AUTHOR} +

{searchresults.LAST_POST_AUTHOR_FULL} {searchresults.LAST_POST_IMG}

 {L_FORUM}: {searchresults.FORUM_TITLE}{L_GLOBAL}   {L_TOPIC}: {searchresults.TOPIC_TITLE}

diff --git a/phpBB/styles/subSilver/template/ucp_header.html b/phpBB/styles/subSilver/template/ucp_header.html index 705d767e94..c1eee778ee 100644 --- a/phpBB/styles/subSilver/template/ucp_header.html +++ b/phpBB/styles/subSilver/template/ucp_header.html @@ -127,7 +127,7 @@ diff --git a/phpBB/styles/subSilver/template/ucp_main_front.html b/phpBB/styles/subSilver/template/ucp_main_front.html index 75eb8f242a..54257d72ea 100644 --- a/phpBB/styles/subSilver/template/ucp_main_front.html +++ b/phpBB/styles/subSilver/template/ucp_main_front.html @@ -20,13 +20,8 @@ diff --git a/phpBB/styles/subSilver/template/ucp_main_subscribed.html b/phpBB/styles/subSilver/template/ucp_main_subscribed.html index 9bcab695ed..ee05923c36 100644 --- a/phpBB/styles/subSilver/template/ucp_main_subscribed.html +++ b/phpBB/styles/subSilver/template/ucp_main_subscribed.html @@ -16,7 +16,7 @@ - + @@ -55,7 +55,7 @@ diff --git a/phpBB/styles/subSilver/template/viewforum_body.html b/phpBB/styles/subSilver/template/viewforum_body.html index 6d483ecac9..fcc7aae70a 100644 --- a/phpBB/styles/subSilver/template/viewforum_body.html +++ b/phpBB/styles/subSilver/template/viewforum_body.html @@ -52,17 +52,12 @@

[ {GOTO_PAGE_IMG}{L_GOTO_PAGE}: {topicrow.PAGINATION} ]

- + @@ -179,12 +174,12 @@

[ {GOTO_PAGE_IMG}{L_GOTO_PAGE}: {topicrow.PAGINATION} ]

- + diff --git a/phpBB/styles/subSilver/template/viewtopic_body.html b/phpBB/styles/subSilver/template/viewtopic_body.html index b1bfe3ccca..8cb8e0b041 100644 --- a/phpBB/styles/subSilver/template/viewtopic_body.html +++ b/phpBB/styles/subSilver/template/viewtopic_body.html @@ -130,10 +130,10 @@ - + - +

{topicrow.LAST_POST_TIME}

-

style="font-weight: bold; color: {topicrow.LAST_POST_AUTHOR_COLOUR}">{topicrow.LAST_POST_AUTHOR}{topicrow.LAST_POST_AUTHOR} +

{topicrow.LAST_POST_AUTHOR_FULL} {topicrow.LAST_POST_IMG}

{topicrow.LAST_POST_TIME}

-

- - style="font-weight: bold; color: {topicrow.LAST_POST_AUTHOR_COLOUR}">{topicrow.LAST_POST_AUTHOR} - - {topicrow.LAST_POST_AUTHOR} - - {topicrow.LAST_POST_IMG} +

{topicrow.LAST_POST_AUTHOR_FULL} + {topicrow.LAST_POST_IMG}

{forumrow.FORUM_FOLDER_IMG}

{forumrow.FORUM_NAME}

{forumrow.LAST_POST_TIME}
style="font-weight: bold; color: {forumrow.LAST_POST_AUTHOR_COLOUR}">{forumrow.LAST_POST_AUTHOR}{forumrow.LAST_POST_AUTHOR} {forumrow.LAST_POST_IMG}{L_NO_POSTS}
{forumrow.LAST_POST_TIME}
{forumrow.LAST_POST_AUTHOR_FULL} {forumrow.LAST_POST_IMG}{L_NO_POSTS}

{topicrow.LAST_POST_TIME}

-

style="font-weight: bold; color: {topicrow.LAST_POST_AUTHOR_COLOUR}">{topicrow.LAST_POST_AUTHOR}{topicrow.LAST_POST_AUTHOR} +

{topicrow.LAST_POST_AUTHOR_FULL} {topicrow.LAST_POST_IMG}

style="font-weight: bold; color: {topicrow.TOPIC_AUTHOR_COLOUR}">{topicrow.TOPIC_AUTHOR}{topicrow.TOPIC_AUTHOR}

{topicrow.TOPIC_AUTHOR_FULL}

{topicrow.REPLIES}

{topicrow.VIEWS}

{topicrow.LAST_POST_TIME}

-

- - style="color: {topicrow.LAST_POST_AUTHOR_COLOUR}; font-weight: bold;">{topicrow.LAST_POST_AUTHOR} - - {topicrow.LAST_POST_AUTHOR} - +

{topicrow.LAST_POST_AUTHOR_FULL} {LAST_POST_IMG}

style="font-weight: bold; color: {topicrow.TOPIC_AUTHOR_COLOUR}">{topicrow.TOPIC_AUTHOR}{topicrow.TOPIC_AUTHOR}

{topicrow.TOPIC_AUTHOR_FULL}

{topicrow.REPLIES}

{topicrow.VIEWS}

{topicrow.LAST_POST_TIME}

-

style="font-weight: bold; color: {topicrow.LAST_POST_AUTHOR_COLOUR}">{topicrow.LAST_POST_AUTHOR}{topicrow.LAST_POST_AUTHOR} +

{topicrow.LAST_POST_AUTHOR_FULL} {LAST_POST_IMG}

{postrow.L_IGNORE_POST}{postrow.L_IGNORE_POST} diff --git a/phpBB/styles/subSilver/template/viewtopic_print.html b/phpBB/styles/subSilver/template/viewtopic_print.html index 3a5fe6433c..000dbe0d85 100644 --- a/phpBB/styles/subSilver/template/viewtopic_print.html +++ b/phpBB/styles/subSilver/template/viewtopic_print.html @@ -83,7 +83,7 @@ hr.sep {
- + diff --git a/phpBB/ucp.php b/phpBB/ucp.php index f0758e752e..397ab50847 100755 --- a/phpBB/ucp.php +++ b/phpBB/ucp.php @@ -274,11 +274,12 @@ while ($row = $db->sql_fetchrow($result)) $which = (time() - $update_time < $row['online_time'] && $row['viewonline'] && $row['user_allow_viewonline']) ? 'online' : 'offline'; $template->assign_block_vars("friends_{$which}", array( - 'U_PROFILE' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $row['user_id']), - 'USER_ID' => $row['user_id'], - 'USER_COLOUR' => ($row['user_colour']) ? '#' . $row['user_colour'] : '', - 'USERNAME' => $row['username']) + + 'U_PROFILE' => get_username_string('profile', $row['user_id'], $row['username'], $row['user_colour']), + 'USER_COLOUR' => get_username_string('colour', $row['user_id'], $row['username'], $row['user_colour']), + 'USERNAME' => get_username_string('username', $row['user_id'], $row['username'], $row['user_colour']), + 'USERNAME_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour'])) ); } $db->sql_freeresult($result); diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php index f94dd77e12..f421e42c9f 100644 --- a/phpBB/viewforum.php +++ b/phpBB/viewforum.php @@ -539,14 +539,16 @@ if (sizeof($topic_list)) $template->assign_block_vars('topicrow', array( 'FORUM_ID' => $forum_id, 'TOPIC_ID' => $topic_id, - 'TOPIC_AUTHOR' => ($row['topic_first_poster_name']) ? $row['topic_first_poster_name'] : $user->lang['GUEST'], - 'TOPIC_AUTHOR_COLOUR' => ($row['topic_first_poster_colour']) ? '#' . $row['topic_first_poster_colour'] : '', + 'TOPIC_AUTHOR' => get_username_string('username', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), + 'TOPIC_AUTHOR_COLOUR' => get_username_string('colour', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), + 'TOPIC_AUTHOR_FULL' => get_username_string('full', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), 'FIRST_POST_TIME' => $user->format_date($row['topic_time']), 'LAST_POST_SUBJECT' => censor_text($row['topic_last_post_subject']), 'LAST_POST_TIME' => $user->format_date($row['topic_last_post_time']), 'LAST_VIEW_TIME' => $user->format_date($row['topic_last_view_time']), - 'LAST_POST_AUTHOR' => ($row['topic_last_poster_name']) ? $row['topic_last_poster_name'] : $user->lang['GUEST'], - 'LAST_POST_AUTHOR_COLOUR' => ($row['topic_last_poster_colour']) ? '#' . $row['topic_last_poster_colour'] : '', + 'LAST_POST_AUTHOR' => get_username_string('username', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']), + 'LAST_POST_AUTHOR_COLOUR' => get_username_string('colour', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']), + 'LAST_POST_AUTHOR_FULL' => get_username_string('full', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']), 'PAGINATION' => topic_generate_pagination($replies, $view_topic_url), 'REPLIES' => $replies, @@ -577,8 +579,8 @@ if (sizeof($topic_list)) 'U_NEWEST_POST' => $view_topic_url . '&view=unread#unread', 'U_LAST_POST' => $view_topic_url . '&p=' . $row['topic_last_post_id'] . '#p' . $row['topic_last_post_id'], - 'U_LAST_POST_AUTHOR' => ($row['topic_last_poster_id'] != ANONYMOUS && $row['topic_last_poster_id']) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $row['topic_last_poster_id']) : '', - 'U_TOPIC_AUTHOR' => ($row['topic_poster'] != ANONYMOUS && $row['topic_poster']) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $row['topic_poster']) : '', + 'U_LAST_POST_AUTHOR' => get_username_string('profile', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']), + 'U_TOPIC_AUTHOR' => get_username_string('profile', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), 'U_VIEW_TOPIC' => $view_topic_url, 'U_MCP_REPORT' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports&mode=reports&f=' . $forum_id . '&t=' . $topic_id, true, $user->session_id), 'U_MCP_QUEUE' => $u_mcp_queue, diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 2898a1c20a..017992bbc9 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -893,22 +893,6 @@ while ($row = $db->sql_fetchrow($result)) } $poster_id = $row['poster_id']; - $poster = ($poster_id == ANONYMOUS) ? ((!empty($row['post_username'])) ? $row['post_username'] : $user->lang['GUEST']) : $row['username']; - - if ($view != 'show' || $post_id != $row['post_id']) - { - if ($row['foe']) - { - $rowset[$row['post_id']] = array( - 'foe' => true, - 'user_id' => $row['user_id'], - 'post_id' => $row['post_id'], - 'poster' => $poster, - ); - - continue; - } - } // Does post have an attachment? If so, add it to the list if ($row['post_attachment'] && $config['allow_attachments']) @@ -922,10 +906,13 @@ while ($row = $db->sql_fetchrow($result)) } $rowset[$row['post_id']] = array( + 'hide_post' => ($row['foe'] && ($view != 'show' || $post_id != $row['post_id'])) ? true : false, + 'post_id' => $row['post_id'], 'post_time' => $row['post_time'], - 'poster' => ($row['user_colour']) ? '' . $poster . '' : $poster, 'user_id' => $row['user_id'], + 'username' => $row['username'], + 'user_colour' => $row['user_colour'], 'topic_id' => $row['topic_id'], 'forum_id' => $row['forum_id'], 'post_subject' => $row['post_subject'], @@ -939,12 +926,14 @@ while ($row = $db->sql_fetchrow($result)) 'post_attachment' => $row['post_attachment'], 'post_approved' => $row['post_approved'], 'post_reported' => $row['post_reported'], + 'post_username' => $row['post_username'], 'post_text' => $row['post_text'], 'bbcode_uid' => $row['bbcode_uid'], 'bbcode_bitfield' => $row['bbcode_bitfield'], 'enable_smilies' => $row['enable_smilies'], 'enable_sig' => $row['enable_sig'], 'friend' => $row['friend'], + 'foe' => $row['foe'], ); // Define the global bbcode bitfield, will be used to load bbcodes @@ -989,7 +978,6 @@ while ($row = $db->sql_fetchrow($result)) 'yim' => '', 'jabber' => '', 'search' => '', - 'username' => ($row['user_colour']) ? '' . $poster . '' : $poster, 'age' => '', 'warnings' => 0, @@ -1033,7 +1021,6 @@ while ($row = $db->sql_fetchrow($result)) 'yim' => ($row['user_yim']) ? 'http://edit.yahoo.com/config/send_webmesg?.target=' . $row['user_yim'] . '&.src=pg' : '', 'jabber' => ($row['user_jabber']) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=contact&action=jabber&u=$poster_id") : '', 'search' => ($auth->acl_get('u_search')) ? append_sid("{$phpbb_root_path}search.$phpEx", 'search_author=' . urlencode($row['username']) .'&showresults=posts') : '', - 'username' => ($row['user_colour']) ? '' . $poster . '' : $poster ); if ($row['user_avatar'] && $user->optionget('viewavatars')) @@ -1242,19 +1229,6 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) $row =& $rowset[$post_list[$i]]; $poster_id = $row['user_id']; - // Two situations can prevent a post being display: - // i) The poster is on the users ignore list - // ii) The post was made in a codepage different from the users - if (!empty($row['foe'])) - { - $template->assign_block_vars('postrow', array( - 'S_IGNORE_POST' => true, - 'L_IGNORE_POST' => sprintf($user->lang['POST_BY_FOE'], $row['poster'], '', '')) - ); - - continue; - } - // End signature parsing, only if needed if ($user_cache[$poster_id]['sig'] && empty($user_cache[$poster_id]['sig_parsed'])) { @@ -1321,7 +1295,6 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) $result2 = $db->sql_query($sql); while ($user_edit_row = $db->sql_fetchrow($result2)) { - $user_edit_row['username'] = ($user_edit_row['user_colour']) ? '' . $user_edit_row['username'] . '' : $user_edit_row['username']; $post_edit_list[$user_edit_row['user_id']] = $user_edit_row; } $db->sql_freeresult($result2); @@ -1334,8 +1307,9 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) if ($row['post_edit_reason']) { $user_edit_row = $post_edit_list[$row['post_edit_user']]; + $display_username = (!$row['post_edit_user']) ? get_username_string('full', $poster_id, $row['username'], $row['user_colour'], $row['post_username']) : get_username_string('full', $row['post_edit_user'], $user_edit_row['username'], $user_edit_row['user_colour']); - $l_edited_by = sprintf($l_edit_time_total, (!$row['post_edit_user']) ? $row['poster'] : $user_edit_row['username'], $user->format_date($row['post_edit_time']), $row['post_edit_count']); + $l_edited_by = sprintf($l_edit_time_total, $display_username, $user->format_date($row['post_edit_time']), $row['post_edit_count']); } else { @@ -1344,7 +1318,8 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) $user_cache[$row['post_edit_user']] = $post_edit_list[$row['post_edit_user']]; } - $l_edited_by = sprintf($l_edit_time_total, (!$row['post_edit_user']) ? $row['poster'] : $user_cache[$row['post_edit_user']]['username'], $user->format_date($row['post_edit_time']), $row['post_edit_count']); + $display_username = (!$row['post_edit_user']) ? get_username_string('full', $poster_id, $row['username'], $row['user_colour'], $row['post_username']) : get_username_string('full', $row['post_edit_user'], $user_cache[$row['post_edit_user']]['username'], $user_cache[$row['post_edit_user']]['user_colour']); + $l_edited_by = sprintf($l_edit_time_total, $display_username, $user->format_date($row['post_edit_time']), $row['post_edit_count']); } } else @@ -1383,7 +1358,11 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) // $postrow = array( - 'POSTER_NAME' => $row['poster'], + 'POST_AUTHOR_FULL' => get_username_string('full', $poster_id, $row['username'], $row['user_colour'], $row['post_username']), + 'POST_AUTHOR_COLOUR' => get_username_string('colour', $poster_id, $row['username'], $row['user_colour'], $row['post_username']), + 'POST_AUTHOR' => get_username_string('username', $poster_id, $row['username'], $row['user_colour'], $row['post_username']), + 'U_POST_AUTHOR' => get_username_string('profile', $poster_id, $row['username'], $row['user_colour'], $row['post_username']), + 'POSTER_RANK' => $user_cache[$poster_id]['rank_title'], 'RANK_IMAGE' => $user_cache[$poster_id]['rank_image'], 'RANK_IMAGE_SRC' => $user_cache[$poster_id]['rank_image_src'], @@ -1444,7 +1423,10 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) 'S_FRIEND' => ($row['friend']) ? true : false, 'S_UNREAD_POST' => $post_unread, 'S_FIRST_UNREAD' => $s_first_unread, - 'S_CUSTOM_FIELDS' => (isset($cp_row['row']) && sizeof($cp_row['row'])) ? true : false + 'S_CUSTOM_FIELDS' => (isset($cp_row['row']) && sizeof($cp_row['row'])) ? true : false, + + 'S_IGNORE_POST' => ($row['hide_post']) ? true : false, + 'L_IGNORE_POST' => ($row['hide_post']) ? sprintf($user->lang['POST_BY_FOE'], get_username_string('full', $poster_id, $row['username'], $row['user_colour'], $row['post_username']), '', '') : '', ); if (isset($cp_row['row']) && sizeof($cp_row['row']))
{L_AUTHOR}: {postrow.POSTER_NAME} [ {postrow.POST_DATE} ] style="color: {postrow.POST_AUTHOR_COLOUR}">{postrow.POST_AUTHOR} [ {postrow.POST_DATE} ]
{L_POST_SUBJECT}: