2 /***************************************************************************
5 * begin : Friday, May 11, 2001
6 * copyright : (C) 2001 The phpBB Group
7 * email : support@phpbb.com
9 * $Id: memberlist.php,v 1.36.2.13 2006/12/16 13:11:24 acydburn Exp $
11 ***************************************************************************/
13 /***************************************************************************
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation; either version 2 of the License, or
18 * (at your option) any later version.
20 ***************************************************************************/
22 define('IN_PHPBB', true);
23 $phpbb_root_path = './';
24 include($phpbb_root_path . 'extension.inc');
25 include($phpbb_root_path . 'common.'.$phpEx);
28 // Start session management
30 $userdata = session_pagestart($user_ip, PAGE_VIEWMEMBERS);
31 init_userprefs($userdata);
33 // End session management
36 $start = ( isset($HTTP_GET_VARS['start']) ) ? intval($HTTP_GET_VARS['start']) : 0;
37 $start = ($start < 0) ? 0 : $start;
39 if ( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
41 $mode = ( isset($HTTP_POST_VARS['mode']) ) ? htmlspecialchars($HTTP_POST_VARS['mode']) : htmlspecialchars($HTTP_GET_VARS['mode']);
48 if(isset($HTTP_POST_VARS['order']))
50 $sort_order = ($HTTP_POST_VARS['order'] == 'ASC') ? 'ASC' : 'DESC';
52 else if(isset($HTTP_GET_VARS['order']))
54 $sort_order = ($HTTP_GET_VARS['order'] == 'ASC') ? 'ASC' : 'DESC';
64 $mode_types_text = array($lang['Sort_Joined'], $lang['Sort_Username'], $lang['Sort_Location'], $lang['Sort_Posts'], $lang['Sort_Email'], $lang['Sort_Website'], $lang['Sort_Top_Ten']);
65 $mode_types = array('joined', 'username', 'location', 'posts', 'email', 'website', 'topten');
67 $select_sort_mode = '<select name="mode">';
68 for($i = 0; $i < count($mode_types_text); $i++)
70 $selected = ( $mode == $mode_types[$i] ) ? ' selected="selected"' : '';
71 $select_sort_mode .= '<option value="' . $mode_types[$i] . '"' . $selected . '>' . $mode_types_text[$i] . '</option>';
73 $select_sort_mode .= '</select>';
75 $select_sort_order = '<select name="order">';
76 if($sort_order == 'ASC')
78 $select_sort_order .= '<option value="ASC" selected="selected">' . $lang['Sort_Ascending'] . '</option><option value="DESC">' . $lang['Sort_Descending'] . '</option>';
82 $select_sort_order .= '<option value="ASC">' . $lang['Sort_Ascending'] . '</option><option value="DESC" selected="selected">' . $lang['Sort_Descending'] . '</option>';
84 $select_sort_order .= '</select>';
89 $page_title = $lang['Memberlist'];
90 include($phpbb_root_path . 'includes/page_header.'.$phpEx);
92 $template->set_filenames(array(
93 'body' => 'memberlist_body.tpl')
95 make_jumpbox('viewforum.'.$phpEx);
97 $template->assign_vars(array(
98 'L_SELECT_SORT_METHOD' => $lang['Select_sort_method'],
99 'L_EMAIL' => $lang['Email'],
100 'L_WEBSITE' => $lang['Website'],
101 'L_FROM' => $lang['Location'],
102 'L_ORDER' => $lang['Order'],
103 'L_SORT' => $lang['Sort'],
104 'L_SUBMIT' => $lang['Sort'],
105 'L_AIM' => $lang['AIM'],
106 'L_YIM' => $lang['YIM'],
107 'L_MSNM' => $lang['MSNM'],
108 'L_ICQ' => $lang['ICQ'],
109 'L_JOINED' => $lang['Joined'],
110 'L_POSTS' => $lang['Posts'],
111 'L_PM' => $lang['Private_Message'],
113 'S_MODE_SELECT' => $select_sort_mode,
114 'S_ORDER_SELECT' => $select_sort_order,
115 'S_MODE_ACTION' => append_sid("memberlist.$phpEx"))
121 $order_by = "user_regdate $sort_order LIMIT $start, " . $board_config['topics_per_page'];
124 $order_by = "username $sort_order LIMIT $start, " . $board_config['topics_per_page'];
127 $order_by = "user_from $sort_order LIMIT $start, " . $board_config['topics_per_page'];
130 $order_by = "user_posts $sort_order LIMIT $start, " . $board_config['topics_per_page'];
133 $order_by = "user_email $sort_order LIMIT $start, " . $board_config['topics_per_page'];
136 $order_by = "user_website $sort_order LIMIT $start, " . $board_config['topics_per_page'];
139 $order_by = "user_posts $sort_order LIMIT 10";
142 $order_by = "user_regdate $sort_order LIMIT $start, " . $board_config['topics_per_page'];
146 $sql = "SELECT username, user_id, user_viewemail, user_posts, user_regdate, user_from, user_website, user_email, user_icq, user_aim, user_yim, user_msnm, user_avatar, user_avatar_type, user_allowavatar
147 FROM " . USERS_TABLE . "
148 WHERE user_id <> " . ANONYMOUS . "
150 if( !($result = $db->sql_query($sql)) )
152 message_die(GENERAL_ERROR, 'Could not query users', '', __LINE__, __FILE__, $sql);
155 if ( $row = $db->sql_fetchrow($result) )
160 $username = $row['username'];
161 $user_id = $row['user_id'];
163 $from = ( !empty($row['user_from']) ) ? $row['user_from'] : ' ';
164 $joined = create_date($lang['DATE_FORMAT'], $row['user_regdate'], $board_config['board_timezone']);
165 $posts = ( $row['user_posts'] ) ? $row['user_posts'] : 0;
168 if ( $row['user_avatar_type'] && $user_id != ANONYMOUS && $row['user_allowavatar'] )
170 switch( $row['user_avatar_type'] )
172 case USER_AVATAR_UPLOAD:
173 $poster_avatar = ( $board_config['allow_avatar_upload'] ) ? '<img src="' . $board_config['avatar_path'] . '/' . $row['user_avatar'] . '" alt="" border="0" />' : '';
175 case USER_AVATAR_REMOTE:
176 $poster_avatar = ( $board_config['allow_avatar_remote'] ) ? '<img src="' . $row['user_avatar'] . '" alt="" border="0" />' : '';
178 case USER_AVATAR_GALLERY:
179 $poster_avatar = ( $board_config['allow_avatar_local'] ) ? '<img src="' . $board_config['avatar_gallery_path'] . '/' . $row['user_avatar'] . '" alt="" border="0" />' : '';
184 if ( !empty($row['user_viewemail']) || $userdata['user_level'] == ADMIN )
186 $email_uri = ( $board_config['board_email_form'] ) ? append_sid("profile.$phpEx?mode=email&" . POST_USERS_URL .'=' . $user_id) : 'mailto:' . $row['user_email'];
188 $email_img = '<a href="' . $email_uri . '"><img src="' . $images['icon_email'] . '" alt="' . $lang['Send_email'] . '" title="' . $lang['Send_email'] . '" border="0" /></a>';
189 $email = '<a href="' . $email_uri . '">' . $lang['Send_email'] . '</a>';
193 $email_img = ' ';
197 $temp_url = append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$user_id");
198 $profile_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_profile'] . '" alt="' . $lang['Read_profile'] . '" title="' . $lang['Read_profile'] . '" border="0" /></a>';
199 $profile = '<a href="' . $temp_url . '">' . $lang['Read_profile'] . '</a>';
201 $temp_url = append_sid("privmsg.$phpEx?mode=post&" . POST_USERS_URL . "=$user_id");
202 $pm_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_pm'] . '" alt="' . $lang['Send_private_message'] . '" title="' . $lang['Send_private_message'] . '" border="0" /></a>';
203 $pm = '<a href="' . $temp_url . '">' . $lang['Send_private_message'] . '</a>';
205 $www_img = ( $row['user_website'] ) ? '<a href="' . $row['user_website'] . '" target="_userwww"><img src="' . $images['icon_www'] . '" alt="' . $lang['Visit_website'] . '" title="' . $lang['Visit_website'] . '" border="0" /></a>' : '';
206 $www = ( $row['user_website'] ) ? '<a href="' . $row['user_website'] . '" target="_userwww">' . $lang['Visit_website'] . '</a>' : '';
208 if ( !empty($row['user_icq']) )
210 $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>';
211 $icq_img = '<a href="http://wwp.icq.com/scripts/search.dll?to=' . $row['user_icq'] . '"><img src="' . $images['icon_icq'] . '" alt="' . $lang['ICQ'] . '" title="' . $lang['ICQ'] . '" border="0" /></a>';
212 $icq = '<a href="http://wwp.icq.com/scripts/search.dll?to=' . $row['user_icq'] . '">' . $lang['ICQ'] . '</a>';
216 $icq_status_img = '';
221 $aim_img = ( $row['user_aim'] ) ? '<a href="aim:goim?screenname=' . $row['user_aim'] . '&message=Hello+Are+you+there?"><img src="' . $images['icon_aim'] . '" alt="' . $lang['AIM'] . '" title="' . $lang['AIM'] . '" border="0" /></a>' : '';
222 $aim = ( $row['user_aim'] ) ? '<a href="aim:goim?screenname=' . $row['user_aim'] . '&message=Hello+Are+you+there?">' . $lang['AIM'] . '</a>' : '';
224 $temp_url = append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$user_id");
225 $msn_img = ( $row['user_msnm'] ) ? '<a href="' . $temp_url . '"><img src="' . $images['icon_msnm'] . '" alt="' . $lang['MSNM'] . '" title="' . $lang['MSNM'] . '" border="0" /></a>' : '';
226 $msn = ( $row['user_msnm'] ) ? '<a href="' . $temp_url . '">' . $lang['MSNM'] . '</a>' : '';
228 $yim_img = ( $row['user_yim'] ) ? '<a href="http://edit.yahoo.com/config/send_webmesg?.target=' . $row['user_yim'] . '&.src=pg"><img src="' . $images['icon_yim'] . '" alt="' . $lang['YIM'] . '" title="' . $lang['YIM'] . '" border="0" /></a>' : '';
229 $yim = ( $row['user_yim'] ) ? '<a href="http://edit.yahoo.com/config/send_webmesg?.target=' . $row['user_yim'] . '&.src=pg">' . $lang['YIM'] . '</a>' : '';
231 $temp_url = append_sid("search.$phpEx?search_author=" . urlencode($username) . "&showresults=posts");
232 $search_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_search'] . '" alt="' . sprintf($lang['Search_user_posts'], $username) . '" title="' . sprintf($lang['Search_user_posts'], $username) . '" border="0" /></a>';
233 $search = '<a href="' . $temp_url . '">' . sprintf($lang['Search_user_posts'], $username) . '</a>';
235 $row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2'];
236 $row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'];
238 $template->assign_block_vars('memberrow', array(
239 'ROW_NUMBER' => $i + ( $start + 1 ),
240 'ROW_COLOR' => '#' . $row_color,
241 'ROW_CLASS' => $row_class,
242 'USERNAME' => $username,
246 'AVATAR_IMG' => $poster_avatar,
247 'PROFILE_IMG' => $profile_img,
248 'PROFILE' => $profile,
249 'SEARCH_IMG' => $search_img,
253 'EMAIL_IMG' => $email_img,
255 'WWW_IMG' => $www_img,
257 'ICQ_STATUS_IMG' => $icq_status_img,
258 'ICQ_IMG' => $icq_img,
260 'AIM_IMG' => $aim_img,
262 'MSN_IMG' => $msn_img,
264 'YIM_IMG' => $yim_img,
267 'U_VIEWPROFILE' => append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$user_id"))
272 while ( $row = $db->sql_fetchrow($result) );
273 $db->sql_freeresult($result);
276 if ( $mode != 'topten' || $board_config['topics_per_page'] < 10 )
278 $sql = "SELECT count(*) AS total
279 FROM " . USERS_TABLE . "
280 WHERE user_id <> " . ANONYMOUS;
282 if ( !($result = $db->sql_query($sql)) )
284 message_die(GENERAL_ERROR, 'Error getting total users', '', __LINE__, __FILE__, $sql);
287 if ( $total = $db->sql_fetchrow($result) )
289 $total_members = $total['total'];
291 $pagination = generate_pagination("memberlist.$phpEx?mode=$mode&order=$sort_order", $total_members, $board_config['topics_per_page'], $start). ' ';
293 $db->sql_freeresult($result);
297 $pagination = ' ';
301 $template->assign_vars(array(
302 'PAGINATION' => $pagination,
303 'PAGE_NUMBER' => sprintf($lang['Page_of'], ( floor( $start / $board_config['topics_per_page'] ) + 1 ), ceil( $total_members / $board_config['topics_per_page'] )),
305 'L_GOTO_PAGE' => $lang['Goto_page'])
308 $template->pparse('body');
310 include($phpbb_root_path . 'includes/page_tail.'.$phpEx);