diff options
Diffstat (limited to 'phpBB')
| -rw-r--r-- | phpBB/includes/functions_display.php | 2 | ||||
| -rw-r--r-- | phpBB/index.php | 2 | ||||
| -rw-r--r-- | phpBB/language/en/lang_main.php | 28 | ||||
| -rw-r--r-- | phpBB/memberlist.php | 715 | ||||
| -rw-r--r-- | phpBB/templates/subSilver/memberslist_view.html | 105 | ||||
| -rw-r--r-- | phpBB/viewforum.php | 5 | ||||
| -rw-r--r-- | phpBB/viewtopic.php | 40 |
7 files changed, 610 insertions, 287 deletions
diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 08bc192c50..599394c8e3 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -176,7 +176,7 @@ function display_forums($root_data = '', $display_moderators = TRUE) { $last_post = $user->format_date($row['forum_last_post_time']) . '<br />'; - $last_post .= ($row['forum_last_poster_id'] == ANONYMOUS) ? (($row['forum_last_poster_name'] != '') ? $row['forum_last_poster_name'] . ' ' : $user->lang['GUEST'] . ' ') : '<a href="ucp.' . $phpEx . $SID . '&mode=viewprofile&u=' . $row['forum_last_poster_id'] . '">' . $row['forum_last_poster_name'] . '</a> '; + $last_post .= ($row['forum_last_poster_id'] == ANONYMOUS) ? (($row['forum_last_poster_name'] != '') ? $row['forum_last_poster_name'] . ' ' : $user->lang['GUEST'] . ' ') : "<a href=\"memberlist.$phpEx$SID&mode=viewprofile&u=" . $row['forum_last_poster_id'] . '">' . $row['forum_last_poster_name'] . '</a> '; $last_post .= '<a href="viewtopic.' . $phpEx . $SID . '&f=' . $row['forum_id'] . '&p=' . $row['forum_last_post_id'] . '#' . $row['forum_last_post_id'] . '">' . $user->img('goto_post_latest', 'VIEW_LATEST_POST') . '</a>'; } diff --git a/phpBB/index.php b/phpBB/index.php index 1516d89843..9718cbe07b 100644 --- a/phpBB/index.php +++ b/phpBB/index.php @@ -101,7 +101,7 @@ else $template->assign_vars(array( 'TOTAL_POSTS' => sprintf($l_total_post_s, $total_posts), 'TOTAL_USERS' => sprintf($l_total_user_s, $total_users), - 'NEWEST_USER' => sprintf($user->lang['Newest_user'], '<a href="ucp.' . $phpEx . $SID . '&mode=viewprofile&u=' . $newest_uid . '">', $newest_user, '</a>'), + 'NEWEST_USER' => sprintf($user->lang['Newest_user'], "<a href=\"memberlist.$phpEx$SID&mode=viewprofile&u=$newest_uid \">", $newest_user, '</a>'), 'FORUM_IMG' => $user->img('forum', 'NO_NEW_POSTS'), 'FORUM_NEW_IMG' => $user->img('forum_new', 'NEW_POSTS'), diff --git a/phpBB/language/en/lang_main.php b/phpBB/language/en/lang_main.php index 7ae4197e8d..754b16e335 100644 --- a/phpBB/language/en/lang_main.php +++ b/phpBB/language/en/lang_main.php @@ -489,9 +489,24 @@ $lang = array_merge($lang, array( 'Savebox_size' => 'Your Savebox is %d%% full', 'Click_view_privmsg' => 'Click %sHere%s to visit your Inbox', + 'NO_USER' => 'No user found', + + 'VIEWING_PROFILE' => 'Viewing profile of %s', + 'ABOUT_USER' => 'Profile', + 'CONTACT_USER' => 'Contact', + 'USER_FORUM' => 'Forum statistics', + 'USER_PRESENCE' => 'User presence', + + 'USER_POST' => '%d Post', + 'USER_POSTS' => '%d Posts', + 'POST_PCT' => '%.2f%% of total', + 'POST_DAY' => '%.2f posts per day', + 'TOTAL_POSTS' => 'Total posts', + 'ACTIVE_IN_FORUM' => 'Most active forum', + 'ACTIVE_IN_TOPIC' => 'Most active topic', + 'SEARCH_USER_POSTS' => 'Search users posts', + - 'Viewing_user_profile' => 'Viewing profile :: %s', - 'About_user' => 'All about %s', 'Preferences' => 'Preferences', 'Items_required' => 'Items marked with a * are required unless stated otherwise', 'Registration_info' => 'Registration Information', @@ -504,12 +519,9 @@ $lang = array_merge($lang, array( 'CONTACT' => 'Contact', 'EMAIL_ADDRESS' => 'Email address', 'SEND_PRIVATE_MESSAGE' => 'Send private message', - 'Search_user_posts' => 'Find all posts by %s', - 'Interests' => 'Interests', - 'Occupation' => 'Occupation', - 'Total_posts' => 'Total posts', - 'User_post_pct_stats' => '%.2f%% of total', - 'User_post_day_stats' => '%.2f posts per day', + 'INTERESTS' => 'Interests', + 'OCCUPATION' => 'Occupation', + 'No_user_id_specified' => 'Sorry but that user does not exist', 'Wrong_Profile' => 'You cannot modify a profile that is not your own.', 'Only_one_avatar' => 'Only one type of avatar can be specified', diff --git a/phpBB/memberlist.php b/phpBB/memberlist.php index aaf8883aa5..3ec2c2aecc 100644 --- a/phpBB/memberlist.php +++ b/phpBB/memberlist.php @@ -40,6 +40,7 @@ if (!$auth->acl_gets('u_viewprofile', 'a_')) // Grab data $mode = (isset($_REQUEST['mode'])) ? $_REQUEST['mode'] : ''; +$user_id = (isset($_GET['u'])) ? intval($_GET['u']) : ANONYMOUS; $start = (isset($_GET['start'])) ? intval($_GET['start']) : 0; $form = (!empty($_GET['form'])) ? $_GET['form'] : 0; @@ -78,323 +79,531 @@ while ($row = $db->sql_fetchrow($result)) $db->sql_freeresult($result); -// Memberlist sorting -$sort_key_text = array('a' => $user->lang['SORT_USERNAME'], 'b' => $user->lang['SORT_LOCATION'], 'c' => $user->lang['SORT_JOINED'], 'd' => $user->lang['SORT_POST_COUNT'], 'e' => $user->lang['SORT_EMAIL'], 'f' => $user->lang['WEBSITE'], 'g' => $user->lang['ICQ'], 'h' => $user->lang['AIM'], 'i' => $user->lang['MSNM'], 'j' => $user->lang['YIM'], 'k' => $user->lang['SORT_LAST_ACTIVE']); -$sort_key_sql = array('a' => 'username', 'b' => 'user_from', 'c' => 'user_regdate', 'd' => 'user_posts', 'e' => 'user_email', 'f' => 'user_website', 'g' => 'user_icq', 'h' => 'user_aim', 'i' => 'user_msnm', 'j' => 'user_yim', 'k' => 'user_lastvisit'); - -$sort_dir_text = array('a' => $user->lang['ASCENDING'], 'd' => $user->lang['DESCENDING']); - -$s_sort_key = '<select name="sk">'; -foreach ($sort_key_text as $key => $value) +if ($mode != 'viewprofile') { - $selected = ($sort_key == $key) ? ' selected="selected"' : ''; - $s_sort_key .= '<option value="' . $key . '"' . $selected . '>' . $value . '</option>'; -} -$s_sort_key .= '</select>'; + // Memberlist sorting + $sort_key_text = array('a' => $user->lang['SORT_USERNAME'], 'b' => $user->lang['SORT_LOCATION'], 'c' => $user->lang['SORT_JOINED'], 'd' => $user->lang['SORT_POST_COUNT'], 'e' => $user->lang['SORT_EMAIL'], 'f' => $user->lang['WEBSITE'], 'g' => $user->lang['ICQ'], 'h' => $user->lang['AIM'], 'i' => $user->lang['MSNM'], 'j' => $user->lang['YIM'], 'k' => $user->lang['SORT_LAST_ACTIVE']); + $sort_key_sql = array('a' => 'username', 'b' => 'user_from', 'c' => 'user_regdate', 'd' => 'user_posts', 'e' => 'user_email', 'f' => 'user_website', 'g' => 'user_icq', 'h' => 'user_aim', 'i' => 'user_msnm', 'j' => 'user_yim', 'k' => 'user_lastvisit'); -$s_sort_dir = '<select name="sd">'; -foreach ($sort_dir_text as $key => $value) -{ - $selected = ($sort_dir == $key) ? ' selected="selected"' : ''; - $s_sort_dir .= '<option value="' . $key . '"' . $selected . '>' . $value . '</option>'; -} -$s_sort_dir .= '</select>'; + $sort_dir_text = array('a' => $user->lang['ASCENDING'], 'd' => $user->lang['DESCENDING']); + $s_sort_key = '<select name="sk">'; + foreach ($sort_key_text as $key => $value) + { + $selected = ($sort_key == $key) ? ' selected="selected"' : ''; + $s_sort_key .= '<option value="' . $key . '"' . $selected . '>' . $value . '</option>'; + } + $s_sort_key .= '</select>'; + $s_sort_dir = '<select name="sd">'; + foreach ($sort_dir_text as $key => $value) + { + $selected = ($sort_dir == $key) ? ' selected="selected"' : ''; + $s_sort_dir .= '<option value="' . $key . '"' . $selected . '>' . $value . '</option>'; + } + $s_sort_dir .= '</select>'; -// Additional sorting options for user search -$where_sql = ''; -if ($mode == 'searchuser') -{ - $find_key_match = array('lt' => '<', 'gt' => '>', 'eq' => '='); - $find_count = array('lt' => $user->lang['LESS_THAN'], 'eq' => $user->lang['EQUAL_TO'], 'gt' => $user->lang['MORE_THAN']); - $s_find_count = ''; - foreach ($find_count as $key => $value) + + // Additional sorting options for user search + $where_sql = ''; + if ($mode == 'searchuser') { - $selected = ($count_select == $key) ? ' selected="selected"' : ''; - $s_find_count .= '<option value="' . $key . '"' . $selected . '>' . $value . '</option>'; - } + $find_key_match = array('lt' => '<', 'gt' => '>', 'eq' => '='); + + $find_count = array('lt' => $user->lang['LESS_THAN'], 'eq' => $user->lang['EQUAL_TO'], 'gt' => $user->lang['MORE_THAN']); + $s_find_count = ''; + foreach ($find_count as $key => $value) + { + $selected = ($count_select == $key) ? ' selected="selected"' : ''; + $s_find_count .= '<option value="' . $key . '"' . $selected . '>' . $value . '</option>'; + } - $find_time = array('lt' => $user->lang['BEFORE'], 'gt' => $user->lang['AFTER']); - $s_find_join_time = ''; - foreach ($find_time as $key => $value) + $find_time = array('lt' => $user->lang['BEFORE'], 'gt' => $user->lang['AFTER']); + $s_find_join_time = ''; + foreach ($find_time as $key => $value) + { + $selected = ($joined_select == $key) ? ' selected="selected"' : ''; + $s_find_join_time .= '<option value="' . $key . '"' . $selected . '>' . $value . '</option>'; + } + + $s_find_active_time = ''; + foreach ($find_time as $key => $value) + { + $selected = ($active_select == $key) ? ' selected="selected"' : ''; + $s_find_active_time .= '<option value="' . $key . '"' . $selected . '>' . $value . '</option>'; + } + + $where_sql .= ($username) ? " AND username LIKE '" . str_replace('*', '%', $db->sql_escape($username)) ."'" : ''; + $where_sql .= ($email) ? " AND user_email LIKE '" . str_replace('*', '%', $db->sql_escape($email)) ."' " : ''; + $where_sql .= ($icq) ? " AND user_icq LIKE '" . str_replace('*', '%', $db->sql_escape($icq)) ."' " : ''; + $where_sql .= ($aim) ? " AND user_aim LIKE '" . str_replace('*', '%', $db->sql_escape($aim)) ."' " : ''; + $where_sql .= ($yahoo) ? " AND user_yim LIKE '" . str_replace('*', '%', $db->sql_escape($yahoo)) ."' " : ''; + $where_sql .= ($msn) ? " AND user_msnm LIKE '" . str_replace('*', '%', $db->sql_escape($msn)) ."' " : ''; + $where_sql .= ($joined) ? " AND user_regdate " . $find_key_match[$joined_select] . " " . gmmktime(0, 0, 0, intval($joined[1]), intval($joined[2]), intval($joined[0])) : ''; + $where_sql .= ($count) ? " AND user_posts " . $find_key_match[$count_select] . " $count " : ''; + $where_sql .= ($active) ? " AND user_lastvisit " . $find_key_match[$active_select] . " " . gmmktime(0, 0, 0, $active[1], intval($active[2]), intval($active[0])) : ''; + + if (!empty($ipdomain)) + { + $ips = (preg_match('#[a-z]#', $ipdomain)) ? implode(', ', preg_replace('#([0-9]{1,3}\.[0-9]{1,3}[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})#', "'\\1'", gethostbynamel($ipdomain))) : "'" . str_replace('*', '%', $ipdomain) . "'"; + + $sql = "SELECT DISTINCT poster_id + FROM " . POSTS_TABLE . " + WHERE poster_ip " . ((preg_match('#%#', $ips)) ? 'LIKE' : 'IN') . " ($ips)"; + $result = $db->sql_query($sql); + + if ($row = $db->sql_fetchrow($result)) + { + $ip_sql = ''; + do + { + $ip_sql .= (($ip_sql != '') ? ', ' : '') . $row['poster_id']; + } + while ($row = $db->sql_fetchrow($result)); + + $where_sql .= " AND user_id IN ($ip_sql)"; + } + else + { + // A minor fudge but it does the job :D + $where_sql .= " AND user_id IN ('-1')"; + } + } + } + else { - $selected = ($joined_select == $key) ? ' selected="selected"' : ''; - $s_find_join_time .= '<option value="' . $key . '"' . $selected . '>' . $value . '</option>'; + $where_sql = ' AND user_active = 1'; } - $s_find_active_time = ''; - foreach ($find_time as $key => $value) + // Sorting and order + $order_by = $sort_key_sql[$sort_key] . ' ' . (($sort_dir == 'a') ? 'ASC' : 'DESC'); + + // Count the users ... + $sql = "SELECT COUNT(user_id) AS total_users + FROM " . USERS_TABLE . " + WHERE user_id <> " . ANONYMOUS . " + $where_sql"; + $result = $db->sql_query($sql); + + $total_users = ($row = $db->sql_fetchrow($result)) ? $row['total_users'] : 0; + + // Pagination string + $pagination_url = ($mode == 'searchuser') ? "memberlist.$phpEx$SID&mode=searchuser&form=$form&field=$field&username=" . urlencode($username) . "&email=" . urlencode($email) . "&icq=$icq&aim=" . urlencode($aim) . "&yahoo=" . urlencode($yahoo) . "&msn=" . urlencode($msn) . "&joined=" . urlencode(implode('-', $joined)) . "&active=" . urlencode(implode('-', $active)) . "&count=$count&ip=" . urlencode($ipdomain) . "&sd=$sort_dir&sk=$sort_key&joined_select=$joined_select&active_select=$active_select&count_select=$count_select" : "memberlist.$phpEx$SID&mode=$mode&sk=$sort_key&sd=$sort_dir"; + + // Some search user specific data + if ($mode == 'searchuser') { - $selected = ($active_select == $key) ? ' selected="selected"' : ''; - $s_find_active_time .= '<option value="' . $key . '"' . $selected . '>' . $value . '</option>'; + $template->assign_vars(array( + 'USERNAME' => $username, + 'EMAIL' => $email, + 'ICQ' => $icq, + 'AIM' => $aim, + 'YAHOO' => $yahoo, + 'MSNM' => $msn, + 'JOINED' => implode('-', $joined), + 'ACTIVE' => implode('-', $active), + 'COUNT' => $count, + 'IP' => $ipdomain, + + 'S_SEARCH_USER' => true, + 'S_FORM_NAME' => $form, + 'S_FIELD_NAME' => $field, + 'S_COUNT_OPTIONS' => $s_find_count, + 'S_SORT_OPTIONS' => $s_sort_key, + 'S_USERNAME_OPTIONS' => $username_list, + 'S_JOINED_TIME_OPTIONS' => $s_find_join_time, + 'S_ACTIVE_TIME_OPTIONS' => $s_find_active_time, + 'S_SEARCH_ACTION' => "memberslist.$phpEx$SID&mode=searchuser&field=$field") + ); } - $where_sql .= ($username) ? " AND username LIKE '" . str_replace('*', '%', $db->sql_escape($username)) ."'" : ''; - $where_sql .= ($email) ? " AND user_email LIKE '" . str_replace('*', '%', $db->sql_escape($email)) ."' " : ''; - $where_sql .= ($icq) ? " AND user_icq LIKE '" . str_replace('*', '%', $db->sql_escape($icq)) ."' " : ''; - $where_sql .= ($aim) ? " AND user_aim LIKE '" . str_replace('*', '%', $db->sql_escape($aim)) ."' " : ''; - $where_sql .= ($yahoo) ? " AND user_yim LIKE '" . str_replace('*', '%', $db->sql_escape($yahoo)) ."' " : ''; - $where_sql .= ($msn) ? " AND user_msnm LIKE '" . str_replace('*', '%', $db->sql_escape($msn)) ."' " : ''; - $where_sql .= ($joined) ? " AND user_regdate " . $find_key_match[$joined_select] . " " . gmmktime(0, 0, 0, intval($joined[1]), intval($joined[2]), intval($joined[0])) : ''; - $where_sql .= ($count) ? " AND user_posts " . $find_key_match[$count_select] . " $count " : ''; - $where_sql .= ($active) ? " AND user_lastvisit " . $find_key_match[$active_select] . " " . gmmktime(0, 0, 0, $active[1], intval($active[2]), intval($active[0])) : ''; - - if (!empty($ipdomain)) + // 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 + FROM " . USERS_TABLE . " + WHERE user_id <> " . ANONYMOUS . " + $where_sql + ORDER BY $order_by + LIMIT $start, " . $config['topics_per_page']; + $result = $db->sql_query($sql); + + if ($row = $db->sql_fetchrow($result)) { - $ips = (preg_match('#[a-z]#', $ipdomain)) ? implode(', ', preg_replace('#([0-9]{1,3}\.[0-9]{1,3}[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})#', "'\\1'", gethostbynamel($ipdomain))) : "'" . str_replace('*', '%', $ipdomain) . "'"; + $i = 0; + do + { + $username = $row['username']; + $user_id = intval($row['user_id']); - $sql = "SELECT DISTINCT poster_id - FROM " . POSTS_TABLE . " - WHERE poster_ip " . ((preg_match('#%#', $ips)) ? 'LIKE' : 'IN') . " ($ips)"; - $result = $db->sql_query($sql); + $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; - if ($row = $db->sql_fetchrow($result)) - { - $ip_sql = ''; - do + $poster_avatar = ''; + if ($row['user_avatar_type'] && $user_id && $row['user_allowavatar']) { - $ip_sql .= (($ip_sql != '') ? ', ' : '') . $row['poster_id']; + switch($row['user_avatar_type']) + { + case USER_AVATAR_UPLOAD: + $poster_avatar = ($config['allow_avatar_upload']) ? '<img src="' . $config['avatar_path'] . '/' . $row['user_avatar'] . '" alt="" border="0" />' : ''; + break; + + case USER_AVATAR_REMOTE: + $poster_avatar = ($config['allow_avatar_remote']) ? '<img src="' . $row['user_avatar'] . '" alt="" border="0" />' : ''; + break; + + case USER_AVATAR_GALLERY: + $poster_avatar = ($config['allow_avatar_local']) ? '<img src="' . $config['avatar_gallery_path'] . '/' . $row['user_avatar'] . '" alt="" border="0" />' : ''; + break; + } } - while ($row = $db->sql_fetchrow($result)); - $where_sql .= " AND user_id IN ($ip_sql)"; - } - else - { - // A minor fudge but it does the job :D - $where_sql .= " AND user_id IN ('-1')"; + $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'])) ? '<img src="' . $rank['rank_image'] . '" border="0" alt="' . $rank_title . '" title="' . $rank_title . '" /><br />' : ''; + break; + } + + if (!empty($rank['rank_special']) && $row['user_rank'] == $rank['rank_id']) + { + $rank_title = $rank['rank_title']; + $rank_img = (!empty($rank['rank_image'])) ? '<img src="' . $rank['rank_image'] . '" border="0" alt="' . $rank_title . '" title="' . $rank_title . '" /><br />' : ''; + 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 = '<a href="' . $email_uri . '">' . $user->img('icon_email', $user->lang['Send_email']) . '</a>'; + $email = '<a href="' . $email_uri . '">' . $user->lang['Send_email'] . '</a>'; + } + else + { + $email_img = ' '; + $email = ' '; + } + + $temp_url = "memberlist.$phpEx$SID&mode=viewprofile&u=$user_id"; + $profile_img = '<a href="' . $temp_url . '">' . $user->img('icon_profile', $user->lang['Read_profile']) . '</a>'; + $profile = '<a href="' . $temp_url . '">' . $user->lang['Read_profile'] . '</a>'; + + $temp_url = "ucp.$phpEx$SID&mode=pm&action=send&u=$user_id"; + $pm_img = '<a href="' . $temp_url . '">' . $user->img('icon_pm', $user->lang['Send_private_message']) . '</a>'; + $pm = '<a href="' . $temp_url . '">' . $user->lang['Send_private_message'] . '</a>'; + + $www_img = ($row['user_website']) ? '<a href="' . $row['user_website'] . '" target="_userwww">' . $user->img('icon_www', $user->lang['Visit_website']) . '</a>' : ''; + $www = ($row['user_website']) ? '<a href="' . $row['user_website'] . '" target="_userwww">' . $user->lang['Visit_website'] . '</a>' : ''; + + if (!empty($row['user_icq'])) + { + $icq_status_img = '<a href="http://wwp.icq.com/' . $row['user_icq'] . '#pager"><img src="http://web.icq.com/whitepages/online?icq=' . $row['user_icq'] . '&img=5" width="18" height="18" border="0" /></a>'; + $icq_img = '<a href="http://wwp.icq.com/scripts/search.dll?to=' . $row['user_icq'] . '">' . $user->img('icon_icq', $user->lang['ICQ']) . '</a>'; + $icq = '<a href="http://wwp.icq.com/scripts/search.dll?to=' . $row['user_icq'] . '">' . $user->lang['ICQ'] . '</a>'; + } + else + { + $icq_status_img = ''; + $icq_img = ''; + $icq = ''; + } + + $aim_img = ($row['user_aim']) ? '<a href="aim:goim?screenname=' . $row['user_aim'] . '&message=Hello+Are+you+there?">' . $user->img('icon_aim', $user->lang['AIM']) . '</a>' : ''; + $aim = ($row['user_aim']) ? '<a href="aim:goim?screenname=' . $row['user_aim'] . '&message=Hello+Are+you+there?">' . $user->lang['AIM'] . '</a>' : ''; + + $temp_url = "ucp.$phpEx$SID&mode=viewprofile&u=$user_id"; + $msn_img = ($row['user_msnm']) ? '<a href="' . $temp_url . '">' . $user->img('icon_msnm', $user->lang['MSNM']) . '</a>' : ''; + $msn = ($row['user_msnm']) ? '<a href="' . $temp_url . '">' . $user->lang['MSNM'] . '</a>' : ''; + + $yim_img = ($row['user_yim']) ? '<a href="http://edit.yahoo.com/config/send_webmesg?.target=' . $row['user_yim'] . '&.src=pg">' . $user->img('icon_yim', $user->lang['YIM']) . '</a>' : ''; + $yim = ($row['user_yim']) ? '<a href="http://edit.yahoo.com/config/send_webmesg?.target=' . $row['user_yim'] . '&.src=pg">' . $user->lang['YIM'] . '</a>' : ''; + + $temp_url = "search.$phpEx$SID&search_author=" . urlencode($username) . "&showresults=posts"; + $search_img = '<a href="' . $temp_url . '">' . $user->img('icon_search', $user->lang['Search_user_posts']) . '</a>'; + $search = '<a href="' . $temp_url . '">' . $user->lang['Search_user_posts'] . '</a>'; + + $template->assign_block_vars('memberrow', 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") + ); + + $i++; } + while ($row = $db->sql_fetchrow($result)); } + + // Generate page + $template->assign_vars(array( + 'PAGINATION' => generate_pagination($pagination_url, $total_users, $config['topics_per_page'], $start), + 'PAGE_NUMBER' => on_page($total_users, $config['topics_per_page'], $start), + + 'U_FIND_MEMBER' => "memberlist.$phpEx$SID&mode=searchuser", + 'U_SORT_USERNAME' => "memberlist.$phpEx$SID&sk=a&sd=" . (($sort_key == 'a' && $sort_dir == 'a') ? 'd' : 'a'), + 'U_SORT_FROM' => "memberlist.$phpEx$SID&sk=b&sd=" . (($sort_key == 'b' && $sort_dir == 'a') ? 'd' : 'a'), + 'U_SORT_JOINED' => "memberlist.$phpEx$SID&sk=c&sd=" . (($sort_key == 'c' && $sort_dir == 'a') ? 'd' : 'a'), + 'U_SORT_POSTS' => "memberlist.$phpEx$SID&sk=d&sd=" . (($sort_key == 'd' && $sort_dir == 'a') ? 'd' : 'a'), + 'U_SORT_EMAIL' => "memberlist.$phpEx$SID&sk=e&sd=" . (($sort_key == 'e' && $sort_dir == 'a') ? 'd' : 'a'), + 'U_SORT_WEBSITE' => "memberlist.$phpEx$SID&sk=f&sd=" . (($sort_key == 'f' && $sort_dir == 'a') ? 'd' : 'a'), + 'U_SORT_ICQ' => "memberlist.$phpEx$SID&sk=g&sd=" . (($sort_key == 'g' && $sort_dir == 'a') ? 'd' : 'a'), + 'U_SORT_AIM' => "memberlist.$phpEx$SID&sk=h&sd=" . (($sort_key == 'h' && $sort_dir == 'a') ? 'd' : 'a'), + 'U_SORT_MSN' => "memberlist.$phpEx$SID&sk=i&sd=" . (($sort_key == 'i' && $sort_dir == 'a') ? 'd' : 'a'), + 'U_SORT_YIM' => "memberlist.$phpEx$SID&sk=j&sd=" . (($sort_key == 'j' && $sort_dir == 'a') ? 'd' : 'a'), + 'U_SORT_ACTIVE' => "memberlist.$phpEx$SID&sk=k&sd=" . (($sort_key == 'k' && $sort_dir == 'a') ? 'd' : 'a'), + + 'S_MODE_SELECT' => $s_sort_key, + 'S_ORDER_SELECT'=> $s_sort_dir, + 'S_MODE_ACTION' => "memberlist.$phpEx$SID&mode=$mode&form=$form") + ); } else { - $where_sql = ' AND user_active = 1'; -} + if ($user_id == ANONYMOUS) + { + trigger_error($user->lang['NO_USER']); + } -// Sorting and order -$order_by = $sort_key_sql[$sort_key] . ' ' . (($sort_dir == 'a') ? 'ASC' : 'DESC'); -// Count the users ... -$sql = "SELECT COUNT(user_id) AS total_users - FROM " . USERS_TABLE . " - WHERE user_id <> " . ANONYMOUS . " - $where_sql"; -$result = $db->sql_query($sql); + // 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 + FROM " . USERS_TABLE . " + WHERE user_id = $user_id"; + $result = $db->sql_query($sql); -$total_users = ($row = $db->sql_fetchrow($result)) ? $row['total_users'] : 0; + if (!($row = $db->sql_fetchrow($result))) + { + trigger_error($user->lang['NO_USER']); + } + $db->sql_freeresult($result); -// Pagination string -$pagination_url = ($mode == 'searchuser') ? "memberlist.$phpEx$SID&mode=searchuser&form=$form&field=$field&username=" . urlencode($username) . "&email=" . urlencode($email) . "&icq=$icq&aim=" . urlencode($aim) . "&yahoo=" . urlencode($yahoo) . "&msn=" . urlencode($msn) . "&joined=" . urlencode(implode('-', $joined)) . "&active=" . urlencode(implode('-', $active)) . "&count=$count&ip=" . urlencode($ipdomain) . "&sd=$sort_dir&sk=$sort_key&joined_select=$joined_select&active_select=$active_select&count_select=$count_select" : "memberlist.$phpEx$SID&mode=$mode&sk=$sort_key&sd=$sort_dir"; + $sql = "SELECT f.forum_id, f.forum_name, COUNT(post_id) AS num_posts + FROM " . POSTS_TABLE . " p, " . FORUMS_TABLE . " f + WHERE p.poster_id = $user_id + AND f.forum_id = p.forum_id + GROUP BY f.forum_id, f.forum_name + ORDER BY num_posts DESC + LIMIT 1"; + $result = $db->sql_query($sql); -// Some search user specific data -if ($mode == 'searchuser') -{ - $template->assign_vars(array( - 'USERNAME' => $username, - 'EMAIL' => $email, - 'ICQ' => $icq, - 'AIM' => $aim, - 'YAHOO' => $yahoo, - 'MSNM' => $msn, - 'JOINED' => implode('-', $joined), - 'ACTIVE' => implode('-', $active), - 'COUNT' => $count, - 'IP' => $ipdomain, - - 'S_SEARCH_USER' => true, - 'S_FORM_NAME' => $form, - 'S_FIELD_NAME' => $field, - 'S_COUNT_OPTIONS' => $s_find_count, - 'S_SORT_OPTIONS' => $s_sort_key, - 'S_USERNAME_OPTIONS' => $username_list, - 'S_JOINED_TIME_OPTIONS' => $s_find_join_time, - 'S_ACTIVE_TIME_OPTIONS' => $s_find_active_time, - 'S_SEARCH_ACTION' => "memberslist.$phpEx$SID&mode=searchuser&field=$field") - ); -} + $active_f_row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); -// 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 - FROM " . USERS_TABLE . " - WHERE user_id <> " . ANONYMOUS . " - $where_sql - ORDER BY $order_by - LIMIT $start, " . $config['topics_per_page']; -$result = $db->sql_query($sql); + $sql = "SELECT t.topic_id, t.topic_title, COUNT(p.post_id) AS num_posts + FROM " . POSTS_TABLE . " p, " . TOPICS_TABLE . " t + WHERE p.poster_id = $user_id + AND t.topic_id = p.topic_id + GROUP BY t.topic_id, t.topic_title + ORDER BY num_posts DESC + LIMIT 1"; + $result = $db->sql_query($sql); -if ($row = $db->sql_fetchrow($result)) -{ - $i = 0; - do + $active_t_row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + + + $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; + + $active_f_name = $active_f_id = $active_f_count = $active_f_pct = ''; + if (!empty($active_f_row['num_posts'])) { - $username = $row['username']; - $user_id = intval($row['user_id']); + $active_f_name = $active_f_row['forum_name']; + $active_f_id = $active_f_row['forum_id']; + $active_f_count = $active_f_row['num_posts']; + $active_f_pct = ($active_f_count / $row['user_posts']) * 100; + } + unset($active_f_row); - $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; + $active_t_name = $active_t_id = $active_t_count = $active_t_pct = ''; + if (!empty($active_t_row['num_posts'])) + { + $active_t_name = $active_t_row['topic_title']; + $active_t_id = $active_t_row['topic_id']; + $active_t_count = $active_t_row['num_posts']; + $active_t_pct = ($active_t_count / $row['user_posts']) * 100; + } + unset($active_t_row); - $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']) ? '<img src="' . $config['avatar_path'] . '/' . $row['user_avatar'] . '" alt="" border="0" />' : ''; - break; - case USER_AVATAR_REMOTE: - $poster_avatar = ($config['allow_avatar_remote']) ? '<img src="' . $row['user_avatar'] . '" alt="" border="0" />' : ''; - break; + $username = $row['username']; + $user_id = intval($row['user_id']); - case USER_AVATAR_GALLERY: - $poster_avatar = ($config['allow_avatar_local']) ? '<img src="' . $config['avatar_gallery_path'] . '/' . $row['user_avatar'] . '" alt="" border="0" />' : ''; - break; - } - } + $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; - $rank_title = $rank_img = ''; - foreach ($ranksrow as $rank) + $poster_avatar = ''; + if ($row['user_avatar_type'] && $row['user_allowavatar']) + { + switch($row['user_avatar_type']) { - if (empty($row['user_rank']) && $row['user_posts'] >= $rank['rank_min']) - { - $rank_title = $rank['rank_title']; - $rank_img = (!empty($rank['rank_image'])) ? '<img src="' . $rank['rank_image'] . '" border="0" alt="' . $rank_title . '" title="' . $rank_title . '" /><br />' : ''; + case USER_AVATAR_UPLOAD: + $poster_avatar = ($config['allow_avatar_upload']) ? '<img src="' . $config['avatar_path'] . '/' . $row['user_avatar'] . '" alt="" border="0" />' : ''; break; - } - if (!empty($rank['rank_special']) && $row['user_rank'] == $rank['rank_id']) - { - $rank_title = $rank['rank_title']; - $rank_img = (!empty($rank['rank_image'])) ? '<img src="' . $rank['rank_image'] . '" border="0" alt="' . $rank_title . '" title="' . $rank_title . '" /><br />' : ''; + case USER_AVATAR_REMOTE: + $poster_avatar = ($config['allow_avatar_remote']) ? '<img src="' . $row['user_avatar'] . '" alt="" border="0" />' : ''; + break; + + case USER_AVATAR_GALLERY: + $poster_avatar = ($config['allow_avatar_local']) ? '<img src="' . $config['avatar_gallery_path'] . '/' . $row['user_avatar'] . '" alt="" border="0" />' : ''; break; - } } + } - if ($row['user_viewemail'] || $auth->acl_get('a_')) + $rank_title = $rank_img = ''; + foreach ($ranksrow as $rank) + { + if (empty($row['user_rank']) && $row['user_posts'] >= $rank['rank_min']) { - $email_uri = ($config['board_email_form']) ? "ucp.$phpEx$SID&mode=email&u=" . $user_id : 'mailto:' . $row['user_email']; - - $email_img = '<a href="' . $email_uri . '">' . $user->img('icon_email', $user->lang['Send_email']) . '</a>'; - $email = '<a href="' . $email_uri . '">' . $user->lang['Send_email'] . '</a>'; + $rank_title = $rank['rank_title']; + $rank_img = (!empty($rank['rank_image'])) ? '<img src="' . $rank['rank_image'] . '" border="0" alt="' . $rank_title . '" title="' . $rank_title . '" /><br />' : ''; + break; } - else + + if (!empty($rank['rank_special']) && $row['user_rank'] == $rank['rank_id']) { - $email_img = ' '; - $email = ' '; + $rank_title = $rank['rank_title']; + $rank_img = (!empty($rank['rank_image'])) ? '<img src="' . $rank['rank_image'] . '" border="0" alt="' . $rank_title . '" title="' . $rank_title . '" /><br />' : ''; + break; } + } - $temp_url = "ucp.$phpEx$SID&mode=viewprofile&u=$user_id"; - $profile_img = '<a href="' . $temp_url . '">' . $user->img('icon_profile', $user->lang['Read_profile']) . '</a>'; - $profile = '<a href="' . $temp_url . '">' . $user->lang['Read_profile'] . '</a>'; + 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']; - $temp_url = "privmsg.$phpEx$SID&mode=post&u=$user_id"; - $pm_img = '<a href="' . $temp_url . '">' . $user->img('icon_pm', $user->lang['Send_private_message']) . '</a>'; - $pm = '<a href="' . $temp_url . '">' . $user->lang['Send_private_message'] . '</a>'; + $email_img = '<a href="' . $email_uri . '">' . $user->img('icon_email', $user->lang['Send_email']) . '</a>'; + $email = '<a href="' . $email_uri . '">' . $user->lang['Send_email'] . '</a>'; + } + else + { + $email_img = ' '; + $email = ' '; + } - $www_img = ($row['user_website']) ? '<a href="' . $row['user_website'] . '" target="_userwww">' . $user->img('icon_www', $user->lang['Visit_website']) . '</a>' : ''; - $www = ($row['user_website']) ? '<a href="' . $row['user_website'] . '" target="_userwww">' . $user->lang['Visit_website'] . '</a>' : ''; + $temp_url = "ucp.$phpEx$SID&mode=viewprofile&u=$user_id"; + $profile_img = '<a href="' . $temp_url . '">' . $user->img('icon_profile', $user->lang['Read_profile']) . '</a>'; + $profile = '<a href="' . $temp_url . '">' . $user->lang['Read_profile'] . '</a>'; - if (!empty($row['user_icq'])) - { - $icq_status_img = '<a href="http://wwp.icq.com/' . $row['user_icq'] . '#pager"><img src="http://web.icq.com/whitepages/online?icq=' . $row['user_icq'] . '&img=5" width="18" height="18" border="0" /></a>'; - $icq_img = '<a href="http://wwp.icq.com/scripts/search.dll?to=' . $row['user_icq'] . '">' . $user->img('icon_icq', $user->lang['ICQ']) . '</a>'; - $icq = '<a href="http://wwp.icq.com/scripts/search.dll?to=' . $row['user_icq'] . '">' . $user->lang['ICQ'] . '</a>'; - } - else - { - $icq_status_img = ''; - $icq_img = ''; - $icq = ''; - } + $temp_url = "ucp.$phpEx$SID&mode=pm&action=send&u=$user_id"; + $pm_img = '<a href="' . $temp_url . '">' . $user->img('icon_pm', $user->lang['Send_private_message']) . '</a>'; + $pm = '<a href="' . $temp_url . '">' . $user->lang['Send_private_message'] . '</a>'; - $aim_img = ($row['user_aim']) ? '<a href="aim:goim?screenname=' . $row['user_aim'] . '&message=Hello+Are+you+there?">' . $user->img('icon_aim', $user->lang['AIM']) . '</a>' : ''; - $aim = ($row['user_aim']) ? '<a href="aim:goim?screenname=' . $row['user_aim'] . '&message=Hello+Are+you+there?">' . $user->lang['AIM'] . '</a>' : ''; - - $temp_url = "ucp.$phpEx$SID&mode=viewprofile&u=$user_id"; - $msn_img = ($row['user_msnm']) ? '<a href="' . $temp_url . '">' . $user->img('icon_msnm', $user->lang['MSNM']) . '</a>' : ''; - $msn = ($row['user_msnm']) ? '<a href="' . $temp_url . '">' . $user->lang['MSNM'] . '</a>' : ''; - - $yim_img = ($row['user_yim']) ? '<a href="http://edit.yahoo.com/config/send_webmesg?.target=' . $row['user_yim'] . '&.src=pg">' . $user->img('icon_yim', $user->lang['YIM']) . '</a>' : ''; - $yim = ($row['user_yim']) ? '<a href="http://edit.yahoo.com/config/send_webmesg?.target=' . $row['user_yim'] . '&.src=pg">' . $user->lang['YIM'] . '</a>' : ''; - - $temp_url = "search.$phpEx$SID&search_author=" . urlencode($username) . "&showresults=posts"; - $search_img = '<a href="' . $temp_url . '">' . $user->img('icon_search', $user->lang['Search_user_posts']) . '</a>'; - $search = '<a href="' . $temp_url . '">' . $user->lang['Search_user_posts'] . '</a>'; - - $template->assign_block_vars('memberrow', 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' => "ucp.$phpEx$SID&mode=viewprofile&u=$user_id") - ); + $www_img = ($row['user_website']) ? '<a href="' . $row['user_website'] . '" target="_userwww">' . $user->img('icon_www', $user->lang['Visit_website']) . '</a>' : ''; + $www = ($row['user_website']) ? '<a href="' . $row['user_website'] . '" target="_userwww">' . $user->lang['Visit_website'] . '</a>' : ''; - $i++; + if (!empty($row['user_icq'])) + { + $icq_status_img = '<a href="http://wwp.icq.com/' . $row['user_icq'] . '#pager"><img src="http://web.icq.com/whitepages/online?icq=' . $row['user_icq'] . '&img=5" width="18" height="18" border="0" /></a>'; + $icq_img = '<a href="http://wwp.icq.com/scripts/search.dll?to=' . $row['user_icq'] . '">' . $user->img('icon_icq', $user->lang['ICQ']) . '</a>'; + $icq = '<a href="http://wwp.icq.com/scripts/search.dll?to=' . $row['user_icq'] . '">' . $user->lang['ICQ'] . '</a>'; + } + else + { + $icq_status_img = ''; + $icq_img = ''; + $icq = ''; } - while ($row = $db->sql_fetchrow($result)); -} -// Generate page -$template->assign_vars(array( - 'PAGINATION' => generate_pagination($pagination_url, $total_users, $config['topics_per_page'], $start), - 'PAGE_NUMBER' => on_page($total_users, $config['topics_per_page'], $start), - - 'U_FIND_MEMBER' => "memberlist.$phpEx$SID&mode=searchuser", - 'U_SORT_USERNAME' => "memberlist.$phpEx$SID&sk=a&sd=" . (($sort_key == 'a' && $sort_dir == 'a') ? 'd' : 'a'), - 'U_SORT_FROM' => "memberlist.$phpEx$SID&sk=b&sd=" . (($sort_key == 'b' && $sort_dir == 'a') ? 'd' : 'a'), - 'U_SORT_JOINED' => "memberlist.$phpEx$SID&sk=c&sd=" . (($sort_key == 'c' && $sort_dir == 'a') ? 'd' : 'a'), - 'U_SORT_POSTS' => "memberlist.$phpEx$SID&sk=d&sd=" . (($sort_key == 'd' && $sort_dir == 'a') ? 'd' : 'a'), - 'U_SORT_EMAIL' => "memberlist.$phpEx$SID&sk=e&sd=" . (($sort_key == 'e' && $sort_dir == 'a') ? 'd' : 'a'), - 'U_SORT_WEBSITE' => "memberlist.$phpEx$SID&sk=f&sd=" . (($sort_key == 'f' && $sort_dir == 'a') ? 'd' : 'a'), - 'U_SORT_ICQ' => "memberlist.$phpEx$SID&sk=g&sd=" . (($sort_key == 'g' && $sort_dir == 'a') ? 'd' : 'a'), - 'U_SORT_AIM' => "memberlist.$phpEx$SID&sk=h&sd=" . (($sort_key == 'h' && $sort_dir == 'a') ? 'd' : 'a'), - 'U_SORT_MSN' => "memberlist.$phpEx$SID&sk=i&sd=" . (($sort_key == 'i' && $sort_dir == 'a') ? 'd' : 'a'), - 'U_SORT_YIM' => "memberlist.$phpEx$SID&sk=j&sd=" . (($sort_key == 'j' && $sort_dir == 'a') ? 'd' : 'a'), - 'U_SORT_ACTIVE' => "memberlist.$phpEx$SID&sk=k&sd=" . (($sort_key == 'k' && $sort_dir == 'a') ? 'd' : 'a'), - - 'S_MODE_SELECT' => $s_sort_key, - 'S_ORDER_SELECT'=> $s_sort_dir, - 'S_MODE_ACTION' => "memberlist.$phpEx$SID&mode=$mode&form=$form") -); + $aim_img = ($row['user_aim']) ? '<a href="aim:goim?screenname=' . $row['user_aim'] . '&message=Hello+Are+you+there?">' . $user->img('icon_aim', $user->lang['AIM']) . '</a>' : ''; + $aim = ($row['user_aim']) ? '<a href="aim:goim?screenname=' . $row['user_aim'] . '&message=Hello+Are+you+there?">' . $user->lang['AIM'] . '</a>' : ''; + + $temp_url = "ucp.$phpEx$SID&mode=viewprofile&u=$user_id"; + $msn_img = ($row['user_msnm']) ? '<a href="' . $temp_url . '">' . $user->img('icon_msnm', $user->lang['MSNM']) . '</a>' : ''; + $msn = ($row['user_msnm']) ? '<a href="' . $temp_url . '">' . $user->lang['MSNM'] . '</a>' : ''; + + $yim_img = ($row['user_yim']) ? '<a href="http://edit.yahoo.com/config/send_webmesg?.target=' . $row['user_yim'] . '&.src=pg">' . $user->img('icon_yim', $user->lang['YIM']) . '</a>' : ''; + $yim = ($row['user_yim']) ? '<a href="http://edit.yahoo.com/config/send_webmesg?.target=' . $row['user_yim'] . '&.src=pg">' . $user->lang['YIM'] . '</a>' : ''; + $template->assign_vars(array( + 'USER_PROFILE' => sprintf($user->lang['VIEWING_PROFILE'], $username), + + 'AVATAR_IMG' => $poster_avatar, + 'RANK_TITLE' => $rank, + '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), + + '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, + + '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",) + ); +} // Output the page $page_title = $user->lang['Memberlist']; include($phpbb_root_path . 'includes/page_header.'.$phpEx); $template->set_filenames(array( - 'body' => 'memberlist_body.html') + 'body' => ($mode != 'viewprofile') ? 'memberlist_body.html' : 'memberslist_view.html') ); make_jumpbox('viewforum.'.$phpEx); diff --git a/phpBB/templates/subSilver/memberslist_view.html b/phpBB/templates/subSilver/memberslist_view.html new file mode 100644 index 0000000000..83a29b09b8 --- /dev/null +++ b/phpBB/templates/subSilver/memberslist_view.html @@ -0,0 +1,105 @@ +<!-- INCLUDE overall_header.html --> + +<table width="100%" cellspacing="2" cellpadding="2" border="0" align="center"> + <tr> + <td align="left"><a class="nav" href="{U_INDEX}" class="nav">{L_INDEX}</a></td> + </tr> +</table> + +<table class="tablebg" width="100%" cellspacing="1" cellpadding="2" border="0" align="center"> + <tr> + <th colspan="2" height="25" nowrap="nowrap">{USER_PROFILE}</th> + </tr> + <tr> + <td class="cat" width="40%" height="28" align="center"><b class="gen">{L_USER_PRESENCE}</b></td> + <td class="cat" width="60%" align="center"><b class="gen">{L_USER_FORUM}</b></td> + </tr> + <tr> + <td class="row1" height="6" valign="top" align="center">{AVATAR_IMG}<br /><span class="postdetails">{POSTER_RANK}</span></td> + <td class="row1" valign="top"><table width="100%" cellspacing="1" cellpadding="2" border="0"> + <tr> + <td class="gen" align="right" valign="middle" nowrap="nowrap">{L_JOINED}: </td> + <td width="100%"><b class="gen">{JOINED}</b></td> + </tr> + <tr> + <td class="gen" valign="top" align="right" nowrap="nowrap">{L_TOTAL_POSTS}: </td> + <td valign="top"><b><span class="gen">{POSTS}</span></b><br /><span class="genmed">[{POSTS_PCT} / {POSTS_DAY}]<br /><a href="{U_SEARCH_USER}">{L_SEARCH_USER_POSTS}</a></span></td> + </tr> + <tr> + <td class="gen" valign="top" align="right" nowrap="nowrap">{L_ACTIVE_IN_FORUM}: </td> + <td><!-- IF ACTIVE_FORUM_PCT --><b><a class="gen" href="{U_ACTIVE_FORUM}">{ACTIVE_FORUM}</a></b><br /><span class="genmed">[ {ACTIVE_FORUM_POSTS} / {ACTIVE_FORUM_PCT} ]</span><!-- ELSE --><span class="gen">{L_NO_POSTS}</span><!-- ENDIF --></td> + </tr> + <tr> + <td class="gen" valign="top" align="right" nowrap="nowrap">{L_ACTIVE_IN_TOPIC}: </td> + <td><!-- IF ACTIVE_TOPIC_PCT --><b><a class="gen" href="{U_ACTIVE_TOPIC}">{ACTIVE_TOPIC}</a></b><br /><span class="gensmall">[ {ACTIVE_TOPIC_POSTS} / {ACTIVE_TOPIC_PCT} ]</span><!-- ELSE --><span class="gen">{L_NO_POSTS}</span><!-- ENDIF --></td> + </tr> + </table></td> + </tr> + <tr> + <td class="cat" height="28" align="center"><b class="gen">{L_CONTACT_USER}</b></td> + <td class="cat" height="28" align="center"><b class="gen">{L_ABOUT_USER}</b></td> + </tr> + <tr> + <td class="row1" valign="top"><table width="100%" cellspacing="1" cellpadding="2" border="0"> + <tr> + <td class="gen" valign="middle" align="right" nowrap="nowrap">{L_EMAIL_ADDRESS}: </td> + <td class="row1" valign="middle" width="100%"><b class="gen">{EMAIL_IMG}</b></td> + </tr> + <tr> + <td class="gen" valign="middle" nowrap="nowrap" align="right">{L_PM}: </td> + <td valign="middle"><b class="gen">{PM_IMG}</b></td> + </tr> + <tr> + <td class="gen" valign="middle" nowrap="nowrap" align="right">{L_MSNM}: </td> + <td valign="middle"><span class="gen">{MSN}</span></td> + </tr> + <tr> + <td class="gen" valign="middle" nowrap="nowrap" align="right">{L_YIM}: </td> + <td valign="middle">{YIM_IMG}</td> + </tr> + <tr> + <td class="gen" valign="middle" nowrap="nowrap" align="right">{L_AIM}: </td> + <td valign="middle">{AIM_IMG}</td> + </tr> + <tr> + <td class="gen" valign="middle" nowrap="nowrap" align="right">{L_ICQ}: </td> + <td><script language="JavaScript" type="text/javascript"><!-- + + if ( navigator.userAgent.toLowerCase().indexOf('mozilla') != -1 && navigator.userAgent.indexOf('5.') == -1 ) + document.write(' {ICQ_IMG}'); + else + document.write('<table cellspacing="0" cellpadding="0" border="0"><tr><td nowrap="nowrap"><div style="position:relative;height:18px"><div style="position:absolute">{ICQ_IMG}</div><div style="position:absolute;left:3px;top:-1px">{ICQ_STATUS_IMG}</div></div></td></tr></table>'); + + //--></script><noscript>{ICQ_IMG}</noscript></td> + </tr> + </table></td> + <td class="row1" valign="top"><table cellspacing="1" cellpadding="2" border="0"> + <tr> + <td class="gen" valign="middle" align="right" nowrap="nowrap">{L_LOCATION}: </td> + <td><b class="gen">{LOCATION}</b></td> + </tr> + <tr> + <td class="gen" valign="middle" align="right" nowrap="nowrap">{L_OCCUPATION}: </td> + <td><b class="gen">{OCCUPATION}</b></td> + </tr> + <tr> + <td class="gen" valign="top" align="right" nowrap="nowrap">{L_INTERESTS}: </td> + <td><b class="gen">{INTERESTS}</b></td> + </tr> + <tr> + <td class="gen" valign="middle" align="right" nowrap="nowrap">{L_WEBSITE}: </td> + <td><b class="gen">{WWW}</b></td> + </tr> + </table></td> + </tr> +</table> + +<br clear="all" /> + +<table width="100%" cellspacing="0" cellpadding="0" border="0" align="center"> + <tr> + <td align="right"><!-- INCLUDE jumpbox.html --></td> + </tr> +</table> + +<!-- INCLUDE overall_footer.html -->
\ No newline at end of file diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php index 04b8ad1597..d268fab721 100644 --- a/phpBB/viewforum.php +++ b/phpBB/viewforum.php @@ -239,6 +239,7 @@ if ($forum_data['forum_postable']) 'S_TOPIC_ICONS' => ($forum_data['enable_icons']) ? true : false, 'S_WATCH_FORUM' => $s_watching_forum, 'S_FORUM_ACTION' => 'viewforum.' . $phpEx . $SID . '&f=' . $forum_id . "&start=$start", + 'S_SHOW_SEARCHBOX' => ($auth->acl_gets('f_search', 'm_', 'a_', $forum_id)) ? true : false, 'S_SEARCHBOX_ACTION'=> "search.$phpEx$SID&f=$forum_id", 'U_POST_NEW_TOPIC' => 'posting.' . $phpEx . $SID . '&mode=post&f=' . $forum_id, @@ -444,11 +445,11 @@ if ($forum_data['forum_postable']) $last_post_img = '<a href="viewtopic.' . $phpEx . $SID . '&f=' . $forum_id . '&p=' . $row['topic_last_post_id'] . '#' . $row['topic_last_post_id'] . '">' . $user->img('goto_post_latest', 'VIEW_LATEST_POST') . '</a>'; - $topic_author = ($row['topic_poster'] != ANONYMOUS) ? '<a href="ucp.' . $phpEx . $SID . '&mode=viewprofile&u=' . $row['topic_poster'] . '">' : ''; + $topic_author = ($row['topic_poster'] != ANONYMOUS) ? "<a href=\"memberlist.$phpEx$SID&mode=viewprofile&u=" . $row['topic_poster'] . '">' : ''; $topic_author .= ($row['topic_poster'] != ANONYMOUS) ? $row['topic_first_poster_name'] : (($row['topic_first_poster_name'] != '') ? $row['topic_first_poster_name'] : $user->lang['GUEST']); $topic_author .= ($row['topic_poster'] != ANONYMOUS) ? '</a>' : ''; - $last_post_author = ($row['topic_last_poster_id'] == ANONYMOUS) ? (($row['topic_last_poster_name'] != '') ? $row['topic_last_poster_name'] . ' ' : $user->lang['GUEST'] . ' ') : '<a href="ucp.' . $phpEx . $SID . '&mode=viewprofile&u=' . $row['topic_last_poster_id'] . '">' . $row['topic_last_poster_name'] . '</a>'; + $last_post_author = ($row['topic_last_poster_id'] == ANONYMOUS) ? (($row['topic_last_poster_name'] != '') ? $row['topic_last_poster_name'] . ' ' : $user->lang['GUEST'] . ' ') : "<a href=\"memberlist.$phpEx$SID&mode=viewprofile&u=" . $row['topic_last_poster_id'] . '">' . $row['topic_last_poster_name'] . '</a>'; $first_post_time = $user->format_date($row['topic_time'], $config['board_timezone']); diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 5258952d7e..aca75c8ffd 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -222,8 +222,9 @@ $sort_order = $sort_by_sql[$sort_key] . ' ' . (($sort_dir == 'd') ? 'DESC' : 'AS // Cache this? ... it is after all doing a simple data grab -$sql = "SELECT * - FROM " . RANKS_TABLE; +$sql = "SELECT * + FROM " . RANKS_TABLE . " + ORDER BY rank_special, rank_min DESC"; $result = $db->sql_query($sql, 120); $ranksrow = array(); @@ -347,6 +348,7 @@ $template->assign_vars(array( 'S_TOPIC_MOD' => ($topic_mod != '') ? '<select name="mode">' . $topic_mod . '</select>' : '', 'S_MOD_ACTION' => "mcp.$phpEx?sid=" . $user->session_id . "&t=$topic_id&quickmod=1", 'S_WATCH_TOPIC' => $s_watching_topic, + 'S_SHOW_SEARCHBOX' => ($auth->acl_gets('f_search', 'm_', 'a_', $forum_id)) ? true : false, 'S_SEARCHBOX_ACTION' => "search.$phpEx$SID&f=$forum_id", 'U_TOPIC' => $server_path . 'viewtopic.' . $phpEx . '?t=' . $topic_id, @@ -532,29 +534,23 @@ if ($row = $db->sql_fetchrow($result)) } - // Generate ranks, set them to empty string initially. - if (!isset($user_cache[$poster_id]['rank_title'])) + // Set poster rank + if (!isset($user_cache[$poster_id]['rank_title']) && $poster_id != ANONYMOUS) { - if ($row['user_rank']) + foreach ($ranksrow as $rank) { - for($j = 0; $j < count($ranksrow); $j++) + if (empty($row['user_rank']) && $row['user_posts'] >= $rank['rank_min']) { - if ($row['user_rank'] == $ranksrow[$j]['rank_id'] && $ranksrow[$j]['rank_special']) - { - $user_cache[$poster_id]['rank_title'] = $ranksrow[$j]['rank_title']; - $user_cache[$poster_id]['rank_image'] = ($ranksrow[$j]['rank_image']) ? '<img src="' . $ranksrow[$j]['rank_image'] . '" border="0" alt="' . $poster_rank . '" title="' . $poster_rank . '" /><br />' : ''; - } + $user_cache[$poster_id]['rank_title'] = $rank['rank_title']; + $user_cache[$poster_id]['rank_image'] = (!empty($rank['rank_image'])) ? '<img src="' . $rank['rank_image'] . '" border="0" alt="' . $user_cache[$poster_id]['rank_title'] . '" title="' . $user_cache[$poster_id]['rank_title'] . '" /><br />' : ''; + break; } - } - else - { - for($j = 0; $j < count($ranksrow); $j++) + + if (!empty($rank['rank_special']) && $row['user_rank'] == $rank['rank_id']) { - if ($row['user_posts'] >= $ranksrow[$j]['rank_min'] && !$ranksrow[$j]['rank_special']) - { - $user_cache[$poster_id]['rank_title'] = $ranksrow[$j]['rank_title']; - $user_cache[$poster_id]['rank_image'] = ($ranksrow[$j]['rank_image']) ? '<img src="' . $ranksrow[$j]['rank_image'] . '" border="0" alt="' . $poster_rank . '" title="' . $poster_rank . '" /><br />' : ''; - } + $user_cache[$poster_id]['rank_title'] = $rank['rank_title']; + $user_cache[$poster_id]['rank_image'] = (!empty($rank['rank_image'])) ? '<img src="' . $rank['rank_image'] . '" border="0" alt="' . $user_cache[$poster_id]['rank_title'] . '" title="' . $user_cache[$poster_id]['rank_title'] . '" /><br />' : ''; + break; } } } @@ -573,7 +569,7 @@ if ($row = $db->sql_fetchrow($result)) // this each time the same user appears on this page if (!isset($user_cache[$poster_id]['profile']) && $poster_id != ANONYMOUS) { - $temp_url = "ucp.$phpEx$SID&mode=viewprofile&u=$poster_id"; + $temp_url = "memberlist.$phpEx$SID&mode=viewprofile&u=$poster_id"; $user_cache[$poster_id]['profile_img'] = '<a href="' . $temp_url . '">' . $user->img('icon_profile', $user->lang['READ_PROFILE']) . '</a>'; $user_cache[$poster_id]['profile'] = '<a href="' . $temp_url . '">' . $user->lang['READ_PROFILE'] . '</a>'; @@ -613,7 +609,7 @@ if ($row = $db->sql_fetchrow($result)) $user_cache[$poster_id]['aim_img'] = ($row['user_aim']) ? '<a href="aim:goim?screenname=' . $row['user_aim'] . '&message=Hello+Are+you+there?">' . $user->img('icon_aim', $user->lang['AIM']) . '</a>' : ''; $user_cache[$poster_id]['aim'] = ($row['user_aim']) ? '<a href="aim:goim?screenname=' . $row['user_aim'] . '&message=Hello+Are+you+there?">' . $user->lang['AIM'] . '</a>' : ''; - $temp_url = "ucp.$phpEx$SID&mode=viewprofile&u=$poster_id"; + $temp_url = "memberlist.$phpEx$SID&mode=viewprofile&u=$poster_id"; $user_cache[$poster_id]['msn_img'] = ($row['user_msnm']) ? '<a href="' . $temp_url . '">' . $user->img('icon_msnm', $user->lang['MSNM']) . '</a>' : ''; $user_cache[$poster_id]['msn'] = ($row['user_msnm']) ? '<a href="' . $temp_url . '">' . $user->lang['MSNM'] . '</a>' : ''; |
