diff --git a/phpBB/index.php b/phpBB/index.php index 9718cbe07b..8aa06f3a98 100644 --- a/phpBB/index.php +++ b/phpBB/index.php @@ -45,7 +45,7 @@ if ($mark_read == 'forums') 'META' => '') ); - $message = $user->lang['Forums_marked_read'] . '

' . sprintf($user->lang['Click_return_index'], '', ' '); + $message = $user->lang['Forums_marked_read'] . '

' . sprintf($user->lang['RETURN_INDEX'], '', ' '); trigger_error($message); } @@ -98,6 +98,15 @@ else $l_total_topic_s = $user->lang['Posted_topics_total']; } + + +$sql = "SELECT group_name, group_colour + FROM " . GROUPS_TABLE . " + WHERE group_colour <> ''"; +$result = $db->sql_query($sql, 300); + + + $template->assign_vars(array( 'TOTAL_POSTS' => sprintf($l_total_post_s, $total_posts), 'TOTAL_USERS' => sprintf($l_total_user_s, $total_users), diff --git a/phpBB/language/en/lang_main.php b/phpBB/language/en/lang_main.php index dca8383ec3..59cf9ccbdf 100644 --- a/phpBB/language/en/lang_main.php +++ b/phpBB/language/en/lang_main.php @@ -506,6 +506,7 @@ $lang = array( 'ACTIVE_IN_FORUM' => 'Most active forum', 'ACTIVE_IN_TOPIC' => 'Most active topic', 'SEARCH_USER_POSTS' => 'Search users posts', + 'VISITED' => 'Last visited', 'Preferences' => 'Preferences', diff --git a/phpBB/memberlist.php b/phpBB/memberlist.php index 3ec2c2aecc..db565c4b25 100644 --- a/phpBB/memberlist.php +++ b/phpBB/memberlist.php @@ -233,134 +233,12 @@ if ($mode != 'viewprofile') $i = 0; do { - $username = $row['username']; - $user_id = intval($row['user_id']); - - $from = (!empty($row['user_from'])) ? $row['user_from'] : ' '; - $joined = $user->format_date($row['user_regdate'], $user->lang['DATE_FORMAT']); - $posts = ($row['user_posts']) ? $row['user_posts'] : 0; - - $poster_avatar = ''; - if ($row['user_avatar_type'] && $user_id && $row['user_allowavatar']) - { - switch($row['user_avatar_type']) - { - case USER_AVATAR_UPLOAD: - $poster_avatar = ($config['allow_avatar_upload']) ? '' : ''; - break; - - case USER_AVATAR_REMOTE: - $poster_avatar = ($config['allow_avatar_remote']) ? '' : ''; - break; - - case USER_AVATAR_GALLERY: - $poster_avatar = ($config['allow_avatar_local']) ? '' : ''; - break; - } - } - - $rank_title = $rank_img = ''; - foreach ($ranksrow as $rank) - { - if (empty($row['user_rank']) && $row['user_posts'] >= $rank['rank_min']) - { - $rank_title = $rank['rank_title']; - $rank_img = (!empty($rank['rank_image'])) ? '' . $rank_title . '
' : ''; - break; - } - - if (!empty($rank['rank_special']) && $row['user_rank'] == $rank['rank_id']) - { - $rank_title = $rank['rank_title']; - $rank_img = (!empty($rank['rank_image'])) ? '' . $rank_title . '
' : ''; - break; - } - } - - if ($row['user_viewemail'] || $auth->acl_get('a_')) - { - $email_uri = ($config['board_email_form']) ? "ucp.$phpEx$SID&mode=email&u=" . $user_id : 'mailto:' . $row['user_email']; - - $email_img = '' . $user->img('icon_email', $user->lang['Send_email']) . ''; - $email = '' . $user->lang['Send_email'] . ''; - } - else - { - $email_img = ' '; - $email = ' '; - } - - $temp_url = "memberlist.$phpEx$SID&mode=viewprofile&u=$user_id"; - $profile_img = '' . $user->img('icon_profile', $user->lang['Read_profile']) . ''; - $profile = '' . $user->lang['Read_profile'] . ''; - - $temp_url = "ucp.$phpEx$SID&mode=pm&action=send&u=$user_id"; - $pm_img = '' . $user->img('icon_pm', $user->lang['Send_private_message']) . ''; - $pm = '' . $user->lang['Send_private_message'] . ''; - - $www_img = ($row['user_website']) ? '' . $user->img('icon_www', $user->lang['Visit_website']) . '' : ''; - $www = ($row['user_website']) ? '' . $user->lang['Visit_website'] . '' : ''; - - if (!empty($row['user_icq'])) - { - $icq_status_img = ''; - $icq_img = '' . $user->img('icon_icq', $user->lang['ICQ']) . ''; - $icq = '' . $user->lang['ICQ'] . ''; - } - else - { - $icq_status_img = ''; - $icq_img = ''; - $icq = ''; - } - - $aim_img = ($row['user_aim']) ? '' . $user->img('icon_aim', $user->lang['AIM']) . '' : ''; - $aim = ($row['user_aim']) ? '' . $user->lang['AIM'] . '' : ''; - - $temp_url = "ucp.$phpEx$SID&mode=viewprofile&u=$user_id"; - $msn_img = ($row['user_msnm']) ? '' . $user->img('icon_msnm', $user->lang['MSNM']) . '' : ''; - $msn = ($row['user_msnm']) ? '' . $user->lang['MSNM'] . '' : ''; - - $yim_img = ($row['user_yim']) ? '' . $user->img('icon_yim', $user->lang['YIM']) . '' : ''; - $yim = ($row['user_yim']) ? '' . $user->lang['YIM'] . '' : ''; - - $temp_url = "search.$phpEx$SID&search_author=" . urlencode($username) . "&showresults=posts"; - $search_img = '' . $user->img('icon_search', $user->lang['Search_user_posts']) . ''; - $search = '' . $user->lang['Search_user_posts'] . ''; - - $template->assign_block_vars('memberrow', array( + $template->assign_block_vars('memberrow', array_merge(show_profile($row), array( 'ROW_NUMBER' => $i + ($start + 1), - 'USERNAME' => $username, - 'FROM' => $from, - 'JOINED' => $joined, - 'POSTS' => $posts, - 'AVATAR_IMG' => $poster_avatar, - 'PROFILE_IMG' => $profile_img, - 'PROFILE' => $profile, - 'SEARCH_IMG' => $search_img, - 'SEARCH' => $search, - 'PM_IMG' => $pm_img, - 'PM' => $pm, - 'EMAIL_IMG' => $email_img, - 'EMAIL' => $email, - 'WWW_IMG' => $www_img, - 'WWW' => $www, - 'ICQ_STATUS_IMG'=> $icq_status_img, - 'ICQ_IMG' => $icq_img, - 'ICQ' => $icq, - 'AIM_IMG' => $aim_img, - 'AIM' => $aim, - 'MSN_IMG' => $msn_img, - 'MSN' => $msn, - 'YIM_IMG' => $yim_img, - 'YIM' => $yim, - 'ACTIVE' => $row['user_last_active'], - 'RANK_TITLE' => $rank, - 'RANK_IMG' => $rank_img, 'S_ROW_COUNT' => $i, - 'U_VIEWPROFILE' => "memberlist.$phpEx$SID&mode=viewprofile&u=$user_id") + 'U_VIEWPROFILE' => "memberlist.$phpEx$SID&mode=viewprofile&u=" . $row['user_id'])) ); $i++; @@ -400,7 +278,7 @@ else // Do the SQL thang - $sql = "SELECT username, user_id, user_viewemail, user_posts, user_regdate, user_rank, user_from, user_website, user_email, user_icq, user_aim, user_yim, user_msnm, user_avatar, user_avatar_type, user_allowavatar, user_lastvisit + $sql = "SELECT username, user_id, user_viewemail, user_posts, user_regdate, user_rank, user_from, user_occ, user_interests, user_website, user_email, user_icq, user_aim, user_yim, user_msnm, user_avatar, user_avatar_type, user_allowavatar, user_lastvisit FROM " . USERS_TABLE . " WHERE user_id = $user_id"; $result = $db->sql_query($sql); @@ -415,6 +293,7 @@ else FROM " . POSTS_TABLE . " p, " . FORUMS_TABLE . " f WHERE p.poster_id = $user_id AND f.forum_id = p.forum_id + AND f.enable_post_count = 1 GROUP BY f.forum_id, f.forum_name ORDER BY num_posts DESC LIMIT 1"; @@ -424,9 +303,11 @@ else $db->sql_freeresult($result); $sql = "SELECT t.topic_id, t.topic_title, COUNT(p.post_id) AS num_posts - FROM " . POSTS_TABLE . " p, " . TOPICS_TABLE . " t + FROM " . POSTS_TABLE . " p, " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f WHERE p.poster_id = $user_id AND t.topic_id = p.topic_id + AND f.forum_id = t.forum_id + AND f.enable_post_count = 1 GROUP BY t.topic_id, t.topic_title ORDER BY num_posts DESC LIMIT 1"; @@ -435,8 +316,7 @@ else $active_t_row = $db->sql_fetchrow($result); $db->sql_freeresult($result); - - + // Do the relevant calculations $memberdays = max(1, round((time() - $row['user_regdate'] ) / 86400)); $posts_per_day = $row['user_posts'] / $memberdays; $percentage = ($config['num_posts']) ? min(100, ($row['user_posts'] / $config['num_posts']) * 100) : 0; @@ -461,29 +341,66 @@ else } unset($active_t_row); + $template->assign_vars(show_profile($row)); - $username = $row['username']; - $user_id = intval($row['user_id']); + $template->assign_vars(array( + 'USER_PROFILE' => sprintf($user->lang['VIEWING_PROFILE'], $row['username']), - $from = (!empty($row['user_from'])) ? $row['user_from'] : ' '; - $joined = $user->format_date($row['user_regdate'], $user->lang['DATE_FORMAT']); - $posts = ($row['user_posts']) ? $row['user_posts'] : 0; + 'POSTS_DAY' => sprintf($user->lang['POST_DAY'], $posts_per_day), + 'POSTS_PCT' => sprintf($user->lang['POST_PCT'], $percentage), + 'ACTIVE_FORUM' => $active_f_name, + 'ACTIVE_FORUM_POSTS'=> ($active_f_count == 1) ? sprintf($user->lang['USER_POST'], 1) : sprintf($user->lang['USER_POSTS'], $active_f_count), + 'ACTIVE_FORUM_PCT' => sprintf($user->lang['POST_PCT'], $active_f_pct), + 'ACTIVE_TOPIC' => $active_t_name, + 'ACTIVE_TOPIC_POSTS'=> ($active_t_count == 1) ? sprintf($user->lang['USER_POST'], 1) : sprintf($user->lang['USER_POSTS'], $active_t_count), + 'ACTIVE_TOPIC_PCT' => sprintf($user->lang['POST_PCT'], $active_t_pct), + + 'OCCUPATION' => (!empty($row['user_occ'])) ? $row['user_occ'] : '', + 'INTERESTS' => (!empty($row['user_interests'])) ? $row['user_interests'] : '', + + 'U_ACTIVE_FORUM' => "viewforum.$phpEx$SID&f=$active_f_id", + 'U_ACTIVE_TOPIC' => "viewtopic.$phpEx$SID&t=$active_t_id",) + ); +} + +// Output the page +$page_title = ($mode != 'viewprofile') ? $user->lang['MEMBERLIST'] : sprintf($user->lang['VIEWING_PROFILE'], $row['username']); +include($phpbb_root_path . 'includes/page_header.'.$phpEx); + +$template->set_filenames(array( + 'body' => ($mode != 'viewprofile') ? 'memberlist_body.html' : 'memberlist_view.html') +); +make_jumpbox('viewforum.'.$phpEx); + +include($phpbb_root_path . 'includes/page_tail.'.$phpEx); + + +// --------- +// FUNCTIONS +// +function show_profile($data) +{ + global $config, $auth, $template, $user, $phpEx; + global $ranksrow; + + $username = $data['username']; + $user_id = $data['user_id']; $poster_avatar = ''; - if ($row['user_avatar_type'] && $row['user_allowavatar']) + if (isset($data['user_avatar_type']) && $user_id && !empty($data['user_allowavatar'])) { - switch($row['user_avatar_type']) + switch($data['user_avatar_type']) { case USER_AVATAR_UPLOAD: - $poster_avatar = ($config['allow_avatar_upload']) ? '' : ''; + $poster_avatar = ($config['allow_avatar_upload']) ? '' : ''; break; case USER_AVATAR_REMOTE: - $poster_avatar = ($config['allow_avatar_remote']) ? '' : ''; + $poster_avatar = ($config['allow_avatar_remote']) ? '' : ''; break; case USER_AVATAR_GALLERY: - $poster_avatar = ($config['allow_avatar_local']) ? '' : ''; + $poster_avatar = ($config['allow_avatar_local']) ? '' : ''; break; } } @@ -491,14 +408,14 @@ else $rank_title = $rank_img = ''; foreach ($ranksrow as $rank) { - if (empty($row['user_rank']) && $row['user_posts'] >= $rank['rank_min']) + if (empty($data['user_rank']) && $data['user_posts'] >= $rank['rank_min']) { $rank_title = $rank['rank_title']; $rank_img = (!empty($rank['rank_image'])) ? '' . $rank_title . '
' : ''; break; } - if (!empty($rank['rank_special']) && $row['user_rank'] == $rank['rank_id']) + if (!empty($rank['rank_special']) && $data['user_rank'] == $rank['rank_id']) { $rank_title = $rank['rank_title']; $rank_img = (!empty($rank['rank_image'])) ? '' . $rank_title . '
' : ''; @@ -506,35 +423,35 @@ else } } - if ($row['user_viewemail'] || $auth->acl_get('a_')) + if (!empty($data['user_viewemail']) || $auth->acl_get('a_')) { $email_uri = ($config['board_email_form']) ? "ucp.$phpEx$SID&mode=email&u=" . $user_id : 'mailto:' . $row['user_email']; - $email_img = '' . $user->img('icon_email', $user->lang['Send_email']) . ''; - $email = '' . $user->lang['Send_email'] . ''; + $email_img = '' . $user->img('icon_email', $user->lang['EMAIL']) . ''; + $email = '' . $user->lang['EMAIL'] . ''; } else { - $email_img = ' '; - $email = ' '; + $email_img = ''; + $email = ''; } - $temp_url = "ucp.$phpEx$SID&mode=viewprofile&u=$user_id"; - $profile_img = '' . $user->img('icon_profile', $user->lang['Read_profile']) . ''; - $profile = '' . $user->lang['Read_profile'] . ''; + $temp_url = "memberlist.$phpEx$SID&mode=viewprofile&u=$user_id"; + $profile_img = '' . $user->img('icon_profile', $user->lang['PROFILE']) . ''; + $profile = '' . $user->lang['PROFILE'] . ''; $temp_url = "ucp.$phpEx$SID&mode=pm&action=send&u=$user_id"; - $pm_img = '' . $user->img('icon_pm', $user->lang['Send_private_message']) . ''; - $pm = '' . $user->lang['Send_private_message'] . ''; + $pm_img = '' . $user->img('icon_pm', $user->lang['MESSAGE']) . ''; + $pm = '' . $user->lang['MESSAGE'] . ''; - $www_img = ($row['user_website']) ? '' . $user->img('icon_www', $user->lang['Visit_website']) . '' : ''; - $www = ($row['user_website']) ? '' . $user->lang['Visit_website'] . '' : ''; + $www_img = (!empty($data['user_website'])) ? '' . $user->img('icon_www', $user->lang['WWW']) . '' : ''; + $www = (!empty($data['user_website'])) ? '' . $user->lang['WWW'] . '' : ''; if (!empty($row['user_icq'])) { - $icq_status_img = ''; - $icq_img = '' . $user->img('icon_icq', $user->lang['ICQ']) . ''; - $icq = '' . $user->lang['ICQ'] . ''; + $icq_status_img = ''; + $icq_img = '' . $user->img('icon_icq', $user->lang['ICQ']) . ''; + $icq = '' . $user->lang['ICQ'] . ''; } else { @@ -543,35 +460,31 @@ else $icq = ''; } - $aim_img = ($row['user_aim']) ? '' . $user->img('icon_aim', $user->lang['AIM']) . '' : ''; - $aim = ($row['user_aim']) ? '' . $user->lang['AIM'] . '' : ''; + $aim_img = (!empty($row['user_aim'])) ? '' . $user->img('icon_aim', $user->lang['AIM']) . '' : ''; + $aim = (!empty($row['user_aim'])) ? '' . $user->lang['AIM'] . '' : ''; $temp_url = "ucp.$phpEx$SID&mode=viewprofile&u=$user_id"; - $msn_img = ($row['user_msnm']) ? '' . $user->img('icon_msnm', $user->lang['MSNM']) . '' : ''; - $msn = ($row['user_msnm']) ? '' . $user->lang['MSNM'] . '' : ''; + $msn_img = (!empty($data['user_msnm'])) ? '' . $user->img('icon_msnm', $user->lang['MSNM']) . '' : ''; + $msn = (!empty($data['user_msnm'])) ? '' . $user->lang['MSNM'] . '' : ''; - $yim_img = ($row['user_yim']) ? '' . $user->img('icon_yim', $user->lang['YIM']) . '' : ''; - $yim = ($row['user_yim']) ? '' . $user->lang['YIM'] . '' : ''; + $yim_img = (!empty($data['user_yim'])) ? '' . $user->img('icon_yim', $user->lang['YIM']) . '' : ''; + $yim = (!empty($data['user_yim'])) ? '' . $user->lang['YIM'] . '' : ''; - $template->assign_vars(array( - 'USER_PROFILE' => sprintf($user->lang['VIEWING_PROFILE'], $username), + $temp_url = "search.$phpEx$SID&search_author=" . urlencode($username) . "&showresults=posts"; + $search_img = '' . $user->img('icon_search', $user->lang['SEARCH']) . ''; + $search = '' . $user->lang['SEARCH'] . ''; + + $template_vars = array( + 'USERNAME' => $username, + 'ONLINE_IMG' => ($data['user_lastvisit'] >= time() - 600) ? 'yes' : 'no', 'AVATAR_IMG' => $poster_avatar, - 'RANK_TITLE' => $rank, + 'RANK_TITLE' => $rank_title, 'RANK_IMG' => $rank_img, - 'JOINED' => $joined, - 'POSTS' => $posts, - 'POSTS_DAY' => sprintf($user->lang['POST_DAY'], $posts_per_day), - 'POSTS_PCT' => sprintf($user->lang['POST_PCT'], $percentage), - - 'ACTIVE_FORUM' => $active_f_name, - 'ACTIVE_FORUM_POSTS'=> ($active_f_count == 1) ? sprintf($user->lang['USER_POST'], 1) : sprintf($user->lang['USER_POSTS'], $active_f_count), - 'ACTIVE_FORUM_PCT' => sprintf($user->lang['POST_PCT'], $active_f_pct), - - 'ACTIVE_TOPIC' => $active_t_name, - 'ACTIVE_TOPIC_POSTS'=> ($active_t_count == 1) ? sprintf($user->lang['USER_POST'], 1) : sprintf($user->lang['USER_POSTS'], $active_t_count), - 'ACTIVE_TOPIC_PCT' => sprintf($user->lang['POST_PCT'], $active_t_pct), + 'JOINED' => $user->format_date($data['user_regdate'], $user->lang['DATE_FORMAT']), + 'VISITED' => $user->format_date($data['user_lastvisit'], $user->lang['DATE_FORMAT']), + 'POSTS' => ($data['user_posts']) ? $data['user_posts'] : 0, 'PM_IMG' => $pm_img, 'PM' => $pm, @@ -587,26 +500,13 @@ else 'MSN_IMG' => $msn_img, 'MSN' => $msn, 'YIM_IMG' => $yim_img, - 'YIM' => $yim, - - 'LOCATION' => ($row['user_from']) ? $row['user_from'] : '', - 'OCCUPATION' => ($row['user_occ']) ? $row['user_occ'] : '', - 'INTERESTS' => ($row['user_interests']) ? $row['user_interests'] : '', - - 'U_ACTIVE_FORUM' => "viewforum.$phpEx$SID&f=$active_f_id", - 'U_ACTIVE_TOPIC' => "viewtopic.$phpEx$SID&t=$active_t_id",) + 'YIM' => $yim ); + + return $template_vars; } - -// Output the page -$page_title = $user->lang['Memberlist']; -include($phpbb_root_path . 'includes/page_header.'.$phpEx); - -$template->set_filenames(array( - 'body' => ($mode != 'viewprofile') ? 'memberlist_body.html' : 'memberslist_view.html') -); -make_jumpbox('viewforum.'.$phpEx); - -include($phpbb_root_path . 'includes/page_tail.'.$phpEx); +// +// FUNCTIONS +// --------- ?> \ No newline at end of file diff --git a/phpBB/templates/subSilver/memberlist_view.html b/phpBB/templates/subSilver/memberlist_view.html new file mode 100644 index 0000000000..a2c31cf0cc --- /dev/null +++ b/phpBB/templates/subSilver/memberlist_view.html @@ -0,0 +1,109 @@ + + + + + + +
{L_INDEX}
+ + + + + + + + + + + + + + + + + + + + + +
{USER_PROFILE}
{L_USER_PRESENCE}{L_USER_FORUM}
{AVATAR_IMG}
{RANK_IMG}{RANK_TITLE}
+ + + + + + + + + + + + + + + + + + + + +
{L_JOINED}: {JOINED}
{L_VISITED}: {VISITED}
{L_TOTAL_POSTS}: {POSTS}
[{POSTS_PCT} / {POSTS_DAY}]
{L_SEARCH_USER_POSTS}
{POSTS}
{L_ACTIVE_IN_FORUM}: {ACTIVE_FORUM}
[ {ACTIVE_FORUM_POSTS} / {ACTIVE_FORUM_PCT} ]-
{L_ACTIVE_IN_TOPIC}: {ACTIVE_TOPIC}
[ {ACTIVE_TOPIC_POSTS} / {ACTIVE_TOPIC_PCT} ]-
{L_CONTACT_USER}{L_ABOUT_USER}
+ + + + + + + + + + + + + + + + + + + + + + + + +
{L_EMAIL_ADDRESS}: {EMAIL_IMG}
{L_PM}: {PM_IMG}
{L_MSNM}: {MSN}
{L_YIM}: {YIM_IMG}
{L_AIM}: {AIM_IMG}
{L_ICQ}:
+ + + + + + + + + + + + + + + + +
{L_LOCATION}: {LOCATION}
{L_OCCUPATION}: {OCCUPATION}
{L_INTERESTS}: {INTERESTS}
{L_WEBSITE}: {WWW}
+ +
+ + + + + +
+ + \ No newline at end of file diff --git a/phpBB/templates/subSilver/viewforum_body.html b/phpBB/templates/subSilver/viewforum_body.html index e51be9e522..269e5f88d4 100644 --- a/phpBB/templates/subSilver/viewforum_body.html +++ b/phpBB/templates/subSilver/viewforum_body.html @@ -130,6 +130,7 @@ +
diff --git a/phpBB/templates/subSilver/viewtopic_body.html b/phpBB/templates/subSilver/viewtopic_body.html index e1926b7356..920540eb72 100644 --- a/phpBB/templates/subSilver/viewtopic_body.html +++ b/phpBB/templates/subSilver/viewtopic_body.html @@ -175,6 +175,7 @@ +
diff --git a/phpBB/viewonline.php b/phpBB/viewonline.php index f222d697a2..1154bafc92 100644 --- a/phpBB/viewonline.php +++ b/phpBB/viewonline.php @@ -200,7 +200,7 @@ while ($row = $db->sql_fetchrow($result)) 'S_ROW_COUNT' => $$which_counter, - 'U_USER_PROFILE' => "ucp.$phpEx$SID&mode=viewprofile&u=" . $user_id, + 'U_USER_PROFILE' => "memberlist.$phpEx$SID&mode=viewprofile&u=" . $user_id, 'U_FORUM_LOCATION' => $location_url) ); diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index cf04a62f1a..534baaa503 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -251,7 +251,7 @@ if (isset($_GET['hilit'])) { if (trim($word) != '') { - $highlight_match .= (($highlight_match != '') ? '|' : '') . str_replace('*', '\w*', preg_quote($word, '#')); + $highlight_match .= (($highlight_match != '') ? '|' : '') . str_replace('*', '\w*?', preg_quote($word, '#')); } } unset($words);