Statistics
| Revision:

root / tags / release_2_0_1 / phpBB / memberlist.php

History | View | Annotate | Download (11.8 KB)

1 272 thefinn
<?php
2 272 thefinn
/***************************************************************************
3 275 psotfx
 *                              memberlist.php
4 272 thefinn
 *                            -------------------
5 272 thefinn
 *   begin                : Friday, May 11, 2001
6 272 thefinn
 *   copyright            : (C) 2001 The phpBB Group
7 272 thefinn
 *   email                : support@phpbb.com
8 272 thefinn
 *
9 272 thefinn
 *   $Id$
10 272 thefinn
 *
11 272 thefinn
 ***************************************************************************/
12 272 thefinn
13 943 thefinn
/***************************************************************************
14 943 thefinn
 *
15 943 thefinn
 *   This program is free software; you can redistribute it and/or modify
16 943 thefinn
 *   it under the terms of the GNU General Public License as published by
17 943 thefinn
 *   the Free Software Foundation; either version 2 of the License, or
18 943 thefinn
 *   (at your option) any later version.
19 943 thefinn
 *
20 943 thefinn
 ***************************************************************************/
21 943 thefinn
22 2305 psotfx
define('IN_PHPBB', true);
23 2448 psotfx
$phpbb_root_path = './';
24 646 psotfx
include($phpbb_root_path . 'extension.inc');
25 646 psotfx
include($phpbb_root_path . 'common.'.$phpEx);
26 646 psotfx
27 272 thefinn
//
28 272 thefinn
// Start session management
29 272 thefinn
//
30 2260 psotfx
$userdata = session_pagestart($user_ip, PAGE_VIEWMEMBERS);
31 272 thefinn
init_userprefs($userdata);
32 272 thefinn
//
33 272 thefinn
// End session management
34 272 thefinn
//
35 272 thefinn
36 2600 psotfx
$start = ( isset($HTTP_GET_VARS['start']) ) ? intval($HTTP_GET_VARS['start']) : 0;
37 272 thefinn
38 563 uid42062
if(isset($HTTP_POST_VARS['order']))
39 272 thefinn
{
40 2448 psotfx
        $sort_order = ($HTTP_POST_VARS['order'] == 'ASC') ? 'ASC' : 'DESC';
41 563 uid42062
}
42 563 uid42062
else if(isset($HTTP_GET_VARS['order']))
43 563 uid42062
{
44 2448 psotfx
        $sort_order = ($HTTP_GET_VARS['order'] == 'ASC') ? 'ASC' : 'DESC';
45 563 uid42062
}
46 563 uid42062
else
47 563 uid42062
{
48 2448 psotfx
        $sort_order = 'ASC';
49 563 uid42062
}
50 563 uid42062
51 2448 psotfx
//
52 2448 psotfx
// Memberlist sorting
53 2448 psotfx
//
54 2448 psotfx
$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']);
55 2448 psotfx
$mode_types = array('joindate', 'username', 'location', 'posts', 'email', 'website', 'topten');
56 2448 psotfx
57 2448 psotfx
$select_sort_mode = '<select name="mode">';
58 2448 psotfx
for($i = 0; $i < count($mode_types_text); $i++)
59 563 uid42062
{
60 2448 psotfx
        $selected = ( $mode == $mode_types[$i] ) ? ' selected="selected"' : '';
61 2600 psotfx
        $select_sort_mode .= '<option value="' . $mode_types[$i] . '"' . $selected . '>' . $mode_types_text[$i] . '</option>';
62 2448 psotfx
}
63 2448 psotfx
$select_sort_mode .= '</select>';
64 563 uid42062
65 2448 psotfx
$select_sort_order = '<select name="order">';
66 2448 psotfx
if($sort_order == 'ASC')
67 2448 psotfx
{
68 2448 psotfx
        $select_sort_order .= '<option value="ASC" selected="selected">' . $lang['Sort_Ascending'] . '</option><option value="DESC">' . $lang['Sort_Descending'] . '</option>';
69 2448 psotfx
}
70 2448 psotfx
else
71 2448 psotfx
{
72 2448 psotfx
        $select_sort_order .= '<option value="ASC">' . $lang['Sort_Ascending'] . '</option><option value="DESC" selected="selected">' . $lang['Sort_Descending'] . '</option>';
73 2448 psotfx
}
74 2448 psotfx
$select_sort_order .= '</select>';
75 2448 psotfx
76 2448 psotfx
//
77 2448 psotfx
// Generate page
78 2448 psotfx
//
79 2448 psotfx
$page_title = $lang['Memberlist'];
80 2448 psotfx
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
81 2448 psotfx
82 2448 psotfx
$template->set_filenames(array(
83 2448 psotfx
        'body' => 'memberlist_body.tpl')
84 2448 psotfx
);
85 2448 psotfx
make_jumpbox('viewforum.'.$phpEx);
86 2448 psotfx
87 2448 psotfx
$template->assign_vars(array(
88 2448 psotfx
        'L_SELECT_SORT_METHOD' => $lang['Select_sort_method'],
89 2448 psotfx
        'L_EMAIL' => $lang['Email'],
90 2448 psotfx
        'L_WEBSITE' => $lang['Website'],
91 2448 psotfx
        'L_FROM' => $lang['Location'],
92 2448 psotfx
        'L_ORDER' => $lang['Order'],
93 2448 psotfx
        'L_SORT' => $lang['Sort'],
94 2448 psotfx
        'L_SUBMIT' => $lang['Sort'],
95 2448 psotfx
        'L_AIM' => $lang['AIM'],
96 2448 psotfx
        'L_YIM' => $lang['YIM'],
97 2448 psotfx
        'L_MSNM' => $lang['MSNM'],
98 2448 psotfx
        'L_ICQ' => $lang['ICQ'],
99 2448 psotfx
        'L_JOINED' => $lang['Joined'],
100 2448 psotfx
        'L_POSTS' => $lang['Posts'],
101 2448 psotfx
102 2448 psotfx
        'S_MODE_SELECT' => $select_sort_mode,
103 2448 psotfx
        'S_ORDER_SELECT' => $select_sort_order,
104 2448 psotfx
        'S_MODE_ACTION' => append_sid("memberlist.$phpEx"))
105 2448 psotfx
);
106 2448 psotfx
107 2448 psotfx
if ( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
108 2448 psotfx
{
109 2448 psotfx
        $mode = ( isset($HTTP_POST_VARS['mode']) ) ? $HTTP_POST_VARS['mode'] : $HTTP_GET_VARS['mode'];
110 2448 psotfx
111 2448 psotfx
        switch( $mode )
112 275 psotfx
        {
113 563 uid42062
                case 'joined':
114 563 uid42062
                        $order_by = "user_regdate ASC LIMIT $start, " . $board_config['topics_per_page'];
115 563 uid42062
                        break;
116 563 uid42062
                case 'username':
117 563 uid42062
                        $order_by = "username $sort_order LIMIT $start, " . $board_config['topics_per_page'];
118 563 uid42062
                        break;
119 563 uid42062
                case 'location':
120 563 uid42062
                        $order_by = "user_from $sort_order LIMIT $start, " . $board_config['topics_per_page'];
121 563 uid42062
                        break;
122 563 uid42062
                case 'posts':
123 563 uid42062
                        $order_by = "user_posts $sort_order LIMIT $start, " . $board_config['topics_per_page'];
124 563 uid42062
                        break;
125 563 uid42062
                case 'email':
126 563 uid42062
                        $order_by = "user_email $sort_order LIMIT $start, " . $board_config['topics_per_page'];
127 563 uid42062
                        break;
128 563 uid42062
                case 'website':
129 563 uid42062
                        $order_by = "user_website $sort_order LIMIT $start, " . $board_config['topics_per_page'];
130 563 uid42062
                        break;
131 275 psotfx
                case 'topten':
132 1699 psotfx
                        $order_by = "user_posts DESC LIMIT 10";
133 275 psotfx
                        break;
134 275 psotfx
                default:
135 563 uid42062
                        $order_by = "user_regdate $sort_order LIMIT $start, " . $board_config['topics_per_page'];
136 275 psotfx
                        break;
137 275 psotfx
        }
138 272 thefinn
}
139 275 psotfx
else
140 275 psotfx
{
141 563 uid42062
        $order_by = "user_regdate $sort_order LIMIT $start, " . $board_config['topics_per_page'];
142 275 psotfx
}
143 2448 psotfx
144 1652 psotfx
$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
145 943 thefinn
        FROM " . USERS_TABLE . "
146 943 thefinn
        WHERE user_id <> " . ANONYMOUS . "
147 563 uid42062
        ORDER BY $order_by";
148 1895 psotfx
if( !($result = $db->sql_query($sql)) )
149 1895 psotfx
{
150 2448 psotfx
        message_die(GENERAL_ERROR, 'Could not query users', '', __LINE__, __FILE__, $sql);
151 1895 psotfx
}
152 272 thefinn
153 2448 psotfx
if ( $row = $db->sql_fetchrow($result) )
154 563 uid42062
{
155 2448 psotfx
        $i = 0;
156 2448 psotfx
        do
157 2448 psotfx
        {
158 2448 psotfx
                $username = $row['username'];
159 2448 psotfx
                $user_id = $row['user_id'];
160 563 uid42062
161 2448 psotfx
                $from = ( !empty($row['user_from']) ) ? $row['user_from'] : '&nbsp;';
162 2448 psotfx
                $joined = create_date($lang['DATE_FORMAT'], $row['user_regdate'], $board_config['board_timezone']);
163 2448 psotfx
                $posts = ( $row['user_posts'] ) ? $row['user_posts'] : 0;
164 563 uid42062
165 2448 psotfx
                $poster_avatar = '';
166 2448 psotfx
                if ( $row['user_avatar_type'] && $user_id != ANONYMOUS && $row['user_allowavatar'] )
167 2448 psotfx
                {
168 2448 psotfx
                        switch( $row['user_avatar_type'] )
169 2448 psotfx
                        {
170 2448 psotfx
                                case USER_AVATAR_UPLOAD:
171 2448 psotfx
                                        $poster_avatar = ( $board_config['allow_avatar_upload'] ) ? '<img src="' . $board_config['avatar_path'] . '/' . $row['user_avatar'] . '" alt="" border="0" />' : '';
172 2448 psotfx
                                        break;
173 2448 psotfx
                                case USER_AVATAR_REMOTE:
174 2448 psotfx
                                        $poster_avatar = ( $board_config['allow_avatar_remote'] ) ? '<img src="' . $row['user_avatar'] . '" alt="" border="0" />' : '';
175 2448 psotfx
                                        break;
176 2448 psotfx
                                case USER_AVATAR_GALLERY:
177 2448 psotfx
                                        $poster_avatar = ( $board_config['allow_avatar_local'] ) ? '<img src="' . $board_config['avatar_gallery_path'] . '/' . $row['user_avatar'] . '" alt="" border="0" />' : '';
178 2448 psotfx
                                        break;
179 2448 psotfx
                        }
180 2448 psotfx
                }
181 563 uid42062
182 2448 psotfx
                if ( !empty($row['user_viewemail']) || $userdata['user_level'] == ADMIN )
183 2448 psotfx
                {
184 2448 psotfx
                        $email_uri = ( $board_config['board_email_form'] ) ? append_sid("profile.$phpEx?mode=email&amp;" . POST_USERS_URL .'=' . $user_id) : 'mailto:' . $row['user_email'];
185 563 uid42062
186 2448 psotfx
                        $email_img = '<a href="' . $email_uri . '"><img src="' . $images['icon_email'] . '" alt="' . $lang['Send_email'] . '" title="' . $lang['Send_email'] . '" border="0" /></a>';
187 2448 psotfx
                        $email = '<a href="' . $email_uri . '">' . $lang['Send_email'] . '</a>';
188 2448 psotfx
                }
189 2448 psotfx
                else
190 2448 psotfx
                {
191 2448 psotfx
                        $email_img = '&nbsp;';
192 2448 psotfx
                        $email = '&nbsp;';
193 2448 psotfx
                }
194 563 uid42062
195 2448 psotfx
                $temp_url = append_sid("profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . "=$user_id");
196 2448 psotfx
                $profile_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_profile'] . '" alt="' . $lang['Read_profile'] . '" title="' . $lang['Read_profile'] . '" border="0" /></a>';
197 2448 psotfx
                $profile = '<a href="' . $temp_url . '">' . $lang['Read_profile'] . '</a>';
198 943 thefinn
199 2448 psotfx
                $temp_url = append_sid("privmsg.$phpEx?mode=post&amp;" . POST_USERS_URL . "=$user_id");
200 2448 psotfx
                $pm_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_pm'] . '" alt="' . $lang['Send_private_message'] . '" title="' . $lang['Send_private_message'] . '" border="0" /></a>';
201 2448 psotfx
                $pm = '<a href="' . $temp_url . '">' . $lang['Send_private_message'] . '</a>';
202 272 thefinn
203 2448 psotfx
                $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>' : '';
204 2448 psotfx
                $www = ( $row['user_website'] ) ? '<a href="' . $row['user_website'] . '" target="_userwww">' . $lang['Visit_website'] . '</a>' : '';
205 596 psotfx
206 2448 psotfx
                if ( !empty($row['user_icq']) )
207 272 thefinn
                {
208 2448 psotfx
                        $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>';
209 2448 psotfx
                        $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>';
210 2448 psotfx
                        $icq =  '<a href="http://wwp.icq.com/scripts/search.dll?to=' . $row['user_icq'] . '">' . $lang['ICQ'] . '</a>';
211 272 thefinn
                }
212 2448 psotfx
                else
213 2448 psotfx
                {
214 2448 psotfx
                        $icq_status_img = '';
215 2448 psotfx
                        $icq_img = '';
216 2448 psotfx
                        $icq = '';
217 2448 psotfx
                }
218 596 psotfx
219 2448 psotfx
                $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>' : '';
220 2448 psotfx
                $aim = ( $row['user_aim'] ) ? '<a href="aim:goim?screenname=' . $row['user_aim'] . '&amp;message=Hello+Are+you+there?">' . $lang['AIM'] . '</a>' : '';
221 943 thefinn
222 2448 psotfx
                $temp_url = append_sid("profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . "=$user_id");
223 2448 psotfx
                $msn_img = ( $row['user_msnm'] ) ? '<a href="' . $temp_url . '"><img src="' . $images['icon_msnm'] . '" alt="' . $lang['MSNM'] . '" title="' . $lang['MSNM'] . '" border="0" /></a>' : '';
224 2448 psotfx
                $msn = ( $row['user_msnm'] ) ? '<a href="' . $temp_url . '">' . $lang['MSNM'] . '</a>' : '';
225 596 psotfx
226 2448 psotfx
                $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>' : '';
227 2448 psotfx
                $yim = ( $row['user_yim'] ) ? '<a href="http://edit.yahoo.com/config/send_webmesg?.target=' . $row['user_yim'] . '&amp;.src=pg">' . $lang['YIM'] . '</a>' : '';
228 596 psotfx
229 2448 psotfx
                $temp_url = append_sid("search.$phpEx?search_author=" . urlencode($username) . "&amp;showresults=posts");
230 2448 psotfx
                $search_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_search'] . '" alt="' . $lang['Search_user_posts'] . '" title="' . $lang['Search_user_posts'] . '" border="0" /></a>';
231 2448 psotfx
                $search = '<a href="' . $temp_url . '">' . $lang['Search_user_posts'] . '</a>';
232 596 psotfx
233 2448 psotfx
                $row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2'];
234 2448 psotfx
                $row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'];
235 596 psotfx
236 2448 psotfx
                $template->assign_block_vars('memberrow', array(
237 2448 psotfx
                        'ROW_NUMBER' => $i + ( $HTTP_GET_VARS['start'] + 1 ),
238 2448 psotfx
                        'ROW_COLOR' => '#' . $row_color,
239 2448 psotfx
                        'ROW_CLASS' => $row_class,
240 2448 psotfx
                        'USERNAME' => $username,
241 2448 psotfx
                        'FROM' => $from,
242 2448 psotfx
                        'JOINED' => $joined,
243 2448 psotfx
                        'POSTS' => $posts,
244 2448 psotfx
                        'AVATAR_IMG' => $poster_avatar,
245 2448 psotfx
                        'PROFILE_IMG' => $profile_img,
246 2448 psotfx
                        'PROFILE' => $profile,
247 2448 psotfx
                        'SEARCH_IMG' => $search_img,
248 2448 psotfx
                        'SEARCH' => $search,
249 2448 psotfx
                        'PM_IMG' => $pm_img,
250 2448 psotfx
                        'PM' => $pm,
251 2448 psotfx
                        'EMAIL_IMG' => $email_img,
252 2448 psotfx
                        'EMAIL' => $email,
253 2448 psotfx
                        'WWW_IMG' => $www_img,
254 2448 psotfx
                        'WWW' => $www,
255 2448 psotfx
                        'ICQ_STATUS_IMG' => $icq_status_img,
256 2448 psotfx
                        'ICQ_IMG' => $icq_img,
257 2448 psotfx
                        'ICQ' => $icq,
258 2448 psotfx
                        'AIM_IMG' => $aim_img,
259 2448 psotfx
                        'AIM' => $aim,
260 2448 psotfx
                        'MSN_IMG' => $msn_img,
261 2448 psotfx
                        'MSN' => $msn,
262 2448 psotfx
                        'YIM_IMG' => $yim_img,
263 2448 psotfx
                        'YIM' => $yim,
264 2448 psotfx
265 2448 psotfx
                        'U_VIEWPROFILE' => append_sid("profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . "=$user_id"))
266 2448 psotfx
                );
267 2448 psotfx
268 2448 psotfx
                $i++;
269 1889 psotfx
        }
270 2448 psotfx
        while ( $row = $db->sql_fetchrow($result) );
271 1889 psotfx
}
272 563 uid42062
273 2448 psotfx
if ( $mode != 'topten' || $board_config['topics_per_page'] < 10 )
274 1889 psotfx
{
275 1889 psotfx
        $sql = "SELECT count(*) AS total
276 1889 psotfx
                FROM " . USERS_TABLE . "
277 1889 psotfx
                WHERE user_id <> " . ANONYMOUS;
278 1889 psotfx
279 2448 psotfx
        if ( !($result = $db->sql_query($sql)) )
280 1889 psotfx
        {
281 2448 psotfx
                message_die(GENERAL_ERROR, 'Error getting total users', '', __LINE__, __FILE__, $sql);
282 272 thefinn
        }
283 2448 psotfx
284 2448 psotfx
        if ( $total = $db->sql_fetchrow($result) )
285 273 thefinn
        {
286 1889 psotfx
                $total_members = $total['total'];
287 943 thefinn
288 2448 psotfx
                $pagination = generate_pagination("memberlist.$phpEx?mode=$mode&amp;order=$sort_order", $total_members, $board_config['topics_per_page'], $start). '&nbsp;';
289 1889 psotfx
        }
290 272 thefinn
}
291 1889 psotfx
else
292 1889 psotfx
{
293 2448 psotfx
        $pagination = '&nbsp;';
294 1889 psotfx
        $total_members = 10;
295 1889 psotfx
}
296 272 thefinn
297 1889 psotfx
$template->assign_vars(array(
298 2448 psotfx
        'PAGINATION' => $pagination,
299 2448 psotfx
        'PAGE_NUMBER' => sprintf($lang['Page_of'], ( floor( $start / $board_config['topics_per_page'] ) + 1 ), ceil( $total_members / $board_config['topics_per_page'] )),
300 1889 psotfx
301 2448 psotfx
        'L_GOTO_PAGE' => $lang['Goto_page'])
302 1889 psotfx
);
303 1889 psotfx
304 2448 psotfx
$template->pparse('body');
305 2448 psotfx
306 646 psotfx
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
307 563 uid42062
308 2448 psotfx
?>