5
* @version $Id: acp_users.php,v 1.142 2007/11/15 19:54:37 kellanved Exp $
6
* @copyright (c) 2005 phpBB Group
7
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
14
if (!defined('IN_PHPBB'))
27
function acp_users(&$p_master)
29
$this->p_master = &$p_master;
32
function main($id, $mode)
34
global $config, $db, $user, $auth, $template, $cache;
35
global $phpbb_root_path, $phpbb_admin_path, $phpEx, $table_prefix, $file_uploads;
37
$user->add_lang(array('posting', 'ucp', 'acp/users'));
38
$this->tpl_name = 'acp_users';
39
$this->page_title = 'ACP_USER_' . strtoupper($mode);
42
$username = utf8_normalize_nfc(request_var('username', '', true));
43
$user_id = request_var('u', 0);
44
$action = request_var('action', '');
46
$submit = (isset($_POST['update']) && !isset($_POST['cancel'])) ? true : false;
48
$form_name = 'acp_users';
49
add_form_key($form_name);
51
// Whois (special case)
52
if ($action == 'whois')
54
include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
56
$this->page_title = 'WHOIS';
57
$this->tpl_name = 'simple_body';
59
$user_ip = request_var('user_ip', '');
60
$domain = gethostbyaddr($user_ip);
61
$ipwhois = user_ipwhois($user_ip);
63
$template->assign_vars(array(
64
'MESSAGE_TITLE' => sprintf($user->lang['IP_WHOIS_FOR'], $domain),
65
'MESSAGE_TEXT' => nl2br($ipwhois))
71
// Show user selection mask
72
if (!$username && !$user_id)
74
$this->page_title = 'SELECT_USER';
76
$template->assign_vars(array(
77
'U_ACTION' => $this->u_action,
78
'ANONYMOUS_USER_ID' => ANONYMOUS,
80
'S_SELECT_USER' => true,
81
'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&form=select_user&field=username&select_single=true'),
89
$sql = 'SELECT user_id
90
FROM ' . USERS_TABLE . "
91
WHERE username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'";
92
$result = $db->sql_query($sql);
93
$user_id = (int) $db->sql_fetchfield('user_id');
94
$db->sql_freeresult($result);
98
trigger_error($user->lang['NO_USER'] . adm_back_link($this->u_action), E_USER_WARNING);
102
// Generate content for all modes
103
$sql = 'SELECT u.*, s.*
104
FROM ' . USERS_TABLE . ' u
105
LEFT JOIN ' . SESSIONS_TABLE . ' s ON (s.session_user_id = u.user_id)
106
WHERE u.user_id = ' . $user_id . '
107
ORDER BY s.session_time DESC';
108
$result = $db->sql_query($sql);
109
$user_row = $db->sql_fetchrow($result);
110
$db->sql_freeresult($result);
114
trigger_error($user->lang['NO_USER'] . adm_back_link($this->u_action), E_USER_WARNING);
117
// Generate overall "header" for user admin
118
$s_form_options = '';
120
// Build modes dropdown list
121
$sql = 'SELECT module_mode, module_auth
122
FROM ' . MODULES_TABLE . "
123
WHERE module_basename = 'users'
124
AND module_enabled = 1
125
AND module_class = 'acp'
126
ORDER BY left_id, module_mode";
127
$result = $db->sql_query($sql);
129
$dropdown_modes = array();
130
while ($row = $db->sql_fetchrow($result))
132
if (!$this->p_master->module_auth($row['module_auth']))
137
$dropdown_modes[$row['module_mode']] = true;
139
$db->sql_freeresult($result);
141
foreach ($dropdown_modes as $module_mode => $null)
143
$selected = ($mode == $module_mode) ? ' selected="selected"' : '';
144
$s_form_options .= '<option value="' . $module_mode . '"' . $selected . '>' . $user->lang['ACP_USER_' . strtoupper($module_mode)] . '</option>';
147
$template->assign_vars(array(
148
'U_BACK' => $this->u_action,
149
'U_MODE_SELECT' => append_sid("{$phpbb_admin_path}index.$phpEx", "i=$id&u=$user_id"),
150
'U_ACTION' => $this->u_action . '&u=' . $user_id,
151
'S_FORM_OPTIONS' => $s_form_options,
152
'MANAGED_USERNAME' => $user_row['username'])
155
// Prevent normal users/admins change/view founders if they are not a founder by themselves
156
if ($user->data['user_type'] != USER_FOUNDER && $user_row['user_type'] == USER_FOUNDER)
158
trigger_error($user->lang['NOT_MANAGE_FOUNDER'] . adm_back_link($this->u_action), E_USER_WARNING);
165
include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
167
$user->add_lang('acp/ban');
169
$delete = request_var('delete', 0);
170
$delete_type = request_var('delete_type', '');
171
$ip = request_var('ip', 'ip');
175
// You can't delete the founder
176
if ($delete && $user_row['user_type'] != USER_FOUNDER)
178
if (!$auth->acl_get('a_userdel'))
180
trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING);
183
// Check if the user wants to remove himself or the guest user account
184
if ($user_id == ANONYMOUS)
186
trigger_error($user->lang['CANNOT_REMOVE_ANONYMOUS'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING);
189
if ($user_id == $user->data['user_id'])
191
trigger_error($user->lang['CANNOT_REMOVE_YOURSELF'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING);
194
if (confirm_box(true))
196
user_delete($delete_type, $user_id, $user_row['username']);
198
add_log('admin', 'LOG_USER_DELETED', $user_row['username']);
199
trigger_error($user->lang['USER_DELETED'] . adm_back_link($this->u_action));
203
confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array(
210
'delete_type' => $delete_type))
215
// Handle quicktool actions
222
if ($user_id == $user->data['user_id'])
224
trigger_error($user->lang['CANNOT_BAN_YOURSELF'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING);
227
if ($user_row['user_type'] == USER_FOUNDER)
229
trigger_error($user->lang['CANNOT_BAN_FOUNDER'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING);
232
if (!check_form_key($form_name))
234
trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING);
242
$ban[] = $user_row['username'];
243
$reason = 'USER_ADMIN_BAN_NAME_REASON';
244
$log = 'LOG_USER_BAN_USER';
248
$ban[] = $user_row['user_email'];
249
$reason = 'USER_ADMIN_BAN_EMAIL_REASON';
250
$log = 'LOG_USER_BAN_EMAIL';
254
$ban[] = $user_row['user_ip'];
256
$sql = 'SELECT DISTINCT poster_ip
257
FROM ' . POSTS_TABLE . "
258
WHERE poster_id = $user_id";
259
$result = $db->sql_query($sql);
261
while ($row = $db->sql_fetchrow($result))
263
$ban[] = $row['poster_ip'];
265
$db->sql_freeresult($result);
267
$reason = 'USER_ADMIN_BAN_IP_REASON';
268
$log = 'LOG_USER_BAN_IP';
272
$ban_reason = utf8_normalize_nfc(request_var('ban_reason', $user->lang[$reason], true));
273
$ban_give_reason = utf8_normalize_nfc(request_var('ban_give_reason', '', true));
275
// Log not used at the moment, we simply utilize the ban function.
276
$result = user_ban(substr($action, 3), $ban, 0, 0, 0, $ban_reason, $ban_give_reason);
278
trigger_error((($result === false) ? $user->lang['BAN_ALREADY_ENTERED'] : $user->lang['BAN_SUCCESSFUL']) . adm_back_link($this->u_action . '&u=' . $user_id));
284
if ($user_id == $user->data['user_id'])
286
trigger_error($user->lang['CANNOT_FORCE_REACT_YOURSELF'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING);
289
if (!check_form_key($form_name))
291
trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING);
294
if ($user_row['user_type'] == USER_FOUNDER)
296
trigger_error($user->lang['CANNOT_FORCE_REACT_FOUNDER'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING);
299
if ($user_row['user_type'] == USER_IGNORE)
301
trigger_error($user->lang['CANNOT_FORCE_REACT_BOT'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING);
304
if ($config['email_enable'])
306
include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);
308
$server_url = generate_board_url();
310
$user_actkey = gen_rand_string(10);
311
$key_len = 54 - (strlen($server_url));
312
$key_len = ($key_len > 6) ? $key_len : 6;
313
$user_actkey = substr($user_actkey, 0, $key_len);
314
$email_template = ($user_row['user_type'] == USER_NORMAL) ? 'user_reactivate_account' : 'user_resend_inactive';
316
if ($user_row['user_type'] == USER_NORMAL)
318
user_active_flip('deactivate', $user_id, INACTIVE_REMIND);
320
$sql = 'UPDATE ' . USERS_TABLE . "
321
SET user_actkey = '" . $db->sql_escape($user_actkey) . "'
322
WHERE user_id = $user_id";
323
$db->sql_query($sql);
327
// Grabbing the last confirm key - we only send a reminder
328
$sql = 'SELECT user_actkey
329
FROM ' . USERS_TABLE . '
330
WHERE user_id = ' . $user_id;
331
$result = $db->sql_query($sql);
332
$user_actkey = (string) $db->sql_fetchfield('user_actkey');
333
$db->sql_freeresult($result);
336
$messenger = new messenger(false);
338
$messenger->template($email_template, $user_row['user_lang']);
340
$messenger->to($user_row['user_email'], $user_row['username']);
342
$messenger->headers('X-AntiAbuse: Board servername - ' . $config['server_name']);
343
$messenger->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']);
344
$messenger->headers('X-AntiAbuse: Username - ' . $user->data['username']);
345
$messenger->headers('X-AntiAbuse: User IP - ' . $user->ip);
347
$messenger->assign_vars(array(
348
'WELCOME_MSG' => htmlspecialchars_decode(sprintf($user->lang['WELCOME_SUBJECT'], $config['sitename'])),
349
'USERNAME' => htmlspecialchars_decode($user_row['username']),
350
'U_ACTIVATE' => "$server_url/ucp.$phpEx?mode=activate&u={$user_row['user_id']}&k=$user_actkey")
353
$messenger->send(NOTIFY_EMAIL);
355
add_log('admin', 'LOG_USER_REACTIVATE', $user_row['username']);
356
add_log('user', $user_id, 'LOG_USER_REACTIVATE_USER');
358
trigger_error($user->lang['FORCE_REACTIVATION_SUCCESS'] . adm_back_link($this->u_action . '&u=' . $user_id));
365
if ($user_id == $user->data['user_id'])
367
// It is only deactivation since the user is already activated (else he would not have reached this page)
368
trigger_error($user->lang['CANNOT_DEACTIVATE_YOURSELF'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING);
371
if (!check_form_key($form_name))
373
trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING);
376
if ($user_row['user_type'] == USER_FOUNDER)
378
trigger_error($user->lang['CANNOT_DEACTIVATE_FOUNDER'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING);
381
if ($user_row['user_type'] == USER_IGNORE)
383
trigger_error($user->lang['CANNOT_DEACTIVATE_BOT'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING);
386
user_active_flip('flip', $user_id);
388
$message = ($user_row['user_type'] == USER_INACTIVE) ? 'USER_ADMIN_ACTIVATED' : 'USER_ADMIN_DEACTIVED';
389
$log = ($user_row['user_type'] == USER_INACTIVE) ? 'LOG_USER_ACTIVE' : 'LOG_USER_INACTIVE';
391
add_log('admin', $log, $user_row['username']);
392
add_log('user', $user_id, $log . '_USER');
394
trigger_error($user->lang[$message] . adm_back_link($this->u_action . '&u=' . $user_id));
400
if (!check_form_key($form_name))
402
trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING);
407
'user_sig_bbcode_uid' => '',
408
'user_sig_bbcode_bitfield' => ''
411
$sql = 'UPDATE ' . USERS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . "
412
WHERE user_id = $user_id";
413
$db->sql_query($sql);
415
add_log('admin', 'LOG_USER_DEL_SIG', $user_row['username']);
416
add_log('user', $user_id, 'LOG_USER_DEL_SIG_USER');
418
trigger_error($user->lang['USER_ADMIN_SIG_REMOVED'] . adm_back_link($this->u_action . '&u=' . $user_id));
424
if (!check_form_key($form_name))
426
trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING);
431
'user_avatar_type' => 0,
432
'user_avatar_width' => 0,
433
'user_avatar_height' => 0,
436
$sql = 'UPDATE ' . USERS_TABLE . '
437
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . "
438
WHERE user_id = $user_id";
439
$db->sql_query($sql);
441
// Delete old avatar if present
442
if ($user_row['user_avatar'] && $user_row['user_avatar_type'] != AVATAR_GALLERY)
444
avatar_delete('user', $user_row);
447
add_log('admin', 'LOG_USER_DEL_AVATAR', $user_row['username']);
448
add_log('user', $user_id, 'LOG_USER_DEL_AVATAR_USER');
450
trigger_error($user->lang['USER_ADMIN_AVATAR_REMOVED'] . adm_back_link($this->u_action . '&u=' . $user_id));
455
if (confirm_box(true))
457
// Delete posts, attachments, etc.
458
delete_posts('poster_id', $user_id);
460
add_log('admin', 'LOG_USER_DEL_POSTS', $user_row['username']);
461
trigger_error($user->lang['USER_POSTS_DELETED'] . adm_back_link($this->u_action . '&u=' . $user_id));
465
confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array(
478
if (confirm_box(true))
480
delete_attachments('user', $user_id);
482
add_log('admin', 'LOG_USER_DEL_ATTACH', $user_row['username']);
483
trigger_error($user->lang['USER_ATTACHMENTS_REMOVED'] . adm_back_link($this->u_action . '&u=' . $user_id));
487
confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array(
500
if (!check_form_key($form_name))
502
trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING);
505
$user->add_lang('acp/forums');
507
$new_forum_id = request_var('new_f', 0);
511
$this->page_title = 'USER_ADMIN_MOVE_POSTS';
513
$template->assign_vars(array(
514
'S_SELECT_FORUM' => true,
515
'U_ACTION' => $this->u_action . "&action=$action&u=$user_id",
516
'U_BACK' => $this->u_action . "&u=$user_id",
517
'S_FORUM_OPTIONS' => make_forum_select(false, false, false, true))
523
// Is the new forum postable to?
524
$sql = 'SELECT forum_name, forum_type
525
FROM ' . FORUMS_TABLE . "
526
WHERE forum_id = $new_forum_id";
527
$result = $db->sql_query($sql);
528
$forum_info = $db->sql_fetchrow($result);
529
$db->sql_freeresult($result);
533
trigger_error($user->lang['NO_FORUM'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING);
536
if ($forum_info['forum_type'] != FORUM_POST)
538
trigger_error($user->lang['MOVE_POSTS_NO_POSTABLE_FORUM'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING);
542
// Move topics comprising only posts from this user
543
$topic_id_ary = $move_topic_ary = $move_post_ary = $new_topic_id_ary = array();
544
$forum_id_ary = array($new_forum_id);
546
$sql = 'SELECT topic_id, COUNT(post_id) AS total_posts
547
FROM ' . POSTS_TABLE . "
548
WHERE poster_id = $user_id
549
AND forum_id <> $new_forum_id
551
$result = $db->sql_query($sql);
553
while ($row = $db->sql_fetchrow($result))
555
$topic_id_ary[$row['topic_id']] = $row['total_posts'];
557
$db->sql_freeresult($result);
559
if (sizeof($topic_id_ary))
561
$sql = 'SELECT topic_id, forum_id, topic_title, topic_replies, topic_replies_real, topic_attachment
562
FROM ' . TOPICS_TABLE . '
563
WHERE ' . $db->sql_in_set('topic_id', array_keys($topic_id_ary));
564
$result = $db->sql_query($sql);
566
while ($row = $db->sql_fetchrow($result))
568
if (max($row['topic_replies'], $row['topic_replies_real']) + 1 == $topic_id_ary[$row['topic_id']])
570
$move_topic_ary[] = $row['topic_id'];
574
$move_post_ary[$row['topic_id']]['title'] = $row['topic_title'];
575
$move_post_ary[$row['topic_id']]['attach'] = ($row['topic_attachment']) ? 1 : 0;
578
$forum_id_ary[] = $row['forum_id'];
580
$db->sql_freeresult($result);
583
// Entire topic comprises posts by this user, move these topics
584
if (sizeof($move_topic_ary))
586
move_topics($move_topic_ary, $new_forum_id, false);
589
if (sizeof($move_post_ary))
592
// Update post_ids, report_ids, attachment_ids
593
foreach ($move_post_ary as $topic_id => $post_ary)
596
$sql = 'INSERT INTO ' . TOPICS_TABLE . ' ' . $db->sql_build_array('INSERT', array(
597
'topic_poster' => $user_id,
598
'topic_time' => time(),
599
'forum_id' => $new_forum_id,
601
'topic_approved' => 1,
602
'topic_title' => $post_ary['title'],
603
'topic_first_poster_name' => $user_row['username'],
604
'topic_type' => POST_NORMAL,
605
'topic_time_limit' => 0,
606
'topic_attachment' => $post_ary['attach'])
608
$db->sql_query($sql);
610
$new_topic_id = $db->sql_nextid();
613
$sql = 'UPDATE ' . POSTS_TABLE . "
614
SET forum_id = $new_forum_id, topic_id = $new_topic_id
615
WHERE topic_id = $topic_id
616
AND poster_id = $user_id";
617
$db->sql_query($sql);
619
if ($post_ary['attach'])
621
$sql = 'UPDATE ' . ATTACHMENTS_TABLE . "
622
SET topic_id = $new_topic_id
623
WHERE topic_id = $topic_id
624
AND poster_id = $user_id";
625
$db->sql_query($sql);
628
$new_topic_id_ary[] = $new_topic_id;
632
$forum_id_ary = array_unique($forum_id_ary);
633
$topic_id_ary = array_unique(array_merge($topic_id_ary, $new_topic_id_ary));
635
if (sizeof($topic_id_ary))
637
sync('reported', 'topic_id', $topic_id_ary);
638
sync('topic', 'topic_id', $topic_id_ary);
641
if (sizeof($forum_id_ary))
643
sync('forum', 'forum_id', $forum_id_ary, false, true);
647
add_log('admin', 'LOG_USER_MOVE_POSTS', $user_row['username'], $forum_info['forum_name']);
648
add_log('user', $user_id, 'LOG_USER_MOVE_POSTS_USER', $forum_info['forum_name']);
650
trigger_error($user->lang['USER_POSTS_MOVED'] . adm_back_link($this->u_action . '&u=' . $user_id));
655
// Handle registration info updates
657
'username' => utf8_normalize_nfc(request_var('user', $user_row['username'], true)),
658
'user_founder' => request_var('user_founder', ($user_row['user_type'] == USER_FOUNDER) ? 1 : 0),
659
'email' => strtolower(request_var('user_email', $user_row['user_email'])),
660
'email_confirm' => strtolower(request_var('email_confirm', '')),
661
'new_password' => request_var('new_password', '', true),
662
'password_confirm' => request_var('password_confirm', '', true),
665
// Validation data - we do not check the password complexity setting here
667
'new_password' => array(
668
array('string', true, $config['min_pass_chars'], $config['max_pass_chars']),
670
'password_confirm' => array('string', true, $config['min_pass_chars'], $config['max_pass_chars']),
673
// Check username if altered
674
if ($data['username'] != $user_row['username'])
678
array('string', false, $config['min_name_chars'], $config['max_name_chars']),
679
array('username', $user_row['username'])
684
// Check email if altered
685
if ($data['email'] != $user_row['user_email'])
689
array('string', false, 6, 60),
690
array('email', $user_row['user_email'])
692
'email_confirm' => array('string', true, 6, 60)
696
$error = validate_data($data, $check_ary);
698
if ($data['new_password'] && $data['password_confirm'] != $data['new_password'])
700
$error[] = 'NEW_PASSWORD_ERROR';
703
if ($data['email'] != $user_row['user_email'] && $data['email_confirm'] != $data['email'])
705
$error[] = 'NEW_EMAIL_ERROR';
708
if (!check_form_key($form_name))
710
$error[] = 'FORM_INVALID';
713
// Which updates do we need to do?
714
$update_username = ($user_row['username'] != $data['username']) ? $data['username'] : false;
715
$update_password = ($data['new_password'] && !phpbb_check_hash($user_row['user_password'], $data['new_password'])) ? true : false;
716
$update_email = ($data['email'] != $user_row['user_email']) ? $data['email'] : false;
722
if ($user_row['user_type'] != USER_FOUNDER || $user->data['user_type'] == USER_FOUNDER)
724
// Only allow founders updating the founder status...
725
if ($user->data['user_type'] == USER_FOUNDER)
727
// Setting a normal member to be a founder
728
if ($data['user_founder'] && $user_row['user_type'] != USER_FOUNDER)
730
// Make sure the user is not setting an Inactive or ignored user to be a founder
731
if ($user_row['user_type'] == USER_IGNORE)
733
trigger_error($user->lang['CANNOT_SET_FOUNDER_IGNORED'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING);
736
if ($user_row['user_type'] == USER_INACTIVE)
738
trigger_error($user->lang['CANNOT_SET_FOUNDER_INACTIVE'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING);
741
$sql_ary['user_type'] = USER_FOUNDER;
743
else if (!$data['user_founder'] && $user_row['user_type'] == USER_FOUNDER)
745
// Check if at least one founder is present
746
$sql = 'SELECT user_id
747
FROM ' . USERS_TABLE . '
748
WHERE user_type = ' . USER_FOUNDER . '
749
AND user_id <> ' . $user_id;
750
$result = $db->sql_query_limit($sql, 1);
751
$row = $db->sql_fetchrow($result);
752
$db->sql_freeresult($result);
756
$sql_ary['user_type'] = USER_NORMAL;
760
trigger_error($user->lang['AT_LEAST_ONE_FOUNDER'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING);
766
if ($update_username !== false)
768
$sql_ary['username'] = $update_username;
769
$sql_ary['username_clean'] = utf8_clean_string($update_username);
771
add_log('user', $user_id, 'LOG_USER_UPDATE_NAME', $user_row['username'], $update_username);
774
if ($update_email !== false)
777
'user_email' => $update_email,
778
'user_email_hash' => crc32($update_email) . strlen($update_email)
781
add_log('user', $user_id, 'LOG_USER_UPDATE_EMAIL', $user_row['username'], $user_row['user_email'], $update_email);
784
if ($update_password)
787
'user_password' => phpbb_hash($data['new_password']),
788
'user_passchg' => time(),
789
'user_pass_convert' => 0,
792
$user->reset_login_keys($user_id);
793
add_log('user', $user_id, 'LOG_USER_NEW_PASSWORD', $user_row['username']);
796
if (sizeof($sql_ary))
798
$sql = 'UPDATE ' . USERS_TABLE . '
799
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
800
WHERE user_id = ' . $user_id;
801
$db->sql_query($sql);
804
if ($update_username)
806
user_update_name($user_row['username'], $update_username);
809
// Let the users permissions being updated
810
$auth->acl_clear_prefetch($user_id);
812
add_log('admin', 'LOG_USER_USER_UPDATE', $data['username']);
814
trigger_error($user->lang['USER_OVERVIEW_UPDATED'] . adm_back_link($this->u_action . '&u=' . $user_id));
817
// Replace "error" strings with their real, localised form
818
$error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error);
821
if ($user_id == $user->data['user_id'])
823
$quick_tool_ary = array('delsig' => 'DEL_SIG', 'delavatar' => 'DEL_AVATAR', 'moveposts' => 'MOVE_POSTS', 'delposts' => 'DEL_POSTS', 'delattach' => 'DEL_ATTACH');
827
$quick_tool_ary = array();
829
if ($user_row['user_type'] != USER_FOUNDER)
831
$quick_tool_ary += array('banuser' => 'BAN_USER', 'banemail' => 'BAN_EMAIL', 'banip' => 'BAN_IP');
834
if ($user_row['user_type'] != USER_FOUNDER && $user_row['user_type'] != USER_IGNORE)
836
$quick_tool_ary += array('active' => (($user_row['user_type'] == USER_INACTIVE) ? 'ACTIVATE' : 'DEACTIVATE'));
839
$quick_tool_ary += array('delsig' => 'DEL_SIG', 'delavatar' => 'DEL_AVATAR', 'moveposts' => 'MOVE_POSTS', 'delposts' => 'DEL_POSTS', 'delattach' => 'DEL_ATTACH');
841
if ($config['email_enable'] && ($user_row['user_type'] == USER_NORMAL || $user_row['user_type'] == USER_INACTIVE))
843
$quick_tool_ary['reactivate'] = 'FORCE';
847
$s_action_options = '<option class="sep" value="">' . $user->lang['SELECT_OPTION'] . '</option>';
848
foreach ($quick_tool_ary as $value => $lang)
850
$s_action_options .= '<option value="' . $value . '">' . $user->lang['USER_ADMIN_' . $lang] . '</option>';
853
if ($config['load_onlinetrack'])
855
$sql = 'SELECT MAX(session_time) AS session_time, MIN(session_viewonline) AS session_viewonline
856
FROM ' . SESSIONS_TABLE . "
857
WHERE session_user_id = $user_id";
858
$result = $db->sql_query($sql);
859
$row = $db->sql_fetchrow($result);
860
$db->sql_freeresult($result);
862
$user_row['session_time'] = (isset($row['session_time'])) ? $row['session_time'] : 0;
863
$user_row['session_viewonline'] = (isset($row['session_viewonline'])) ? $row['session_viewonline'] : 0;
867
$last_visit = (!empty($user_row['session_time'])) ? $user_row['session_time'] : $user_row['user_lastvisit'];
869
$inactive_reason = '';
870
if ($user_row['user_type'] == USER_INACTIVE)
872
$inactive_reason = $user->lang['INACTIVE_REASON_UNKNOWN'];
874
switch ($user_row['user_inactive_reason'])
876
case INACTIVE_REGISTER:
877
$inactive_reason = $user->lang['INACTIVE_REASON_REGISTER'];
880
case INACTIVE_PROFILE:
881
$inactive_reason = $user->lang['INACTIVE_REASON_PROFILE'];
884
case INACTIVE_MANUAL:
885
$inactive_reason = $user->lang['INACTIVE_REASON_MANUAL'];
888
case INACTIVE_REMIND:
889
$inactive_reason = $user->lang['INACTIVE_REASON_REMIND'];
894
$template->assign_vars(array(
895
'L_NAME_CHARS_EXPLAIN' => sprintf($user->lang[$config['allow_name_chars'] . '_EXPLAIN'], $config['min_name_chars'], $config['max_name_chars']),
896
'L_CHANGE_PASSWORD_EXPLAIN' => sprintf($user->lang[$config['pass_complex'] . '_EXPLAIN'], $config['min_pass_chars'], $config['max_pass_chars']),
897
'S_FOUNDER' => ($user->data['user_type'] == USER_FOUNDER) ? true : false,
899
'S_OVERVIEW' => true,
900
'S_USER_IP' => ($user_row['user_ip']) ? true : false,
901
'S_USER_FOUNDER' => ($user_row['user_type'] == USER_FOUNDER) ? true : false,
902
'S_ACTION_OPTIONS' => $s_action_options,
903
'S_OWN_ACCOUNT' => ($user_id == $user->data['user_id']) ? true : false,
904
'S_USER_INACTIVE' => ($user_row['user_type'] == USER_INACTIVE) ? true : false,
906
'U_SHOW_IP' => $this->u_action . "&u=$user_id&ip=" . (($ip == 'ip') ? 'hostname' : 'ip'),
907
'U_WHOIS' => $this->u_action . "&action=whois&user_ip={$user_row['user_ip']}",
909
'U_SWITCH_PERMISSIONS' => ($auth->acl_get('a_switchperm') && $user->data['user_id'] != $user_row['user_id']) ? append_sid("{$phpbb_root_path}ucp.$phpEx", "mode=switch_perm&u={$user_row['user_id']}") : '',
911
'USER' => $user_row['username'],
912
'USER_REGISTERED' => $user->format_date($user_row['user_regdate']),
913
'REGISTERED_IP' => ($ip == 'hostname') ? gethostbyaddr($user_row['user_ip']) : $user_row['user_ip'],
914
'USER_LASTACTIVE' => ($last_visit) ? $user->format_date($last_visit) : ' - ',
915
'USER_EMAIL' => $user_row['user_email'],
916
'USER_WARNINGS' => $user_row['user_warnings'],
917
'USER_POSTS' => $user_row['user_posts'],
918
'USER_INACTIVE_REASON' => $inactive_reason,
925
$user->add_lang('mcp');
927
// Set up general vars
928
$start = request_var('start', 0);
929
$deletemark = (isset($_POST['delmarked'])) ? true : false;
930
$deleteall = (isset($_POST['delall'])) ? true : false;
931
$marked = request_var('mark', array(0));
932
$message = utf8_normalize_nfc(request_var('message', '', true));
935
$sort_days = request_var('st', 0);
936
$sort_key = request_var('sk', 't');
937
$sort_dir = request_var('sd', 'd');
939
// Delete entries if requested and able
940
if (($deletemark || $deleteall) && $auth->acl_get('a_clearlogs'))
942
if (!check_form_key($form_name))
944
trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING);
948
if ($deletemark && $marked)
951
foreach ($marked as $mark)
955
$where_sql = ' AND ' . $db->sql_in_set('log_id', $sql_in);
959
if ($where_sql || $deleteall)
961
$sql = 'DELETE FROM ' . LOG_TABLE . '
962
WHERE log_type = ' . LOG_USERS . "
964
$db->sql_query($sql);
966
add_log('admin', 'LOG_CLEAR_USER', $user_row['username']);
970
if ($submit && $message)
972
if (!check_form_key($form_name))
974
trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING);
977
add_log('admin', 'LOG_USER_FEEDBACK', $user_row['username']);
978
add_log('mod', 0, 0, 'LOG_USER_FEEDBACK', $user_row['username']);
979
add_log('user', $user_id, 'LOG_USER_GENERAL', $message);
981
trigger_error($user->lang['USER_FEEDBACK_ADDED'] . adm_back_link($this->u_action . '&u=' . $user_id));
985
$limit_days = array(0 => $user->lang['ALL_ENTRIES'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']);
986
$sort_by_text = array('u' => $user->lang['SORT_USERNAME'], 't' => $user->lang['SORT_DATE'], 'i' => $user->lang['SORT_IP'], 'o' => $user->lang['SORT_ACTION']);
987
$sort_by_sql = array('u' => 'u.username_clean', 't' => 'l.log_time', 'i' => 'l.log_ip', 'o' => 'l.log_operation');
989
$s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = '';
990
gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param);
992
// Define where and sort sql for use in displaying logs
993
$sql_where = ($sort_days) ? (time() - ($sort_days * 86400)) : 0;
994
$sql_sort = $sort_by_sql[$sort_key] . ' ' . (($sort_dir == 'd') ? 'DESC' : 'ASC');
999
view_log('user', $log_data, $log_count, $config['topics_per_page'], $start, 0, 0, $user_id, $sql_where, $sql_sort);
1001
$template->assign_vars(array(
1002
'S_FEEDBACK' => true,
1003
'S_ON_PAGE' => on_page($log_count, $config['topics_per_page'], $start),
1004
'PAGINATION' => generate_pagination($this->u_action . "&u=$user_id&$u_sort_param", $log_count, $config['topics_per_page'], $start, true),
1006
'S_LIMIT_DAYS' => $s_limit_days,
1007
'S_SORT_KEY' => $s_sort_key,
1008
'S_SORT_DIR' => $s_sort_dir,
1009
'S_CLEARLOGS' => $auth->acl_get('a_clearlogs'))
1012
foreach ($log_data as $row)
1014
$template->assign_block_vars('log', array(
1015
'USERNAME' => $row['username_full'],
1017
'DATE' => $user->format_date($row['time']),
1018
'ACTION' => nl2br($row['action']),
1027
include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
1028
include($phpbb_root_path . 'includes/functions_profile_fields.' . $phpEx);
1030
$cp = new custom_profile();
1032
$cp_data = $cp_error = array();
1034
$sql = 'SELECT lang_id
1035
FROM ' . LANG_TABLE . "
1036
WHERE lang_iso = '" . $db->sql_escape($user->data['user_lang']) . "'";
1037
$result = $db->sql_query($sql);
1038
$row = $db->sql_fetchrow($result);
1039
$db->sql_freeresult($result);
1041
$user_row['iso_lang_id'] = $row['lang_id'];
1044
'icq' => request_var('icq', $user_row['user_icq']),
1045
'aim' => request_var('aim', $user_row['user_aim']),
1046
'msn' => request_var('msn', $user_row['user_msnm']),
1047
'yim' => request_var('yim', $user_row['user_yim']),
1048
'jabber' => utf8_normalize_nfc(request_var('jabber', $user_row['user_jabber'], true)),
1049
'website' => request_var('website', $user_row['user_website']),
1050
'location' => utf8_normalize_nfc(request_var('location', $user_row['user_from'], true)),
1051
'occupation' => utf8_normalize_nfc(request_var('occupation', $user_row['user_occ'], true)),
1052
'interests' => utf8_normalize_nfc(request_var('interests', $user_row['user_interests'], true)),
1058
if ($user_row['user_birthday'])
1060
list($data['bday_day'], $data['bday_month'], $data['bday_year']) = explode('-', $user_row['user_birthday']);
1063
$data['bday_day'] = request_var('bday_day', $data['bday_day']);
1064
$data['bday_month'] = request_var('bday_month', $data['bday_month']);
1065
$data['bday_year'] = request_var('bday_year', $data['bday_year']);
1069
$error = validate_data($data, array(
1071
array('string', true, 3, 15),
1072
array('match', true, '#^[0-9]+$#i')),
1073
'aim' => array('string', true, 3, 255),
1074
'msn' => array('string', true, 5, 255),
1076
array('string', true, 5, 255),
1078
'yim' => array('string', true, 5, 255),
1080
array('string', true, 12, 255),
1081
array('match', true, '#^http[s]?://(.*?\.)*?[a-z0-9\-]+\.[a-z]{2,4}#i')),
1082
'location' => array('string', true, 2, 255),
1083
'occupation' => array('string', true, 2, 500),
1084
'interests' => array('string', true, 2, 500),
1085
'bday_day' => array('num', true, 1, 31),
1086
'bday_month' => array('num', true, 1, 12),
1087
'bday_year' => array('num', true, 1901, gmdate('Y', time())),
1090
// validate custom profile fields
1091
$cp->submit_cp_field('profile', $user_row['iso_lang_id'], $cp_data, $cp_error);
1093
if (sizeof($cp_error))
1095
$error = array_merge($error, $cp_error);
1097
if (!check_form_key($form_name))
1099
$error[] = 'FORM_INVALID';
1102
if (!sizeof($error))
1105
'user_icq' => $data['icq'],
1106
'user_aim' => $data['aim'],
1107
'user_msnm' => $data['msn'],
1108
'user_yim' => $data['yim'],
1109
'user_jabber' => $data['jabber'],
1110
'user_website' => $data['website'],
1111
'user_from' => $data['location'],
1112
'user_occ' => $data['occupation'],
1113
'user_interests'=> $data['interests'],
1114
'user_birthday' => sprintf('%2d-%2d-%4d', $data['bday_day'], $data['bday_month'], $data['bday_year']),
1117
$sql = 'UPDATE ' . USERS_TABLE . '
1118
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . "
1119
WHERE user_id = $user_id";
1120
$db->sql_query($sql);
1122
// Update Custom Fields
1123
if (sizeof($cp_data))
1125
switch ($db->sql_layer)
1130
$right_delim = $left_delim = '"';
1143
$right_delim = $left_delim = '`';
1147
foreach ($cp_data as $key => $value)
1149
$cp_data[$left_delim . $key . $right_delim] = $value;
1150
unset($cp_data[$key]);
1153
$sql = 'UPDATE ' . PROFILE_FIELDS_DATA_TABLE . '
1154
SET ' . $db->sql_build_array('UPDATE', $cp_data) . "
1155
WHERE user_id = $user_id";
1156
$db->sql_query($sql);
1158
if (!$db->sql_affectedrows())
1160
$cp_data['user_id'] = (int) $user_id;
1162
$db->sql_return_on_error(true);
1164
$sql = 'INSERT INTO ' . PROFILE_FIELDS_DATA_TABLE . ' ' . $db->sql_build_array('INSERT', $cp_data);
1165
$db->sql_query($sql);
1167
$db->sql_return_on_error(false);
1171
trigger_error($user->lang['USER_PROFILE_UPDATED'] . adm_back_link($this->u_action . '&u=' . $user_id));
1174
// Replace "error" strings with their real, localised form
1175
$error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error);
1178
$s_birthday_day_options = '<option value="0"' . ((!$data['bday_day']) ? ' selected="selected"' : '') . '>--</option>';
1179
for ($i = 1; $i < 32; $i++)
1181
$selected = ($i == $data['bday_day']) ? ' selected="selected"' : '';
1182
$s_birthday_day_options .= "<option value=\"$i\"$selected>$i</option>";
1185
$s_birthday_month_options = '<option value="0"' . ((!$data['bday_month']) ? ' selected="selected"' : '') . '>--</option>';
1186
for ($i = 1; $i < 13; $i++)
1188
$selected = ($i == $data['bday_month']) ? ' selected="selected"' : '';
1189
$s_birthday_month_options .= "<option value=\"$i\"$selected>$i</option>";
1191
$s_birthday_year_options = '';
1194
$s_birthday_year_options = '<option value="0"' . ((!$data['bday_year']) ? ' selected="selected"' : '') . '>--</option>';
1195
for ($i = $now['year'] - 100; $i < $now['year']; $i++)
1197
$selected = ($i == $data['bday_year']) ? ' selected="selected"' : '';
1198
$s_birthday_year_options .= "<option value=\"$i\"$selected>$i</option>";
1202
$template->assign_vars(array(
1203
'ICQ' => $data['icq'],
1204
'YIM' => $data['yim'],
1205
'AIM' => $data['aim'],
1206
'MSN' => $data['msn'],
1207
'JABBER' => $data['jabber'],
1208
'WEBSITE' => $data['website'],
1209
'LOCATION' => $data['location'],
1210
'OCCUPATION' => $data['occupation'],
1211
'INTERESTS' => $data['interests'],
1213
'S_BIRTHDAY_DAY_OPTIONS' => $s_birthday_day_options,
1214
'S_BIRTHDAY_MONTH_OPTIONS' => $s_birthday_month_options,
1215
'S_BIRTHDAY_YEAR_OPTIONS' => $s_birthday_year_options,
1217
'S_PROFILE' => true)
1220
// Get additional profile fields and assign them to the template block var 'profile_fields'
1221
$user->get_profile_fields($user_id);
1223
$cp->generate_profile_fields('profile', $user_row['iso_lang_id']);
1229
include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
1232
'dateformat' => utf8_normalize_nfc(request_var('dateformat', $user_row['user_dateformat'], true)),
1233
'lang' => basename(request_var('lang', $user_row['user_lang'])),
1234
'tz' => request_var('tz', (float) $user_row['user_timezone']),
1235
'style' => request_var('style', $user_row['user_style']),
1236
'dst' => request_var('dst', $user_row['user_dst']),
1237
'viewemail' => request_var('viewemail', $user_row['user_allow_viewemail']),
1238
'massemail' => request_var('massemail', $user_row['user_allow_massemail']),
1239
'hideonline' => request_var('hideonline', !$user_row['user_allow_viewonline']),
1240
'notifymethod' => request_var('notifymethod', $user_row['user_notify_type']),
1241
'notifypm' => request_var('notifypm', $user_row['user_notify_pm']),
1242
'popuppm' => request_var('popuppm', $this->optionget($user_row, 'popuppm')),
1243
'allowpm' => request_var('allowpm', $user_row['user_allow_pm']),
1245
'topic_sk' => request_var('topic_sk', ($user_row['user_topic_sortby_type']) ? $user_row['user_topic_sortby_type'] : 't'),
1246
'topic_sd' => request_var('topic_sd', ($user_row['user_topic_sortby_dir']) ? $user_row['user_topic_sortby_dir'] : 'd'),
1247
'topic_st' => request_var('topic_st', ($user_row['user_topic_show_days']) ? $user_row['user_topic_show_days'] : 0),
1249
'post_sk' => request_var('post_sk', ($user_row['user_post_sortby_type']) ? $user_row['user_post_sortby_type'] : 't'),
1250
'post_sd' => request_var('post_sd', ($user_row['user_post_sortby_dir']) ? $user_row['user_post_sortby_dir'] : 'a'),
1251
'post_st' => request_var('post_st', ($user_row['user_post_show_days']) ? $user_row['user_post_show_days'] : 0),
1253
'view_images' => request_var('view_images', $this->optionget($user_row, 'viewimg')),
1254
'view_flash' => request_var('view_flash', $this->optionget($user_row, 'viewflash')),
1255
'view_smilies' => request_var('view_smilies', $this->optionget($user_row, 'viewsmilies')),
1256
'view_sigs' => request_var('view_sigs', $this->optionget($user_row, 'viewsigs')),
1257
'view_avatars' => request_var('view_avatars', $this->optionget($user_row, 'viewavatars')),
1258
'view_wordcensor' => request_var('view_wordcensor', $this->optionget($user_row, 'viewcensors')),
1260
'bbcode' => request_var('bbcode', $this->optionget($user_row, 'bbcode')),
1261
'smilies' => request_var('smilies', $this->optionget($user_row, 'smilies')),
1262
'sig' => request_var('sig', $this->optionget($user_row, 'attachsig')),
1263
'notify' => request_var('notify', $user_row['user_notify']),
1268
$error = validate_data($data, array(
1269
'dateformat' => array('string', false, 1, 30),
1270
'lang' => array('match', false, '#^[a-z_\-]{2,}$#i'),
1271
'tz' => array('num', false, -14, 14),
1273
'topic_sk' => array('string', false, 1, 1),
1274
'topic_sd' => array('string', false, 1, 1),
1275
'post_sk' => array('string', false, 1, 1),
1276
'post_sd' => array('string', false, 1, 1),
1279
if (!check_form_key($form_name))
1281
$error[] = 'FORM_INVALID';
1284
if (!sizeof($error))
1286
$this->optionset($user_row, 'popuppm', $data['popuppm']);
1287
$this->optionset($user_row, 'viewimg', $data['view_images']);
1288
$this->optionset($user_row, 'viewflash', $data['view_flash']);
1289
$this->optionset($user_row, 'viewsmilies', $data['view_smilies']);
1290
$this->optionset($user_row, 'viewsigs', $data['view_sigs']);
1291
$this->optionset($user_row, 'viewavatars', $data['view_avatars']);
1292
$this->optionset($user_row, 'viewcensors', $data['view_wordcensor']);
1293
$this->optionset($user_row, 'bbcode', $data['bbcode']);
1294
$this->optionset($user_row, 'smilies', $data['smilies']);
1295
$this->optionset($user_row, 'attachsig', $data['sig']);
1298
'user_options' => $user_row['user_options'],
1300
'user_allow_pm' => $data['allowpm'],
1301
'user_allow_viewemail' => $data['viewemail'],
1302
'user_allow_massemail' => $data['massemail'],
1303
'user_allow_viewonline' => !$data['hideonline'],
1304
'user_notify_type' => $data['notifymethod'],
1305
'user_notify_pm' => $data['notifypm'],
1307
'user_dst' => $data['dst'],
1308
'user_dateformat' => $data['dateformat'],
1309
'user_lang' => $data['lang'],
1310
'user_timezone' => $data['tz'],
1311
'user_style' => $data['style'],
1313
'user_topic_sortby_type' => $data['topic_sk'],
1314
'user_post_sortby_type' => $data['post_sk'],
1315
'user_topic_sortby_dir' => $data['topic_sd'],
1316
'user_post_sortby_dir' => $data['post_sd'],
1318
'user_topic_show_days' => $data['topic_st'],
1319
'user_post_show_days' => $data['post_st'],
1321
'user_notify' => $data['notify'],
1324
$sql = 'UPDATE ' . USERS_TABLE . '
1325
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . "
1326
WHERE user_id = $user_id";
1327
$db->sql_query($sql);
1329
trigger_error($user->lang['USER_PREFS_UPDATED'] . adm_back_link($this->u_action . '&u=' . $user_id));
1332
// Replace "error" strings with their real, localised form
1333
$error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error);
1336
$dateformat_options = '';
1337
foreach ($user->lang['dateformats'] as $format => $null)
1339
$dateformat_options .= '<option value="' . $format . '"' . (($format == $data['dateformat']) ? ' selected="selected"' : '') . '>';
1340
$dateformat_options .= $user->format_date(time(), $format, false) . ((strpos($format, '|') !== false) ? $user->lang['VARIANT_DATE_SEPARATOR'] . $user->format_date(time(), $format, true) : '');
1341
$dateformat_options .= '</option>';
1346
$dateformat_options .= '<option value="custom"';
1347
if (!in_array($data['dateformat'], array_keys($user->lang['dateformats'])))
1349
$dateformat_options .= ' selected="selected"';
1352
$dateformat_options .= '>' . $user->lang['CUSTOM_DATEFORMAT'] . '</option>';
1354
$sort_dir_text = array('a' => $user->lang['ASCENDING'], 'd' => $user->lang['DESCENDING']);
1356
// Topic ordering options
1357
$limit_topic_days = array(0 => $user->lang['ALL_TOPICS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']);
1358
$sort_by_topic_text = array('a' => $user->lang['AUTHOR'], 't' => $user->lang['POST_TIME'], 'r' => $user->lang['REPLIES'], 's' => $user->lang['SUBJECT'], 'v' => $user->lang['VIEWS']);
1360
// Post ordering options
1361
$limit_post_days = array(0 => $user->lang['ALL_POSTS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']);
1362
$sort_by_post_text = array('a' => $user->lang['AUTHOR'], 't' => $user->lang['POST_TIME'], 's' => $user->lang['SUBJECT']);
1364
$_options = array('topic', 'post');
1365
foreach ($_options as $sort_option)
1367
${'s_limit_' . $sort_option . '_days'} = '<select name="' . $sort_option . '_st">';
1368
foreach (${'limit_' . $sort_option . '_days'} as $day => $text)
1370
$selected = ($data[$sort_option . '_st'] == $day) ? ' selected="selected"' : '';
1371
${'s_limit_' . $sort_option . '_days'} .= '<option value="' . $day . '"' . $selected . '>' . $text . '</option>';
1373
${'s_limit_' . $sort_option . '_days'} .= '</select>';
1375
${'s_sort_' . $sort_option . '_key'} = '<select name="' . $sort_option . '_sk">';
1376
foreach (${'sort_by_' . $sort_option . '_text'} as $key => $text)
1378
$selected = ($data[$sort_option . '_sk'] == $key) ? ' selected="selected"' : '';
1379
${'s_sort_' . $sort_option . '_key'} .= '<option value="' . $key . '"' . $selected . '>' . $text . '</option>';
1381
${'s_sort_' . $sort_option . '_key'} .= '</select>';
1383
${'s_sort_' . $sort_option . '_dir'} = '<select name="' . $sort_option . '_sd">';
1384
foreach ($sort_dir_text as $key => $value)
1386
$selected = ($data[$sort_option . '_sd'] == $key) ? ' selected="selected"' : '';
1387
${'s_sort_' . $sort_option . '_dir'} .= '<option value="' . $key . '"' . $selected . '>' . $value . '</option>';
1389
${'s_sort_' . $sort_option . '_dir'} .= '</select>';
1392
$template->assign_vars(array(
1394
'S_JABBER_DISABLED' => ($config['jab_enable'] && $user_row['user_jabber'] && @extension_loaded('xml')) ? false : true,
1396
'VIEW_EMAIL' => $data['viewemail'],
1397
'MASS_EMAIL' => $data['massemail'],
1398
'ALLOW_PM' => $data['allowpm'],
1399
'HIDE_ONLINE' => $data['hideonline'],
1400
'NOTIFY_EMAIL' => ($data['notifymethod'] == NOTIFY_EMAIL) ? true : false,
1401
'NOTIFY_IM' => ($data['notifymethod'] == NOTIFY_IM) ? true : false,
1402
'NOTIFY_BOTH' => ($data['notifymethod'] == NOTIFY_BOTH) ? true : false,
1403
'NOTIFY_PM' => $data['notifypm'],
1404
'POPUP_PM' => $data['popuppm'],
1405
'DST' => $data['dst'],
1406
'BBCODE' => $data['bbcode'],
1407
'SMILIES' => $data['smilies'],
1408
'ATTACH_SIG' => $data['sig'],
1409
'NOTIFY' => $data['notify'],
1410
'VIEW_IMAGES' => $data['view_images'],
1411
'VIEW_FLASH' => $data['view_flash'],
1412
'VIEW_SMILIES' => $data['view_smilies'],
1413
'VIEW_SIGS' => $data['view_sigs'],
1414
'VIEW_AVATARS' => $data['view_avatars'],
1415
'VIEW_WORDCENSOR' => $data['view_wordcensor'],
1417
'S_TOPIC_SORT_DAYS' => $s_limit_topic_days,
1418
'S_TOPIC_SORT_KEY' => $s_sort_topic_key,
1419
'S_TOPIC_SORT_DIR' => $s_sort_topic_dir,
1420
'S_POST_SORT_DAYS' => $s_limit_post_days,
1421
'S_POST_SORT_KEY' => $s_sort_post_key,
1422
'S_POST_SORT_DIR' => $s_sort_post_dir,
1424
'DATE_FORMAT' => $data['dateformat'],
1425
'S_DATEFORMAT_OPTIONS' => $dateformat_options,
1426
'S_CUSTOM_DATEFORMAT' => $s_custom,
1427
'DEFAULT_DATEFORMAT' => $config['default_dateformat'],
1428
'A_DEFAULT_DATEFORMAT' => addslashes($config['default_dateformat']),
1430
'S_LANG_OPTIONS' => language_select($data['lang']),
1431
'S_STYLE_OPTIONS' => style_select($data['style']),
1432
'S_TZ_OPTIONS' => tz_select($data['tz'], true),
1440
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
1441
include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
1443
$can_upload = (file_exists($phpbb_root_path . $config['avatar_path']) && @is_writable($phpbb_root_path . $config['avatar_path']) && $file_uploads) ? true : false;
1448
if (!check_form_key($form_name))
1450
trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING);
1453
if (avatar_process_user($error, $user_row))
1455
trigger_error($user->lang['USER_AVATAR_UPDATED'] . adm_back_link($this->u_action . '&u=' . $user_row['user_id']));
1458
// Replace "error" strings with their real, localised form
1459
$error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error);
1462
// Generate users avatar
1463
$avatar_img = ($user_row['user_avatar']) ? get_user_avatar($user_row['user_avatar'], $user_row['user_avatar_type'], $user_row['user_avatar_width'], $user_row['user_avatar_height']) : '<img src="' . $phpbb_admin_path . 'images/no_avatar.gif" alt="" />';
1465
$display_gallery = (isset($_POST['display_gallery'])) ? true : false;
1466
$avatar_select = basename(request_var('avatar_select', ''));
1467
$category = basename(request_var('category', ''));
1469
if ($config['allow_avatar_local'] && $display_gallery)
1471
avatar_gallery($category, $avatar_select, 4);
1474
$template->assign_vars(array(
1476
'S_CAN_UPLOAD' => ($can_upload && $config['allow_avatar_upload']) ? true : false,
1477
'S_ALLOW_REMOTE' => ($config['allow_avatar_remote']) ? true : false,
1478
'S_DISPLAY_GALLERY' => ($config['allow_avatar_local'] && !$display_gallery) ? true : false,
1479
'S_IN_GALLERY' => ($config['allow_avatar_local'] && $display_gallery) ? true : false,
1481
'AVATAR_IMAGE' => $avatar_img,
1482
'AVATAR_MAX_FILESIZE' => $config['avatar_filesize'],
1483
'USER_AVATAR_WIDTH' => $user_row['user_avatar_width'],
1484
'USER_AVATAR_HEIGHT' => $user_row['user_avatar_height'],
1486
'L_AVATAR_EXPLAIN' => sprintf($user->lang['AVATAR_EXPLAIN'], $config['avatar_max_width'], $config['avatar_max_height'], round($config['avatar_filesize'] / 1024)))
1495
if (!check_form_key($form_name))
1497
trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING);
1500
$rank_id = request_var('user_rank', 0);
1502
$sql = 'UPDATE ' . USERS_TABLE . "
1503
SET user_rank = $rank_id
1504
WHERE user_id = $user_id";
1505
$db->sql_query($sql);
1507
trigger_error($user->lang['USER_RANK_UPDATED'] . adm_back_link($this->u_action . '&u=' . $user_id));
1511
FROM ' . RANKS_TABLE . '
1512
WHERE rank_special = 1
1513
ORDER BY rank_title';
1514
$result = $db->sql_query($sql);
1516
$s_rank_options = '<option value="0"' . ((!$user_row['user_rank']) ? ' selected="selected"' : '') . '>' . $user->lang['NO_SPECIAL_RANK'] . '</option>';
1518
while ($row = $db->sql_fetchrow($result))
1520
$selected = ($user_row['user_rank'] && $row['rank_id'] == $user_row['user_rank']) ? ' selected="selected"' : '';
1521
$s_rank_options .= '<option value="' . $row['rank_id'] . '"' . $selected . '>' . $row['rank_title'] . '</option>';
1523
$db->sql_freeresult($result);
1525
$template->assign_vars(array(
1527
'S_RANK_OPTIONS' => $s_rank_options)
1534
include_once($phpbb_root_path . 'includes/functions_posting.' . $phpEx);
1535
include_once($phpbb_root_path . 'includes/functions_display.' . $phpEx);
1537
$enable_bbcode = ($config['allow_sig_bbcode']) ? ((request_var('disable_bbcode', !$user->optionget('bbcode'))) ? false : true) : false;
1538
$enable_smilies = ($config['allow_sig_smilies']) ? ((request_var('disable_smilies', !$user->optionget('smilies'))) ? false : true) : false;
1539
$enable_urls = ($config['allow_sig_links']) ? ((request_var('disable_magic_url', false)) ? false : true) : false;
1540
$signature = utf8_normalize_nfc(request_var('signature', (string) $user_row['user_sig'], true));
1542
$preview = (isset($_POST['preview'])) ? true : false;
1544
if ($submit || $preview)
1546
include_once($phpbb_root_path . 'includes/message_parser.' . $phpEx);
1548
$message_parser = new parse_message($signature);
1550
// Allowing Quote BBCode
1551
$message_parser->parse($enable_bbcode, $enable_urls, $enable_smilies, $config['allow_sig_img'], $config['allow_sig_flash'], true, $config['allow_sig_links'], true, 'sig');
1553
if (sizeof($message_parser->warn_msg))
1555
$error[] = implode('<br />', $message_parser->warn_msg);
1558
if (!check_form_key($form_name))
1560
$error = 'FORM_INVALID';
1563
if (!sizeof($error) && $submit)
1566
'user_sig' => (string) $message_parser->message,
1567
'user_sig_bbcode_uid' => (string) $message_parser->bbcode_uid,
1568
'user_sig_bbcode_bitfield' => (string) $message_parser->bbcode_bitfield
1571
$sql = 'UPDATE ' . USERS_TABLE . '
1572
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
1573
WHERE user_id = ' . $user_id;
1574
$db->sql_query($sql);
1576
trigger_error($user->lang['USER_SIG_UPDATED'] . adm_back_link($this->u_action . '&u=' . $user_id));
1579
// Replace "error" strings with their real, localised form
1580
$error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error);
1583
$signature_preview = '';
1587
// Now parse it for displaying
1588
$signature_preview = $message_parser->format_display($enable_bbcode, $enable_urls, $enable_smilies, false);
1589
unset($message_parser);
1592
decode_message($signature, $user_row['user_sig_bbcode_uid']);
1594
$template->assign_vars(array(
1595
'S_SIGNATURE' => true,
1597
'SIGNATURE' => $signature,
1598
'SIGNATURE_PREVIEW' => $signature_preview,
1600
'S_BBCODE_CHECKED' => (!$enable_bbcode) ? ' checked="checked"' : '',
1601
'S_SMILIES_CHECKED' => (!$enable_smilies) ? ' checked="checked"' : '',
1602
'S_MAGIC_URL_CHECKED' => (!$enable_urls) ? ' checked="checked"' : '',
1604
'BBCODE_STATUS' => ($config['allow_sig_bbcode']) ? sprintf($user->lang['BBCODE_IS_ON'], '<a href="' . append_sid("{$phpbb_root_path}faq.$phpEx", 'mode=bbcode') . '">', '</a>') : sprintf($user->lang['BBCODE_IS_OFF'], '<a href="' . append_sid("{$phpbb_root_path}faq.$phpEx", 'mode=bbcode') . '">', '</a>'),
1605
'SMILIES_STATUS' => ($config['allow_sig_smilies']) ? $user->lang['SMILIES_ARE_ON'] : $user->lang['SMILIES_ARE_OFF'],
1606
'IMG_STATUS' => ($config['allow_sig_img']) ? $user->lang['IMAGES_ARE_ON'] : $user->lang['IMAGES_ARE_OFF'],
1607
'FLASH_STATUS' => ($config['allow_sig_flash']) ? $user->lang['FLASH_IS_ON'] : $user->lang['FLASH_IS_OFF'],
1608
'URL_STATUS' => ($config['allow_sig_links']) ? $user->lang['URL_IS_ON'] : $user->lang['URL_IS_OFF'],
1610
'L_SIGNATURE_EXPLAIN' => sprintf($user->lang['SIGNATURE_EXPLAIN'], $config['max_sig_chars']),
1612
'S_BBCODE_ALLOWED' => $config['allow_sig_bbcode'],
1613
'S_SMILIES_ALLOWED' => $config['allow_sig_smilies'],
1614
'S_BBCODE_IMG' => ($config['allow_sig_img']) ? true : false,
1615
'S_BBCODE_FLASH' => ($config['allow_sig_flash']) ? true : false,
1616
'S_LINKS_ALLOWED' => ($config['allow_sig_links']) ? true : false)
1619
// Assigning custom bbcodes
1620
display_custom_bbcodes();
1626
$start = request_var('start', 0);
1627
$deletemark = (isset($_POST['delmarked'])) ? true : false;
1628
$marked = request_var('mark', array(0));
1631
$sort_key = request_var('sk', 'a');
1632
$sort_dir = request_var('sd', 'd');
1634
if ($deletemark && sizeof($marked))
1636
$sql = 'SELECT attach_id
1637
FROM ' . ATTACHMENTS_TABLE . '
1638
WHERE poster_id = ' . $user_id . '
1640
AND ' . $db->sql_in_set('attach_id', $marked);
1641
$result = $db->sql_query($sql);
1644
while ($row = $db->sql_fetchrow($result))
1646
$marked[] = $row['attach_id'];
1648
$db->sql_freeresult($result);
1651
if ($deletemark && sizeof($marked))
1653
if (confirm_box(true))
1655
$sql = 'SELECT real_filename
1656
FROM ' . ATTACHMENTS_TABLE . '
1657
WHERE ' . $db->sql_in_set('attach_id', $marked);
1658
$result = $db->sql_query($sql);
1660
$log_attachments = array();
1661
while ($row = $db->sql_fetchrow($result))
1663
$log_attachments[] = $row['real_filename'];
1665
$db->sql_freeresult($result);
1667
delete_attachments('attach', $marked);
1669
$message = (sizeof($log_attachments) == 1) ? $user->lang['ATTACHMENT_DELETED'] : $user->lang['ATTACHMENTS_DELETED'];
1671
add_log('admin', 'LOG_ATTACHMENTS_DELETED', implode(', ', $log_attachments));
1672
trigger_error($message . adm_back_link($this->u_action . '&u=' . $user_id));
1676
confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array(
1680
'action' => $action,
1681
'delmarked' => true,
1687
$sk_text = array('a' => $user->lang['SORT_FILENAME'], 'c' => $user->lang['SORT_EXTENSION'], 'd' => $user->lang['SORT_SIZE'], 'e' => $user->lang['SORT_DOWNLOADS'], 'f' => $user->lang['SORT_POST_TIME'], 'g' => $user->lang['SORT_TOPIC_TITLE']);
1688
$sk_sql = array('a' => 'a.real_filename', 'c' => 'a.extension', 'd' => 'a.filesize', 'e' => 'a.download_count', 'f' => 'a.filetime', 'g' => 't.topic_title');
1690
$sd_text = array('a' => $user->lang['ASCENDING'], 'd' => $user->lang['DESCENDING']);
1693
foreach ($sk_text as $key => $value)
1695
$selected = ($sort_key == $key) ? ' selected="selected"' : '';
1696
$s_sort_key .= '<option value="' . $key . '"' . $selected . '>' . $value . '</option>';
1700
foreach ($sd_text as $key => $value)
1702
$selected = ($sort_dir == $key) ? ' selected="selected"' : '';
1703
$s_sort_dir .= '<option value="' . $key . '"' . $selected . '>' . $value . '</option>';
1706
if (!isset($sk_sql[$sort_key]))
1711
$order_by = $sk_sql[$sort_key] . ' ' . (($sort_dir == 'a') ? 'ASC' : 'DESC');
1713
$sql = 'SELECT COUNT(attach_id) as num_attachments
1714
FROM ' . ATTACHMENTS_TABLE . "
1715
WHERE poster_id = $user_id
1717
$result = $db->sql_query_limit($sql, 1);
1718
$num_attachments = (int) $db->sql_fetchfield('num_attachments');
1719
$db->sql_freeresult($result);
1721
$sql = 'SELECT a.*, t.topic_title, p.message_subject as message_title
1722
FROM ' . ATTACHMENTS_TABLE . ' a
1723
LEFT JOIN ' . TOPICS_TABLE . ' t ON (a.topic_id = t.topic_id
1724
AND a.in_message = 0)
1725
LEFT JOIN ' . PRIVMSGS_TABLE . ' p ON (a.post_msg_id = p.msg_id
1726
AND a.in_message = 1)
1727
WHERE a.poster_id = ' . $user_id . "
1729
ORDER BY $order_by";
1730
$result = $db->sql_query_limit($sql, $config['posts_per_page'], $start);
1732
while ($row = $db->sql_fetchrow($result))
1734
if ($row['in_message'])
1736
$view_topic = append_sid("{$phpbb_root_path}ucp.$phpEx", "i=pm&p={$row['post_msg_id']}");
1740
$view_topic = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "t={$row['topic_id']}&p={$row['post_msg_id']}") . '#p' . $row['post_msg_id'];
1743
$template->assign_block_vars('attach', array(
1744
'REAL_FILENAME' => $row['real_filename'],
1745
'COMMENT' => nl2br($row['attach_comment']),
1746
'EXTENSION' => $row['extension'],
1747
'SIZE' => ($row['filesize'] >= 1048576) ? ($row['filesize'] >> 20) . ' ' . $user->lang['MB'] : (($row['filesize'] >= 1024) ? ($row['filesize'] >> 10) . ' ' . $user->lang['KB'] : $row['filesize'] . ' ' . $user->lang['BYTES']),
1748
'DOWNLOAD_COUNT' => $row['download_count'],
1749
'POST_TIME' => $user->format_date($row['filetime']),
1750
'TOPIC_TITLE' => ($row['in_message']) ? $row['message_title'] : $row['topic_title'],
1752
'ATTACH_ID' => $row['attach_id'],
1753
'POST_ID' => $row['post_msg_id'],
1754
'TOPIC_ID' => $row['topic_id'],
1756
'S_IN_MESSAGE' => $row['in_message'],
1758
'U_DOWNLOAD' => append_sid("{$phpbb_root_path}download/file.$phpEx", 'mode=view&id=' . $row['attach_id']),
1759
'U_VIEW_TOPIC' => $view_topic)
1762
$db->sql_freeresult($result);
1764
$template->assign_vars(array(
1765
'S_ATTACHMENTS' => true,
1766
'S_ON_PAGE' => on_page($num_attachments, $config['topics_per_page'], $start),
1767
'S_SORT_KEY' => $s_sort_key,
1768
'S_SORT_DIR' => $s_sort_dir,
1770
'PAGINATION' => generate_pagination($this->u_action . "&u=$user_id&sk=$sort_key&sd=$sort_dir", $num_attachments, $config['topics_per_page'], $start, true))
1777
include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
1779
$user->add_lang(array('groups', 'acp/groups'));
1780
$group_id = request_var('g', 0);
1784
// Check the founder only entry for this group to make sure everything is well
1785
$sql = 'SELECT group_founder_manage
1786
FROM ' . GROUPS_TABLE . '
1787
WHERE group_id = ' . $group_id;
1788
$result = $db->sql_query($sql);
1789
$founder_manage = (int) $db->sql_fetchfield('group_founder_manage');
1790
$db->sql_freeresult($result);
1792
if ($user->data['user_type'] != USER_FOUNDER && $founder_manage)
1794
trigger_error($user->lang['NOT_ALLOWED_MANAGE_GROUP'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING);
1799
$founder_manage = 0;
1809
trigger_error($user->lang['NO_GROUP'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING);
1811
group_user_attributes($action, $group_id, $user_id);
1813
if ($action == 'default')
1815
$user_row['group_id'] = $group_id;
1821
if (confirm_box(true))
1825
trigger_error($user->lang['NO_GROUP'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING);
1828
if ($error = group_user_del($group_id, $user_id))
1830
trigger_error($user->lang[$error] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING);
1837
confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array(
1841
'action' => $action,
1849
// Add user to group?
1853
if (!check_form_key($form_name))
1855
trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING);
1860
trigger_error($user->lang['NO_GROUP'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING);
1863
// Add user/s to group
1864
if ($error = group_user_add($group_id, $user_id))
1866
trigger_error($user->lang[$error] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING);
1873
$sql = 'SELECT ug.*, g.*
1874
FROM ' . GROUPS_TABLE . ' g, ' . USER_GROUP_TABLE . " ug
1875
WHERE ug.user_id = $user_id
1876
AND g.group_id = ug.group_id
1877
ORDER BY g.group_type DESC, ug.user_pending ASC, g.group_name";
1878
$result = $db->sql_query($sql);
1881
$group_data = $id_ary = array();
1882
while ($row = $db->sql_fetchrow($result))
1884
$type = ($row['group_type'] == GROUP_SPECIAL) ? 'special' : (($row['user_pending']) ? 'pending' : 'normal');
1886
$group_data[$type][$i]['group_id'] = $row['group_id'];
1887
$group_data[$type][$i]['group_name'] = $row['group_name'];
1888
$group_data[$type][$i]['group_leader'] = ($row['group_leader']) ? 1 : 0;
1890
$id_ary[] = $row['group_id'];
1894
$db->sql_freeresult($result);
1896
// Select box for other groups
1897
$sql = 'SELECT group_id, group_name, group_type, group_founder_manage
1898
FROM ' . GROUPS_TABLE . '
1899
' . ((sizeof($id_ary)) ? 'WHERE ' . $db->sql_in_set('group_id', $id_ary, true) : '') . '
1900
ORDER BY group_type DESC, group_name ASC';
1901
$result = $db->sql_query($sql);
1903
$s_group_options = '';
1904
while ($row = $db->sql_fetchrow($result))
1906
if (!$config['coppa_enable'] && $row['group_name'] == 'REGISTERED_COPPA')
1911
// Do not display those groups not allowed to be managed
1912
if ($user->data['user_type'] != USER_FOUNDER && $row['group_founder_manage'])
1917
$s_group_options .= '<option' . (($row['group_type'] == GROUP_SPECIAL) ? ' class="sep"' : '') . ' value="' . $row['group_id'] . '">' . (($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name']) . '</option>';
1919
$db->sql_freeresult($result);
1922
foreach ($group_data as $group_type => $data_ary)
1924
if ($current_type != $group_type)
1926
$template->assign_block_vars('group', array(
1927
'S_NEW_GROUP_TYPE' => true,
1928
'GROUP_TYPE' => $user->lang['USER_GROUP_' . strtoupper($group_type)])
1932
foreach ($data_ary as $data)
1934
$template->assign_block_vars('group', array(
1935
'U_EDIT_GROUP' => append_sid("{$phpbb_admin_path}index.$phpEx", "i=groups&mode=manage&action=edit&u=$user_id&g={$data['group_id']}&back_link=acp_users_groups"),
1936
'U_DEFAULT' => $this->u_action . "&action=default&u=$user_id&g=" . $data['group_id'],
1937
'U_DEMOTE_PROMOTE' => $this->u_action . '&action=' . (($data['group_leader']) ? 'demote' : 'promote') . "&u=$user_id&g=" . $data['group_id'],
1938
'U_DELETE' => $this->u_action . "&action=delete&u=$user_id&g=" . $data['group_id'],
1940
'GROUP_NAME' => ($group_type == 'special') ? $user->lang['G_' . $data['group_name']] : $data['group_name'],
1941
'L_DEMOTE_PROMOTE' => ($data['group_leader']) ? $user->lang['GROUP_DEMOTE'] : $user->lang['GROUP_PROMOTE'],
1943
'S_NO_DEFAULT' => ($user_row['group_id'] != $data['group_id']) ? true : false,
1944
'S_SPECIAL_GROUP' => ($group_type == 'special') ? true : false,
1950
$template->assign_vars(array(
1952
'S_GROUP_OPTIONS' => $s_group_options)
1959
include_once($phpbb_root_path . 'includes/acp/auth.' . $phpEx);
1961
$auth_admin = new auth_admin();
1963
$user->add_lang('acp/permissions');
1964
add_permission_language();
1966
$forum_id = request_var('f', 0);
1968
// Global Permissions
1971
// Select auth options
1972
$sql = 'SELECT auth_option, is_local, is_global
1973
FROM ' . ACL_OPTIONS_TABLE . '
1974
WHERE auth_option ' . $db->sql_like_expression($db->any_char . '_') . '
1976
ORDER BY auth_option';
1977
$result = $db->sql_query($sql);
1979
$hold_ary = array();
1981
while ($row = $db->sql_fetchrow($result))
1983
$hold_ary = $auth_admin->get_mask('view', $user_id, false, false, $row['auth_option'], 'global', ACL_NEVER);
1984
$auth_admin->display_mask('view', $row['auth_option'], $hold_ary, 'user', false, false);
1986
$db->sql_freeresult($result);
1992
$sql = 'SELECT auth_option, is_local, is_global
1993
FROM ' . ACL_OPTIONS_TABLE . "
1994
WHERE auth_option " . $db->sql_like_expression($db->any_char . '_') . "
1996
ORDER BY is_global DESC, auth_option";
1997
$result = $db->sql_query($sql);
1999
while ($row = $db->sql_fetchrow($result))
2001
$hold_ary = $auth_admin->get_mask('view', $user_id, false, $forum_id, $row['auth_option'], 'local', ACL_NEVER);
2002
$auth_admin->display_mask('view', $row['auth_option'], $hold_ary, 'user', true, false);
2004
$db->sql_freeresult($result);
2007
$s_forum_options = '<option value="0"' . ((!$forum_id) ? ' selected="selected"' : '') . '>' . $user->lang['VIEW_GLOBAL_PERMS'] . '</option>';
2008
$s_forum_options .= make_forum_select($forum_id, false, true, false, false, false);
2010
$template->assign_vars(array(
2011
'S_PERMISSIONS' => true,
2013
'S_GLOBAL' => (!$forum_id) ? true : false,
2014
'S_FORUM_OPTIONS' => $s_forum_options,
2016
'U_ACTION' => $this->u_action . '&u=' . $user_id,
2017
'U_USER_PERMISSIONS' => append_sid("{$phpbb_admin_path}index.$phpEx" ,'i=permissions&mode=setting_user_global&user_id[]=' . $user_id),
2018
'U_USER_FORUM_PERMISSIONS' => append_sid("{$phpbb_admin_path}index.$phpEx", 'i=permissions&mode=setting_user_local&user_id[]=' . $user_id))
2025
// Assign general variables
2026
$template->assign_vars(array(
2027
'S_ERROR' => (sizeof($error)) ? true : false,
2028
'ERROR_MSG' => (sizeof($error)) ? implode('<br />', $error) : '')
2033
* Optionset replacement for this module based on $user->optionset
2035
function optionset(&$user_row, $key, $value, $data = false)
2039
$var = ($data) ? $data : $user_row['user_options'];
2041
if ($value && !($var & 1 << $user->keyoptions[$key]))
2043
$var += 1 << $user->keyoptions[$key];
2045
else if (!$value && ($var & 1 << $user->keyoptions[$key]))
2047
$var -= 1 << $user->keyoptions[$key];
2051
return ($data) ? $var : false;
2056
$user_row['user_options'] = $var;
2066
* Optionget replacement for this module based on $user->optionget
2068
function optionget(&$user_row, $key, $data = false)
2072
$var = ($data) ? $data : $user_row['user_options'];
2073
return ($var & 1 << $user->keyoptions[$key]) ? true : false;
b'\\ No newline at end of file'