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.10 2004/07/11 16:46:15 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;
38 if ( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
40 $mode = ( isset($HTTP_POST_VARS['mode']) ) ? htmlspecialchars($HTTP_POST_VARS['mode']) : htmlspecialchars($HTTP_GET_VARS['mode']);
47 if(isset($HTTP_POST_VARS['order']))
49 $sort_order = ($HTTP_POST_VARS['order'] == 'ASC') ? 'ASC' : 'DESC';
51 else if(isset($HTTP_GET_VARS['order']))
53 $sort_order = ($HTTP_GET_VARS['order'] == 'ASC') ? 'ASC' : 'DESC';
63 $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']);
64 $mode_types = array('joindate', 'username', 'location', 'posts', 'email', 'website', 'topten');
66 $select_sort_mode = '<select name="mode">';
67 for($i = 0; $i < count($mode_types_text); $i++)
69 $selected = ( $mode == $mode_types[$i] ) ? ' selected="selected"' : '';
70 $select_sort_mode .= '<option value="' . $mode_types[$i] . '"' . $selected . '>' . $mode_types_text[$i] . '</option>';
72 $select_sort_mode .= '</select>';
74 $select_sort_order = '<select name="order">';
75 if($sort_order == 'ASC')
77 $select_sort_order .= '<option value="ASC" selected="selected">' . $lang['Sort_Ascending'] . '</option><option value="DESC">' . $lang['Sort_Descending'] . '</option>';
81 $select_sort_order .= '<option value="ASC">' . $lang['Sort_Ascending'] . '</option><option value="DESC" selected="selected">' . $lang['Sort_Descending'] . '</option>';
83 $select_sort_order .= '</select>';
88 $page_title = $lang['Memberlist'];
89 include($phpbb_root_path . 'includes/page_header.'.$phpEx);
91 $template->set_filenames(array(
92 'body' => 'memberlist_body.tpl')
94 make_jumpbox('viewforum.'.$phpEx);
96 $template->assign_vars(array(
97 'L_SELECT_SORT_METHOD' => $lang['Select_sort_method'],
98 'L_EMAIL' => $lang['Email'],
99 'L_WEBSITE' => $lang['Website'],
100 'L_FROM' => $lang['Location'],
101 'L_ORDER' => $lang['Order'],
102 'L_SORT' => $lang['Sort'],
103 'L_SUBMIT' => $lang['Sort'],
104 'L_AIM' => $lang['AIM'],
105 'L_YIM' => $lang['YIM'],
106 'L_MSNM' => $lang['MSNM'],
107 'L_ICQ' => $lang['ICQ'],
108 'L_JOINED' => $lang['Joined'],
109 'L_POSTS' => $lang['Posts'],
110 'L_PM' => $lang['Private_Message'],
112 'S_MODE_SELECT' => $select_sort_mode,
113 'S_ORDER_SELECT' => $select_sort_order,
114 'S_MODE_ACTION' => append_sid("memberlist.$phpEx"))
120 $order_by = "user_regdate $sort_order LIMIT $start, " . $board_config['topics_per_page'];
123 $order_by = "username $sort_order LIMIT $start, " . $board_config['topics_per_page'];
126 $order_by = "user_from $sort_order LIMIT $start, " . $board_config['topics_per_page'];
129 $order_by = "user_posts $sort_order LIMIT $start, " . $board_config['topics_per_page'];
132 $order_by = "user_email $sort_order LIMIT $start, " . $board_config['topics_per_page'];
135 $order_by = "user_website $sort_order LIMIT $start, " . $board_config['topics_per_page'];
138 $order_by = "user_posts $sort_order LIMIT 10";
141 $order_by = "user_regdate $sort_order LIMIT $start, " . $board_config['topics_per_page'];
145 $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
146 FROM " . USERS_TABLE . "
147 WHERE user_id <> " . ANONYMOUS . "
149 if( !($result = $db->sql_query($sql)) )
151 message_die(GENERAL_ERROR, 'Could not query users', '', __LINE__, __FILE__, $sql);
154 if ( $row = $db->sql_fetchrow($result) )
159 $username = $row['username'];
160 $user_id = $row['user_id'];
162 $from = ( !empty($row['user_from']) ) ? $row['user_from'] : ' ';
163 $joined = create_date($lang['DATE_FORMAT'], $row['user_regdate'], $board_config['board_timezone']);
164 $posts = ( $row['user_posts'] ) ? $row['user_posts'] : 0;
167 if ( $row['user_avatar_type'] && $user_id != ANONYMOUS && $row['user_allowavatar'] )
169 switch( $row['user_avatar_type'] )
171 case USER_AVATAR_UPLOAD:
172 $poster_avatar = ( $board_config['allow_avatar_upload'] ) ? '<img src="' . $board_config['avatar_path'] . '/' . $row['user_avatar'] . '" alt="" border="0" />' : '';
174 case USER_AVATAR_REMOTE:
175 $poster_avatar = ( $board_config['allow_avatar_remote'] ) ? '<img src="' . $row['user_avatar'] . '" alt="" border="0" />' : '';
177 case USER_AVATAR_GALLERY:
178 $poster_avatar = ( $board_config['allow_avatar_local'] ) ? '<img src="' . $board_config['avatar_gallery_path'] . '/' . $row['user_avatar'] . '" alt="" border="0" />' : '';
183 if ( !empty($row['user_viewemail']) || $userdata['user_level'] == ADMIN )
185 $email_uri = ( $board_config['board_email_form'] ) ? append_sid("profile.$phpEx?mode=email&" . POST_USERS_URL .'=' . $user_id) : 'mailto:' . $row['user_email'];
187 $email_img = '<a href="' . $email_uri . '"><img src="' . $images['icon_email'] . '" alt="' . $lang['Send_email'] . '" title="' . $lang['Send_email'] . '" border="0" /></a>';
188 $email = '<a href="' . $email_uri . '">' . $lang['Send_email'] . '</a>';
192 $email_img = ' ';
196 $temp_url = append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$user_id");
197 $profile_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_profile'] . '" alt="' . $lang['Read_profile'] . '" title="' . $lang['Read_profile'] . '" border="0" /></a>';
198 $profile = '<a href="' . $temp_url . '">' . $lang['Read_profile'] . '</a>';
200 $temp_url = append_sid("privmsg.$phpEx?mode=post&" . POST_USERS_URL . "=$user_id");
201 $pm_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_pm'] . '" alt="' . $lang['Send_private_message'] . '" title="' . $lang['Send_private_message'] . '" border="0" /></a>';
202 $pm = '<a href="' . $temp_url . '">' . $lang['Send_private_message'] . '</a>';
204 $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>' : '';
205 $www = ( $row['user_website'] ) ? '<a href="' . $row['user_website'] . '" target="_userwww">' . $lang['Visit_website'] . '</a>' : '';
207 if ( !empty($row['user_icq']) )
209 $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>';
210 $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>';
211 $icq = '<a href="http://wwp.icq.com/scripts/search.dll?to=' . $row['user_icq'] . '">' . $lang['ICQ'] . '</a>';
215 $icq_status_img = '';
220 $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>' : '';
221 $aim = ( $row['user_aim'] ) ? '<a href="aim:goim?screenname=' . $row['user_aim'] . '&message=Hello+Are+you+there?">' . $lang['AIM'] . '</a>' : '';
223 $temp_url = append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$user_id");
224 $msn_img = ( $row['user_msnm'] ) ? '<a href="' . $temp_url . '"><img src="' . $images['icon_msnm'] . '" alt="' . $lang['MSNM'] . '" title="' . $lang['MSNM'] . '" border="0" /></a>' : '';
225 $msn = ( $row['user_msnm'] ) ? '<a href="' . $temp_url . '">' . $lang['MSNM'] . '</a>' : '';
227 $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>' : '';
228 $yim = ( $row['user_yim'] ) ? '<a href="http://edit.yahoo.com/config/send_webmesg?.target=' . $row['user_yim'] . '&.src=pg">' . $lang['YIM'] . '</a>' : '';
230 $temp_url = append_sid("search.$phpEx?search_author=" . urlencode($username) . "&showresults=posts");
231 $search_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_search'] . '" alt="' . $lang['Search_user_posts'] . '" title="' . $lang['Search_user_posts'] . '" border="0" /></a>';
232 $search = '<a href="' . $temp_url . '">' . $lang['Search_user_posts'] . '</a>';
234 $row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2'];
235 $row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'];
237 $template->assign_block_vars('memberrow', array(
238 'ROW_NUMBER' => $i + ( $start + 1 ),
239 'ROW_COLOR' => '#' . $row_color,
240 'ROW_CLASS' => $row_class,
241 'USERNAME' => $username,
245 'AVATAR_IMG' => $poster_avatar,
246 'PROFILE_IMG' => $profile_img,
247 'PROFILE' => $profile,
248 'SEARCH_IMG' => $search_img,
252 'EMAIL_IMG' => $email_img,
254 'WWW_IMG' => $www_img,
256 'ICQ_STATUS_IMG' => $icq_status_img,
257 'ICQ_IMG' => $icq_img,
259 'AIM_IMG' => $aim_img,
261 'MSN_IMG' => $msn_img,
263 'YIM_IMG' => $yim_img,
266 'U_VIEWPROFILE' => append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$user_id"))
271 while ( $row = $db->sql_fetchrow($result) );
272 $db->sql_freeresult($result);
275 if ( $mode != 'topten' || $board_config['topics_per_page'] < 10 )
277 $sql = "SELECT count(*) AS total
278 FROM " . USERS_TABLE . "
279 WHERE user_id <> " . ANONYMOUS;
281 if ( !($result = $db->sql_query($sql)) )
283 message_die(GENERAL_ERROR, 'Error getting total users', '', __LINE__, __FILE__, $sql);
286 if ( $total = $db->sql_fetchrow($result) )
288 $total_members = $total['total'];
290 $pagination = generate_pagination("memberlist.$phpEx?mode=$mode&order=$sort_order", $total_members, $board_config['topics_per_page'], $start). ' ';
292 $db->sql_freeresult($result);
296 $pagination = ' ';
300 $template->assign_vars(array(
301 'PAGINATION' => $pagination,
302 'PAGE_NUMBER' => sprintf($lang['Page_of'], ( floor( $start / $board_config['topics_per_page'] ) + 1 ), ceil( $total_members / $board_config['topics_per_page'] )),
304 'L_GOTO_PAGE' => $lang['Goto_page'])
307 $template->pparse('body');
309 include($phpbb_root_path . 'includes/page_tail.'.$phpEx);