1 | <?php
|
---|
2 | /**
|
---|
3 | *
|
---|
4 | * @package phpBB3
|
---|
5 | * @version $Id$
|
---|
6 | * @copyright (c) 2005 phpBB Group
|
---|
7 | * @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
---|
8 | *
|
---|
9 | */
|
---|
10 |
|
---|
11 | /**
|
---|
12 | * @ignore
|
---|
13 | */
|
---|
14 | define('IN_PHPBB', true);
|
---|
15 | $phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
|
---|
16 | $phpEx = substr(strrchr(__FILE__, '.'), 1);
|
---|
17 | include($phpbb_root_path . 'common.' . $phpEx);
|
---|
18 | include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
|
---|
19 |
|
---|
20 | // Start session management
|
---|
21 | $user->session_begin();
|
---|
22 | $auth->acl($user->data);
|
---|
23 | $user->setup(array('memberlist', 'groups'));
|
---|
24 |
|
---|
25 | // Grab data
|
---|
26 | $mode = request_var('mode', '');
|
---|
27 | $action = request_var('action', '');
|
---|
28 | $user_id = request_var('u', ANONYMOUS);
|
---|
29 | $username = request_var('un', '', true);
|
---|
30 | $group_id = request_var('g', 0);
|
---|
31 | $topic_id = request_var('t', 0);
|
---|
32 |
|
---|
33 | // Check our mode...
|
---|
34 | if (!in_array($mode, array('', 'group', 'viewprofile', 'email', 'contact', 'searchuser', 'leaders')))
|
---|
35 | {
|
---|
36 | trigger_error('NO_MODE');
|
---|
37 | }
|
---|
38 |
|
---|
39 | switch ($mode)
|
---|
40 | {
|
---|
41 | case 'email':
|
---|
42 | break;
|
---|
43 |
|
---|
44 | default:
|
---|
45 | // Can this user view profiles/memberlist?
|
---|
46 | if (!$auth->acl_gets('u_viewprofile', 'a_user', 'a_useradd', 'a_userdel'))
|
---|
47 | {
|
---|
48 | if ($user->data['user_id'] != ANONYMOUS)
|
---|
49 | {
|
---|
50 | trigger_error('NO_VIEW_USERS');
|
---|
51 | }
|
---|
52 |
|
---|
53 | login_box('', ((isset($user->lang['LOGIN_EXPLAIN_' . strtoupper($mode)])) ? $user->lang['LOGIN_EXPLAIN_' . strtoupper($mode)] : $user->lang['LOGIN_EXPLAIN_MEMBERLIST']));
|
---|
54 | }
|
---|
55 | break;
|
---|
56 | }
|
---|
57 |
|
---|
58 | $start = request_var('start', 0);
|
---|
59 | $submit = (isset($_POST['submit'])) ? true : false;
|
---|
60 |
|
---|
61 | $default_key = 'c';
|
---|
62 | $sort_key = request_var('sk', $default_key);
|
---|
63 | $sort_dir = request_var('sd', 'a');
|
---|
64 |
|
---|
65 |
|
---|
66 | // Grab rank information for later
|
---|
67 | $ranks = $cache->obtain_ranks();
|
---|
68 |
|
---|
69 |
|
---|
70 | // What do you want to do today? ... oops, I think that line is taken ...
|
---|
71 | switch ($mode)
|
---|
72 | {
|
---|
73 | case 'leaders':
|
---|
74 | // Display a listing of board admins, moderators
|
---|
75 | include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
|
---|
76 |
|
---|
77 | $page_title = $user->lang['THE_TEAM'];
|
---|
78 | $template_html = 'memberlist_leaders.html';
|
---|
79 |
|
---|
80 | $user_ary = $auth->acl_get_list(false, array('a_', 'm_'), false);
|
---|
81 |
|
---|
82 | $admin_id_ary = $global_mod_id_ary = $mod_id_ary = $forum_id_ary = array();
|
---|
83 | foreach ($user_ary as $forum_id => $forum_ary)
|
---|
84 | {
|
---|
85 | foreach ($forum_ary as $auth_option => $id_ary)
|
---|
86 | {
|
---|
87 | if (!$forum_id)
|
---|
88 | {
|
---|
89 | if ($auth_option == 'a_')
|
---|
90 | {
|
---|
91 | $admin_id_ary = array_merge($admin_id_ary, $id_ary);
|
---|
92 | }
|
---|
93 | else
|
---|
94 | {
|
---|
95 | $global_mod_id_ary = array_merge($global_mod_id_ary, $id_ary);
|
---|
96 | }
|
---|
97 | continue;
|
---|
98 | }
|
---|
99 | else
|
---|
100 | {
|
---|
101 | $mod_id_ary = array_merge($mod_id_ary, $id_ary);
|
---|
102 | }
|
---|
103 |
|
---|
104 | if ($forum_id)
|
---|
105 | {
|
---|
106 | foreach ($id_ary as $id)
|
---|
107 | {
|
---|
108 | $forum_id_ary[$id][] = $forum_id;
|
---|
109 | }
|
---|
110 | }
|
---|
111 | }
|
---|
112 | }
|
---|
113 |
|
---|
114 | $admin_id_ary = array_unique($admin_id_ary);
|
---|
115 | $global_mod_id_ary = array_unique($global_mod_id_ary);
|
---|
116 |
|
---|
117 | $mod_id_ary = array_merge($mod_id_ary, $global_mod_id_ary);
|
---|
118 | $mod_id_ary = array_unique($mod_id_ary);
|
---|
119 |
|
---|
120 | // Admin group id...
|
---|
121 | $sql = 'SELECT group_id
|
---|
122 | FROM ' . GROUPS_TABLE . "
|
---|
123 | WHERE group_name = 'ADMINISTRATORS'";
|
---|
124 | $result = $db->sql_query($sql);
|
---|
125 | $admin_group_id = (int) $db->sql_fetchfield('group_id');
|
---|
126 | $db->sql_freeresult($result);
|
---|
127 |
|
---|
128 | // Get group memberships for the admin id ary...
|
---|
129 | $admin_memberships = group_memberships($admin_group_id, $admin_id_ary);
|
---|
130 |
|
---|
131 | $admin_user_ids = array();
|
---|
132 |
|
---|
133 | if (!empty($admin_memberships))
|
---|
134 | {
|
---|
135 | // ok, we only need the user ids...
|
---|
136 | foreach ($admin_memberships as $row)
|
---|
137 | {
|
---|
138 | $admin_user_ids[$row['user_id']] = true;
|
---|
139 | }
|
---|
140 | }
|
---|
141 | unset($admin_memberships);
|
---|
142 |
|
---|
143 | $sql = 'SELECT forum_id, forum_name
|
---|
144 | FROM ' . FORUMS_TABLE;
|
---|
145 | $result = $db->sql_query($sql);
|
---|
146 |
|
---|
147 | $forums = array();
|
---|
148 | while ($row = $db->sql_fetchrow($result))
|
---|
149 | {
|
---|
150 | $forums[$row['forum_id']] = $row['forum_name'];
|
---|
151 | }
|
---|
152 | $db->sql_freeresult($result);
|
---|
153 |
|
---|
154 | $sql = $db->sql_build_query('SELECT', array(
|
---|
155 | 'SELECT' => 'u.user_id, u.group_id as default_group, u.username, u.username_clean, u.user_colour, u.user_rank, u.user_posts, u.user_allow_pm, g.group_id, g.group_name, g.group_colour, g.group_type, ug.user_id as ug_user_id',
|
---|
156 |
|
---|
157 | 'FROM' => array(
|
---|
158 | USERS_TABLE => 'u',
|
---|
159 | GROUPS_TABLE => 'g'
|
---|
160 | ),
|
---|
161 |
|
---|
162 | 'LEFT_JOIN' => array(
|
---|
163 | array(
|
---|
164 | 'FROM' => array(USER_GROUP_TABLE => 'ug'),
|
---|
165 | 'ON' => 'ug.group_id = g.group_id AND ug.user_pending = 0 AND ug.user_id = ' . $user->data['user_id']
|
---|
166 | )
|
---|
167 | ),
|
---|
168 |
|
---|
169 | 'WHERE' => $db->sql_in_set('u.user_id', array_unique(array_merge($admin_id_ary, $mod_id_ary)), false, true) . '
|
---|
170 | AND u.group_id = g.group_id',
|
---|
171 |
|
---|
172 | 'ORDER_BY' => 'g.group_name ASC, u.username_clean ASC'
|
---|
173 | ));
|
---|
174 | $result = $db->sql_query($sql);
|
---|
175 |
|
---|
176 | while ($row = $db->sql_fetchrow($result))
|
---|
177 | {
|
---|
178 | $which_row = (in_array($row['user_id'], $admin_id_ary)) ? 'admin' : 'mod';
|
---|
179 |
|
---|
180 | // We sort out admins not within the 'Administrators' group.
|
---|
181 | // Else, we will list those as admin only having the permission to view logs for example.
|
---|
182 | if ($which_row == 'admin' && empty($admin_user_ids[$row['user_id']]))
|
---|
183 | {
|
---|
184 | // Remove from admin_id_ary, because the user may be a mod instead
|
---|
185 | unset($admin_id_ary[array_search($row['user_id'], $admin_id_ary)]);
|
---|
186 |
|
---|
187 | if (!in_array($row['user_id'], $mod_id_ary) && !in_array($row['user_id'], $global_mod_id_ary))
|
---|
188 | {
|
---|
189 | continue;
|
---|
190 | }
|
---|
191 | else
|
---|
192 | {
|
---|
193 | $which_row = 'mod';
|
---|
194 | }
|
---|
195 | }
|
---|
196 |
|
---|
197 | $s_forum_select = '';
|
---|
198 | $undisclosed_forum = false;
|
---|
199 |
|
---|
200 | if (isset($forum_id_ary[$row['user_id']]) && !in_array($row['user_id'], $global_mod_id_ary))
|
---|
201 | {
|
---|
202 | if ($which_row == 'mod' && sizeof(array_diff(array_keys($forums), $forum_id_ary[$row['user_id']])))
|
---|
203 | {
|
---|
204 | foreach ($forum_id_ary[$row['user_id']] as $forum_id)
|
---|
205 | {
|
---|
206 | if (isset($forums[$forum_id]))
|
---|
207 | {
|
---|
208 | if ($auth->acl_get('f_list', $forum_id))
|
---|
209 | {
|
---|
210 | $s_forum_select .= '<option value="">' . $forums[$forum_id] . '</option>';
|
---|
211 | }
|
---|
212 | else
|
---|
213 | {
|
---|
214 | $undisclosed_forum = true;
|
---|
215 | }
|
---|
216 | }
|
---|
217 | }
|
---|
218 | }
|
---|
219 | }
|
---|
220 |
|
---|
221 | // If the mod is only moderating non-viewable forums we skip the user. There is no gain in displaying the person then...
|
---|
222 | if (!$s_forum_select && $undisclosed_forum)
|
---|
223 | {
|
---|
224 | // $s_forum_select = '<option value="">' . $user->lang['FORUM_UNDISCLOSED'] . '</option>';
|
---|
225 | continue;
|
---|
226 | }
|
---|
227 |
|
---|
228 | // The person is moderating several "public" forums, therefore the person should be listed, but not giving the real group name if hidden.
|
---|
229 | if ($row['group_type'] == GROUP_HIDDEN && !$auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel') && $row['ug_user_id'] != $user->data['user_id'])
|
---|
230 | {
|
---|
231 | $group_name = $user->lang['GROUP_UNDISCLOSED'];
|
---|
232 | $u_group = '';
|
---|
233 | }
|
---|
234 | else
|
---|
235 | {
|
---|
236 | $group_name = ($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name'];
|
---|
237 | $u_group = append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&g=' . $row['group_id']);
|
---|
238 | }
|
---|
239 |
|
---|
240 | $rank_title = $rank_img = '';
|
---|
241 | get_user_rank($row['user_rank'], (($row['user_id'] == ANONYMOUS) ? false : $row['user_posts']), $rank_title, $rank_img, $rank_img_src);
|
---|
242 |
|
---|
243 | $template->assign_block_vars($which_row, array(
|
---|
244 | 'USER_ID' => $row['user_id'],
|
---|
245 | 'FORUMS' => $s_forum_select,
|
---|
246 | 'RANK_TITLE' => $rank_title,
|
---|
247 | 'GROUP_NAME' => $group_name,
|
---|
248 | 'GROUP_COLOR' => $row['group_colour'],
|
---|
249 |
|
---|
250 | 'RANK_IMG' => $rank_img,
|
---|
251 | 'RANK_IMG_SRC' => $rank_img_src,
|
---|
252 |
|
---|
253 | 'U_GROUP' => $u_group,
|
---|
254 | 'U_PM' => ($config['allow_privmsg'] && $auth->acl_get('u_sendpm') && ($row['user_allow_pm'] || $auth->acl_gets('a_', 'm_') || $auth->acl_getf_global('m_'))) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&mode=compose&u=' . $row['user_id']) : '',
|
---|
255 |
|
---|
256 | 'USERNAME_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']),
|
---|
257 | 'USERNAME' => get_username_string('username', $row['user_id'], $row['username'], $row['user_colour']),
|
---|
258 | 'USER_COLOR' => get_username_string('colour', $row['user_id'], $row['username'], $row['user_colour']),
|
---|
259 | 'U_VIEW_PROFILE' => get_username_string('profile', $row['user_id'], $row['username'], $row['user_colour']),
|
---|
260 | ));
|
---|
261 | }
|
---|
262 | $db->sql_freeresult($result);
|
---|
263 |
|
---|
264 | $template->assign_vars(array(
|
---|
265 | 'PM_IMG' => $user->img('icon_contact_pm', $user->lang['SEND_PRIVATE_MESSAGE']))
|
---|
266 | );
|
---|
267 | break;
|
---|
268 |
|
---|
269 | case 'contact':
|
---|
270 |
|
---|
271 | $page_title = $user->lang['IM_USER'];
|
---|
272 | $template_html = 'memberlist_im.html';
|
---|
273 |
|
---|
274 | if (!$auth->acl_get('u_sendim'))
|
---|
275 | {
|
---|
276 | trigger_error('NOT_AUTHORISED');
|
---|
277 | }
|
---|
278 |
|
---|
279 | $presence_img = '';
|
---|
280 | switch ($action)
|
---|
281 | {
|
---|
282 | case 'aim':
|
---|
283 | $lang = 'AIM';
|
---|
284 | $sql_field = 'user_aim';
|
---|
285 | $s_select = 'S_SEND_AIM';
|
---|
286 | $s_action = '';
|
---|
287 | break;
|
---|
288 |
|
---|
289 | case 'msnm':
|
---|
290 | $lang = 'MSNM';
|
---|
291 | $sql_field = 'user_msnm';
|
---|
292 | $s_select = 'S_SEND_MSNM';
|
---|
293 | $s_action = '';
|
---|
294 | break;
|
---|
295 |
|
---|
296 | case 'jabber':
|
---|
297 | $lang = 'JABBER';
|
---|
298 | $sql_field = 'user_jabber';
|
---|
299 | $s_select = (@extension_loaded('xml') && $config['jab_enable']) ? 'S_SEND_JABBER' : 'S_NO_SEND_JABBER';
|
---|
300 | $s_action = append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=contact&action=$action&u=$user_id");
|
---|
301 | break;
|
---|
302 |
|
---|
303 | default:
|
---|
304 | trigger_error('NO_MODE', E_USER_ERROR);
|
---|
305 | break;
|
---|
306 | }
|
---|
307 |
|
---|
308 | // Grab relevant data
|
---|
309 | $sql = "SELECT user_id, username, user_email, user_lang, $sql_field
|
---|
310 | FROM " . USERS_TABLE . "
|
---|
311 | WHERE user_id = $user_id
|
---|
312 | AND user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ')';
|
---|
313 | $result = $db->sql_query($sql);
|
---|
314 | $row = $db->sql_fetchrow($result);
|
---|
315 | $db->sql_freeresult($result);
|
---|
316 |
|
---|
317 | if (!$row)
|
---|
318 | {
|
---|
319 | trigger_error('NO_USER');
|
---|
320 | }
|
---|
321 | else if (empty($row[$sql_field]))
|
---|
322 | {
|
---|
323 | trigger_error('IM_NO_DATA');
|
---|
324 | }
|
---|
325 |
|
---|
326 | // Post data grab actions
|
---|
327 | switch ($action)
|
---|
328 | {
|
---|
329 | case 'jabber':
|
---|
330 | add_form_key('memberlist_messaging');
|
---|
331 |
|
---|
332 | if ($submit && @extension_loaded('xml') && $config['jab_enable'])
|
---|
333 | {
|
---|
334 | if (check_form_key('memberlist_messaging'))
|
---|
335 | {
|
---|
336 |
|
---|
337 | include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);
|
---|
338 |
|
---|
339 | $subject = sprintf($user->lang['IM_JABBER_SUBJECT'], $user->data['username'], $config['server_name']);
|
---|
340 | $message = utf8_normalize_nfc(request_var('message', '', true));
|
---|
341 |
|
---|
342 | if (empty($message))
|
---|
343 | {
|
---|
344 | trigger_error('EMPTY_MESSAGE_IM');
|
---|
345 | }
|
---|
346 |
|
---|
347 | $messenger = new messenger(false);
|
---|
348 |
|
---|
349 | $messenger->template('profile_send_im', $row['user_lang']);
|
---|
350 | $messenger->subject(htmlspecialchars_decode($subject));
|
---|
351 |
|
---|
352 | $messenger->replyto($user->data['user_email']);
|
---|
353 | $messenger->im($row['user_jabber'], $row['username']);
|
---|
354 |
|
---|
355 | $messenger->assign_vars(array(
|
---|
356 | 'BOARD_CONTACT' => $config['board_contact'],
|
---|
357 | 'FROM_USERNAME' => htmlspecialchars_decode($user->data['username']),
|
---|
358 | 'TO_USERNAME' => htmlspecialchars_decode($row['username']),
|
---|
359 | 'MESSAGE' => htmlspecialchars_decode($message))
|
---|
360 | );
|
---|
361 |
|
---|
362 | $messenger->send(NOTIFY_IM);
|
---|
363 |
|
---|
364 | $s_select = 'S_SENT_JABBER';
|
---|
365 | }
|
---|
366 | else
|
---|
367 | {
|
---|
368 | trigger_error('FORM_INVALID');
|
---|
369 | }
|
---|
370 | }
|
---|
371 | break;
|
---|
372 | }
|
---|
373 |
|
---|
374 | // Send vars to the template
|
---|
375 | $template->assign_vars(array(
|
---|
376 | 'IM_CONTACT' => $row[$sql_field],
|
---|
377 | 'A_IM_CONTACT' => addslashes($row[$sql_field]),
|
---|
378 |
|
---|
379 | 'U_AIM_CONTACT' => ($action == 'aim') ? 'aim:addbuddy?screenname=' . urlencode($row[$sql_field]) : '',
|
---|
380 | 'U_AIM_MESSAGE' => ($action == 'aim') ? 'aim:goim?screenname=' . urlencode($row[$sql_field]) . '&message=' . urlencode($config['sitename']) : '',
|
---|
381 |
|
---|
382 | 'USERNAME' => $row['username'],
|
---|
383 | 'CONTACT_NAME' => $row[$sql_field],
|
---|
384 | 'SITENAME' => $config['sitename'],
|
---|
385 |
|
---|
386 | 'PRESENCE_IMG' => $presence_img,
|
---|
387 |
|
---|
388 | 'L_SEND_IM_EXPLAIN' => $user->lang['IM_' . $lang],
|
---|
389 | 'L_IM_SENT_JABBER' => sprintf($user->lang['IM_SENT_JABBER'], $row['username']),
|
---|
390 |
|
---|
391 | $s_select => true,
|
---|
392 | 'S_IM_ACTION' => $s_action)
|
---|
393 | );
|
---|
394 |
|
---|
395 | break;
|
---|
396 |
|
---|
397 | case 'viewprofile':
|
---|
398 | // Display a profile
|
---|
399 | if ($user_id == ANONYMOUS && !$username)
|
---|
400 | {
|
---|
401 | trigger_error('NO_USER');
|
---|
402 | }
|
---|
403 |
|
---|
404 | // Get user...
|
---|
405 | $sql = 'SELECT *
|
---|
406 | FROM ' . USERS_TABLE . '
|
---|
407 | WHERE ' . (($username) ? "username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'" : "user_id = $user_id");
|
---|
408 | $result = $db->sql_query($sql);
|
---|
409 | $member = $db->sql_fetchrow($result);
|
---|
410 | $db->sql_freeresult($result);
|
---|
411 |
|
---|
412 | if (!$member)
|
---|
413 | {
|
---|
414 | trigger_error('NO_USER');
|
---|
415 | }
|
---|
416 |
|
---|
417 | // a_user admins and founder are able to view inactive users and bots to be able to manage them more easily
|
---|
418 | // Normal users are able to see at least users having only changed their profile settings but not yet reactivated.
|
---|
419 | if (!$auth->acl_get('a_user') && $user->data['user_type'] != USER_FOUNDER)
|
---|
420 | {
|
---|
421 | if ($member['user_type'] == USER_IGNORE)
|
---|
422 | {
|
---|
423 | trigger_error('NO_USER');
|
---|
424 | }
|
---|
425 | else if ($member['user_type'] == USER_INACTIVE && $member['user_inactive_reason'] != INACTIVE_PROFILE)
|
---|
426 | {
|
---|
427 | trigger_error('NO_USER');
|
---|
428 | }
|
---|
429 | }
|
---|
430 |
|
---|
431 | $user_id = (int) $member['user_id'];
|
---|
432 |
|
---|
433 | // Get group memberships
|
---|
434 | // Also get visiting user's groups to determine hidden group memberships if necessary.
|
---|
435 | $auth_hidden_groups = ($user_id === (int) $user->data['user_id'] || $auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel')) ? true : false;
|
---|
436 | $sql_uid_ary = ($auth_hidden_groups) ? array($user_id) : array($user_id, (int) $user->data['user_id']);
|
---|
437 |
|
---|
438 | // Do the SQL thang
|
---|
439 | $sql = 'SELECT g.group_id, g.group_name, g.group_type, ug.user_id
|
---|
440 | FROM ' . GROUPS_TABLE . ' g, ' . USER_GROUP_TABLE . ' ug
|
---|
441 | WHERE ' . $db->sql_in_set('ug.user_id', $sql_uid_ary) . '
|
---|
442 | AND g.group_id = ug.group_id
|
---|
443 | AND ug.user_pending = 0';
|
---|
444 | $result = $db->sql_query($sql);
|
---|
445 |
|
---|
446 | // Divide data into profile data and current user data
|
---|
447 | $profile_groups = $user_groups = array();
|
---|
448 | while ($row = $db->sql_fetchrow($result))
|
---|
449 | {
|
---|
450 | $row['user_id'] = (int) $row['user_id'];
|
---|
451 | $row['group_id'] = (int) $row['group_id'];
|
---|
452 |
|
---|
453 | if ($row['user_id'] == $user_id)
|
---|
454 | {
|
---|
455 | $profile_groups[] = $row;
|
---|
456 | }
|
---|
457 | else
|
---|
458 | {
|
---|
459 | $user_groups[$row['group_id']] = $row['group_id'];
|
---|
460 | }
|
---|
461 | }
|
---|
462 | $db->sql_freeresult($result);
|
---|
463 |
|
---|
464 | // Filter out hidden groups and sort groups by name
|
---|
465 | $group_data = $group_sort = array();
|
---|
466 | foreach ($profile_groups as $row)
|
---|
467 | {
|
---|
468 | if ($row['group_type'] == GROUP_SPECIAL)
|
---|
469 | {
|
---|
470 | // Lookup group name in language dictionary
|
---|
471 | if (isset($user->lang['G_' . $row['group_name']]))
|
---|
472 | {
|
---|
473 | $row['group_name'] = $user->lang['G_' . $row['group_name']];
|
---|
474 | }
|
---|
475 | }
|
---|
476 | else if (!$auth_hidden_groups && $row['group_type'] == GROUP_HIDDEN && !isset($user_groups[$row['group_id']]))
|
---|
477 | {
|
---|
478 | // Skip over hidden groups the user cannot see
|
---|
479 | continue;
|
---|
480 | }
|
---|
481 |
|
---|
482 | $group_sort[$row['group_id']] = utf8_clean_string($row['group_name']);
|
---|
483 | $group_data[$row['group_id']] = $row;
|
---|
484 | }
|
---|
485 | unset($profile_groups);
|
---|
486 | unset($user_groups);
|
---|
487 | asort($group_sort);
|
---|
488 |
|
---|
489 | $group_options = '';
|
---|
490 | foreach ($group_sort as $group_id => $null)
|
---|
491 | {
|
---|
492 | $row = $group_data[$group_id];
|
---|
493 |
|
---|
494 | $group_options .= '<option value="' . $row['group_id'] . '"' . (($row['group_id'] == $member['group_id']) ? ' selected="selected"' : '') . '>' . $row['group_name'] . '</option>';
|
---|
495 | }
|
---|
496 | unset($group_data);
|
---|
497 | unset($group_sort);
|
---|
498 |
|
---|
499 | // What colour is the zebra
|
---|
500 | $sql = 'SELECT friend, foe
|
---|
501 | FROM ' . ZEBRA_TABLE . "
|
---|
502 | WHERE zebra_id = $user_id
|
---|
503 | AND user_id = {$user->data['user_id']}";
|
---|
504 |
|
---|
505 | $result = $db->sql_query($sql);
|
---|
506 | $row = $db->sql_fetchrow($result);
|
---|
507 | $foe = ($row['foe']) ? true : false;
|
---|
508 | $friend = ($row['friend']) ? true : false;
|
---|
509 | $db->sql_freeresult($result);
|
---|
510 |
|
---|
511 | if ($config['load_onlinetrack'])
|
---|
512 | {
|
---|
513 | $sql = 'SELECT MAX(session_time) AS session_time, MIN(session_viewonline) AS session_viewonline
|
---|
514 | FROM ' . SESSIONS_TABLE . "
|
---|
515 | WHERE session_user_id = $user_id";
|
---|
516 | $result = $db->sql_query($sql);
|
---|
517 | $row = $db->sql_fetchrow($result);
|
---|
518 | $db->sql_freeresult($result);
|
---|
519 |
|
---|
520 | $member['session_time'] = (isset($row['session_time'])) ? $row['session_time'] : 0;
|
---|
521 | $member['session_viewonline'] = (isset($row['session_viewonline'])) ? $row['session_viewonline'] : 0;
|
---|
522 | unset($row);
|
---|
523 | }
|
---|
524 |
|
---|
525 | if ($config['load_user_activity'])
|
---|
526 | {
|
---|
527 | display_user_activity($member);
|
---|
528 | }
|
---|
529 |
|
---|
530 | // Do the relevant calculations
|
---|
531 | $memberdays = max(1, round((time() - $member['user_regdate']) / 86400));
|
---|
532 | $posts_per_day = $member['user_posts'] / $memberdays;
|
---|
533 | $percentage = ($config['num_posts']) ? min(100, ($member['user_posts'] / $config['num_posts']) * 100) : 0;
|
---|
534 |
|
---|
535 |
|
---|
536 | if ($member['user_sig'])
|
---|
537 | {
|
---|
538 | $member['user_sig'] = censor_text($member['user_sig']);
|
---|
539 |
|
---|
540 | if ($member['user_sig_bbcode_bitfield'])
|
---|
541 | {
|
---|
542 | include_once($phpbb_root_path . 'includes/bbcode.' . $phpEx);
|
---|
543 | $bbcode = new bbcode();
|
---|
544 | $bbcode->bbcode_second_pass($member['user_sig'], $member['user_sig_bbcode_uid'], $member['user_sig_bbcode_bitfield']);
|
---|
545 | }
|
---|
546 |
|
---|
547 | $member['user_sig'] = bbcode_nl2br($member['user_sig']);
|
---|
548 | $member['user_sig'] = smiley_text($member['user_sig']);
|
---|
549 | }
|
---|
550 |
|
---|
551 | $poster_avatar = get_user_avatar($member['user_avatar'], $member['user_avatar_type'], $member['user_avatar_width'], $member['user_avatar_height']);
|
---|
552 |
|
---|
553 | // We need to check if the modules 'zebra' ('friends' & 'foes' mode), 'notes' ('user_notes' mode) and 'warn' ('warn_user' mode) are accessible to decide if we can display appropriate links
|
---|
554 | $zebra_enabled = $friends_enabled = $foes_enabled = $user_notes_enabled = $warn_user_enabled = false;
|
---|
555 |
|
---|
556 | // Only check if the user is logged in
|
---|
557 | if ($user->data['is_registered'])
|
---|
558 | {
|
---|
559 | if (!class_exists('p_master'))
|
---|
560 | {
|
---|
561 | include($phpbb_root_path . 'includes/functions_module.' . $phpEx);
|
---|
562 | }
|
---|
563 | $module = new p_master();
|
---|
564 |
|
---|
565 | $module->list_modules('ucp');
|
---|
566 | $module->list_modules('mcp');
|
---|
567 |
|
---|
568 | $user_notes_enabled = ($module->loaded('notes', 'user_notes')) ? true : false;
|
---|
569 | $warn_user_enabled = ($module->loaded('warn', 'warn_user')) ? true : false;
|
---|
570 | $zebra_enabled = ($module->loaded('zebra')) ? true : false;
|
---|
571 | $friends_enabled = ($module->loaded('zebra', 'friends')) ? true : false;
|
---|
572 | $foes_enabled = ($module->loaded('zebra', 'foes')) ? true : false;
|
---|
573 |
|
---|
574 | unset($module);
|
---|
575 | }
|
---|
576 |
|
---|
577 | $template->assign_vars(show_profile($member, $user_notes_enabled, $warn_user_enabled));
|
---|
578 |
|
---|
579 | // Custom Profile Fields
|
---|
580 | $profile_fields = array();
|
---|
581 | if ($config['load_cpf_viewprofile'])
|
---|
582 | {
|
---|
583 | include_once($phpbb_root_path . 'includes/functions_profile_fields.' . $phpEx);
|
---|
584 | $cp = new custom_profile();
|
---|
585 | $profile_fields = $cp->generate_profile_fields_template('grab', $user_id);
|
---|
586 | $profile_fields = (isset($profile_fields[$user_id])) ? $cp->generate_profile_fields_template('show', false, $profile_fields[$user_id]) : array();
|
---|
587 | }
|
---|
588 |
|
---|
589 | // If the user has m_approve permission or a_user permission, then list then display unapproved posts
|
---|
590 | if ($auth->acl_getf_global('m_approve') || $auth->acl_get('a_user'))
|
---|
591 | {
|
---|
592 | $sql = 'SELECT COUNT(post_id) as posts_in_queue
|
---|
593 | FROM ' . POSTS_TABLE . '
|
---|
594 | WHERE poster_id = ' . $user_id . '
|
---|
595 | AND post_approved = 0';
|
---|
596 | $result = $db->sql_query($sql);
|
---|
597 | $member['posts_in_queue'] = (int) $db->sql_fetchfield('posts_in_queue');
|
---|
598 | $db->sql_freeresult($result);
|
---|
599 | }
|
---|
600 | else
|
---|
601 | {
|
---|
602 | $member['posts_in_queue'] = 0;
|
---|
603 | }
|
---|
604 |
|
---|
605 | $template->assign_vars(array(
|
---|
606 | 'L_POSTS_IN_QUEUE' => $user->lang('NUM_POSTS_IN_QUEUE', $member['posts_in_queue']),
|
---|
607 |
|
---|
608 | 'POSTS_DAY' => sprintf($user->lang['POST_DAY'], $posts_per_day),
|
---|
609 | 'POSTS_PCT' => sprintf($user->lang['POST_PCT'], $percentage),
|
---|
610 |
|
---|
611 | 'OCCUPATION' => (!empty($member['user_occ'])) ? censor_text($member['user_occ']) : '',
|
---|
612 | 'INTERESTS' => (!empty($member['user_interests'])) ? censor_text($member['user_interests']) : '',
|
---|
613 | 'SIGNATURE' => $member['user_sig'],
|
---|
614 | 'POSTS_IN_QUEUE'=> $member['posts_in_queue'],
|
---|
615 |
|
---|
616 | 'AVATAR_IMG' => $poster_avatar,
|
---|
617 | 'PM_IMG' => $user->img('icon_contact_pm', $user->lang['SEND_PRIVATE_MESSAGE']),
|
---|
618 | 'EMAIL_IMG' => $user->img('icon_contact_email', $user->lang['EMAIL']),
|
---|
619 | 'WWW_IMG' => $user->img('icon_contact_www', $user->lang['WWW']),
|
---|
620 | 'ICQ_IMG' => $user->img('icon_contact_icq', $user->lang['ICQ']),
|
---|
621 | 'AIM_IMG' => $user->img('icon_contact_aim', $user->lang['AIM']),
|
---|
622 | 'MSN_IMG' => $user->img('icon_contact_msnm', $user->lang['MSNM']),
|
---|
623 | 'YIM_IMG' => $user->img('icon_contact_yahoo', $user->lang['YIM']),
|
---|
624 | 'JABBER_IMG' => $user->img('icon_contact_jabber', $user->lang['JABBER']),
|
---|
625 | 'SEARCH_IMG' => $user->img('icon_user_search', $user->lang['SEARCH']),
|
---|
626 |
|
---|
627 | 'S_PROFILE_ACTION' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group'),
|
---|
628 | 'S_GROUP_OPTIONS' => $group_options,
|
---|
629 | 'S_CUSTOM_FIELDS' => (isset($profile_fields['row']) && sizeof($profile_fields['row'])) ? true : false,
|
---|
630 |
|
---|
631 | 'U_USER_ADMIN' => ($auth->acl_get('a_user')) ? append_sid("{$phpbb_root_path}adm/index.$phpEx", 'i=users&mode=overview&u=' . $user_id, true, $user->session_id) : '',
|
---|
632 | 'U_USER_BAN' => ($auth->acl_get('m_ban') && $user_id != $user->data['user_id']) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=ban&mode=user&u=' . $user_id, true, $user->session_id) : '',
|
---|
633 | 'U_MCP_QUEUE' => ($auth->acl_getf_global('m_approve')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue', true, $user->session_id) : '',
|
---|
634 |
|
---|
635 | 'U_SWITCH_PERMISSIONS' => ($auth->acl_get('a_switchperm') && $user->data['user_id'] != $user_id) ? append_sid("{$phpbb_root_path}ucp.$phpEx", "mode=switch_perm&u={$user_id}&hash=" . generate_link_hash('switchperm')) : '',
|
---|
636 |
|
---|
637 | 'S_USER_NOTES' => ($user_notes_enabled) ? true : false,
|
---|
638 | 'S_WARN_USER' => ($warn_user_enabled) ? true : false,
|
---|
639 | 'S_ZEBRA' => ($user->data['user_id'] != $user_id && $user->data['is_registered'] && $zebra_enabled) ? true : false,
|
---|
640 | 'U_ADD_FRIEND' => (!$friend && !$foe && $friends_enabled) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=zebra&add=' . urlencode(htmlspecialchars_decode($member['username']))) : '',
|
---|
641 | 'U_ADD_FOE' => (!$friend && !$foe && $foes_enabled) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=zebra&mode=foes&add=' . urlencode(htmlspecialchars_decode($member['username']))) : '',
|
---|
642 | 'U_REMOVE_FRIEND' => ($friend && $friends_enabled) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=zebra&remove=1&usernames[]=' . $user_id) : '',
|
---|
643 | 'U_REMOVE_FOE' => ($foe && $foes_enabled) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=zebra&remove=1&mode=foes&usernames[]=' . $user_id) : '',
|
---|
644 | ));
|
---|
645 |
|
---|
646 | if (!empty($profile_fields['row']))
|
---|
647 | {
|
---|
648 | $template->assign_vars($profile_fields['row']);
|
---|
649 | }
|
---|
650 |
|
---|
651 | if (!empty($profile_fields['blockrow']))
|
---|
652 | {
|
---|
653 | foreach ($profile_fields['blockrow'] as $field_data)
|
---|
654 | {
|
---|
655 | $template->assign_block_vars('custom_fields', $field_data);
|
---|
656 | }
|
---|
657 | }
|
---|
658 |
|
---|
659 | // Inactive reason/account?
|
---|
660 | if ($member['user_type'] == USER_INACTIVE)
|
---|
661 | {
|
---|
662 | $user->add_lang('acp/common');
|
---|
663 |
|
---|
664 | $inactive_reason = $user->lang['INACTIVE_REASON_UNKNOWN'];
|
---|
665 |
|
---|
666 | switch ($member['user_inactive_reason'])
|
---|
667 | {
|
---|
668 | case INACTIVE_REGISTER:
|
---|
669 | $inactive_reason = $user->lang['INACTIVE_REASON_REGISTER'];
|
---|
670 | break;
|
---|
671 |
|
---|
672 | case INACTIVE_PROFILE:
|
---|
673 | $inactive_reason = $user->lang['INACTIVE_REASON_PROFILE'];
|
---|
674 | break;
|
---|
675 |
|
---|
676 | case INACTIVE_MANUAL:
|
---|
677 | $inactive_reason = $user->lang['INACTIVE_REASON_MANUAL'];
|
---|
678 | break;
|
---|
679 |
|
---|
680 | case INACTIVE_REMIND:
|
---|
681 | $inactive_reason = $user->lang['INACTIVE_REASON_REMIND'];
|
---|
682 | break;
|
---|
683 | }
|
---|
684 |
|
---|
685 | $template->assign_vars(array(
|
---|
686 | 'S_USER_INACTIVE' => true,
|
---|
687 | 'USER_INACTIVE_REASON' => $inactive_reason)
|
---|
688 | );
|
---|
689 | }
|
---|
690 |
|
---|
691 | // Now generate page title
|
---|
692 | $page_title = sprintf($user->lang['VIEWING_PROFILE'], $member['username']);
|
---|
693 | $template_html = 'memberlist_view.html';
|
---|
694 |
|
---|
695 | break;
|
---|
696 |
|
---|
697 | case 'email':
|
---|
698 |
|
---|
699 | // Send an email
|
---|
700 | $page_title = $user->lang['SEND_EMAIL'];
|
---|
701 | $template_html = 'memberlist_email.html';
|
---|
702 |
|
---|
703 | add_form_key('memberlist_email');
|
---|
704 |
|
---|
705 | if (!$config['email_enable'])
|
---|
706 | {
|
---|
707 | trigger_error('EMAIL_DISABLED');
|
---|
708 | }
|
---|
709 |
|
---|
710 | if (!$auth->acl_get('u_sendemail'))
|
---|
711 | {
|
---|
712 | trigger_error('NO_EMAIL');
|
---|
713 | }
|
---|
714 |
|
---|
715 | // Are we trying to abuse the facility?
|
---|
716 | if (time() - $user->data['user_emailtime'] < $config['flood_interval'])
|
---|
717 | {
|
---|
718 | trigger_error('FLOOD_EMAIL_LIMIT');
|
---|
719 | }
|
---|
720 |
|
---|
721 | // Determine action...
|
---|
722 | $user_id = request_var('u', 0);
|
---|
723 | $topic_id = request_var('t', 0);
|
---|
724 |
|
---|
725 | // Send email to user...
|
---|
726 | if ($user_id)
|
---|
727 | {
|
---|
728 | if ($user_id == ANONYMOUS || !$config['board_email_form'])
|
---|
729 | {
|
---|
730 | trigger_error('NO_EMAIL');
|
---|
731 | }
|
---|
732 |
|
---|
733 | // Get the appropriate username, etc.
|
---|
734 | $sql = 'SELECT username, user_email, user_allow_viewemail, user_lang, user_jabber, user_notify_type
|
---|
735 | FROM ' . USERS_TABLE . "
|
---|
736 | WHERE user_id = $user_id
|
---|
737 | AND user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ')';
|
---|
738 | $result = $db->sql_query($sql);
|
---|
739 | $row = $db->sql_fetchrow($result);
|
---|
740 | $db->sql_freeresult($result);
|
---|
741 |
|
---|
742 | if (!$row)
|
---|
743 | {
|
---|
744 | trigger_error('NO_USER');
|
---|
745 | }
|
---|
746 |
|
---|
747 | // Can we send email to this user?
|
---|
748 | if (!$row['user_allow_viewemail'] && !$auth->acl_get('a_user'))
|
---|
749 | {
|
---|
750 | trigger_error('NO_EMAIL');
|
---|
751 | }
|
---|
752 | }
|
---|
753 | else if ($topic_id)
|
---|
754 | {
|
---|
755 | // Send topic heads-up to email address
|
---|
756 | $sql = 'SELECT forum_id, topic_title
|
---|
757 | FROM ' . TOPICS_TABLE . "
|
---|
758 | WHERE topic_id = $topic_id";
|
---|
759 | $result = $db->sql_query($sql);
|
---|
760 | $row = $db->sql_fetchrow($result);
|
---|
761 | $db->sql_freeresult($result);
|
---|
762 |
|
---|
763 | if (!$row)
|
---|
764 | {
|
---|
765 | trigger_error('NO_TOPIC');
|
---|
766 | }
|
---|
767 |
|
---|
768 | if ($row['forum_id'])
|
---|
769 | {
|
---|
770 | if (!$auth->acl_get('f_read', $row['forum_id']))
|
---|
771 | {
|
---|
772 | trigger_error('SORRY_AUTH_READ');
|
---|
773 | }
|
---|
774 |
|
---|
775 | if (!$auth->acl_get('f_email', $row['forum_id']))
|
---|
776 | {
|
---|
777 | trigger_error('NO_EMAIL');
|
---|
778 | }
|
---|
779 | }
|
---|
780 | else
|
---|
781 | {
|
---|
782 | // If global announcement, we need to check if the user is able to at least read and email in one forum...
|
---|
783 | if (!$auth->acl_getf_global('f_read'))
|
---|
784 | {
|
---|
785 | trigger_error('SORRY_AUTH_READ');
|
---|
786 | }
|
---|
787 |
|
---|
788 | if (!$auth->acl_getf_global('f_email'))
|
---|
789 | {
|
---|
790 | trigger_error('NO_EMAIL');
|
---|
791 | }
|
---|
792 | }
|
---|
793 | }
|
---|
794 | else
|
---|
795 | {
|
---|
796 | trigger_error('NO_EMAIL');
|
---|
797 | }
|
---|
798 |
|
---|
799 | $error = array();
|
---|
800 |
|
---|
801 | $name = utf8_normalize_nfc(request_var('name', '', true));
|
---|
802 | $email = request_var('email', '');
|
---|
803 | $email_lang = request_var('lang', $config['default_lang']);
|
---|
804 | $subject = utf8_normalize_nfc(request_var('subject', '', true));
|
---|
805 | $message = utf8_normalize_nfc(request_var('message', '', true));
|
---|
806 | $cc = (isset($_POST['cc_email'])) ? true : false;
|
---|
807 | $submit = (isset($_POST['submit'])) ? true : false;
|
---|
808 |
|
---|
809 | if ($submit)
|
---|
810 | {
|
---|
811 | if (!check_form_key('memberlist_email'))
|
---|
812 | {
|
---|
813 | $error[] = 'FORM_INVALID';
|
---|
814 | }
|
---|
815 | if ($user_id)
|
---|
816 | {
|
---|
817 | if (!$subject)
|
---|
818 | {
|
---|
819 | $error[] = $user->lang['EMPTY_SUBJECT_EMAIL'];
|
---|
820 | }
|
---|
821 |
|
---|
822 | if (!$message)
|
---|
823 | {
|
---|
824 | $error[] = $user->lang['EMPTY_MESSAGE_EMAIL'];
|
---|
825 | }
|
---|
826 |
|
---|
827 | $name = $row['username'];
|
---|
828 | $email_lang = $row['user_lang'];
|
---|
829 | $email = $row['user_email'];
|
---|
830 | }
|
---|
831 | else
|
---|
832 | {
|
---|
833 | if (!$email || !preg_match('/^' . get_preg_expression('email') . '$/i', $email))
|
---|
834 | {
|
---|
835 | $error[] = $user->lang['EMPTY_ADDRESS_EMAIL'];
|
---|
836 | }
|
---|
837 |
|
---|
838 | if (!$name)
|
---|
839 | {
|
---|
840 | $error[] = $user->lang['EMPTY_NAME_EMAIL'];
|
---|
841 | }
|
---|
842 | }
|
---|
843 |
|
---|
844 | if (!sizeof($error))
|
---|
845 | {
|
---|
846 | $sql = 'UPDATE ' . USERS_TABLE . '
|
---|
847 | SET user_emailtime = ' . time() . '
|
---|
848 | WHERE user_id = ' . $user->data['user_id'];
|
---|
849 | $result = $db->sql_query($sql);
|
---|
850 |
|
---|
851 | include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);
|
---|
852 | $messenger = new messenger(false);
|
---|
853 | $email_tpl = ($user_id) ? 'profile_send_email' : 'email_notify';
|
---|
854 |
|
---|
855 | $mail_to_users = array();
|
---|
856 |
|
---|
857 | $mail_to_users[] = array(
|
---|
858 | 'email_lang' => $email_lang,
|
---|
859 | 'email' => $email,
|
---|
860 | 'name' => $name,
|
---|
861 | 'username' => ($user_id) ? $row['username'] : '',
|
---|
862 | 'to_name' => $name,
|
---|
863 | 'user_jabber' => ($user_id) ? $row['user_jabber'] : '',
|
---|
864 | 'user_notify_type' => ($user_id) ? $row['user_notify_type'] : NOTIFY_EMAIL,
|
---|
865 | 'topic_title' => (!$user_id) ? $row['topic_title'] : '',
|
---|
866 | 'forum_id' => (!$user_id) ? $row['forum_id'] : 0,
|
---|
867 | );
|
---|
868 |
|
---|
869 | // Ok, now the same email if CC specified, but without exposing the users email address
|
---|
870 | if ($cc)
|
---|
871 | {
|
---|
872 | $mail_to_users[] = array(
|
---|
873 | 'email_lang' => $user->data['user_lang'],
|
---|
874 | 'email' => $user->data['user_email'],
|
---|
875 | 'name' => $user->data['username'],
|
---|
876 | 'username' => $user->data['username'],
|
---|
877 | 'to_name' => $name,
|
---|
878 | 'user_jabber' => $user->data['user_jabber'],
|
---|
879 | 'user_notify_type' => ($user_id) ? $user->data['user_notify_type'] : NOTIFY_EMAIL,
|
---|
880 | 'topic_title' => (!$user_id) ? $row['topic_title'] : '',
|
---|
881 | 'forum_id' => (!$user_id) ? $row['forum_id'] : 0,
|
---|
882 | );
|
---|
883 | }
|
---|
884 |
|
---|
885 | foreach ($mail_to_users as $row)
|
---|
886 | {
|
---|
887 | $messenger->template($email_tpl, $row['email_lang']);
|
---|
888 | $messenger->replyto($user->data['user_email']);
|
---|
889 | $messenger->to($row['email'], $row['name']);
|
---|
890 |
|
---|
891 | if ($user_id)
|
---|
892 | {
|
---|
893 | $messenger->subject(htmlspecialchars_decode($subject));
|
---|
894 | $messenger->im($row['user_jabber'], $row['username']);
|
---|
895 | $notify_type = $row['user_notify_type'];
|
---|
896 | }
|
---|
897 | else
|
---|
898 | {
|
---|
899 | $notify_type = NOTIFY_EMAIL;
|
---|
900 | }
|
---|
901 |
|
---|
902 | $messenger->headers('X-AntiAbuse: Board servername - ' . $config['server_name']);
|
---|
903 | $messenger->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']);
|
---|
904 | $messenger->headers('X-AntiAbuse: Username - ' . $user->data['username']);
|
---|
905 | $messenger->headers('X-AntiAbuse: User IP - ' . $user->ip);
|
---|
906 |
|
---|
907 | $messenger->assign_vars(array(
|
---|
908 | 'BOARD_CONTACT' => $config['board_contact'],
|
---|
909 | 'TO_USERNAME' => htmlspecialchars_decode($row['to_name']),
|
---|
910 | 'FROM_USERNAME' => htmlspecialchars_decode($user->data['username']),
|
---|
911 | 'MESSAGE' => htmlspecialchars_decode($message))
|
---|
912 | );
|
---|
913 |
|
---|
914 | if ($topic_id)
|
---|
915 | {
|
---|
916 | $messenger->assign_vars(array(
|
---|
917 | 'TOPIC_NAME' => htmlspecialchars_decode($row['topic_title']),
|
---|
918 | 'U_TOPIC' => generate_board_url() . "/viewtopic.$phpEx?f=" . $row['forum_id'] . "&t=$topic_id")
|
---|
919 | );
|
---|
920 | }
|
---|
921 |
|
---|
922 | $messenger->send($notify_type);
|
---|
923 | }
|
---|
924 |
|
---|
925 | meta_refresh(3, append_sid("{$phpbb_root_path}index.$phpEx"));
|
---|
926 | $message = ($user_id) ? sprintf($user->lang['RETURN_INDEX'], '<a href="' . append_sid("{$phpbb_root_path}index.$phpEx") . '">', '</a>') : sprintf($user->lang['RETURN_TOPIC'], '<a href="' . append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f={$row['forum_id']}&t=$topic_id") . '">', '</a>');
|
---|
927 | trigger_error($user->lang['EMAIL_SENT'] . '<br /><br />' . $message);
|
---|
928 | }
|
---|
929 | }
|
---|
930 |
|
---|
931 | if ($user_id)
|
---|
932 | {
|
---|
933 | $template->assign_vars(array(
|
---|
934 | 'S_SEND_USER' => true,
|
---|
935 | 'USERNAME' => $row['username'],
|
---|
936 |
|
---|
937 | 'L_EMAIL_BODY_EXPLAIN' => $user->lang['EMAIL_BODY_EXPLAIN'],
|
---|
938 | 'S_POST_ACTION' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=email&u=' . $user_id))
|
---|
939 | );
|
---|
940 | }
|
---|
941 | else
|
---|
942 | {
|
---|
943 | $template->assign_vars(array(
|
---|
944 | 'EMAIL' => $email,
|
---|
945 | 'NAME' => $name,
|
---|
946 | 'S_LANG_OPTIONS' => language_select($email_lang),
|
---|
947 |
|
---|
948 | 'L_EMAIL_BODY_EXPLAIN' => $user->lang['EMAIL_TOPIC_EXPLAIN'],
|
---|
949 | 'S_POST_ACTION' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=email&t=' . $topic_id))
|
---|
950 | );
|
---|
951 | }
|
---|
952 |
|
---|
953 | $template->assign_vars(array(
|
---|
954 | 'ERROR_MESSAGE' => (sizeof($error)) ? implode('<br />', $error) : '',
|
---|
955 | 'SUBJECT' => $subject,
|
---|
956 | 'MESSAGE' => $message,
|
---|
957 | )
|
---|
958 | );
|
---|
959 |
|
---|
960 | break;
|
---|
961 |
|
---|
962 | case 'group':
|
---|
963 | default:
|
---|
964 | // The basic memberlist
|
---|
965 | $page_title = $user->lang['MEMBERLIST'];
|
---|
966 | $template_html = 'memberlist_body.html';
|
---|
967 |
|
---|
968 | // Sorting
|
---|
969 | $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'], 'f' => $user->lang['WEBSITE'], 'g' => $user->lang['ICQ'], 'h' => $user->lang['AIM'], 'i' => $user->lang['MSNM'], 'j' => $user->lang['YIM'], 'k' => $user->lang['JABBER']);
|
---|
970 | $sort_key_sql = array('a' => 'u.username_clean', 'b' => 'u.user_from', 'c' => 'u.user_regdate', 'd' => 'u.user_posts', 'f' => 'u.user_website', 'g' => 'u.user_icq', 'h' => 'u.user_aim', 'i' => 'u.user_msnm', 'j' => 'u.user_yim', 'k' => 'u.user_jabber');
|
---|
971 |
|
---|
972 | if ($auth->acl_get('a_user'))
|
---|
973 | {
|
---|
974 | $sort_key_text['e'] = $user->lang['SORT_EMAIL'];
|
---|
975 | $sort_key_sql['e'] = 'u.user_email';
|
---|
976 | }
|
---|
977 |
|
---|
978 | if ($auth->acl_get('u_viewonline'))
|
---|
979 | {
|
---|
980 | $sort_key_text['l'] = $user->lang['SORT_LAST_ACTIVE'];
|
---|
981 | $sort_key_sql['l'] = 'u.user_lastvisit';
|
---|
982 | }
|
---|
983 |
|
---|
984 | $sort_key_text['m'] = $user->lang['SORT_RANK'];
|
---|
985 | $sort_key_sql['m'] = 'u.user_rank';
|
---|
986 |
|
---|
987 | $sort_dir_text = array('a' => $user->lang['ASCENDING'], 'd' => $user->lang['DESCENDING']);
|
---|
988 |
|
---|
989 | $s_sort_key = '';
|
---|
990 | foreach ($sort_key_text as $key => $value)
|
---|
991 | {
|
---|
992 | $selected = ($sort_key == $key) ? ' selected="selected"' : '';
|
---|
993 | $s_sort_key .= '<option value="' . $key . '"' . $selected . '>' . $value . '</option>';
|
---|
994 | }
|
---|
995 |
|
---|
996 | $s_sort_dir = '';
|
---|
997 | foreach ($sort_dir_text as $key => $value)
|
---|
998 | {
|
---|
999 | $selected = ($sort_dir == $key) ? ' selected="selected"' : '';
|
---|
1000 | $s_sort_dir .= '<option value="' . $key . '"' . $selected . '>' . $value . '</option>';
|
---|
1001 | }
|
---|
1002 |
|
---|
1003 | // Additional sorting options for user search ... if search is enabled, if not
|
---|
1004 | // then only admins can make use of this (for ACP functionality)
|
---|
1005 | $sql_select = $sql_where_data = $sql_from = $sql_where = $order_by = '';
|
---|
1006 |
|
---|
1007 |
|
---|
1008 | $form = request_var('form', '');
|
---|
1009 | $field = request_var('field', '');
|
---|
1010 | $select_single = request_var('select_single', false);
|
---|
1011 |
|
---|
1012 | // Search URL parameters, if any of these are in the URL we do a search
|
---|
1013 | $search_params = array('username', 'email', 'icq', 'aim', 'yahoo', 'msn', 'jabber', 'search_group_id', 'joined_select', 'active_select', 'count_select', 'joined', 'active', 'count', 'ip');
|
---|
1014 |
|
---|
1015 | // We validate form and field here, only id/class allowed
|
---|
1016 | $form = (!preg_match('/^[a-z0-9_-]+$/i', $form)) ? '' : $form;
|
---|
1017 | $field = (!preg_match('/^[a-z0-9_-]+$/i', $field)) ? '' : $field;
|
---|
1018 | if (($mode == 'searchuser' || sizeof(array_intersect(array_keys($_GET), $search_params)) > 0) && ($config['load_search'] || $auth->acl_get('a_')))
|
---|
1019 | {
|
---|
1020 | $username = request_var('username', '', true);
|
---|
1021 | $email = strtolower(request_var('email', ''));
|
---|
1022 | $icq = request_var('icq', '');
|
---|
1023 | $aim = request_var('aim', '');
|
---|
1024 | $yahoo = request_var('yahoo', '');
|
---|
1025 | $msn = request_var('msn', '');
|
---|
1026 | $jabber = request_var('jabber', '');
|
---|
1027 | $search_group_id = request_var('search_group_id', 0);
|
---|
1028 |
|
---|
1029 | // when using these, make sure that we actually have values defined in $find_key_match
|
---|
1030 | $joined_select = request_var('joined_select', 'lt');
|
---|
1031 | $active_select = request_var('active_select', 'lt');
|
---|
1032 | $count_select = request_var('count_select', 'eq');
|
---|
1033 |
|
---|
1034 | $joined = explode('-', request_var('joined', ''));
|
---|
1035 | $active = explode('-', request_var('active', ''));
|
---|
1036 | $count = (request_var('count', '') !== '') ? request_var('count', 0) : '';
|
---|
1037 | $ipdomain = request_var('ip', '');
|
---|
1038 |
|
---|
1039 | $find_key_match = array('lt' => '<', 'gt' => '>', 'eq' => '=');
|
---|
1040 |
|
---|
1041 | $find_count = array('lt' => $user->lang['LESS_THAN'], 'eq' => $user->lang['EQUAL_TO'], 'gt' => $user->lang['MORE_THAN']);
|
---|
1042 | $s_find_count = '';
|
---|
1043 | foreach ($find_count as $key => $value)
|
---|
1044 | {
|
---|
1045 | $selected = ($count_select == $key) ? ' selected="selected"' : '';
|
---|
1046 | $s_find_count .= '<option value="' . $key . '"' . $selected . '>' . $value . '</option>';
|
---|
1047 | }
|
---|
1048 |
|
---|
1049 | $find_time = array('lt' => $user->lang['BEFORE'], 'gt' => $user->lang['AFTER']);
|
---|
1050 | $s_find_join_time = '';
|
---|
1051 | foreach ($find_time as $key => $value)
|
---|
1052 | {
|
---|
1053 | $selected = ($joined_select == $key) ? ' selected="selected"' : '';
|
---|
1054 | $s_find_join_time .= '<option value="' . $key . '"' . $selected . '>' . $value . '</option>';
|
---|
1055 | }
|
---|
1056 |
|
---|
1057 | $s_find_active_time = '';
|
---|
1058 | foreach ($find_time as $key => $value)
|
---|
1059 | {
|
---|
1060 | $selected = ($active_select == $key) ? ' selected="selected"' : '';
|
---|
1061 | $s_find_active_time .= '<option value="' . $key . '"' . $selected . '>' . $value . '</option>';
|
---|
1062 | }
|
---|
1063 |
|
---|
1064 | $sql_where .= ($username) ? ' AND u.username_clean ' . $db->sql_like_expression(str_replace('*', $db->any_char, utf8_clean_string($username))) : '';
|
---|
1065 | $sql_where .= ($auth->acl_get('a_user') && $email) ? ' AND u.user_email ' . $db->sql_like_expression(str_replace('*', $db->any_char, $email)) . ' ' : '';
|
---|
1066 | $sql_where .= ($icq) ? ' AND u.user_icq ' . $db->sql_like_expression(str_replace('*', $db->any_char, $icq)) . ' ' : '';
|
---|
1067 | $sql_where .= ($aim) ? ' AND u.user_aim ' . $db->sql_like_expression(str_replace('*', $db->any_char, $aim)) . ' ' : '';
|
---|
1068 | $sql_where .= ($yahoo) ? ' AND u.user_yim ' . $db->sql_like_expression(str_replace('*', $db->any_char, $yahoo)) . ' ' : '';
|
---|
1069 | $sql_where .= ($msn) ? ' AND u.user_msnm ' . $db->sql_like_expression(str_replace('*', $db->any_char, $msn)) . ' ' : '';
|
---|
1070 | $sql_where .= ($jabber) ? ' AND u.user_jabber ' . $db->sql_like_expression(str_replace('*', $db->any_char, $jabber)) . ' ' : '';
|
---|
1071 | $sql_where .= (is_numeric($count) && isset($find_key_match[$count_select])) ? ' AND u.user_posts ' . $find_key_match[$count_select] . ' ' . (int) $count . ' ' : '';
|
---|
1072 | $sql_where .= (sizeof($joined) > 1 && isset($find_key_match[$joined_select])) ? " AND u.user_regdate " . $find_key_match[$joined_select] . ' ' . gmmktime(0, 0, 0, intval($joined[1]), intval($joined[2]), intval($joined[0])) : '';
|
---|
1073 | $sql_where .= ($auth->acl_get('u_viewonline') && sizeof($active) > 1 && isset($find_key_match[$active_select])) ? " AND u.user_lastvisit " . $find_key_match[$active_select] . ' ' . gmmktime(0, 0, 0, $active[1], intval($active[2]), intval($active[0])) : '';
|
---|
1074 | $sql_where .= ($search_group_id) ? " AND u.user_id = ug.user_id AND ug.group_id = $search_group_id AND ug.user_pending = 0 " : '';
|
---|
1075 |
|
---|
1076 | if ($search_group_id)
|
---|
1077 | {
|
---|
1078 | $sql_from = ', ' . USER_GROUP_TABLE . ' ug ';
|
---|
1079 | }
|
---|
1080 |
|
---|
1081 | if ($ipdomain && $auth->acl_getf_global('m_info'))
|
---|
1082 | {
|
---|
1083 | if (strspn($ipdomain, 'abcdefghijklmnopqrstuvwxyz'))
|
---|
1084 | {
|
---|
1085 | $hostnames = gethostbynamel($ipdomain);
|
---|
1086 |
|
---|
1087 | if ($hostnames !== false)
|
---|
1088 | {
|
---|
1089 | $ips = "'" . implode('\', \'', array_map(array($db, 'sql_escape'), 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)))) . "'";
|
---|
1090 | }
|
---|
1091 | else
|
---|
1092 | {
|
---|
1093 | $ips = false;
|
---|
1094 | }
|
---|
1095 | }
|
---|
1096 | else
|
---|
1097 | {
|
---|
1098 | $ips = "'" . str_replace('*', '%', $db->sql_escape($ipdomain)) . "'";
|
---|
1099 | }
|
---|
1100 |
|
---|
1101 | if ($ips === false)
|
---|
1102 | {
|
---|
1103 | // A minor fudge but it does the job :D
|
---|
1104 | $sql_where .= " AND u.user_id = 0";
|
---|
1105 | }
|
---|
1106 | else
|
---|
1107 | {
|
---|
1108 | $ip_forums = array_keys($auth->acl_getf('m_info', true));
|
---|
1109 |
|
---|
1110 | $sql = 'SELECT DISTINCT poster_id
|
---|
1111 | FROM ' . POSTS_TABLE . '
|
---|
1112 | WHERE poster_ip ' . ((strpos($ips, '%') !== false) ? 'LIKE' : 'IN') . " ($ips)
|
---|
1113 | AND forum_id IN (0, " . implode(', ', $ip_forums) . ')';
|
---|
1114 | $result = $db->sql_query($sql);
|
---|
1115 |
|
---|
1116 | if ($row = $db->sql_fetchrow($result))
|
---|
1117 | {
|
---|
1118 | $ip_sql = array();
|
---|
1119 | do
|
---|
1120 | {
|
---|
1121 | $ip_sql[] = $row['poster_id'];
|
---|
1122 | }
|
---|
1123 | while ($row = $db->sql_fetchrow($result));
|
---|
1124 |
|
---|
1125 | $sql_where .= ' AND ' . $db->sql_in_set('u.user_id', $ip_sql);
|
---|
1126 | }
|
---|
1127 | else
|
---|
1128 | {
|
---|
1129 | // A minor fudge but it does the job :D
|
---|
1130 | $sql_where .= " AND u.user_id = 0";
|
---|
1131 | }
|
---|
1132 | unset($ip_forums);
|
---|
1133 |
|
---|
1134 | $db->sql_freeresult($result);
|
---|
1135 | }
|
---|
1136 | }
|
---|
1137 | }
|
---|
1138 |
|
---|
1139 | $first_char = request_var('first_char', '');
|
---|
1140 |
|
---|
1141 | if ($first_char == 'other')
|
---|
1142 | {
|
---|
1143 | for ($i = 97; $i < 123; $i++)
|
---|
1144 | {
|
---|
1145 | $sql_where .= ' AND u.username_clean NOT ' . $db->sql_like_expression(chr($i) . $db->any_char);
|
---|
1146 | }
|
---|
1147 | }
|
---|
1148 | else if ($first_char)
|
---|
1149 | {
|
---|
1150 | $sql_where .= ' AND u.username_clean ' . $db->sql_like_expression(substr($first_char, 0, 1) . $db->any_char);
|
---|
1151 | }
|
---|
1152 |
|
---|
1153 | // Are we looking at a usergroup? If so, fetch additional info
|
---|
1154 | // and further restrict the user info query
|
---|
1155 | if ($mode == 'group')
|
---|
1156 | {
|
---|
1157 | // We JOIN here to save a query for determining membership for hidden groups. ;)
|
---|
1158 | $sql = 'SELECT g.*, ug.user_id
|
---|
1159 | FROM ' . GROUPS_TABLE . ' g
|
---|
1160 | LEFT JOIN ' . USER_GROUP_TABLE . ' ug ON (ug.user_pending = 0 AND ug.user_id = ' . $user->data['user_id'] . " AND ug.group_id = $group_id)
|
---|
1161 | WHERE g.group_id = $group_id";
|
---|
1162 | $result = $db->sql_query($sql);
|
---|
1163 | $group_row = $db->sql_fetchrow($result);
|
---|
1164 | $db->sql_freeresult($result);
|
---|
1165 |
|
---|
1166 | if (!$group_row)
|
---|
1167 | {
|
---|
1168 | trigger_error('NO_GROUP');
|
---|
1169 | }
|
---|
1170 |
|
---|
1171 | switch ($group_row['group_type'])
|
---|
1172 | {
|
---|
1173 | case GROUP_OPEN:
|
---|
1174 | $group_row['l_group_type'] = 'OPEN';
|
---|
1175 | break;
|
---|
1176 |
|
---|
1177 | case GROUP_CLOSED:
|
---|
1178 | $group_row['l_group_type'] = 'CLOSED';
|
---|
1179 | break;
|
---|
1180 |
|
---|
1181 | case GROUP_HIDDEN:
|
---|
1182 | $group_row['l_group_type'] = 'HIDDEN';
|
---|
1183 |
|
---|
1184 | // Check for membership or special permissions
|
---|
1185 | if (!$auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel') && $group_row['user_id'] != $user->data['user_id'])
|
---|
1186 | {
|
---|
1187 | trigger_error('NO_GROUP');
|
---|
1188 | }
|
---|
1189 | break;
|
---|
1190 |
|
---|
1191 | case GROUP_SPECIAL:
|
---|
1192 | $group_row['l_group_type'] = 'SPECIAL';
|
---|
1193 | break;
|
---|
1194 |
|
---|
1195 | case GROUP_FREE:
|
---|
1196 | $group_row['l_group_type'] = 'FREE';
|
---|
1197 | break;
|
---|
1198 | }
|
---|
1199 |
|
---|
1200 | // Misusing the avatar function for displaying group avatars...
|
---|
1201 | $avatar_img = get_user_avatar($group_row['group_avatar'], $group_row['group_avatar_type'], $group_row['group_avatar_width'], $group_row['group_avatar_height'], 'GROUP_AVATAR');
|
---|
1202 |
|
---|
1203 | $rank_title = $rank_img = $rank_img_src = '';
|
---|
1204 | if ($group_row['group_rank'])
|
---|
1205 | {
|
---|
1206 | if (isset($ranks['special'][$group_row['group_rank']]))
|
---|
1207 | {
|
---|
1208 | $rank_title = $ranks['special'][$group_row['group_rank']]['rank_title'];
|
---|
1209 | }
|
---|
1210 | $rank_img = (!empty($ranks['special'][$group_row['group_rank']]['rank_image'])) ? '<img src="' . $config['ranks_path'] . '/' . $ranks['special'][$group_row['group_rank']]['rank_image'] . '" alt="' . $ranks['special'][$group_row['group_rank']]['rank_title'] . '" title="' . $ranks['special'][$group_row['group_rank']]['rank_title'] . '" /><br />' : '';
|
---|
1211 | $rank_img_src = (!empty($ranks['special'][$group_row['group_rank']]['rank_image'])) ? $config['ranks_path'] . '/' . $ranks['special'][$group_row['group_rank']]['rank_image'] : '';
|
---|
1212 | }
|
---|
1213 | else
|
---|
1214 | {
|
---|
1215 | $rank_title = '';
|
---|
1216 | $rank_img = '';
|
---|
1217 | $rank_img_src = '';
|
---|
1218 | }
|
---|
1219 |
|
---|
1220 | $template->assign_vars(array(
|
---|
1221 | 'GROUP_DESC' => generate_text_for_display($group_row['group_desc'], $group_row['group_desc_uid'], $group_row['group_desc_bitfield'], $group_row['group_desc_options']),
|
---|
1222 | 'GROUP_NAME' => ($group_row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $group_row['group_name']] : $group_row['group_name'],
|
---|
1223 | 'GROUP_COLOR' => $group_row['group_colour'],
|
---|
1224 | 'GROUP_TYPE' => $user->lang['GROUP_IS_' . $group_row['l_group_type']],
|
---|
1225 | 'GROUP_RANK' => $rank_title,
|
---|
1226 |
|
---|
1227 | 'AVATAR_IMG' => $avatar_img,
|
---|
1228 | 'RANK_IMG' => $rank_img,
|
---|
1229 | 'RANK_IMG_SRC' => $rank_img_src,
|
---|
1230 |
|
---|
1231 | 'U_PM' => ($auth->acl_get('u_sendpm') && $auth->acl_get('u_masspm_group') && $group_row['group_receive_pm'] && $config['allow_privmsg'] && $config['allow_mass_pm']) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&mode=compose&g=' . $group_id) : '',)
|
---|
1232 | );
|
---|
1233 |
|
---|
1234 | $sql_select = ', ug.group_leader';
|
---|
1235 | $sql_from = ', ' . USER_GROUP_TABLE . ' ug ';
|
---|
1236 | $order_by = 'ug.group_leader DESC, ';
|
---|
1237 |
|
---|
1238 | $sql_where .= " AND ug.user_pending = 0 AND u.user_id = ug.user_id AND ug.group_id = $group_id";
|
---|
1239 | $sql_where_data = " AND u.user_id = ug.user_id AND ug.group_id = $group_id";
|
---|
1240 | }
|
---|
1241 |
|
---|
1242 | // Sorting and order
|
---|
1243 | if (!isset($sort_key_sql[$sort_key]))
|
---|
1244 | {
|
---|
1245 | $sort_key = $default_key;
|
---|
1246 | }
|
---|
1247 |
|
---|
1248 | $order_by .= $sort_key_sql[$sort_key] . ' ' . (($sort_dir == 'a') ? 'ASC' : 'DESC');
|
---|
1249 |
|
---|
1250 | // Unfortunately we must do this here for sorting by rank, else the sort order is applied wrongly
|
---|
1251 | if ($sort_key == 'm')
|
---|
1252 | {
|
---|
1253 | $order_by .= ', u.user_posts DESC';
|
---|
1254 | }
|
---|
1255 |
|
---|
1256 | // Count the users ...
|
---|
1257 | if ($sql_where)
|
---|
1258 | {
|
---|
1259 | $sql = 'SELECT COUNT(u.user_id) AS total_users
|
---|
1260 | FROM ' . USERS_TABLE . " u$sql_from
|
---|
1261 | WHERE u.user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ")
|
---|
1262 | $sql_where";
|
---|
1263 | $result = $db->sql_query($sql);
|
---|
1264 | $total_users = (int) $db->sql_fetchfield('total_users');
|
---|
1265 | $db->sql_freeresult($result);
|
---|
1266 | }
|
---|
1267 | else
|
---|
1268 | {
|
---|
1269 | $total_users = $config['num_users'];
|
---|
1270 | }
|
---|
1271 |
|
---|
1272 | $s_char_options = '<option value=""' . ((!$first_char) ? ' selected="selected"' : '') . '> </option>';
|
---|
1273 | for ($i = 97; $i < 123; $i++)
|
---|
1274 | {
|
---|
1275 | $s_char_options .= '<option value="' . chr($i) . '"' . (($first_char == chr($i)) ? ' selected="selected"' : '') . '>' . chr($i-32) . '</option>';
|
---|
1276 | }
|
---|
1277 | $s_char_options .= '<option value="other"' . (($first_char == 'other') ? ' selected="selected"' : '') . '>' . $user->lang['OTHER'] . '</option>';
|
---|
1278 |
|
---|
1279 | // Build a relevant pagination_url
|
---|
1280 | $params = $sort_params = array();
|
---|
1281 |
|
---|
1282 | // We do not use request_var() here directly to save some calls (not all variables are set)
|
---|
1283 | $check_params = array(
|
---|
1284 | 'g' => array('g', 0),
|
---|
1285 | 'sk' => array('sk', $default_key),
|
---|
1286 | 'sd' => array('sd', 'a'),
|
---|
1287 | 'form' => array('form', ''),
|
---|
1288 | 'field' => array('field', ''),
|
---|
1289 | 'select_single' => array('select_single', $select_single),
|
---|
1290 | 'username' => array('username', '', true),
|
---|
1291 | 'email' => array('email', ''),
|
---|
1292 | 'icq' => array('icq', ''),
|
---|
1293 | 'aim' => array('aim', ''),
|
---|
1294 | 'yahoo' => array('yahoo', ''),
|
---|
1295 | 'msn' => array('msn', ''),
|
---|
1296 | 'jabber' => array('jabber', ''),
|
---|
1297 | 'search_group_id' => array('search_group_id', 0),
|
---|
1298 | 'joined_select' => array('joined_select', 'lt'),
|
---|
1299 | 'active_select' => array('active_select', 'lt'),
|
---|
1300 | 'count_select' => array('count_select', 'eq'),
|
---|
1301 | 'joined' => array('joined', ''),
|
---|
1302 | 'active' => array('active', ''),
|
---|
1303 | 'count' => (request_var('count', '') !== '') ? array('count', 0) : array('count', ''),
|
---|
1304 | 'ip' => array('ip', ''),
|
---|
1305 | 'first_char' => array('first_char', ''),
|
---|
1306 | );
|
---|
1307 |
|
---|
1308 | foreach ($check_params as $key => $call)
|
---|
1309 | {
|
---|
1310 | if (!isset($_REQUEST[$key]))
|
---|
1311 | {
|
---|
1312 | continue;
|
---|
1313 | }
|
---|
1314 |
|
---|
1315 | $param = call_user_func_array('request_var', $call);
|
---|
1316 | $param = urlencode($key) . '=' . ((is_string($param)) ? urlencode($param) : $param);
|
---|
1317 | $params[] = $param;
|
---|
1318 |
|
---|
1319 | if ($key != 'sk' && $key != 'sd')
|
---|
1320 | {
|
---|
1321 | $sort_params[] = $param;
|
---|
1322 | }
|
---|
1323 | }
|
---|
1324 |
|
---|
1325 | $u_hide_find_member = append_sid("{$phpbb_root_path}memberlist.$phpEx", "start=$start" . (!empty($params) ? '&' . implode('&', $params) : ''));
|
---|
1326 |
|
---|
1327 | if ($mode)
|
---|
1328 | {
|
---|
1329 | $params[] = "mode=$mode";
|
---|
1330 | }
|
---|
1331 | $sort_params[] = "mode=$mode";
|
---|
1332 |
|
---|
1333 | $pagination_url = append_sid("{$phpbb_root_path}memberlist.$phpEx", implode('&', $params));
|
---|
1334 | $sort_url = append_sid("{$phpbb_root_path}memberlist.$phpEx", implode('&', $sort_params));
|
---|
1335 |
|
---|
1336 | unset($search_params, $sort_params);
|
---|
1337 |
|
---|
1338 | // Some search user specific data
|
---|
1339 | if ($mode == 'searchuser' && ($config['load_search'] || $auth->acl_get('a_')))
|
---|
1340 | {
|
---|
1341 | $group_selected = request_var('search_group_id', 0);
|
---|
1342 | $s_group_select = '<option value="0"' . ((!$group_selected) ? ' selected="selected"' : '') . '> </option>';
|
---|
1343 | $group_ids = array();
|
---|
1344 |
|
---|
1345 | /**
|
---|
1346 | * @todo add this to a separate function (function is responsible for returning the groups the user is able to see based on the users group membership)
|
---|
1347 | */
|
---|
1348 |
|
---|
1349 | if ($auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel'))
|
---|
1350 | {
|
---|
1351 | $sql = 'SELECT group_id, group_name, group_type
|
---|
1352 | FROM ' . GROUPS_TABLE;
|
---|
1353 |
|
---|
1354 | if (!$config['coppa_enable'])
|
---|
1355 | {
|
---|
1356 | $sql .= " WHERE group_name <> 'REGISTERED_COPPA'";
|
---|
1357 | }
|
---|
1358 |
|
---|
1359 | $sql .= ' ORDER BY group_name ASC';
|
---|
1360 | }
|
---|
1361 | else
|
---|
1362 | {
|
---|
1363 | $sql = 'SELECT g.group_id, g.group_name, g.group_type
|
---|
1364 | FROM ' . GROUPS_TABLE . ' g
|
---|
1365 | LEFT JOIN ' . USER_GROUP_TABLE . ' ug
|
---|
1366 | ON (
|
---|
1367 | g.group_id = ug.group_id
|
---|
1368 | AND ug.user_id = ' . $user->data['user_id'] . '
|
---|
1369 | AND ug.user_pending = 0
|
---|
1370 | )
|
---|
1371 | WHERE (g.group_type <> ' . GROUP_HIDDEN . ' OR ug.user_id = ' . $user->data['user_id'] . ')';
|
---|
1372 |
|
---|
1373 | if (!$config['coppa_enable'])
|
---|
1374 | {
|
---|
1375 | $sql .= " AND g.group_name <> 'REGISTERED_COPPA'";
|
---|
1376 | }
|
---|
1377 |
|
---|
1378 | $sql .= ' ORDER BY g.group_name ASC';
|
---|
1379 | }
|
---|
1380 | $result = $db->sql_query($sql);
|
---|
1381 |
|
---|
1382 | while ($row = $db->sql_fetchrow($result))
|
---|
1383 | {
|
---|
1384 | $group_ids[] = $row['group_id'];
|
---|
1385 | $s_group_select .= '<option value="' . $row['group_id'] . '"' . (($group_selected == $row['group_id']) ? ' selected="selected"' : '') . '>' . (($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name']) . '</option>';
|
---|
1386 | }
|
---|
1387 | $db->sql_freeresult($result);
|
---|
1388 |
|
---|
1389 | if ($group_selected !== 0 && !in_array($group_selected, $group_ids))
|
---|
1390 | {
|
---|
1391 | trigger_error('NO_GROUP');
|
---|
1392 | }
|
---|
1393 |
|
---|
1394 | $template->assign_vars(array(
|
---|
1395 | 'USERNAME' => $username,
|
---|
1396 | 'EMAIL' => $email,
|
---|
1397 | 'ICQ' => $icq,
|
---|
1398 | 'AIM' => $aim,
|
---|
1399 | 'YAHOO' => $yahoo,
|
---|
1400 | 'MSNM' => $msn,
|
---|
1401 | 'JABBER' => $jabber,
|
---|
1402 | 'JOINED' => implode('-', $joined),
|
---|
1403 | 'ACTIVE' => implode('-', $active),
|
---|
1404 | 'COUNT' => $count,
|
---|
1405 | 'IP' => $ipdomain,
|
---|
1406 |
|
---|
1407 | 'S_IP_SEARCH_ALLOWED' => ($auth->acl_getf_global('m_info')) ? true : false,
|
---|
1408 | 'S_EMAIL_SEARCH_ALLOWED'=> ($auth->acl_get('a_user')) ? true : false,
|
---|
1409 | 'S_IN_SEARCH_POPUP' => ($form && $field) ? true : false,
|
---|
1410 | 'S_SEARCH_USER' => true,
|
---|
1411 | 'S_FORM_NAME' => $form,
|
---|
1412 | 'S_FIELD_NAME' => $field,
|
---|
1413 | 'S_SELECT_SINGLE' => $select_single,
|
---|
1414 | 'S_COUNT_OPTIONS' => $s_find_count,
|
---|
1415 | 'S_SORT_OPTIONS' => $s_sort_key,
|
---|
1416 | 'S_JOINED_TIME_OPTIONS' => $s_find_join_time,
|
---|
1417 | 'S_ACTIVE_TIME_OPTIONS' => $s_find_active_time,
|
---|
1418 | 'S_GROUP_SELECT' => $s_group_select,
|
---|
1419 | 'S_USER_SEARCH_ACTION' => append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=searchuser&form=$form&field=$field"))
|
---|
1420 | );
|
---|
1421 | }
|
---|
1422 |
|
---|
1423 | // Get us some users :D
|
---|
1424 | $sql = "SELECT u.user_id
|
---|
1425 | FROM " . USERS_TABLE . " u
|
---|
1426 | $sql_from
|
---|
1427 | WHERE u.user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ")
|
---|
1428 | $sql_where
|
---|
1429 | ORDER BY $order_by";
|
---|
1430 | $result = $db->sql_query_limit($sql, $config['topics_per_page'], $start);
|
---|
1431 |
|
---|
1432 | $user_list = array();
|
---|
1433 | while ($row = $db->sql_fetchrow($result))
|
---|
1434 | {
|
---|
1435 | $user_list[] = (int) $row['user_id'];
|
---|
1436 | }
|
---|
1437 | $db->sql_freeresult($result);
|
---|
1438 | $leaders_set = false;
|
---|
1439 | // So, did we get any users?
|
---|
1440 | if (sizeof($user_list))
|
---|
1441 | {
|
---|
1442 | // Session time?! Session time...
|
---|
1443 | $sql = 'SELECT session_user_id, MAX(session_time) AS session_time
|
---|
1444 | FROM ' . SESSIONS_TABLE . '
|
---|
1445 | WHERE session_time >= ' . (time() - $config['session_length']) . '
|
---|
1446 | AND ' . $db->sql_in_set('session_user_id', $user_list) . '
|
---|
1447 | GROUP BY session_user_id';
|
---|
1448 | $result = $db->sql_query($sql);
|
---|
1449 |
|
---|
1450 | $session_times = array();
|
---|
1451 | while ($row = $db->sql_fetchrow($result))
|
---|
1452 | {
|
---|
1453 | $session_times[$row['session_user_id']] = $row['session_time'];
|
---|
1454 | }
|
---|
1455 | $db->sql_freeresult($result);
|
---|
1456 |
|
---|
1457 | // Do the SQL thang
|
---|
1458 | if ($mode == 'group')
|
---|
1459 | {
|
---|
1460 | $sql = "SELECT u.*
|
---|
1461 | $sql_select
|
---|
1462 | FROM " . USERS_TABLE . " u
|
---|
1463 | $sql_from
|
---|
1464 | WHERE " . $db->sql_in_set('u.user_id', $user_list) . "
|
---|
1465 | $sql_where_data";
|
---|
1466 | }
|
---|
1467 | else
|
---|
1468 | {
|
---|
1469 | $sql = 'SELECT *
|
---|
1470 | FROM ' . USERS_TABLE . '
|
---|
1471 | WHERE ' . $db->sql_in_set('user_id', $user_list);
|
---|
1472 | }
|
---|
1473 | $result = $db->sql_query($sql);
|
---|
1474 |
|
---|
1475 | $id_cache = array();
|
---|
1476 | while ($row = $db->sql_fetchrow($result))
|
---|
1477 | {
|
---|
1478 | $row['session_time'] = (!empty($session_times[$row['user_id']])) ? $session_times[$row['user_id']] : 0;
|
---|
1479 | $row['last_visit'] = (!empty($row['session_time'])) ? $row['session_time'] : $row['user_lastvisit'];
|
---|
1480 |
|
---|
1481 | $id_cache[$row['user_id']] = $row;
|
---|
1482 | }
|
---|
1483 | $db->sql_freeresult($result);
|
---|
1484 |
|
---|
1485 | // Load custom profile fields
|
---|
1486 | if ($config['load_cpf_memberlist'])
|
---|
1487 | {
|
---|
1488 | include_once($phpbb_root_path . 'includes/functions_profile_fields.' . $phpEx);
|
---|
1489 | $cp = new custom_profile();
|
---|
1490 |
|
---|
1491 | // Grab all profile fields from users in id cache for later use - similar to the poster cache
|
---|
1492 | $profile_fields_cache = $cp->generate_profile_fields_template('grab', $user_list);
|
---|
1493 | }
|
---|
1494 |
|
---|
1495 | // If we sort by last active date we need to adjust the id cache due to user_lastvisit not being the last active date...
|
---|
1496 | if ($sort_key == 'l')
|
---|
1497 | {
|
---|
1498 | // uasort($id_cache, create_function('$first, $second', "return (\$first['last_visit'] == \$second['last_visit']) ? 0 : ((\$first['last_visit'] < \$second['last_visit']) ? $lesser_than : ($lesser_than * -1));"));
|
---|
1499 | usort($user_list, '_sort_last_active');
|
---|
1500 | }
|
---|
1501 |
|
---|
1502 | for ($i = 0, $end = sizeof($user_list); $i < $end; ++$i)
|
---|
1503 | {
|
---|
1504 | $user_id = $user_list[$i];
|
---|
1505 | $row =& $id_cache[$user_id];
|
---|
1506 | $is_leader = (isset($row['group_leader']) && $row['group_leader']) ? true : false;
|
---|
1507 | $leaders_set = ($leaders_set || $is_leader);
|
---|
1508 |
|
---|
1509 | $cp_row = array();
|
---|
1510 | if ($config['load_cpf_memberlist'])
|
---|
1511 | {
|
---|
1512 | $cp_row = (isset($profile_fields_cache[$user_id])) ? $cp->generate_profile_fields_template('show', false, $profile_fields_cache[$user_id]) : array();
|
---|
1513 | }
|
---|
1514 |
|
---|
1515 | $memberrow = array_merge(show_profile($row), array(
|
---|
1516 | 'ROW_NUMBER' => $i + ($start + 1),
|
---|
1517 |
|
---|
1518 | 'S_CUSTOM_PROFILE' => (isset($cp_row['row']) && sizeof($cp_row['row'])) ? true : false,
|
---|
1519 | 'S_GROUP_LEADER' => $is_leader,
|
---|
1520 |
|
---|
1521 | 'U_VIEW_PROFILE' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $user_id))
|
---|
1522 | );
|
---|
1523 |
|
---|
1524 | if (isset($cp_row['row']) && sizeof($cp_row['row']))
|
---|
1525 | {
|
---|
1526 | $memberrow = array_merge($memberrow, $cp_row['row']);
|
---|
1527 | }
|
---|
1528 |
|
---|
1529 | $template->assign_block_vars('memberrow', $memberrow);
|
---|
1530 |
|
---|
1531 | if (isset($cp_row['blockrow']) && sizeof($cp_row['blockrow']))
|
---|
1532 | {
|
---|
1533 | foreach ($cp_row['blockrow'] as $field_data)
|
---|
1534 | {
|
---|
1535 | $template->assign_block_vars('memberrow.custom_fields', $field_data);
|
---|
1536 | }
|
---|
1537 | }
|
---|
1538 |
|
---|
1539 | unset($id_cache[$user_id]);
|
---|
1540 | }
|
---|
1541 | }
|
---|
1542 |
|
---|
1543 | // Generate page
|
---|
1544 | $template->assign_vars(array(
|
---|
1545 | 'PAGINATION' => generate_pagination($pagination_url, $total_users, $config['topics_per_page'], $start),
|
---|
1546 | 'PAGE_NUMBER' => on_page($total_users, $config['topics_per_page'], $start),
|
---|
1547 | 'TOTAL_USERS' => ($total_users == 1) ? $user->lang['LIST_USER'] : sprintf($user->lang['LIST_USERS'], $total_users),
|
---|
1548 |
|
---|
1549 | 'PROFILE_IMG' => $user->img('icon_user_profile', $user->lang['PROFILE']),
|
---|
1550 | 'PM_IMG' => $user->img('icon_contact_pm', $user->lang['SEND_PRIVATE_MESSAGE']),
|
---|
1551 | 'EMAIL_IMG' => $user->img('icon_contact_email', $user->lang['EMAIL']),
|
---|
1552 | 'WWW_IMG' => $user->img('icon_contact_www', $user->lang['WWW']),
|
---|
1553 | 'ICQ_IMG' => $user->img('icon_contact_icq', $user->lang['ICQ']),
|
---|
1554 | 'AIM_IMG' => $user->img('icon_contact_aim', $user->lang['AIM']),
|
---|
1555 | 'MSN_IMG' => $user->img('icon_contact_msnm', $user->lang['MSNM']),
|
---|
1556 | 'YIM_IMG' => $user->img('icon_contact_yahoo', $user->lang['YIM']),
|
---|
1557 | 'JABBER_IMG' => $user->img('icon_contact_jabber', $user->lang['JABBER']),
|
---|
1558 | 'SEARCH_IMG' => $user->img('icon_user_search', $user->lang['SEARCH']),
|
---|
1559 |
|
---|
1560 | 'U_FIND_MEMBER' => ($config['load_search'] || $auth->acl_get('a_')) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser' . (($start) ? "&start=$start" : '') . (!empty($params) ? '&' . implode('&', $params) : '')) : '',
|
---|
1561 | 'U_HIDE_FIND_MEMBER' => ($mode == 'searchuser') ? $u_hide_find_member : '',
|
---|
1562 | 'U_SORT_USERNAME' => $sort_url . '&sk=a&sd=' . (($sort_key == 'a' && $sort_dir == 'a') ? 'd' : 'a'),
|
---|
1563 | 'U_SORT_FROM' => $sort_url . '&sk=b&sd=' . (($sort_key == 'b' && $sort_dir == 'a') ? 'd' : 'a'),
|
---|
1564 | 'U_SORT_JOINED' => $sort_url . '&sk=c&sd=' . (($sort_key == 'c' && $sort_dir == 'a') ? 'd' : 'a'),
|
---|
1565 | 'U_SORT_POSTS' => $sort_url . '&sk=d&sd=' . (($sort_key == 'd' && $sort_dir == 'a') ? 'd' : 'a'),
|
---|
1566 | 'U_SORT_EMAIL' => $sort_url . '&sk=e&sd=' . (($sort_key == 'e' && $sort_dir == 'a') ? 'd' : 'a'),
|
---|
1567 | 'U_SORT_WEBSITE' => $sort_url . '&sk=f&sd=' . (($sort_key == 'f' && $sort_dir == 'a') ? 'd' : 'a'),
|
---|
1568 | 'U_SORT_LOCATION' => $sort_url . '&sk=b&sd=' . (($sort_key == 'b' && $sort_dir == 'a') ? 'd' : 'a'),
|
---|
1569 | 'U_SORT_ICQ' => $sort_url . '&sk=g&sd=' . (($sort_key == 'g' && $sort_dir == 'a') ? 'd' : 'a'),
|
---|
1570 | 'U_SORT_AIM' => $sort_url . '&sk=h&sd=' . (($sort_key == 'h' && $sort_dir == 'a') ? 'd' : 'a'),
|
---|
1571 | 'U_SORT_MSN' => $sort_url . '&sk=i&sd=' . (($sort_key == 'i' && $sort_dir == 'a') ? 'd' : 'a'),
|
---|
1572 | 'U_SORT_YIM' => $sort_url . '&sk=j&sd=' . (($sort_key == 'j' && $sort_dir == 'a') ? 'd' : 'a'),
|
---|
1573 | 'U_SORT_ACTIVE' => ($auth->acl_get('u_viewonline')) ? $sort_url . '&sk=l&sd=' . (($sort_key == 'l' && $sort_dir == 'a') ? 'd' : 'a') : '',
|
---|
1574 | 'U_SORT_RANK' => $sort_url . '&sk=m&sd=' . (($sort_key == 'm' && $sort_dir == 'a') ? 'd' : 'a'),
|
---|
1575 | 'U_LIST_CHAR' => $sort_url . '&sk=a&sd=' . (($sort_key == 'l' && $sort_dir == 'a') ? 'd' : 'a'),
|
---|
1576 |
|
---|
1577 | 'S_SHOW_GROUP' => ($mode == 'group') ? true : false,
|
---|
1578 | 'S_VIEWONLINE' => $auth->acl_get('u_viewonline'),
|
---|
1579 | 'S_LEADERS_SET' => $leaders_set,
|
---|
1580 | 'S_MODE_SELECT' => $s_sort_key,
|
---|
1581 | 'S_ORDER_SELECT' => $s_sort_dir,
|
---|
1582 | 'S_CHAR_OPTIONS' => $s_char_options,
|
---|
1583 | 'S_MODE_ACTION' => $pagination_url)
|
---|
1584 | );
|
---|
1585 | }
|
---|
1586 |
|
---|
1587 | // Output the page
|
---|
1588 | page_header($page_title, false);
|
---|
1589 |
|
---|
1590 | $template->set_filenames(array(
|
---|
1591 | 'body' => $template_html)
|
---|
1592 | );
|
---|
1593 | make_jumpbox(append_sid("{$phpbb_root_path}viewforum.$phpEx"));
|
---|
1594 |
|
---|
1595 | page_footer();
|
---|
1596 |
|
---|
1597 | /**
|
---|
1598 | * Prepare profile data
|
---|
1599 | */
|
---|
1600 | function show_profile($data, $user_notes_enabled = false, $warn_user_enabled = false)
|
---|
1601 | {
|
---|
1602 | global $config, $auth, $template, $user, $phpEx, $phpbb_root_path;
|
---|
1603 |
|
---|
1604 | $username = $data['username'];
|
---|
1605 | $user_id = $data['user_id'];
|
---|
1606 |
|
---|
1607 | $rank_title = $rank_img = $rank_img_src = '';
|
---|
1608 | get_user_rank($data['user_rank'], (($user_id == ANONYMOUS) ? false : $data['user_posts']), $rank_title, $rank_img, $rank_img_src);
|
---|
1609 |
|
---|
1610 | if (!empty($data['user_allow_viewemail']) || $auth->acl_get('a_user'))
|
---|
1611 | {
|
---|
1612 | $email = ($config['board_email_form'] && $config['email_enable']) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=email&u=' . $user_id) : (($config['board_hide_emails'] && !$auth->acl_get('a_user')) ? '' : 'mailto:' . $data['user_email']);
|
---|
1613 | }
|
---|
1614 | else
|
---|
1615 | {
|
---|
1616 | $email = '';
|
---|
1617 | }
|
---|
1618 |
|
---|
1619 | if ($config['load_onlinetrack'])
|
---|
1620 | {
|
---|
1621 | $update_time = $config['load_online_time'] * 60;
|
---|
1622 | $online = (time() - $update_time < $data['session_time'] && ((isset($data['session_viewonline']) && $data['session_viewonline']) || $auth->acl_get('u_viewonline'))) ? true : false;
|
---|
1623 | }
|
---|
1624 | else
|
---|
1625 | {
|
---|
1626 | $online = false;
|
---|
1627 | }
|
---|
1628 |
|
---|
1629 | if ($data['user_allow_viewonline'] || $auth->acl_get('u_viewonline'))
|
---|
1630 | {
|
---|
1631 | $last_visit = (!empty($data['session_time'])) ? $data['session_time'] : $data['user_lastvisit'];
|
---|
1632 | }
|
---|
1633 | else
|
---|
1634 | {
|
---|
1635 | $last_visit = '';
|
---|
1636 | }
|
---|
1637 |
|
---|
1638 | $age = '';
|
---|
1639 |
|
---|
1640 | if ($config['allow_birthdays'] && $data['user_birthday'])
|
---|
1641 | {
|
---|
1642 | list($bday_day, $bday_month, $bday_year) = array_map('intval', explode('-', $data['user_birthday']));
|
---|
1643 |
|
---|
1644 | if ($bday_year)
|
---|
1645 | {
|
---|
1646 | $now = getdate(time() + $user->timezone + $user->dst - date('Z'));
|
---|
1647 |
|
---|
1648 | $diff = $now['mon'] - $bday_month;
|
---|
1649 | if ($diff == 0)
|
---|
1650 | {
|
---|
1651 | $diff = ($now['mday'] - $bday_day < 0) ? 1 : 0;
|
---|
1652 | }
|
---|
1653 | else
|
---|
1654 | {
|
---|
1655 | $diff = ($diff < 0) ? 1 : 0;
|
---|
1656 | }
|
---|
1657 |
|
---|
1658 | $age = (int) ($now['year'] - $bday_year - $diff);
|
---|
1659 | }
|
---|
1660 | }
|
---|
1661 |
|
---|
1662 | // Dump it out to the template
|
---|
1663 | return array(
|
---|
1664 | 'AGE' => $age,
|
---|
1665 | 'RANK_TITLE' => $rank_title,
|
---|
1666 | 'JOINED' => $user->format_date($data['user_regdate']),
|
---|
1667 | 'VISITED' => (empty($last_visit)) ? ' - ' : $user->format_date($last_visit),
|
---|
1668 | 'POSTS' => ($data['user_posts']) ? $data['user_posts'] : 0,
|
---|
1669 | 'WARNINGS' => isset($data['user_warnings']) ? $data['user_warnings'] : 0,
|
---|
1670 |
|
---|
1671 | 'USERNAME_FULL' => get_username_string('full', $user_id, $username, $data['user_colour']),
|
---|
1672 | 'USERNAME' => get_username_string('username', $user_id, $username, $data['user_colour']),
|
---|
1673 | 'USER_COLOR' => get_username_string('colour', $user_id, $username, $data['user_colour']),
|
---|
1674 | 'U_VIEW_PROFILE' => get_username_string('profile', $user_id, $username, $data['user_colour']),
|
---|
1675 |
|
---|
1676 | 'A_USERNAME' => addslashes(get_username_string('username', $user_id, $username, $data['user_colour'])),
|
---|
1677 |
|
---|
1678 | 'AVATAR_IMG' => get_user_avatar($data['user_avatar'], $data['user_avatar_type'], $data['user_avatar_width'], $data['user_avatar_height']),
|
---|
1679 | 'ONLINE_IMG' => (!$config['load_onlinetrack']) ? '' : (($online) ? $user->img('icon_user_online', 'ONLINE') : $user->img('icon_user_offline', 'OFFLINE')),
|
---|
1680 | 'S_ONLINE' => ($config['load_onlinetrack'] && $online) ? true : false,
|
---|
1681 | 'RANK_IMG' => $rank_img,
|
---|
1682 | 'RANK_IMG_SRC' => $rank_img_src,
|
---|
1683 | 'ICQ_STATUS_IMG' => (!empty($data['user_icq'])) ? '<img src="http://web.icq.com/whitepages/online?icq=' . $data['user_icq'] . '&img=5" width="18" height="18" />' : '',
|
---|
1684 | 'S_JABBER_ENABLED' => ($config['jab_enable']) ? true : false,
|
---|
1685 |
|
---|
1686 | 'S_WARNINGS' => ($auth->acl_getf_global('m_') || $auth->acl_get('m_warn')) ? true : false,
|
---|
1687 |
|
---|
1688 | 'U_SEARCH_USER' => ($auth->acl_get('u_search')) ? append_sid("{$phpbb_root_path}search.$phpEx", "author_id=$user_id&sr=posts") : '',
|
---|
1689 | 'U_NOTES' => ($user_notes_enabled && $auth->acl_getf_global('m_')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=notes&mode=user_notes&u=' . $user_id, true, $user->session_id) : '',
|
---|
1690 | 'U_WARN' => ($warn_user_enabled && $auth->acl_get('m_warn')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=warn&mode=warn_user&u=' . $user_id, true, $user->session_id) : '',
|
---|
1691 | 'U_PM' => ($config['allow_privmsg'] && $auth->acl_get('u_sendpm') && ($data['user_allow_pm'] || $auth->acl_gets('a_', 'm_') || $auth->acl_getf_global('m_'))) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&mode=compose&u=' . $user_id) : '',
|
---|
1692 | 'U_EMAIL' => $email,
|
---|
1693 | 'U_WWW' => (!empty($data['user_website'])) ? $data['user_website'] : '',
|
---|
1694 | 'U_SHORT_WWW' => (!empty($data['user_website'])) ? ((strlen($data['user_website']) > 55) ? substr($data['user_website'], 0, 39) . ' ... ' . substr($data['user_website'], -10) : $data['user_website']) : '',
|
---|
1695 | 'U_ICQ' => ($data['user_icq']) ? 'http://www.icq.com/people/webmsg.php?to=' . urlencode($data['user_icq']) : '',
|
---|
1696 | 'U_AIM' => ($data['user_aim'] && $auth->acl_get('u_sendim')) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=contact&action=aim&u=' . $user_id) : '',
|
---|
1697 | 'U_YIM' => ($data['user_yim']) ? 'http://edit.yahoo.com/config/send_webmesg?.target=' . urlencode($data['user_yim']) . '&.src=pg' : '',
|
---|
1698 | 'U_MSN' => ($data['user_msnm'] && $auth->acl_get('u_sendim')) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=contact&action=msnm&u=' . $user_id) : '',
|
---|
1699 | 'U_JABBER' => ($data['user_jabber'] && $auth->acl_get('u_sendim')) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=contact&action=jabber&u=' . $user_id) : '',
|
---|
1700 | 'LOCATION' => ($data['user_from']) ? $data['user_from'] : '',
|
---|
1701 |
|
---|
1702 | 'USER_ICQ' => $data['user_icq'],
|
---|
1703 | 'USER_AIM' => $data['user_aim'],
|
---|
1704 | 'USER_YIM' => $data['user_yim'],
|
---|
1705 | 'USER_MSN' => $data['user_msnm'],
|
---|
1706 | 'USER_JABBER' => $data['user_jabber'],
|
---|
1707 | 'USER_JABBER_IMG' => ($data['user_jabber']) ? $user->img('icon_contact_jabber', $data['user_jabber']) : '',
|
---|
1708 |
|
---|
1709 | 'L_VIEWING_PROFILE' => sprintf($user->lang['VIEWING_PROFILE'], $username),
|
---|
1710 | );
|
---|
1711 | }
|
---|
1712 |
|
---|
1713 | function _sort_last_active($first, $second)
|
---|
1714 | {
|
---|
1715 | global $id_cache, $sort_dir;
|
---|
1716 |
|
---|
1717 | $lesser_than = ($sort_dir === 'd') ? -1 : 1;
|
---|
1718 |
|
---|
1719 | if (isset($id_cache[$first]['group_leader']) && $id_cache[$first]['group_leader'] && (!isset($id_cache[$second]['group_leader']) || !$id_cache[$second]['group_leader']))
|
---|
1720 | {
|
---|
1721 | return -1;
|
---|
1722 | }
|
---|
1723 | else if (isset($id_cache[$second]['group_leader']) && (!isset($id_cache[$first]['group_leader']) || !$id_cache[$first]['group_leader']) && $id_cache[$second]['group_leader'])
|
---|
1724 | {
|
---|
1725 | return 1;
|
---|
1726 | }
|
---|
1727 | else
|
---|
1728 | {
|
---|
1729 | return $lesser_than * (int) ($id_cache[$first]['last_visit'] - $id_cache[$second]['last_visit']);
|
---|
1730 | }
|
---|
1731 | }
|
---|
1732 |
|
---|
1733 | ?>
|
---|