Rev Author Line No. Line
130 kaklik 1 <?php
2 /***************************************************************************
3 * memberlist.php
4 * -------------------
5 * begin : Friday, May 11, 2001
6 * copyright : (C) 2001 The phpBB Group
7 * email : support@phpbb.com
8 *
9 * $Id: memberlist.php,v 1.36.2.12 2006/02/07 20:42:51 grahamje Exp $
10 *
11 ***************************************************************************/
12  
13 /***************************************************************************
14 *
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.
19 *
20 ***************************************************************************/
21  
22 define('IN_PHPBB', true);
23 $phpbb_root_path = './';
24 include($phpbb_root_path . 'extension.inc');
25 include($phpbb_root_path . 'common.'.$phpEx);
26  
27 //
28 // Start session management
29 //
30 $userdata = session_pagestart($user_ip, PAGE_VIEWMEMBERS);
31 init_userprefs($userdata);
32 //
33 // End session management
34 //
35  
36 $start = ( isset($HTTP_GET_VARS['start']) ) ? intval($HTTP_GET_VARS['start']) : 0;
37  
38 if ( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
39 {
40 $mode = ( isset($HTTP_POST_VARS['mode']) ) ? htmlspecialchars($HTTP_POST_VARS['mode']) : htmlspecialchars($HTTP_GET_VARS['mode']);
41 }
42 else
43 {
44 $mode = 'joined';
45 }
46  
47 if(isset($HTTP_POST_VARS['order']))
48 {
49 $sort_order = ($HTTP_POST_VARS['order'] == 'ASC') ? 'ASC' : 'DESC';
50 }
51 else if(isset($HTTP_GET_VARS['order']))
52 {
53 $sort_order = ($HTTP_GET_VARS['order'] == 'ASC') ? 'ASC' : 'DESC';
54 }
55 else
56 {
57 $sort_order = 'ASC';
58 }
59  
60 //
61 // Memberlist sorting
62 //
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('joined', 'username', 'location', 'posts', 'email', 'website', 'topten');
65  
66 $select_sort_mode = '<select name="mode">';
67 for($i = 0; $i < count($mode_types_text); $i++)
68 {
69 $selected = ( $mode == $mode_types[$i] ) ? ' selected="selected"' : '';
70 $select_sort_mode .= '<option value="' . $mode_types[$i] . '"' . $selected . '>' . $mode_types_text[$i] . '</option>';
71 }
72 $select_sort_mode .= '</select>';
73  
74 $select_sort_order = '<select name="order">';
75 if($sort_order == 'ASC')
76 {
77 $select_sort_order .= '<option value="ASC" selected="selected">' . $lang['Sort_Ascending'] . '</option><option value="DESC">' . $lang['Sort_Descending'] . '</option>';
78 }
79 else
80 {
81 $select_sort_order .= '<option value="ASC">' . $lang['Sort_Ascending'] . '</option><option value="DESC" selected="selected">' . $lang['Sort_Descending'] . '</option>';
82 }
83 $select_sort_order .= '</select>';
84  
85 //
86 // Generate page
87 //
88 $page_title = $lang['Memberlist'];
89 include($phpbb_root_path . 'includes/page_header.'.$phpEx);
90  
91 $template->set_filenames(array(
92 'body' => 'memberlist_body.tpl')
93 );
94 make_jumpbox('viewforum.'.$phpEx);
95  
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'],
111  
112 'S_MODE_SELECT' => $select_sort_mode,
113 'S_ORDER_SELECT' => $select_sort_order,
114 'S_MODE_ACTION' => append_sid("memberlist.$phpEx"))
115 );
116  
117 switch( $mode )
118 {
119 case 'joined':
120 $order_by = "user_regdate $sort_order LIMIT $start, " . $board_config['topics_per_page'];
121 break;
122 case 'username':
123 $order_by = "username $sort_order LIMIT $start, " . $board_config['topics_per_page'];
124 break;
125 case 'location':
126 $order_by = "user_from $sort_order LIMIT $start, " . $board_config['topics_per_page'];
127 break;
128 case 'posts':
129 $order_by = "user_posts $sort_order LIMIT $start, " . $board_config['topics_per_page'];
130 break;
131 case 'email':
132 $order_by = "user_email $sort_order LIMIT $start, " . $board_config['topics_per_page'];
133 break;
134 case 'website':
135 $order_by = "user_website $sort_order LIMIT $start, " . $board_config['topics_per_page'];
136 break;
137 case 'topten':
138 $order_by = "user_posts $sort_order LIMIT 10";
139 break;
140 default:
141 $order_by = "user_regdate $sort_order LIMIT $start, " . $board_config['topics_per_page'];
142 break;
143 }
144  
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 . "
148 ORDER BY $order_by";
149 if( !($result = $db->sql_query($sql)) )
150 {
151 message_die(GENERAL_ERROR, 'Could not query users', '', __LINE__, __FILE__, $sql);
152 }
153  
154 if ( $row = $db->sql_fetchrow($result) )
155 {
156 $i = 0;
157 do
158 {
159 $username = $row['username'];
160 $user_id = $row['user_id'];
161  
162 $from = ( !empty($row['user_from']) ) ? $row['user_from'] : '&nbsp;';
163 $joined = create_date($lang['DATE_FORMAT'], $row['user_regdate'], $board_config['board_timezone']);
164 $posts = ( $row['user_posts'] ) ? $row['user_posts'] : 0;
165  
166 $poster_avatar = '';
167 if ( $row['user_avatar_type'] && $user_id != ANONYMOUS && $row['user_allowavatar'] )
168 {
169 switch( $row['user_avatar_type'] )
170 {
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" />' : '';
173 break;
174 case USER_AVATAR_REMOTE:
175 $poster_avatar = ( $board_config['allow_avatar_remote'] ) ? '<img src="' . $row['user_avatar'] . '" alt="" border="0" />' : '';
176 break;
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" />' : '';
179 break;
180 }
181 }
182  
183 if ( !empty($row['user_viewemail']) || $userdata['user_level'] == ADMIN )
184 {
185 $email_uri = ( $board_config['board_email_form'] ) ? append_sid("profile.$phpEx?mode=email&amp;" . POST_USERS_URL .'=' . $user_id) : 'mailto:' . $row['user_email'];
186  
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>';
189 }
190 else
191 {
192 $email_img = '&nbsp;';
193 $email = '&nbsp;';
194 }
195  
196 $temp_url = append_sid("profile.$phpEx?mode=viewprofile&amp;" . 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>';
199  
200 $temp_url = append_sid("privmsg.$phpEx?mode=post&amp;" . 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>';
203  
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>' : '';
206  
207 if ( !empty($row['user_icq']) )
208 {
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>';
212 }
213 else
214 {
215 $icq_status_img = '';
216 $icq_img = '';
217 $icq = '';
218 }
219  
220 $aim_img = ( $row['user_aim'] ) ? '<a href="aim:goim?screenname=' . $row['user_aim'] . '&amp;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'] . '&amp;message=Hello+Are+you+there?">' . $lang['AIM'] . '</a>' : '';
222  
223 $temp_url = append_sid("profile.$phpEx?mode=viewprofile&amp;" . 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>' : '';
226  
227 $yim_img = ( $row['user_yim'] ) ? '<a href="http://edit.yahoo.com/config/send_webmesg?.target=' . $row['user_yim'] . '&amp;.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'] . '&amp;.src=pg">' . $lang['YIM'] . '</a>' : '';
229  
230 $temp_url = append_sid("search.$phpEx?search_author=" . urlencode($username) . "&amp;showresults=posts");
231 $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>';
232 $search = '<a href="' . $temp_url . '">' . sprintf($lang['Search_user_posts'], $username) . '</a>';
233  
234 $row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2'];
235 $row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'];
236  
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,
242 'FROM' => $from,
243 'JOINED' => $joined,
244 'POSTS' => $posts,
245 'AVATAR_IMG' => $poster_avatar,
246 'PROFILE_IMG' => $profile_img,
247 'PROFILE' => $profile,
248 'SEARCH_IMG' => $search_img,
249 'SEARCH' => $search,
250 'PM_IMG' => $pm_img,
251 'PM' => $pm,
252 'EMAIL_IMG' => $email_img,
253 'EMAIL' => $email,
254 'WWW_IMG' => $www_img,
255 'WWW' => $www,
256 'ICQ_STATUS_IMG' => $icq_status_img,
257 'ICQ_IMG' => $icq_img,
258 'ICQ' => $icq,
259 'AIM_IMG' => $aim_img,
260 'AIM' => $aim,
261 'MSN_IMG' => $msn_img,
262 'MSN' => $msn,
263 'YIM_IMG' => $yim_img,
264 'YIM' => $yim,
265  
266 'U_VIEWPROFILE' => append_sid("profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . "=$user_id"))
267 );
268  
269 $i++;
270 }
271 while ( $row = $db->sql_fetchrow($result) );
272 $db->sql_freeresult($result);
273 }
274  
275 if ( $mode != 'topten' || $board_config['topics_per_page'] < 10 )
276 {
277 $sql = "SELECT count(*) AS total
278 FROM " . USERS_TABLE . "
279 WHERE user_id <> " . ANONYMOUS;
280  
281 if ( !($result = $db->sql_query($sql)) )
282 {
283 message_die(GENERAL_ERROR, 'Error getting total users', '', __LINE__, __FILE__, $sql);
284 }
285  
286 if ( $total = $db->sql_fetchrow($result) )
287 {
288 $total_members = $total['total'];
289  
290 $pagination = generate_pagination("memberlist.$phpEx?mode=$mode&amp;order=$sort_order", $total_members, $board_config['topics_per_page'], $start). '&nbsp;';
291 }
292 $db->sql_freeresult($result);
293 }
294 else
295 {
296 $pagination = '&nbsp;';
297 $total_members = 10;
298 }
299  
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'] )),
303  
304 'L_GOTO_PAGE' => $lang['Goto_page'])
305 );
306  
307 $template->pparse('body');
308  
309 include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
310  
311 ?>