From 85055ac97fa57ca339924cef719115d85bdf6c2e Mon Sep 17 00:00:00 2001 From: David M Date: Thu, 3 Jan 2008 17:00:40 +0000 Subject: oh boy... - Migrate code base to PHP 5.1+ git-svn-id: file:///svn/phpbb/trunk@8295 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/acp/acp_users.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 310759d38c..252fb743cd 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -24,7 +24,7 @@ class acp_users var $u_action; var $p_master; - function acp_users(&$p_master) + function __construct(&$p_master) { $this->p_master = &$p_master; } -- cgit v1.2.1 From 57645ad5bc2469e166cb3e5d54628d87ffa74c42 Mon Sep 17 00:00:00 2001 From: David M Date: Sun, 6 Jan 2008 02:21:44 +0000 Subject: the end of an era... - MySQL < 4.1.3 support is removed - renamed mysql4 to mysql, no need to cause confusion - changed the cfg cacher, reduces file system lookups and include count by two on every page load git-svn-id: file:///svn/phpbb/trunk@8307 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/acp/acp_users.php | 1 - 1 file changed, 1 deletion(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 252fb743cd..f87e175301 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1141,7 +1141,6 @@ class acp_users break; case 'mysql': - case 'mysql4': case 'mysqli': $right_delim = $left_delim = '`'; break; -- cgit v1.2.1 From 2f08a3606203c1a2c7aad96e2eb65f6fa882d9a8 Mon Sep 17 00:00:00 2001 From: David M Date: Sun, 6 Jan 2008 13:46:20 +0000 Subject: - add DB2 support /me takes a nap git-svn-id: file:///svn/phpbb/trunk@8308 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/acp/acp_users.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index f87e175301..13612cf363 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -775,7 +775,7 @@ class acp_users { $sql_ary += array( 'user_email' => $update_email, - 'user_email_hash' => crc32($update_email) . strlen($update_email) + 'user_email_hash' => hexdec(crc32($update_email) . strlen($update_email)) ); add_log('user', $user_id, 'LOG_USER_UPDATE_EMAIL', $user_row['username'], $user_row['user_email'], $update_email); @@ -1130,6 +1130,7 @@ class acp_users case 'oracle': case 'firebird': case 'postgres': + case 'db2': $right_delim = $left_delim = '"'; break; -- cgit v1.2.1 From 5dddcb42aee429bcd77f18ec1ae94677a01b1c3a Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Sun, 6 Jan 2008 17:00:09 +0000 Subject: - Do not split topic list for topics being promoted to announcements after been moved to another forum (Bug #18635) - Allow editing usernames within database_update on username cleanup (Bug #18415) - Fixing wrong sync() calls if moving all posts by a member in ACP (Bug #18385) - Check entered imagemagick path for trailing slash (Bug #18205) - Use proper title on index for new/unread posts (Bug #13101) - patch provided by Pyramide - Allow calls to $user->set_cookie() define no cookie time for setting session cookies (Bug #18025) git-svn-id: file:///svn/phpbb/trunk@8310 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/acp/acp_users.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 13612cf363..8279bf92b4 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -630,7 +630,7 @@ class acp_users } $forum_id_ary = array_unique($forum_id_ary); - $topic_id_ary = array_unique(array_merge($topic_id_ary, $new_topic_id_ary)); + $topic_id_ary = array_unique(array_merge(array_keys($topic_id_ary), $new_topic_id_ary)); if (sizeof($topic_id_ary)) { -- cgit v1.2.1 From 2928574ed46334bb8dbbb6612a62db3c3654ba12 Mon Sep 17 00:00:00 2001 From: David M Date: Mon, 7 Jan 2008 15:19:38 +0000 Subject: - a few tiny clean ups - a new MS SQL DBAL, it does not work so hot because of issues with the extension it depends on git-svn-id: file:///svn/phpbb/trunk@8313 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/acp/acp_users.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 8279bf92b4..cb33450759 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1125,7 +1125,7 @@ class acp_users // Update Custom Fields if (sizeof($cp_data)) { - switch ($db->sql_layer) + switch ($db->dbms_type) { case 'oracle': case 'firebird': @@ -1136,13 +1136,11 @@ class acp_users case 'sqlite': case 'mssql': - case 'mssql_odbc': $right_delim = ']'; $left_delim = '['; break; case 'mysql': - case 'mysqli': $right_delim = $left_delim = '`'; break; } -- cgit v1.2.1 From 4b5fab372ff69a809144dee3a0a7f90c219fe400 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Wed, 30 Jan 2008 16:14:39 +0000 Subject: merge with revision #r8350 git-svn-id: file:///svn/phpbb/trunk@8351 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/acp/acp_users.php | 56 ++++++++++++++++++++-------------------- 1 file changed, 28 insertions(+), 28 deletions(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index cb33450759..61fd5ea752 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -411,7 +411,7 @@ class acp_users $sql = 'UPDATE ' . USERS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . " WHERE user_id = $user_id"; $db->sql_query($sql); - + add_log('admin', 'LOG_USER_DEL_SIG', $user_row['username']); add_log('user', $user_id, 'LOG_USER_DEL_SIG_USER'); @@ -492,9 +492,9 @@ class acp_users 'update' => true)) ); } - + break; - + case 'moveposts': if (!check_form_key($form_name)) @@ -835,9 +835,9 @@ class acp_users { $quick_tool_ary += array('active' => (($user_row['user_type'] == USER_INACTIVE) ? 'ACTIVATE' : 'DEACTIVATE')); } - + $quick_tool_ary += array('delsig' => 'DEL_SIG', 'delavatar' => 'DEL_AVATAR', 'moveposts' => 'MOVE_POSTS', 'delposts' => 'DEL_POSTS', 'delattach' => 'DEL_ATTACH'); - + if ($config['email_enable'] && ($user_row['user_type'] == USER_NORMAL || $user_row['user_type'] == USER_INACTIVE)) { $quick_tool_ary['reactivate'] = 'FORCE'; @@ -923,7 +923,7 @@ class acp_users case 'feedback': $user->add_lang('mcp'); - + // Set up general vars $start = request_var('start', 0); $deletemark = (isset($_POST['delmarked'])) ? true : false; @@ -980,7 +980,7 @@ class acp_users trigger_error($user->lang['USER_FEEDBACK_ADDED'] . adm_back_link($this->u_action . '&u=' . $user_id)); } - + // Sorting $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']); $sort_by_text = array('u' => $user->lang['SORT_USERNAME'], 't' => $user->lang['SORT_DATE'], 'i' => $user->lang['SORT_IP'], 'o' => $user->lang['SORT_ACTION']); @@ -1214,7 +1214,7 @@ class acp_users 'S_BIRTHDAY_DAY_OPTIONS' => $s_birthday_day_options, 'S_BIRTHDAY_MONTH_OPTIONS' => $s_birthday_month_options, 'S_BIRTHDAY_YEAR_OPTIONS' => $s_birthday_year_options, - + 'S_PROFILE' => true) ); @@ -1345,7 +1345,7 @@ class acp_users $s_custom = false; $dateformat_options .= ''; - } - $db->sql_freeresult($result); - - $current_type = ''; - foreach ($group_data as $group_type => $data_ary) - { - if ($current_type != $group_type) - { - $template->assign_block_vars('group', array( - 'S_NEW_GROUP_TYPE' => true, - 'GROUP_TYPE' => $user->lang['USER_GROUP_' . strtoupper($group_type)]) - ); - } - - foreach ($data_ary as $data) - { - $template->assign_block_vars('group', array( - 'U_EDIT_GROUP' => append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, "i=groups&mode=manage&action=edit&u=$user_id&g={$data['group_id']}&back_link=acp_users_groups"), - 'U_DEFAULT' => $this->u_action . "&action=default&u=$user_id&g=" . $data['group_id'], - 'U_DEMOTE_PROMOTE' => $this->u_action . '&action=' . (($data['group_leader']) ? 'demote' : 'promote') . "&u=$user_id&g=" . $data['group_id'], - 'U_DELETE' => $this->u_action . "&action=delete&u=$user_id&g=" . $data['group_id'], - - 'GROUP_NAME' => ($group_type == 'special') ? $user->lang['G_' . $data['group_name']] : $data['group_name'], - 'L_DEMOTE_PROMOTE' => ($data['group_leader']) ? $user->lang['GROUP_DEMOTE'] : $user->lang['GROUP_PROMOTE'], - - 'S_NO_DEFAULT' => ($user_row['group_id'] != $data['group_id']) ? true : false, - 'S_SPECIAL_GROUP' => ($group_type == 'special') ? true : false, - ) - ); - } - } - - $template->assign_vars(array( - 'S_GROUPS' => true, - 'S_GROUP_OPTIONS' => $s_group_options) - ); - - break; - - case 'perm': - - include_once(PHPBB_ROOT_PATH . 'includes/acp/auth.' . PHP_EXT); - - $auth_admin = new auth_admin(); - - $user->add_lang('acp/permissions'); - add_permission_language(); - - $forum_id = request_var('f', 0); - - // Global Permissions - if (!$forum_id) - { - // Select auth options - $sql = 'SELECT auth_option, is_local, is_global - FROM ' . ACL_OPTIONS_TABLE . ' - WHERE auth_option ' . $db->sql_like_expression($db->any_char . '_') . ' - AND is_global = 1 - ORDER BY auth_option'; - $result = $db->sql_query($sql); - - $hold_ary = array(); - - while ($row = $db->sql_fetchrow($result)) - { - $hold_ary = $auth_admin->get_mask('view', $user_id, false, false, $row['auth_option'], 'global', ACL_NEVER); - $auth_admin->display_mask('view', $row['auth_option'], $hold_ary, 'user', false, false); - } - $db->sql_freeresult($result); - - unset($hold_ary); - } - else - { - $sql = 'SELECT auth_option, is_local, is_global - FROM ' . ACL_OPTIONS_TABLE . " - WHERE auth_option " . $db->sql_like_expression($db->any_char . '_') . " - AND is_local = 1 - ORDER BY is_global DESC, auth_option"; - $result = $db->sql_query($sql); - - while ($row = $db->sql_fetchrow($result)) - { - $hold_ary = $auth_admin->get_mask('view', $user_id, false, $forum_id, $row['auth_option'], 'local', ACL_NEVER); - $auth_admin->display_mask('view', $row['auth_option'], $hold_ary, 'user', true, false); - } - $db->sql_freeresult($result); - } - - $s_forum_options = ''; - $s_forum_options .= make_forum_select($forum_id, false, true, false, false, false); - - $template->assign_vars(array( - 'S_PERMISSIONS' => true, - - 'S_GLOBAL' => (!$forum_id) ? true : false, - 'S_FORUM_OPTIONS' => $s_forum_options, - - 'U_ACTION' => $this->u_action . '&u=' . $user_id, - 'U_USER_PERMISSIONS' => append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, 'i=permissions&mode=setting_user_global&user_id[]=' . $user_id), - 'U_USER_FORUM_PERMISSIONS' => append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, 'i=permissions&mode=setting_user_local&user_id[]=' . $user_id)) - ); - - break; - - } - - // Assign general variables - $template->assign_vars(array( - 'S_ERROR' => (sizeof($error)) ? true : false, - 'ERROR_MSG' => (sizeof($error)) ? implode('
', $error) : '') - ); - } - - /** - * Optionset replacement for this module based on $user->optionset - */ - function optionset(&$user_row, $key, $value, $data = false) - { - global $user; - - $var = ($data) ? $data : $user_row['user_options']; - - if ($value && !($var & 1 << $user->keyoptions[$key])) - { - $var += 1 << $user->keyoptions[$key]; - } - else if (!$value && ($var & 1 << $user->keyoptions[$key])) - { - $var -= 1 << $user->keyoptions[$key]; - } - else - { - return ($data) ? $var : false; - } - - if (!$data) - { - $user_row['user_options'] = $var; - return true; - } - else - { - return $var; - } - } - - /** - * Optionget replacement for this module based on $user->optionget - */ - function optionget(&$user_row, $key, $data = false) - { - global $user; - - $var = ($data) ? $data : $user_row['user_options']; - return ($var & 1 << $user->keyoptions[$key]) ? true : false; - } -} - -?> \ No newline at end of file -- cgit v1.2.1 From 2e17e448deed073f8614bb555a8ef20c57291c2a Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Sun, 4 Oct 2009 18:14:59 +0000 Subject: Copy 3.0.x branch to trunk git-svn-id: file:///svn/phpbb/trunk@10211 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/acp/acp_users.php | 2358 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 2358 insertions(+) create mode 100644 phpBB/includes/acp/acp_users.php (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php new file mode 100644 index 0000000000..afca056eb2 --- /dev/null +++ b/phpBB/includes/acp/acp_users.php @@ -0,0 +1,2358 @@ +p_master = &$p_master; + } + + function main($id, $mode) + { + global $config, $db, $user, $auth, $template, $cache; + global $phpbb_root_path, $phpbb_admin_path, $phpEx, $table_prefix, $file_uploads; + + $user->add_lang(array('posting', 'ucp', 'acp/users')); + $this->tpl_name = 'acp_users'; + $this->page_title = 'ACP_USER_' . strtoupper($mode); + + $error = array(); + $username = utf8_normalize_nfc(request_var('username', '', true)); + $user_id = request_var('u', 0); + $action = request_var('action', ''); + + $submit = (isset($_POST['update']) && !isset($_POST['cancel'])) ? true : false; + + $form_name = 'acp_users'; + add_form_key($form_name); + + // Whois (special case) + if ($action == 'whois') + { + include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + + $this->page_title = 'WHOIS'; + $this->tpl_name = 'simple_body'; + + $user_ip = request_var('user_ip', ''); + $domain = gethostbyaddr($user_ip); + $ipwhois = user_ipwhois($user_ip); + + $template->assign_vars(array( + 'MESSAGE_TITLE' => sprintf($user->lang['IP_WHOIS_FOR'], $domain), + 'MESSAGE_TEXT' => nl2br($ipwhois)) + ); + + return; + } + + // Show user selection mask + if (!$username && !$user_id) + { + $this->page_title = 'SELECT_USER'; + + $template->assign_vars(array( + 'U_ACTION' => $this->u_action, + 'ANONYMOUS_USER_ID' => ANONYMOUS, + + 'S_SELECT_USER' => true, + 'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&form=select_user&field=username&select_single=true'), + )); + + return; + } + + if (!$user_id) + { + $sql = 'SELECT user_id + FROM ' . USERS_TABLE . " + WHERE username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'"; + $result = $db->sql_query($sql); + $user_id = (int) $db->sql_fetchfield('user_id'); + $db->sql_freeresult($result); + + if (!$user_id) + { + trigger_error($user->lang['NO_USER'] . adm_back_link($this->u_action), E_USER_WARNING); + } + } + + // Generate content for all modes + $sql = 'SELECT u.*, s.* + FROM ' . USERS_TABLE . ' u + LEFT JOIN ' . SESSIONS_TABLE . ' s ON (s.session_user_id = u.user_id) + WHERE u.user_id = ' . $user_id . ' + ORDER BY s.session_time DESC'; + $result = $db->sql_query($sql); + $user_row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$user_row) + { + trigger_error($user->lang['NO_USER'] . adm_back_link($this->u_action), E_USER_WARNING); + } + + // Generate overall "header" for user admin + $s_form_options = ''; + + // Build modes dropdown list + $sql = 'SELECT module_mode, module_auth + FROM ' . MODULES_TABLE . " + WHERE module_basename = 'users' + AND module_enabled = 1 + AND module_class = 'acp' + ORDER BY left_id, module_mode"; + $result = $db->sql_query($sql); + + $dropdown_modes = array(); + while ($row = $db->sql_fetchrow($result)) + { + if (!$this->p_master->module_auth($row['module_auth'])) + { + continue; + } + + $dropdown_modes[$row['module_mode']] = true; + } + $db->sql_freeresult($result); + + foreach ($dropdown_modes as $module_mode => $null) + { + $selected = ($mode == $module_mode) ? ' selected="selected"' : ''; + $s_form_options .= ''; + } + + $template->assign_vars(array( + 'U_BACK' => $this->u_action, + 'U_MODE_SELECT' => append_sid("{$phpbb_admin_path}index.$phpEx", "i=$id&u=$user_id"), + 'U_ACTION' => $this->u_action . '&u=' . $user_id, + 'S_FORM_OPTIONS' => $s_form_options, + 'MANAGED_USERNAME' => $user_row['username']) + ); + + // Prevent normal users/admins change/view founders if they are not a founder by themselves + if ($user->data['user_type'] != USER_FOUNDER && $user_row['user_type'] == USER_FOUNDER) + { + trigger_error($user->lang['NOT_MANAGE_FOUNDER'] . adm_back_link($this->u_action), E_USER_WARNING); + } + + switch ($mode) + { + case 'overview': + + include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + + $user->add_lang('acp/ban'); + + $delete = request_var('delete', 0); + $delete_type = request_var('delete_type', ''); + $ip = request_var('ip', 'ip'); + + if ($submit) + { + // You can't delete the founder + if ($delete && $user_row['user_type'] != USER_FOUNDER) + { + if (!$auth->acl_get('a_userdel')) + { + trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + + // Check if the user wants to remove himself or the guest user account + if ($user_id == ANONYMOUS) + { + trigger_error($user->lang['CANNOT_REMOVE_ANONYMOUS'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + + if ($user_id == $user->data['user_id']) + { + trigger_error($user->lang['CANNOT_REMOVE_YOURSELF'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + + if (confirm_box(true)) + { + user_delete($delete_type, $user_id, $user_row['username']); + + add_log('admin', 'LOG_USER_DELETED', $user_row['username']); + trigger_error($user->lang['USER_DELETED'] . adm_back_link($this->u_action)); + } + else + { + confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( + 'u' => $user_id, + 'i' => $id, + 'mode' => $mode, + 'action' => $action, + 'update' => true, + 'delete' => 1, + 'delete_type' => $delete_type)) + ); + } + } + + // Handle quicktool actions + switch ($action) + { + case 'banuser': + case 'banemail': + case 'banip': + + if ($user_id == $user->data['user_id']) + { + trigger_error($user->lang['CANNOT_BAN_YOURSELF'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + + if ($user_row['user_type'] == USER_FOUNDER) + { + trigger_error($user->lang['CANNOT_BAN_FOUNDER'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + + if (!check_form_key($form_name)) + { + trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + + $ban = array(); + + switch ($action) + { + case 'banuser': + $ban[] = $user_row['username']; + $reason = 'USER_ADMIN_BAN_NAME_REASON'; + $log = 'LOG_USER_BAN_USER'; + break; + + case 'banemail': + $ban[] = $user_row['user_email']; + $reason = 'USER_ADMIN_BAN_EMAIL_REASON'; + $log = 'LOG_USER_BAN_EMAIL'; + break; + + case 'banip': + $ban[] = $user_row['user_ip']; + + $sql = 'SELECT DISTINCT poster_ip + FROM ' . POSTS_TABLE . " + WHERE poster_id = $user_id"; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $ban[] = $row['poster_ip']; + } + $db->sql_freeresult($result); + + $reason = 'USER_ADMIN_BAN_IP_REASON'; + $log = 'LOG_USER_BAN_IP'; + break; + } + + $ban_reason = utf8_normalize_nfc(request_var('ban_reason', $user->lang[$reason], true)); + $ban_give_reason = utf8_normalize_nfc(request_var('ban_give_reason', '', true)); + + // Log not used at the moment, we simply utilize the ban function. + $result = user_ban(substr($action, 3), $ban, 0, 0, 0, $ban_reason, $ban_give_reason); + + trigger_error((($result === false) ? $user->lang['BAN_ALREADY_ENTERED'] : $user->lang['BAN_SUCCESSFUL']) . adm_back_link($this->u_action . '&u=' . $user_id)); + + break; + + case 'reactivate': + + if ($user_id == $user->data['user_id']) + { + trigger_error($user->lang['CANNOT_FORCE_REACT_YOURSELF'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + + if (!check_form_key($form_name)) + { + trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + + if ($user_row['user_type'] == USER_FOUNDER) + { + trigger_error($user->lang['CANNOT_FORCE_REACT_FOUNDER'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + + if ($user_row['user_type'] == USER_IGNORE) + { + trigger_error($user->lang['CANNOT_FORCE_REACT_BOT'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + + if ($config['email_enable']) + { + include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx); + + $server_url = generate_board_url(); + + $user_actkey = gen_rand_string(10); + $key_len = 54 - (strlen($server_url)); + $key_len = ($key_len > 6) ? $key_len : 6; + $user_actkey = substr($user_actkey, 0, $key_len); + $email_template = ($user_row['user_type'] == USER_NORMAL) ? 'user_reactivate_account' : 'user_resend_inactive'; + + if ($user_row['user_type'] == USER_NORMAL) + { + user_active_flip('deactivate', $user_id, INACTIVE_REMIND); + + $sql = 'UPDATE ' . USERS_TABLE . " + SET user_actkey = '" . $db->sql_escape($user_actkey) . "' + WHERE user_id = $user_id"; + $db->sql_query($sql); + } + else + { + // Grabbing the last confirm key - we only send a reminder + $sql = 'SELECT user_actkey + FROM ' . USERS_TABLE . ' + WHERE user_id = ' . $user_id; + $result = $db->sql_query($sql); + $user_actkey = (string) $db->sql_fetchfield('user_actkey'); + $db->sql_freeresult($result); + } + + $messenger = new messenger(false); + + $messenger->template($email_template, $user_row['user_lang']); + + $messenger->to($user_row['user_email'], $user_row['username']); + + $messenger->headers('X-AntiAbuse: Board servername - ' . $config['server_name']); + $messenger->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']); + $messenger->headers('X-AntiAbuse: Username - ' . $user->data['username']); + $messenger->headers('X-AntiAbuse: User IP - ' . $user->ip); + + $messenger->assign_vars(array( + 'WELCOME_MSG' => htmlspecialchars_decode(sprintf($user->lang['WELCOME_SUBJECT'], $config['sitename'])), + 'USERNAME' => htmlspecialchars_decode($user_row['username']), + 'U_ACTIVATE' => "$server_url/ucp.$phpEx?mode=activate&u={$user_row['user_id']}&k=$user_actkey") + ); + + $messenger->send(NOTIFY_EMAIL); + + add_log('admin', 'LOG_USER_REACTIVATE', $user_row['username']); + add_log('user', $user_id, 'LOG_USER_REACTIVATE_USER'); + + trigger_error($user->lang['FORCE_REACTIVATION_SUCCESS'] . adm_back_link($this->u_action . '&u=' . $user_id)); + } + + break; + + case 'active': + + if ($user_id == $user->data['user_id']) + { + // It is only deactivation since the user is already activated (else he would not have reached this page) + trigger_error($user->lang['CANNOT_DEACTIVATE_YOURSELF'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + + if (!check_form_key($form_name)) + { + trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + + if ($user_row['user_type'] == USER_FOUNDER) + { + trigger_error($user->lang['CANNOT_DEACTIVATE_FOUNDER'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + + if ($user_row['user_type'] == USER_IGNORE) + { + trigger_error($user->lang['CANNOT_DEACTIVATE_BOT'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + + user_active_flip('flip', $user_id); + + if ($user_row['user_type'] == USER_INACTIVE) + { + if ($config['require_activation'] == USER_ACTIVATION_ADMIN) + { + include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx); + + $messenger = new messenger(false); + + $messenger->template('admin_welcome_activated', $user_row['user_lang']); + + $messenger->to($user_row['user_email'], $user_row['username']); + + $messenger->headers('X-AntiAbuse: Board servername - ' . $config['server_name']); + $messenger->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']); + $messenger->headers('X-AntiAbuse: Username - ' . $user->data['username']); + $messenger->headers('X-AntiAbuse: User IP - ' . $user->ip); + + $messenger->assign_vars(array( + 'USERNAME' => htmlspecialchars_decode($user_row['username'])) + ); + + $messenger->send(NOTIFY_EMAIL); + } + } + + $message = ($user_row['user_type'] == USER_INACTIVE) ? 'USER_ADMIN_ACTIVATED' : 'USER_ADMIN_DEACTIVED'; + $log = ($user_row['user_type'] == USER_INACTIVE) ? 'LOG_USER_ACTIVE' : 'LOG_USER_INACTIVE'; + + add_log('admin', $log, $user_row['username']); + add_log('user', $user_id, $log . '_USER'); + + trigger_error($user->lang[$message] . adm_back_link($this->u_action . '&u=' . $user_id)); + + break; + + case 'delsig': + + if (!check_form_key($form_name)) + { + trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + + $sql_ary = array( + 'user_sig' => '', + 'user_sig_bbcode_uid' => '', + 'user_sig_bbcode_bitfield' => '' + ); + + $sql = 'UPDATE ' . USERS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . " + WHERE user_id = $user_id"; + $db->sql_query($sql); + + add_log('admin', 'LOG_USER_DEL_SIG', $user_row['username']); + add_log('user', $user_id, 'LOG_USER_DEL_SIG_USER'); + + trigger_error($user->lang['USER_ADMIN_SIG_REMOVED'] . adm_back_link($this->u_action . '&u=' . $user_id)); + + break; + + case 'delavatar': + + if (!check_form_key($form_name)) + { + trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + + $sql_ary = array( + 'user_avatar' => '', + 'user_avatar_type' => 0, + 'user_avatar_width' => 0, + 'user_avatar_height' => 0, + ); + + $sql = 'UPDATE ' . USERS_TABLE . ' + SET ' . $db->sql_build_array('UPDATE', $sql_ary) . " + WHERE user_id = $user_id"; + $db->sql_query($sql); + + // Delete old avatar if present + if ($user_row['user_avatar'] && $user_row['user_avatar_type'] != AVATAR_GALLERY) + { + avatar_delete('user', $user_row); + } + + add_log('admin', 'LOG_USER_DEL_AVATAR', $user_row['username']); + add_log('user', $user_id, 'LOG_USER_DEL_AVATAR_USER'); + + trigger_error($user->lang['USER_ADMIN_AVATAR_REMOVED'] . adm_back_link($this->u_action . '&u=' . $user_id)); + break; + + case 'delposts': + + if (confirm_box(true)) + { + // Delete posts, attachments, etc. + delete_posts('poster_id', $user_id); + + add_log('admin', 'LOG_USER_DEL_POSTS', $user_row['username']); + trigger_error($user->lang['USER_POSTS_DELETED'] . adm_back_link($this->u_action . '&u=' . $user_id)); + } + else + { + confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( + 'u' => $user_id, + 'i' => $id, + 'mode' => $mode, + 'action' => $action, + 'update' => true)) + ); + } + + break; + + case 'delattach': + + if (confirm_box(true)) + { + delete_attachments('user', $user_id); + + add_log('admin', 'LOG_USER_DEL_ATTACH', $user_row['username']); + trigger_error($user->lang['USER_ATTACHMENTS_REMOVED'] . adm_back_link($this->u_action . '&u=' . $user_id)); + } + else + { + confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( + 'u' => $user_id, + 'i' => $id, + 'mode' => $mode, + 'action' => $action, + 'update' => true)) + ); + } + + break; + + case 'deloutbox': + + if (confirm_box(true)) + { + $msg_ids = array(); + $lang = 'EMPTY'; + + $sql = 'SELECT msg_id + FROM ' . PRIVMSGS_TO_TABLE . " + WHERE author_id = $user_id + AND folder_id = " . PRIVMSGS_OUTBOX; + $result = $db->sql_query($sql); + + if ($row = $db->sql_fetchrow($result)) + { + if (!function_exists('delete_pm')) + { + include($phpbb_root_path . 'includes/functions_privmsgs.' . $phpEx); + } + + do + { + $msg_ids[] = (int) $row['msg_id']; + } + while ($row = $db->sql_fetchrow($result)); + + $db->sql_freeresult($result); + + delete_pm($user_id, $msg_ids, PRIVMSGS_OUTBOX); + + add_log('admin', 'LOG_USER_DEL_OUTBOX', $user_row['username']); + + $lang = 'EMPTIED'; + } + $db->sql_freeresult($result); + + trigger_error($user->lang['USER_OUTBOX_' . $lang] . adm_back_link($this->u_action . '&u=' . $user_id)); + } + else + { + confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( + 'u' => $user_id, + 'i' => $id, + 'mode' => $mode, + 'action' => $action, + 'update' => true)) + ); + } + break; + + case 'moveposts': + + if (!check_form_key($form_name)) + { + trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + + $user->add_lang('acp/forums'); + + $new_forum_id = request_var('new_f', 0); + + if (!$new_forum_id) + { + $this->page_title = 'USER_ADMIN_MOVE_POSTS'; + + $template->assign_vars(array( + 'S_SELECT_FORUM' => true, + 'U_ACTION' => $this->u_action . "&action=$action&u=$user_id", + 'U_BACK' => $this->u_action . "&u=$user_id", + 'S_FORUM_OPTIONS' => make_forum_select(false, false, false, true)) + ); + + return; + } + + // Is the new forum postable to? + $sql = 'SELECT forum_name, forum_type + FROM ' . FORUMS_TABLE . " + WHERE forum_id = $new_forum_id"; + $result = $db->sql_query($sql); + $forum_info = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$forum_info) + { + trigger_error($user->lang['NO_FORUM'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + + if ($forum_info['forum_type'] != FORUM_POST) + { + trigger_error($user->lang['MOVE_POSTS_NO_POSTABLE_FORUM'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + + // Two stage? + // Move topics comprising only posts from this user + $topic_id_ary = $move_topic_ary = $move_post_ary = $new_topic_id_ary = array(); + $forum_id_ary = array($new_forum_id); + + $sql = 'SELECT topic_id, COUNT(post_id) AS total_posts + FROM ' . POSTS_TABLE . " + WHERE poster_id = $user_id + AND forum_id <> $new_forum_id + GROUP BY topic_id"; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $topic_id_ary[$row['topic_id']] = $row['total_posts']; + } + $db->sql_freeresult($result); + + if (sizeof($topic_id_ary)) + { + $sql = 'SELECT topic_id, forum_id, topic_title, topic_replies, topic_replies_real, topic_attachment + FROM ' . TOPICS_TABLE . ' + WHERE ' . $db->sql_in_set('topic_id', array_keys($topic_id_ary)); + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + if (max($row['topic_replies'], $row['topic_replies_real']) + 1 == $topic_id_ary[$row['topic_id']]) + { + $move_topic_ary[] = $row['topic_id']; + } + else + { + $move_post_ary[$row['topic_id']]['title'] = $row['topic_title']; + $move_post_ary[$row['topic_id']]['attach'] = ($row['topic_attachment']) ? 1 : 0; + } + + $forum_id_ary[] = $row['forum_id']; + } + $db->sql_freeresult($result); + } + + // Entire topic comprises posts by this user, move these topics + if (sizeof($move_topic_ary)) + { + move_topics($move_topic_ary, $new_forum_id, false); + } + + if (sizeof($move_post_ary)) + { + // Create new topic + // Update post_ids, report_ids, attachment_ids + foreach ($move_post_ary as $topic_id => $post_ary) + { + // Create new topic + $sql = 'INSERT INTO ' . TOPICS_TABLE . ' ' . $db->sql_build_array('INSERT', array( + 'topic_poster' => $user_id, + 'topic_time' => time(), + 'forum_id' => $new_forum_id, + 'icon_id' => 0, + 'topic_approved' => 1, + 'topic_title' => $post_ary['title'], + 'topic_first_poster_name' => $user_row['username'], + 'topic_type' => POST_NORMAL, + 'topic_time_limit' => 0, + 'topic_attachment' => $post_ary['attach']) + ); + $db->sql_query($sql); + + $new_topic_id = $db->sql_nextid(); + + // Move posts + $sql = 'UPDATE ' . POSTS_TABLE . " + SET forum_id = $new_forum_id, topic_id = $new_topic_id + WHERE topic_id = $topic_id + AND poster_id = $user_id"; + $db->sql_query($sql); + + if ($post_ary['attach']) + { + $sql = 'UPDATE ' . ATTACHMENTS_TABLE . " + SET topic_id = $new_topic_id + WHERE topic_id = $topic_id + AND poster_id = $user_id"; + $db->sql_query($sql); + } + + $new_topic_id_ary[] = $new_topic_id; + } + } + + $forum_id_ary = array_unique($forum_id_ary); + $topic_id_ary = array_unique(array_merge(array_keys($topic_id_ary), $new_topic_id_ary)); + + if (sizeof($topic_id_ary)) + { + sync('topic_reported', 'topic_id', $topic_id_ary); + sync('topic', 'topic_id', $topic_id_ary); + } + + if (sizeof($forum_id_ary)) + { + sync('forum', 'forum_id', $forum_id_ary, false, true); + } + + + add_log('admin', 'LOG_USER_MOVE_POSTS', $user_row['username'], $forum_info['forum_name']); + add_log('user', $user_id, 'LOG_USER_MOVE_POSTS_USER', $forum_info['forum_name']); + + trigger_error($user->lang['USER_POSTS_MOVED'] . adm_back_link($this->u_action . '&u=' . $user_id)); + + break; + + case 'leave_nr': + + if (confirm_box(true)) + { + remove_newly_registered($user_id, $user_row); + + add_log('admin', 'LOG_USER_REMOVED_NR', $user_row['username']); + trigger_error($user->lang['USER_LIFTED_NR'] . adm_back_link($this->u_action . '&u=' . $user_id)); + } + else + { + confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( + 'u' => $user_id, + 'i' => $id, + 'mode' => $mode, + 'action' => $action, + 'update' => true)) + ); + } + + break; + } + + // Handle registration info updates + $data = array( + 'username' => utf8_normalize_nfc(request_var('user', $user_row['username'], true)), + 'user_founder' => request_var('user_founder', ($user_row['user_type'] == USER_FOUNDER) ? 1 : 0), + 'email' => strtolower(request_var('user_email', $user_row['user_email'])), + 'email_confirm' => strtolower(request_var('email_confirm', '')), + 'new_password' => request_var('new_password', '', true), + 'password_confirm' => request_var('password_confirm', '', true), + ); + + // Validation data - we do not check the password complexity setting here + $check_ary = array( + 'new_password' => array( + array('string', true, $config['min_pass_chars'], $config['max_pass_chars']), + array('password')), + 'password_confirm' => array('string', true, $config['min_pass_chars'], $config['max_pass_chars']), + ); + + // Check username if altered + if ($data['username'] != $user_row['username']) + { + $check_ary += array( + 'username' => array( + array('string', false, $config['min_name_chars'], $config['max_name_chars']), + array('username', $user_row['username']) + ), + ); + } + + // Check email if altered + if ($data['email'] != $user_row['user_email']) + { + $check_ary += array( + 'email' => array( + array('string', false, 6, 60), + array('email', $user_row['user_email']) + ), + 'email_confirm' => array('string', true, 6, 60) + ); + } + + $error = validate_data($data, $check_ary); + + if ($data['new_password'] && $data['password_confirm'] != $data['new_password']) + { + $error[] = 'NEW_PASSWORD_ERROR'; + } + + if ($data['email'] != $user_row['user_email'] && $data['email_confirm'] != $data['email']) + { + $error[] = 'NEW_EMAIL_ERROR'; + } + + if (!check_form_key($form_name)) + { + $error[] = 'FORM_INVALID'; + } + + // Which updates do we need to do? + $update_username = ($user_row['username'] != $data['username']) ? $data['username'] : false; + $update_password = ($data['new_password'] && !phpbb_check_hash($user_row['user_password'], $data['new_password'])) ? true : false; + $update_email = ($data['email'] != $user_row['user_email']) ? $data['email'] : false; + + if (!sizeof($error)) + { + $sql_ary = array(); + + if ($user_row['user_type'] != USER_FOUNDER || $user->data['user_type'] == USER_FOUNDER) + { + // Only allow founders updating the founder status... + if ($user->data['user_type'] == USER_FOUNDER) + { + // Setting a normal member to be a founder + if ($data['user_founder'] && $user_row['user_type'] != USER_FOUNDER) + { + // Make sure the user is not setting an Inactive or ignored user to be a founder + if ($user_row['user_type'] == USER_IGNORE) + { + trigger_error($user->lang['CANNOT_SET_FOUNDER_IGNORED'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + + if ($user_row['user_type'] == USER_INACTIVE) + { + trigger_error($user->lang['CANNOT_SET_FOUNDER_INACTIVE'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + + $sql_ary['user_type'] = USER_FOUNDER; + } + else if (!$data['user_founder'] && $user_row['user_type'] == USER_FOUNDER) + { + // Check if at least one founder is present + $sql = 'SELECT user_id + FROM ' . USERS_TABLE . ' + WHERE user_type = ' . USER_FOUNDER . ' + AND user_id <> ' . $user_id; + $result = $db->sql_query_limit($sql, 1); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if ($row) + { + $sql_ary['user_type'] = USER_NORMAL; + } + else + { + trigger_error($user->lang['AT_LEAST_ONE_FOUNDER'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + } + } + } + + if ($update_username !== false) + { + $sql_ary['username'] = $update_username; + $sql_ary['username_clean'] = utf8_clean_string($update_username); + + add_log('user', $user_id, 'LOG_USER_UPDATE_NAME', $user_row['username'], $update_username); + } + + if ($update_email !== false) + { + $sql_ary += array( + 'user_email' => $update_email, + 'user_email_hash' => phpbb_email_hash($update_email), + ); + + add_log('user', $user_id, 'LOG_USER_UPDATE_EMAIL', $user_row['username'], $user_row['user_email'], $update_email); + } + + if ($update_password) + { + $sql_ary += array( + 'user_password' => phpbb_hash($data['new_password']), + 'user_passchg' => time(), + 'user_pass_convert' => 0, + ); + + $user->reset_login_keys($user_id); + add_log('user', $user_id, 'LOG_USER_NEW_PASSWORD', $user_row['username']); + } + + if (sizeof($sql_ary)) + { + $sql = 'UPDATE ' . USERS_TABLE . ' + SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' + WHERE user_id = ' . $user_id; + $db->sql_query($sql); + } + + if ($update_username) + { + user_update_name($user_row['username'], $update_username); + } + + // Let the users permissions being updated + $auth->acl_clear_prefetch($user_id); + + add_log('admin', 'LOG_USER_USER_UPDATE', $data['username']); + + trigger_error($user->lang['USER_OVERVIEW_UPDATED'] . adm_back_link($this->u_action . '&u=' . $user_id)); + } + + // Replace "error" strings with their real, localised form + $error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error); + } + + if ($user_id == $user->data['user_id']) + { + $quick_tool_ary = array('delsig' => 'DEL_SIG', 'delavatar' => 'DEL_AVATAR', 'moveposts' => 'MOVE_POSTS', 'delposts' => 'DEL_POSTS', 'delattach' => 'DEL_ATTACH', 'deloutbox' => 'DEL_OUTBOX'); + if ($user_row['user_new']) + { + $quick_tool_ary['leave_nr'] = 'LEAVE_NR'; + } + } + else + { + $quick_tool_ary = array(); + + if ($user_row['user_type'] != USER_FOUNDER) + { + $quick_tool_ary += array('banuser' => 'BAN_USER', 'banemail' => 'BAN_EMAIL', 'banip' => 'BAN_IP'); + } + + if ($user_row['user_type'] != USER_FOUNDER && $user_row['user_type'] != USER_IGNORE) + { + $quick_tool_ary += array('active' => (($user_row['user_type'] == USER_INACTIVE) ? 'ACTIVATE' : 'DEACTIVATE')); + } + + $quick_tool_ary += array('delsig' => 'DEL_SIG', 'delavatar' => 'DEL_AVATAR', 'moveposts' => 'MOVE_POSTS', 'delposts' => 'DEL_POSTS', 'delattach' => 'DEL_ATTACH', 'deloutbox' => 'DEL_OUTBOX'); + + if ($config['email_enable'] && ($user_row['user_type'] == USER_NORMAL || $user_row['user_type'] == USER_INACTIVE)) + { + $quick_tool_ary['reactivate'] = 'FORCE'; + } + + if ($user_row['user_new']) + { + $quick_tool_ary['leave_nr'] = 'LEAVE_NR'; + } + } + + $s_action_options = ''; + foreach ($quick_tool_ary as $value => $lang) + { + $s_action_options .= ''; + } + + if ($config['load_onlinetrack']) + { + $sql = 'SELECT MAX(session_time) AS session_time, MIN(session_viewonline) AS session_viewonline + FROM ' . SESSIONS_TABLE . " + WHERE session_user_id = $user_id"; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + $user_row['session_time'] = (isset($row['session_time'])) ? $row['session_time'] : 0; + $user_row['session_viewonline'] = (isset($row['session_viewonline'])) ? $row['session_viewonline'] : 0; + unset($row); + } + + $last_visit = (!empty($user_row['session_time'])) ? $user_row['session_time'] : $user_row['user_lastvisit']; + + $inactive_reason = ''; + if ($user_row['user_type'] == USER_INACTIVE) + { + $inactive_reason = $user->lang['INACTIVE_REASON_UNKNOWN']; + + switch ($user_row['user_inactive_reason']) + { + case INACTIVE_REGISTER: + $inactive_reason = $user->lang['INACTIVE_REASON_REGISTER']; + break; + + case INACTIVE_PROFILE: + $inactive_reason = $user->lang['INACTIVE_REASON_PROFILE']; + break; + + case INACTIVE_MANUAL: + $inactive_reason = $user->lang['INACTIVE_REASON_MANUAL']; + break; + + case INACTIVE_REMIND: + $inactive_reason = $user->lang['INACTIVE_REASON_REMIND']; + break; + } + } + + // Posts in Queue + $sql = 'SELECT COUNT(post_id) as posts_in_queue + FROM ' . POSTS_TABLE . ' + WHERE poster_id = ' . $user_id . ' + AND post_approved = 0'; + $result = $db->sql_query($sql); + $user_row['posts_in_queue'] = (int) $db->sql_fetchfield('posts_in_queue'); + $db->sql_freeresult($result); + + $template->assign_vars(array( + 'L_NAME_CHARS_EXPLAIN' => sprintf($user->lang[$config['allow_name_chars'] . '_EXPLAIN'], $config['min_name_chars'], $config['max_name_chars']), + 'L_CHANGE_PASSWORD_EXPLAIN' => sprintf($user->lang[$config['pass_complex'] . '_EXPLAIN'], $config['min_pass_chars'], $config['max_pass_chars']), + 'L_POSTS_IN_QUEUE' => $user->lang('NUM_POSTS_IN_QUEUE', $user_row['posts_in_queue']), + 'S_FOUNDER' => ($user->data['user_type'] == USER_FOUNDER) ? true : false, + + 'S_OVERVIEW' => true, + 'S_USER_IP' => ($user_row['user_ip']) ? true : false, + 'S_USER_FOUNDER' => ($user_row['user_type'] == USER_FOUNDER) ? true : false, + 'S_ACTION_OPTIONS' => $s_action_options, + 'S_OWN_ACCOUNT' => ($user_id == $user->data['user_id']) ? true : false, + 'S_USER_INACTIVE' => ($user_row['user_type'] == USER_INACTIVE) ? true : false, + + 'U_SHOW_IP' => $this->u_action . "&u=$user_id&ip=" . (($ip == 'ip') ? 'hostname' : 'ip'), + 'U_WHOIS' => $this->u_action . "&action=whois&user_ip={$user_row['user_ip']}", + 'U_MCP_QUEUE' => ($auth->acl_getf_global('m_approve')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue', true, $user->session_id) : '', + + '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']}&hash=" . generate_link_hash('switchperm')) : '', + + 'POSTS_IN_QUEUE' => $user_row['posts_in_queue'], + 'USER' => $user_row['username'], + 'USER_REGISTERED' => $user->format_date($user_row['user_regdate']), + 'REGISTERED_IP' => ($ip == 'hostname') ? gethostbyaddr($user_row['user_ip']) : $user_row['user_ip'], + 'USER_LASTACTIVE' => ($last_visit) ? $user->format_date($last_visit) : ' - ', + 'USER_EMAIL' => $user_row['user_email'], + 'USER_WARNINGS' => $user_row['user_warnings'], + 'USER_POSTS' => $user_row['user_posts'], + 'USER_INACTIVE_REASON' => $inactive_reason, + )); + + break; + + case 'feedback': + + $user->add_lang('mcp'); + + // Set up general vars + $start = request_var('start', 0); + $deletemark = (isset($_POST['delmarked'])) ? true : false; + $deleteall = (isset($_POST['delall'])) ? true : false; + $marked = request_var('mark', array(0)); + $message = utf8_normalize_nfc(request_var('message', '', true)); + + // Sort keys + $sort_days = request_var('st', 0); + $sort_key = request_var('sk', 't'); + $sort_dir = request_var('sd', 'd'); + + // Delete entries if requested and able + if (($deletemark || $deleteall) && $auth->acl_get('a_clearlogs')) + { + if (!check_form_key($form_name)) + { + trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + + $where_sql = ''; + if ($deletemark && $marked) + { + $sql_in = array(); + foreach ($marked as $mark) + { + $sql_in[] = $mark; + } + $where_sql = ' AND ' . $db->sql_in_set('log_id', $sql_in); + unset($sql_in); + } + + if ($where_sql || $deleteall) + { + $sql = 'DELETE FROM ' . LOG_TABLE . ' + WHERE log_type = ' . LOG_USERS . " + AND reportee_id = $user_id + $where_sql"; + $db->sql_query($sql); + + add_log('admin', 'LOG_CLEAR_USER', $user_row['username']); + } + } + + if ($submit && $message) + { + if (!check_form_key($form_name)) + { + trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + + add_log('admin', 'LOG_USER_FEEDBACK', $user_row['username']); + add_log('mod', 0, 0, 'LOG_USER_FEEDBACK', $user_row['username']); + add_log('user', $user_id, 'LOG_USER_GENERAL', $message); + + trigger_error($user->lang['USER_FEEDBACK_ADDED'] . adm_back_link($this->u_action . '&u=' . $user_id)); + } + + // Sorting + $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']); + $sort_by_text = array('u' => $user->lang['SORT_USERNAME'], 't' => $user->lang['SORT_DATE'], 'i' => $user->lang['SORT_IP'], 'o' => $user->lang['SORT_ACTION']); + $sort_by_sql = array('u' => 'u.username_clean', 't' => 'l.log_time', 'i' => 'l.log_ip', 'o' => 'l.log_operation'); + + $s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = ''; + 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); + + // Define where and sort sql for use in displaying logs + $sql_where = ($sort_days) ? (time() - ($sort_days * 86400)) : 0; + $sql_sort = $sort_by_sql[$sort_key] . ' ' . (($sort_dir == 'd') ? 'DESC' : 'ASC'); + + // Grab log data + $log_data = array(); + $log_count = 0; + view_log('user', $log_data, $log_count, $config['topics_per_page'], $start, 0, 0, $user_id, $sql_where, $sql_sort); + + $template->assign_vars(array( + 'S_FEEDBACK' => true, + 'S_ON_PAGE' => on_page($log_count, $config['topics_per_page'], $start), + 'PAGINATION' => generate_pagination($this->u_action . "&u=$user_id&$u_sort_param", $log_count, $config['topics_per_page'], $start, true), + + 'S_LIMIT_DAYS' => $s_limit_days, + 'S_SORT_KEY' => $s_sort_key, + 'S_SORT_DIR' => $s_sort_dir, + 'S_CLEARLOGS' => $auth->acl_get('a_clearlogs')) + ); + + foreach ($log_data as $row) + { + $template->assign_block_vars('log', array( + 'USERNAME' => $row['username_full'], + 'IP' => $row['ip'], + 'DATE' => $user->format_date($row['time']), + 'ACTION' => nl2br($row['action']), + 'ID' => $row['id']) + ); + } + + break; + + case 'warnings': + $user->add_lang('mcp'); + + // Set up general vars + $start = request_var('start', 0); + $deletemark = (isset($_POST['delmarked'])) ? true : false; + $deleteall = (isset($_POST['delall'])) ? true : false; + $confirm = (isset($_POST['confirm'])) ? true : false; + $marked = request_var('mark', array(0)); + $message = utf8_normalize_nfc(request_var('message', '', true)); + + // Sort keys + $sort_days = request_var('st', 0); + $sort_key = request_var('sk', 't'); + $sort_dir = request_var('sd', 'd'); + + // Delete entries if requested and able + if ($deletemark || $deleteall || $confirm) + { + if (confirm_box(true)) + { + $where_sql = ''; + $deletemark = request_var('delmarked', 0); + $deleteall = request_var('delall', 0); + if ($deletemark && $marked) + { + $where_sql = ' AND ' . $db->sql_in_set('warning_id', array_values($marked)); + } + + if ($where_sql || $deleteall) + { + $sql = 'DELETE FROM ' . WARNINGS_TABLE . " + WHERE user_id = $user_id + $where_sql"; + $db->sql_query($sql); + + if ($deleteall) + { + $log_warnings = $deleted_warnings = 0; + } + else + { + $num_warnings = (int) $db->sql_affectedrows(); + $deleted_warnings = ' user_warnings - ' . $num_warnings; + $log_warnings = ($num_warnings > 2) ? 2 : $num_warnings; + } + + $sql = 'UPDATE ' . USERS_TABLE . " + SET user_warnings = $deleted_warnings + WHERE user_id = $user_id"; + $db->sql_query($sql); + + switch ($log_warnings) + { + case 2: + add_log('admin', 'LOG_WARNINGS_DELETED', $user_row['username'], $num_warnings); + break; + case 1: + add_log('admin', 'LOG_WARNING_DELETED', $user_row['username']); + break; + default: + add_log('admin', 'LOG_WARNINGS_DELETED_ALL', $user_row['username']); + break; + } + } + } + else + { + $s_hidden_fields = array( + 'i' => $id, + 'mode' => $mode, + 'u' => $user_id, + 'mark' => $marked, + ); + if (isset($_POST['delmarked'])) + { + $s_hidden_fields['delmarked'] = 1; + } + if (isset($_POST['delall'])) + { + $s_hidden_fields['delall'] = 1; + } + if (isset($_POST['delall']) || (isset($_POST['delmarked']) && sizeof($marked))) + { + confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields($s_hidden_fields)); + } + } + } + + $sql = 'SELECT w.warning_id, w.warning_time, w.post_id, l.log_operation, l.log_data, l.user_id AS mod_user_id, m.username AS mod_username, m.user_colour AS mod_user_colour + FROM ' . WARNINGS_TABLE . ' w + LEFT JOIN ' . LOG_TABLE . ' l + ON (w.log_id = l.log_id) + LEFT JOIN ' . USERS_TABLE . ' m + ON (l.user_id = m.user_id) + WHERE w.user_id = ' . $user_id . ' + ORDER BY w.warning_time DESC'; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + if (!$row['log_operation']) + { + // We do not have a log-entry anymore, so there is no data available + $row['action'] = $user->lang['USER_WARNING_LOG_DELETED']; + } + else + { + $row['action'] = (isset($user->lang[$row['log_operation']])) ? $user->lang[$row['log_operation']] : '{' . ucfirst(str_replace('_', ' ', $row['log_operation'])) . '}'; + if (!empty($row['log_data'])) + { + $log_data_ary = @unserialize($row['log_data']); + $log_data_ary = ($log_data_ary === false) ? array() : $log_data_ary; + + if (isset($user->lang[$row['log_operation']])) + { + // Check if there are more occurrences of % than arguments, if there are we fill out the arguments array + // It doesn't matter if we add more arguments than placeholders + if ((substr_count($row['action'], '%') - sizeof($log_data_ary)) > 0) + { + $log_data_ary = array_merge($log_data_ary, array_fill(0, substr_count($row['action'], '%') - sizeof($log_data_ary), '')); + } + $row['action'] = vsprintf($row['action'], $log_data_ary); + $row['action'] = bbcode_nl2br(censor_text($row['action'])); + } + else if (!empty($log_data_ary)) + { + $row['action'] .= '
' . implode('', $log_data_ary); + } + } + } + + + $template->assign_block_vars('warn', array( + 'ID' => $row['warning_id'], + 'USERNAME' => ($row['log_operation']) ? get_username_string('full', $row['mod_user_id'], $row['mod_username'], $row['mod_user_colour']) : '-', + 'ACTION' => make_clickable($row['action']), + 'DATE' => $user->format_date($row['warning_time']), + )); + } + $db->sql_freeresult($result); + + $template->assign_vars(array( + 'S_WARNINGS' => true, + )); + + break; + + case 'profile': + + include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + include($phpbb_root_path . 'includes/functions_profile_fields.' . $phpEx); + + $cp = new custom_profile(); + + $cp_data = $cp_error = array(); + + $sql = 'SELECT lang_id + FROM ' . LANG_TABLE . " + WHERE lang_iso = '" . $db->sql_escape($user->data['user_lang']) . "'"; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + $user_row['iso_lang_id'] = $row['lang_id']; + + $data = array( + 'icq' => request_var('icq', $user_row['user_icq']), + 'aim' => request_var('aim', $user_row['user_aim']), + 'msn' => request_var('msn', $user_row['user_msnm']), + 'yim' => request_var('yim', $user_row['user_yim']), + 'jabber' => utf8_normalize_nfc(request_var('jabber', $user_row['user_jabber'], true)), + 'website' => request_var('website', $user_row['user_website']), + 'location' => utf8_normalize_nfc(request_var('location', $user_row['user_from'], true)), + 'occupation' => utf8_normalize_nfc(request_var('occupation', $user_row['user_occ'], true)), + 'interests' => utf8_normalize_nfc(request_var('interests', $user_row['user_interests'], true)), + 'bday_day' => 0, + 'bday_month' => 0, + 'bday_year' => 0, + ); + + if ($user_row['user_birthday']) + { + list($data['bday_day'], $data['bday_month'], $data['bday_year']) = explode('-', $user_row['user_birthday']); + } + + $data['bday_day'] = request_var('bday_day', $data['bday_day']); + $data['bday_month'] = request_var('bday_month', $data['bday_month']); + $data['bday_year'] = request_var('bday_year', $data['bday_year']); + $data['user_birthday'] = sprintf('%2d-%2d-%4d', $data['bday_day'], $data['bday_month'], $data['bday_year']); + + + if ($submit) + { + $error = validate_data($data, array( + 'icq' => array( + array('string', true, 3, 15), + array('match', true, '#^[0-9]+$#i')), + 'aim' => array('string', true, 3, 255), + 'msn' => array('string', true, 5, 255), + 'jabber' => array( + array('string', true, 5, 255), + array('jabber')), + 'yim' => array('string', true, 5, 255), + 'website' => array( + array('string', true, 12, 255), + array('match', true, '#^http[s]?://(.*?\.)*?[a-z0-9\-]+\.[a-z]{2,4}#i')), + 'location' => array('string', true, 2, 100), + 'occupation' => array('string', true, 2, 500), + 'interests' => array('string', true, 2, 500), + 'bday_day' => array('num', true, 1, 31), + 'bday_month' => array('num', true, 1, 12), + 'bday_year' => array('num', true, 1901, gmdate('Y', time())), + 'user_birthday' => array('date', true), + )); + + // validate custom profile fields + $cp->submit_cp_field('profile', $user_row['iso_lang_id'], $cp_data, $cp_error); + + if (sizeof($cp_error)) + { + $error = array_merge($error, $cp_error); + } + if (!check_form_key($form_name)) + { + $error[] = 'FORM_INVALID'; + } + + if (!sizeof($error)) + { + $sql_ary = array( + 'user_icq' => $data['icq'], + 'user_aim' => $data['aim'], + 'user_msnm' => $data['msn'], + 'user_yim' => $data['yim'], + 'user_jabber' => $data['jabber'], + 'user_website' => $data['website'], + 'user_from' => $data['location'], + 'user_occ' => $data['occupation'], + 'user_interests'=> $data['interests'], + 'user_birthday' => $data['user_birthday'], + ); + + $sql = 'UPDATE ' . USERS_TABLE . ' + SET ' . $db->sql_build_array('UPDATE', $sql_ary) . " + WHERE user_id = $user_id"; + $db->sql_query($sql); + + // Update Custom Fields + $cp->update_profile_field_data($user_id, $cp_data); + + trigger_error($user->lang['USER_PROFILE_UPDATED'] . adm_back_link($this->u_action . '&u=' . $user_id)); + } + + // Replace "error" strings with their real, localised form + $error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error); + } + + $s_birthday_day_options = ''; + for ($i = 1; $i < 32; $i++) + { + $selected = ($i == $data['bday_day']) ? ' selected="selected"' : ''; + $s_birthday_day_options .= ""; + } + + $s_birthday_month_options = ''; + for ($i = 1; $i < 13; $i++) + { + $selected = ($i == $data['bday_month']) ? ' selected="selected"' : ''; + $s_birthday_month_options .= ""; + } + $s_birthday_year_options = ''; + + $now = getdate(); + $s_birthday_year_options = ''; + for ($i = $now['year'] - 100; $i < $now['year']; $i++) + { + $selected = ($i == $data['bday_year']) ? ' selected="selected"' : ''; + $s_birthday_year_options .= ""; + } + unset($now); + + $template->assign_vars(array( + 'ICQ' => $data['icq'], + 'YIM' => $data['yim'], + 'AIM' => $data['aim'], + 'MSN' => $data['msn'], + 'JABBER' => $data['jabber'], + 'WEBSITE' => $data['website'], + 'LOCATION' => $data['location'], + 'OCCUPATION' => $data['occupation'], + 'INTERESTS' => $data['interests'], + + 'S_BIRTHDAY_DAY_OPTIONS' => $s_birthday_day_options, + 'S_BIRTHDAY_MONTH_OPTIONS' => $s_birthday_month_options, + 'S_BIRTHDAY_YEAR_OPTIONS' => $s_birthday_year_options, + + 'S_PROFILE' => true) + ); + + // Get additional profile fields and assign them to the template block var 'profile_fields' + $user->get_profile_fields($user_id); + + $cp->generate_profile_fields('profile', $user_row['iso_lang_id']); + + break; + + case 'prefs': + + include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + + $data = array( + 'dateformat' => utf8_normalize_nfc(request_var('dateformat', $user_row['user_dateformat'], true)), + 'lang' => basename(request_var('lang', $user_row['user_lang'])), + 'tz' => request_var('tz', (float) $user_row['user_timezone']), + 'style' => request_var('style', $user_row['user_style']), + 'dst' => request_var('dst', $user_row['user_dst']), + 'viewemail' => request_var('viewemail', $user_row['user_allow_viewemail']), + 'massemail' => request_var('massemail', $user_row['user_allow_massemail']), + 'hideonline' => request_var('hideonline', !$user_row['user_allow_viewonline']), + 'notifymethod' => request_var('notifymethod', $user_row['user_notify_type']), + 'notifypm' => request_var('notifypm', $user_row['user_notify_pm']), + 'popuppm' => request_var('popuppm', $this->optionget($user_row, 'popuppm')), + 'allowpm' => request_var('allowpm', $user_row['user_allow_pm']), + + 'topic_sk' => request_var('topic_sk', ($user_row['user_topic_sortby_type']) ? $user_row['user_topic_sortby_type'] : 't'), + 'topic_sd' => request_var('topic_sd', ($user_row['user_topic_sortby_dir']) ? $user_row['user_topic_sortby_dir'] : 'd'), + 'topic_st' => request_var('topic_st', ($user_row['user_topic_show_days']) ? $user_row['user_topic_show_days'] : 0), + + 'post_sk' => request_var('post_sk', ($user_row['user_post_sortby_type']) ? $user_row['user_post_sortby_type'] : 't'), + 'post_sd' => request_var('post_sd', ($user_row['user_post_sortby_dir']) ? $user_row['user_post_sortby_dir'] : 'a'), + 'post_st' => request_var('post_st', ($user_row['user_post_show_days']) ? $user_row['user_post_show_days'] : 0), + + 'view_images' => request_var('view_images', $this->optionget($user_row, 'viewimg')), + 'view_flash' => request_var('view_flash', $this->optionget($user_row, 'viewflash')), + 'view_smilies' => request_var('view_smilies', $this->optionget($user_row, 'viewsmilies')), + 'view_sigs' => request_var('view_sigs', $this->optionget($user_row, 'viewsigs')), + 'view_avatars' => request_var('view_avatars', $this->optionget($user_row, 'viewavatars')), + 'view_wordcensor' => request_var('view_wordcensor', $this->optionget($user_row, 'viewcensors')), + + 'bbcode' => request_var('bbcode', $this->optionget($user_row, 'bbcode')), + 'smilies' => request_var('smilies', $this->optionget($user_row, 'smilies')), + 'sig' => request_var('sig', $this->optionget($user_row, 'attachsig')), + 'notify' => request_var('notify', $user_row['user_notify']), + ); + + if ($submit) + { + $error = validate_data($data, array( + 'dateformat' => array('string', false, 1, 30), + 'lang' => array('match', false, '#^[a-z_\-]{2,}$#i'), + 'tz' => array('num', false, -14, 14), + + 'topic_sk' => array('string', false, 1, 1), + 'topic_sd' => array('string', false, 1, 1), + 'post_sk' => array('string', false, 1, 1), + 'post_sd' => array('string', false, 1, 1), + )); + + if (!check_form_key($form_name)) + { + $error[] = 'FORM_INVALID'; + } + + if (!sizeof($error)) + { + $this->optionset($user_row, 'popuppm', $data['popuppm']); + $this->optionset($user_row, 'viewimg', $data['view_images']); + $this->optionset($user_row, 'viewflash', $data['view_flash']); + $this->optionset($user_row, 'viewsmilies', $data['view_smilies']); + $this->optionset($user_row, 'viewsigs', $data['view_sigs']); + $this->optionset($user_row, 'viewavatars', $data['view_avatars']); + $this->optionset($user_row, 'viewcensors', $data['view_wordcensor']); + $this->optionset($user_row, 'bbcode', $data['bbcode']); + $this->optionset($user_row, 'smilies', $data['smilies']); + $this->optionset($user_row, 'attachsig', $data['sig']); + + $sql_ary = array( + 'user_options' => $user_row['user_options'], + + 'user_allow_pm' => $data['allowpm'], + 'user_allow_viewemail' => $data['viewemail'], + 'user_allow_massemail' => $data['massemail'], + 'user_allow_viewonline' => !$data['hideonline'], + 'user_notify_type' => $data['notifymethod'], + 'user_notify_pm' => $data['notifypm'], + + 'user_dst' => $data['dst'], + 'user_dateformat' => $data['dateformat'], + 'user_lang' => $data['lang'], + 'user_timezone' => $data['tz'], + 'user_style' => $data['style'], + + 'user_topic_sortby_type' => $data['topic_sk'], + 'user_post_sortby_type' => $data['post_sk'], + 'user_topic_sortby_dir' => $data['topic_sd'], + 'user_post_sortby_dir' => $data['post_sd'], + + 'user_topic_show_days' => $data['topic_st'], + 'user_post_show_days' => $data['post_st'], + + 'user_notify' => $data['notify'], + ); + + $sql = 'UPDATE ' . USERS_TABLE . ' + SET ' . $db->sql_build_array('UPDATE', $sql_ary) . " + WHERE user_id = $user_id"; + $db->sql_query($sql); + + trigger_error($user->lang['USER_PREFS_UPDATED'] . adm_back_link($this->u_action . '&u=' . $user_id)); + } + + // Replace "error" strings with their real, localised form + $error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error); + } + + $dateformat_options = ''; + foreach ($user->lang['dateformats'] as $format => $null) + { + $dateformat_options .= ''; + } + + $s_custom = false; + + $dateformat_options .= ''; + + $sort_dir_text = array('a' => $user->lang['ASCENDING'], 'd' => $user->lang['DESCENDING']); + + // Topic ordering options + $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']); + $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']); + + // Post ordering options + $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']); + $sort_by_post_text = array('a' => $user->lang['AUTHOR'], 't' => $user->lang['POST_TIME'], 's' => $user->lang['SUBJECT']); + + $_options = array('topic', 'post'); + foreach ($_options as $sort_option) + { + ${'s_limit_' . $sort_option . '_days'} = ''; + + ${'s_sort_' . $sort_option . '_key'} = ''; + + ${'s_sort_' . $sort_option . '_dir'} = ''; + } + + $template->assign_vars(array( + 'S_PREFS' => true, + 'S_JABBER_DISABLED' => ($config['jab_enable'] && $user_row['user_jabber'] && @extension_loaded('xml')) ? false : true, + + 'VIEW_EMAIL' => $data['viewemail'], + 'MASS_EMAIL' => $data['massemail'], + 'ALLOW_PM' => $data['allowpm'], + 'HIDE_ONLINE' => $data['hideonline'], + 'NOTIFY_EMAIL' => ($data['notifymethod'] == NOTIFY_EMAIL) ? true : false, + 'NOTIFY_IM' => ($data['notifymethod'] == NOTIFY_IM) ? true : false, + 'NOTIFY_BOTH' => ($data['notifymethod'] == NOTIFY_BOTH) ? true : false, + 'NOTIFY_PM' => $data['notifypm'], + 'POPUP_PM' => $data['popuppm'], + 'DST' => $data['dst'], + 'BBCODE' => $data['bbcode'], + 'SMILIES' => $data['smilies'], + 'ATTACH_SIG' => $data['sig'], + 'NOTIFY' => $data['notify'], + 'VIEW_IMAGES' => $data['view_images'], + 'VIEW_FLASH' => $data['view_flash'], + 'VIEW_SMILIES' => $data['view_smilies'], + 'VIEW_SIGS' => $data['view_sigs'], + 'VIEW_AVATARS' => $data['view_avatars'], + 'VIEW_WORDCENSOR' => $data['view_wordcensor'], + + 'S_TOPIC_SORT_DAYS' => $s_limit_topic_days, + 'S_TOPIC_SORT_KEY' => $s_sort_topic_key, + 'S_TOPIC_SORT_DIR' => $s_sort_topic_dir, + 'S_POST_SORT_DAYS' => $s_limit_post_days, + 'S_POST_SORT_KEY' => $s_sort_post_key, + 'S_POST_SORT_DIR' => $s_sort_post_dir, + + 'DATE_FORMAT' => $data['dateformat'], + 'S_DATEFORMAT_OPTIONS' => $dateformat_options, + 'S_CUSTOM_DATEFORMAT' => $s_custom, + 'DEFAULT_DATEFORMAT' => $config['default_dateformat'], + 'A_DEFAULT_DATEFORMAT' => addslashes($config['default_dateformat']), + + 'S_LANG_OPTIONS' => language_select($data['lang']), + 'S_STYLE_OPTIONS' => style_select($data['style']), + 'S_TZ_OPTIONS' => tz_select($data['tz'], true), + ) + ); + + break; + + case 'avatar': + + include($phpbb_root_path . 'includes/functions_display.' . $phpEx); + include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + + $can_upload = (file_exists($phpbb_root_path . $config['avatar_path']) && @is_writable($phpbb_root_path . $config['avatar_path']) && $file_uploads) ? true : false; + + if ($submit) + { + + if (!check_form_key($form_name)) + { + trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + + if (avatar_process_user($error, $user_row)) + { + trigger_error($user->lang['USER_AVATAR_UPDATED'] . adm_back_link($this->u_action . '&u=' . $user_row['user_id'])); + } + + // Replace "error" strings with their real, localised form + $error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error); + } + + if (!$config['allow_avatar'] && $user_row['user_avatar_type']) + { + $error[] = $user->lang['USER_AVATAR_NOT_ALLOWED']; + } + else if ((($user_row['user_avatar_type'] == AVATAR_UPLOAD) && !$config['allow_avatar_upload']) || + (($user_row['user_avatar_type'] == AVATAR_REMOTE) && !$config['allow_avatar_remote']) || + (($user_row['user_avatar_type'] == AVATAR_GALLERY) && !$config['allow_avatar_local'])) + { + $error[] = $user->lang['USER_AVATAR_TYPE_NOT_ALLOWED']; + } + + // Generate users avatar + $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'], 'USER_AVATAR', true) : ''; + + $display_gallery = (isset($_POST['display_gallery'])) ? true : false; + $avatar_select = basename(request_var('avatar_select', '')); + $category = basename(request_var('category', '')); + + if ($config['allow_avatar_local'] && $display_gallery) + { + avatar_gallery($category, $avatar_select, 4); + } + + $template->assign_vars(array( + 'S_AVATAR' => true, + 'S_CAN_UPLOAD' => $can_upload, + 'S_UPLOAD_FILE' => ($config['allow_avatar'] && $can_upload && $config['allow_avatar_upload']) ? true : false, + 'S_REMOTE_UPLOAD' => ($config['allow_avatar'] && $can_upload && $config['allow_avatar_remote_upload']) ? true : false, + 'S_ALLOW_REMOTE' => ($config['allow_avatar'] && $config['allow_avatar_remote']) ? true : false, + 'S_DISPLAY_GALLERY' => ($config['allow_avatar'] && $config['allow_avatar_local'] && !$display_gallery) ? true : false, + 'S_IN_GALLERY' => ($config['allow_avatar'] && $config['allow_avatar_local'] && $display_gallery) ? true : false, + + 'AVATAR_IMAGE' => $avatar_img, + 'AVATAR_MAX_FILESIZE' => $config['avatar_filesize'], + 'USER_AVATAR_WIDTH' => $user_row['user_avatar_width'], + 'USER_AVATAR_HEIGHT' => $user_row['user_avatar_height'], + + 'L_AVATAR_EXPLAIN' => sprintf($user->lang['AVATAR_EXPLAIN'], $config['avatar_max_width'], $config['avatar_max_height'], round($config['avatar_filesize'] / 1024))) + ); + + break; + + case 'rank': + + if ($submit) + { + if (!check_form_key($form_name)) + { + trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + + $rank_id = request_var('user_rank', 0); + + $sql = 'UPDATE ' . USERS_TABLE . " + SET user_rank = $rank_id + WHERE user_id = $user_id"; + $db->sql_query($sql); + + trigger_error($user->lang['USER_RANK_UPDATED'] . adm_back_link($this->u_action . '&u=' . $user_id)); + } + + $sql = 'SELECT * + FROM ' . RANKS_TABLE . ' + WHERE rank_special = 1 + ORDER BY rank_title'; + $result = $db->sql_query($sql); + + $s_rank_options = ''; + + while ($row = $db->sql_fetchrow($result)) + { + $selected = ($user_row['user_rank'] && $row['rank_id'] == $user_row['user_rank']) ? ' selected="selected"' : ''; + $s_rank_options .= ''; + } + $db->sql_freeresult($result); + + $template->assign_vars(array( + 'S_RANK' => true, + 'S_RANK_OPTIONS' => $s_rank_options) + ); + + break; + + case 'sig': + + include_once($phpbb_root_path . 'includes/functions_posting.' . $phpEx); + include_once($phpbb_root_path . 'includes/functions_display.' . $phpEx); + + $enable_bbcode = ($config['allow_sig_bbcode']) ? (bool) $this->optionget($user_row, 'sig_bbcode') : false; + $enable_smilies = ($config['allow_sig_smilies']) ? (bool) $this->optionget($user_row, 'sig_smilies') : false; + $enable_urls = ($config['allow_sig_links']) ? (bool) $this->optionget($user_row, 'sig_links') : false; + $signature = utf8_normalize_nfc(request_var('signature', (string) $user_row['user_sig'], true)); + + $preview = (isset($_POST['preview'])) ? true : false; + + if ($submit || $preview) + { + include_once($phpbb_root_path . 'includes/message_parser.' . $phpEx); + + $enable_bbcode = ($config['allow_sig_bbcode']) ? ((request_var('disable_bbcode', false)) ? false : true) : false; + $enable_smilies = ($config['allow_sig_smilies']) ? ((request_var('disable_smilies', false)) ? false : true) : false; + $enable_urls = ($config['allow_sig_links']) ? ((request_var('disable_magic_url', false)) ? false : true) : false; + + $message_parser = new parse_message($signature); + + // Allowing Quote BBCode + $message_parser->parse($enable_bbcode, $enable_urls, $enable_smilies, $config['allow_sig_img'], $config['allow_sig_flash'], true, $config['allow_sig_links'], true, 'sig'); + + if (sizeof($message_parser->warn_msg)) + { + $error[] = implode('
', $message_parser->warn_msg); + } + + if (!check_form_key($form_name)) + { + $error = 'FORM_INVALID'; + } + + if (!sizeof($error) && $submit) + { + $this->optionset($user_row, 'sig_bbcode', $enable_bbcode); + $this->optionset($user_row, 'sig_smilies', $enable_smilies); + $this->optionset($user_row, 'sig_links', $enable_urls); + + $sql_ary = array( + 'user_sig' => (string) $message_parser->message, + 'user_options' => $user_row['user_options'], + 'user_sig_bbcode_uid' => (string) $message_parser->bbcode_uid, + 'user_sig_bbcode_bitfield' => (string) $message_parser->bbcode_bitfield + ); + + $sql = 'UPDATE ' . USERS_TABLE . ' + SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' + WHERE user_id = ' . $user_id; + $db->sql_query($sql); + + trigger_error($user->lang['USER_SIG_UPDATED'] . adm_back_link($this->u_action . '&u=' . $user_id)); + } + + // Replace "error" strings with their real, localised form + $error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error); + } + + $signature_preview = ''; + + if ($preview) + { + // Now parse it for displaying + $signature_preview = $message_parser->format_display($enable_bbcode, $enable_urls, $enable_smilies, false); + unset($message_parser); + } + + decode_message($signature, $user_row['user_sig_bbcode_uid']); + + $template->assign_vars(array( + 'S_SIGNATURE' => true, + + 'SIGNATURE' => $signature, + 'SIGNATURE_PREVIEW' => $signature_preview, + + 'S_BBCODE_CHECKED' => (!$enable_bbcode) ? ' checked="checked"' : '', + 'S_SMILIES_CHECKED' => (!$enable_smilies) ? ' checked="checked"' : '', + 'S_MAGIC_URL_CHECKED' => (!$enable_urls) ? ' checked="checked"' : '', + + 'BBCODE_STATUS' => ($config['allow_sig_bbcode']) ? sprintf($user->lang['BBCODE_IS_ON'], '', '') : sprintf($user->lang['BBCODE_IS_OFF'], '', ''), + 'SMILIES_STATUS' => ($config['allow_sig_smilies']) ? $user->lang['SMILIES_ARE_ON'] : $user->lang['SMILIES_ARE_OFF'], + 'IMG_STATUS' => ($config['allow_sig_img']) ? $user->lang['IMAGES_ARE_ON'] : $user->lang['IMAGES_ARE_OFF'], + 'FLASH_STATUS' => ($config['allow_sig_flash']) ? $user->lang['FLASH_IS_ON'] : $user->lang['FLASH_IS_OFF'], + 'URL_STATUS' => ($config['allow_sig_links']) ? $user->lang['URL_IS_ON'] : $user->lang['URL_IS_OFF'], + + 'L_SIGNATURE_EXPLAIN' => sprintf($user->lang['SIGNATURE_EXPLAIN'], $config['max_sig_chars']), + + 'S_BBCODE_ALLOWED' => $config['allow_sig_bbcode'], + 'S_SMILIES_ALLOWED' => $config['allow_sig_smilies'], + 'S_BBCODE_IMG' => ($config['allow_sig_img']) ? true : false, + 'S_BBCODE_FLASH' => ($config['allow_sig_flash']) ? true : false, + 'S_LINKS_ALLOWED' => ($config['allow_sig_links']) ? true : false) + ); + + // Assigning custom bbcodes + display_custom_bbcodes(); + + break; + + case 'attach': + + $start = request_var('start', 0); + $deletemark = (isset($_POST['delmarked'])) ? true : false; + $marked = request_var('mark', array(0)); + + // Sort keys + $sort_key = request_var('sk', 'a'); + $sort_dir = request_var('sd', 'd'); + + if ($deletemark && sizeof($marked)) + { + $sql = 'SELECT attach_id + FROM ' . ATTACHMENTS_TABLE . ' + WHERE poster_id = ' . $user_id . ' + AND is_orphan = 0 + AND ' . $db->sql_in_set('attach_id', $marked); + $result = $db->sql_query($sql); + + $marked = array(); + while ($row = $db->sql_fetchrow($result)) + { + $marked[] = $row['attach_id']; + } + $db->sql_freeresult($result); + } + + if ($deletemark && sizeof($marked)) + { + if (confirm_box(true)) + { + $sql = 'SELECT real_filename + FROM ' . ATTACHMENTS_TABLE . ' + WHERE ' . $db->sql_in_set('attach_id', $marked); + $result = $db->sql_query($sql); + + $log_attachments = array(); + while ($row = $db->sql_fetchrow($result)) + { + $log_attachments[] = $row['real_filename']; + } + $db->sql_freeresult($result); + + delete_attachments('attach', $marked); + + $message = (sizeof($log_attachments) == 1) ? $user->lang['ATTACHMENT_DELETED'] : $user->lang['ATTACHMENTS_DELETED']; + + add_log('admin', 'LOG_ATTACHMENTS_DELETED', implode(', ', $log_attachments)); + trigger_error($message . adm_back_link($this->u_action . '&u=' . $user_id)); + } + else + { + confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( + 'u' => $user_id, + 'i' => $id, + 'mode' => $mode, + 'action' => $action, + 'delmarked' => true, + 'mark' => $marked)) + ); + } + } + + $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']); + $sk_sql = array('a' => 'a.real_filename', 'c' => 'a.extension', 'd' => 'a.filesize', 'e' => 'a.download_count', 'f' => 'a.filetime', 'g' => 't.topic_title'); + + $sd_text = array('a' => $user->lang['ASCENDING'], 'd' => $user->lang['DESCENDING']); + + $s_sort_key = ''; + foreach ($sk_text as $key => $value) + { + $selected = ($sort_key == $key) ? ' selected="selected"' : ''; + $s_sort_key .= ''; + } + + $s_sort_dir = ''; + foreach ($sd_text as $key => $value) + { + $selected = ($sort_dir == $key) ? ' selected="selected"' : ''; + $s_sort_dir .= ''; + } + + if (!isset($sk_sql[$sort_key])) + { + $sort_key = 'a'; + } + + $order_by = $sk_sql[$sort_key] . ' ' . (($sort_dir == 'a') ? 'ASC' : 'DESC'); + + $sql = 'SELECT COUNT(attach_id) as num_attachments + FROM ' . ATTACHMENTS_TABLE . " + WHERE poster_id = $user_id + AND is_orphan = 0"; + $result = $db->sql_query_limit($sql, 1); + $num_attachments = (int) $db->sql_fetchfield('num_attachments'); + $db->sql_freeresult($result); + + $sql = 'SELECT a.*, t.topic_title, p.message_subject as message_title + FROM ' . ATTACHMENTS_TABLE . ' a + LEFT JOIN ' . TOPICS_TABLE . ' t ON (a.topic_id = t.topic_id + AND a.in_message = 0) + LEFT JOIN ' . PRIVMSGS_TABLE . ' p ON (a.post_msg_id = p.msg_id + AND a.in_message = 1) + WHERE a.poster_id = ' . $user_id . " + AND a.is_orphan = 0 + ORDER BY $order_by"; + $result = $db->sql_query_limit($sql, $config['posts_per_page'], $start); + + while ($row = $db->sql_fetchrow($result)) + { + if ($row['in_message']) + { + $view_topic = append_sid("{$phpbb_root_path}ucp.$phpEx", "i=pm&p={$row['post_msg_id']}"); + } + else + { + $view_topic = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "t={$row['topic_id']}&p={$row['post_msg_id']}") . '#p' . $row['post_msg_id']; + } + + $template->assign_block_vars('attach', array( + 'REAL_FILENAME' => $row['real_filename'], + 'COMMENT' => nl2br($row['attach_comment']), + 'EXTENSION' => $row['extension'], + 'SIZE' => get_formatted_filesize($row['filesize']), + 'DOWNLOAD_COUNT' => $row['download_count'], + 'POST_TIME' => $user->format_date($row['filetime']), + 'TOPIC_TITLE' => ($row['in_message']) ? $row['message_title'] : $row['topic_title'], + + 'ATTACH_ID' => $row['attach_id'], + 'POST_ID' => $row['post_msg_id'], + 'TOPIC_ID' => $row['topic_id'], + + 'S_IN_MESSAGE' => $row['in_message'], + + 'U_DOWNLOAD' => append_sid("{$phpbb_root_path}download/file.$phpEx", 'mode=view&id=' . $row['attach_id']), + 'U_VIEW_TOPIC' => $view_topic) + ); + } + $db->sql_freeresult($result); + + $template->assign_vars(array( + 'S_ATTACHMENTS' => true, + 'S_ON_PAGE' => on_page($num_attachments, $config['topics_per_page'], $start), + 'S_SORT_KEY' => $s_sort_key, + 'S_SORT_DIR' => $s_sort_dir, + + 'PAGINATION' => generate_pagination($this->u_action . "&u=$user_id&sk=$sort_key&sd=$sort_dir", $num_attachments, $config['topics_per_page'], $start, true)) + ); + + break; + + case 'groups': + + include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + + $user->add_lang(array('groups', 'acp/groups')); + $group_id = request_var('g', 0); + + if ($group_id) + { + // Check the founder only entry for this group to make sure everything is well + $sql = 'SELECT group_founder_manage + FROM ' . GROUPS_TABLE . ' + WHERE group_id = ' . $group_id; + $result = $db->sql_query($sql); + $founder_manage = (int) $db->sql_fetchfield('group_founder_manage'); + $db->sql_freeresult($result); + + if ($user->data['user_type'] != USER_FOUNDER && $founder_manage) + { + trigger_error($user->lang['NOT_ALLOWED_MANAGE_GROUP'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + } + else + { + $founder_manage = 0; + } + + switch ($action) + { + case 'demote': + case 'promote': + case 'default': + if (!$group_id) + { + trigger_error($user->lang['NO_GROUP'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + group_user_attributes($action, $group_id, $user_id); + + if ($action == 'default') + { + $user_row['group_id'] = $group_id; + } + break; + + case 'delete': + + if (confirm_box(true)) + { + if (!$group_id) + { + trigger_error($user->lang['NO_GROUP'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + + if ($error = group_user_del($group_id, $user_id)) + { + trigger_error($user->lang[$error] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + + $error = array(); + + // The delete action was successful - therefore update the user row... + $sql = 'SELECT u.*, s.* + FROM ' . USERS_TABLE . ' u + LEFT JOIN ' . SESSIONS_TABLE . ' s ON (s.session_user_id = u.user_id) + WHERE u.user_id = ' . $user_id . ' + ORDER BY s.session_time DESC'; + $result = $db->sql_query($sql); + $user_row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + } + else + { + confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( + 'u' => $user_id, + 'i' => $id, + 'mode' => $mode, + 'action' => $action, + 'g' => $group_id)) + ); + } + + break; + + case 'approve': + + if (confirm_box(true)) + { + if (!$group_id) + { + trigger_error($user->lang['NO_GROUP'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + group_user_attributes($action, $group_id, $user_id); + } + else + { + confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( + 'u' => $user_id, + 'i' => $id, + 'mode' => $mode, + 'action' => $action, + 'g' => $group_id)) + ); + } + + break; + } + + // Add user to group? + if ($submit) + { + + if (!check_form_key($form_name)) + { + trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + + if (!$group_id) + { + trigger_error($user->lang['NO_GROUP'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + + // Add user/s to group + if ($error = group_user_add($group_id, $user_id)) + { + trigger_error($user->lang[$error] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + + $error = array(); + } + + + $sql = 'SELECT ug.*, g.* + FROM ' . GROUPS_TABLE . ' g, ' . USER_GROUP_TABLE . " ug + WHERE ug.user_id = $user_id + AND g.group_id = ug.group_id + ORDER BY g.group_type DESC, ug.user_pending ASC, g.group_name"; + $result = $db->sql_query($sql); + + $i = 0; + $group_data = $id_ary = array(); + while ($row = $db->sql_fetchrow($result)) + { + $type = ($row['group_type'] == GROUP_SPECIAL) ? 'special' : (($row['user_pending']) ? 'pending' : 'normal'); + + $group_data[$type][$i]['group_id'] = $row['group_id']; + $group_data[$type][$i]['group_name'] = $row['group_name']; + $group_data[$type][$i]['group_leader'] = ($row['group_leader']) ? 1 : 0; + + $id_ary[] = $row['group_id']; + + $i++; + } + $db->sql_freeresult($result); + + // Select box for other groups + $sql = 'SELECT group_id, group_name, group_type, group_founder_manage + FROM ' . GROUPS_TABLE . ' + ' . ((sizeof($id_ary)) ? 'WHERE ' . $db->sql_in_set('group_id', $id_ary, true) : '') . ' + ORDER BY group_type DESC, group_name ASC'; + $result = $db->sql_query($sql); + + $s_group_options = ''; + while ($row = $db->sql_fetchrow($result)) + { + if (!$config['coppa_enable'] && $row['group_name'] == 'REGISTERED_COPPA') + { + continue; + } + + // Do not display those groups not allowed to be managed + if ($user->data['user_type'] != USER_FOUNDER && $row['group_founder_manage']) + { + continue; + } + + $s_group_options .= '' . (($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name']) . ''; + } + $db->sql_freeresult($result); + + $current_type = ''; + foreach ($group_data as $group_type => $data_ary) + { + if ($current_type != $group_type) + { + $template->assign_block_vars('group', array( + 'S_NEW_GROUP_TYPE' => true, + 'GROUP_TYPE' => $user->lang['USER_GROUP_' . strtoupper($group_type)]) + ); + } + + foreach ($data_ary as $data) + { + $template->assign_block_vars('group', array( + '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"), + 'U_DEFAULT' => $this->u_action . "&action=default&u=$user_id&g=" . $data['group_id'], + 'U_DEMOTE_PROMOTE' => $this->u_action . '&action=' . (($data['group_leader']) ? 'demote' : 'promote') . "&u=$user_id&g=" . $data['group_id'], + 'U_DELETE' => $this->u_action . "&action=delete&u=$user_id&g=" . $data['group_id'], + 'U_APPROVE' => ($group_type == 'pending') ? $this->u_action . "&action=approve&u=$user_id&g=" . $data['group_id'] : '', + + 'GROUP_NAME' => ($group_type == 'special') ? $user->lang['G_' . $data['group_name']] : $data['group_name'], + 'L_DEMOTE_PROMOTE' => ($data['group_leader']) ? $user->lang['GROUP_DEMOTE'] : $user->lang['GROUP_PROMOTE'], + + 'S_IS_MEMBER' => ($group_type != 'pending') ? true : false, + 'S_NO_DEFAULT' => ($user_row['group_id'] != $data['group_id']) ? true : false, + 'S_SPECIAL_GROUP' => ($group_type == 'special') ? true : false, + ) + ); + } + } + + $template->assign_vars(array( + 'S_GROUPS' => true, + 'S_GROUP_OPTIONS' => $s_group_options) + ); + + break; + + case 'perm': + + include_once($phpbb_root_path . 'includes/acp/auth.' . $phpEx); + + $auth_admin = new auth_admin(); + + $user->add_lang('acp/permissions'); + add_permission_language(); + + $forum_id = request_var('f', 0); + + // Global Permissions + if (!$forum_id) + { + // Select auth options + $sql = 'SELECT auth_option, is_local, is_global + FROM ' . ACL_OPTIONS_TABLE . ' + WHERE auth_option ' . $db->sql_like_expression($db->any_char . '_') . ' + AND is_global = 1 + ORDER BY auth_option'; + $result = $db->sql_query($sql); + + $hold_ary = array(); + + while ($row = $db->sql_fetchrow($result)) + { + $hold_ary = $auth_admin->get_mask('view', $user_id, false, false, $row['auth_option'], 'global', ACL_NEVER); + $auth_admin->display_mask('view', $row['auth_option'], $hold_ary, 'user', false, false); + } + $db->sql_freeresult($result); + + unset($hold_ary); + } + else + { + $sql = 'SELECT auth_option, is_local, is_global + FROM ' . ACL_OPTIONS_TABLE . " + WHERE auth_option " . $db->sql_like_expression($db->any_char . '_') . " + AND is_local = 1 + ORDER BY is_global DESC, auth_option"; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $hold_ary = $auth_admin->get_mask('view', $user_id, false, $forum_id, $row['auth_option'], 'local', ACL_NEVER); + $auth_admin->display_mask('view', $row['auth_option'], $hold_ary, 'user', true, false); + } + $db->sql_freeresult($result); + } + + $s_forum_options = ''; + $s_forum_options .= make_forum_select($forum_id, false, true, false, false, false); + + $template->assign_vars(array( + 'S_PERMISSIONS' => true, + + 'S_GLOBAL' => (!$forum_id) ? true : false, + 'S_FORUM_OPTIONS' => $s_forum_options, + + 'U_ACTION' => $this->u_action . '&u=' . $user_id, + 'U_USER_PERMISSIONS' => append_sid("{$phpbb_admin_path}index.$phpEx" ,'i=permissions&mode=setting_user_global&user_id[]=' . $user_id), + 'U_USER_FORUM_PERMISSIONS' => append_sid("{$phpbb_admin_path}index.$phpEx", 'i=permissions&mode=setting_user_local&user_id[]=' . $user_id)) + ); + + break; + + } + + // Assign general variables + $template->assign_vars(array( + 'S_ERROR' => (sizeof($error)) ? true : false, + 'ERROR_MSG' => (sizeof($error)) ? implode('
', $error) : '') + ); + } + + /** + * Optionset replacement for this module based on $user->optionset + */ + function optionset(&$user_row, $key, $value, $data = false) + { + global $user; + + $var = ($data) ? $data : $user_row['user_options']; + + if ($value && !($var & 1 << $user->keyoptions[$key])) + { + $var += 1 << $user->keyoptions[$key]; + } + else if (!$value && ($var & 1 << $user->keyoptions[$key])) + { + $var -= 1 << $user->keyoptions[$key]; + } + else + { + return ($data) ? $var : false; + } + + if (!$data) + { + $user_row['user_options'] = $var; + return true; + } + else + { + return $var; + } + } + + /** + * Optionget replacement for this module based on $user->optionget + */ + function optionget(&$user_row, $key, $data = false) + { + global $user; + + $var = ($data) ? $data : $user_row['user_options']; + return ($var & 1 << $user->keyoptions[$key]) ? true : false; + } +} + +?> \ No newline at end of file -- cgit v1.2.1 From b68de2323d6444b4b3685a98bbcb9500a38e45cb Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Wed, 16 Dec 2009 15:48:23 +0000 Subject: merge changes from 3.0.x branch git-svn-id: file:///svn/phpbb/trunk@10342 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/acp/acp_users.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index afca056eb2..4905840e02 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1416,7 +1416,7 @@ class acp_users $now = getdate(); $s_birthday_year_options = ''; - for ($i = $now['year'] - 100; $i < $now['year']; $i++) + for ($i = $now['year'] - 100; $i <= $now['year']; $i++) { $selected = ($i == $data['bday_year']) ? ' selected="selected"' : ''; $s_birthday_year_options .= ""; -- cgit v1.2.1 From 67b243cfc53e3f5f8bf6cd2a5eb80df475a6dd4c Mon Sep 17 00:00:00 2001 From: rxu Date: Tue, 26 Oct 2010 01:38:09 +0800 Subject: [ticket/9867] Adjust the implementation of error messages localization. Use array_map instead of preg_replace. PHPBB3-9867 --- phpBB/includes/acp/acp_users.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 6be0760be0..e9550648ad 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -921,7 +921,7 @@ class acp_users } // Replace "error" strings with their real, localised form - $error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error); + $error = array_map(array($user, 'lang'), $error); } if ($user_id == $user->data['user_id']) @@ -1405,7 +1405,7 @@ class acp_users } // Replace "error" strings with their real, localised form - $error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error); + $error = array_map(array($user, 'lang'), $error); } $s_birthday_day_options = ''; @@ -1588,7 +1588,7 @@ class acp_users } // Replace "error" strings with their real, localised form - $error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error); + $error = array_map(array($user, 'lang'), $error); } $dateformat_options = ''; @@ -1714,7 +1714,7 @@ class acp_users } // Replace "error" strings with their real, localised form - $error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error); + $error = array_map(array($user, 'lang'), $error); } if (!$config['allow_avatar'] && $user_row['user_avatar_type']) @@ -1857,7 +1857,7 @@ class acp_users } // Replace "error" strings with their real, localised form - $error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error); + $error = array_map(array($user, 'lang'), $error); } $signature_preview = ''; -- cgit v1.2.1 From af5b9a96409d788733fcb1ff367e0c7fb0583702 Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Tue, 9 Nov 2010 08:59:25 +0100 Subject: [ticket/9556] Drop php closing tags, add trailing newline Closing tags converted using Oleg's script. remove-php-end-tags.py -a . Trailing newlines added using the following where $ext is file extension. find . -type f -name "*.$ext" -print | xargs printf "e %s\nw\n" | ed -s; Extensions: php, css, html, js, xml. PHPBB3-9556 --- phpBB/includes/acp/acp_users.php | 2 -- 1 file changed, 2 deletions(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index e9550648ad..79c594ed6d 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -2388,5 +2388,3 @@ class acp_users return ($var & 1 << $user->keyoptions[$key]) ? true : false; } } - -?> \ No newline at end of file -- cgit v1.2.1 From 3c713b5e7d883d7414538de0557c68195cd73018 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Tue, 3 Aug 2010 11:41:01 +0200 Subject: [ticket/9746] Adding some more calls to phpbb_ip_normalise(). PHPBB3-9746 --- phpBB/includes/acp/acp_users.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 79c594ed6d..006c3617f7 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -56,7 +56,7 @@ class acp_users $this->page_title = 'WHOIS'; $this->tpl_name = 'simple_body'; - $user_ip = request_var('user_ip', ''); + $user_ip = phpbb_ip_normalise(request_var('user_ip', '')); $domain = gethostbyaddr($user_ip); $ipwhois = user_ipwhois($user_ip); -- cgit v1.2.1 From 179662e949967090724c5e14ea4d4d399886a38a Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 20 Sep 2011 01:33:33 +0200 Subject: [ticket/10345] Use the plural function in some more places. I added two function avatar_explanation_string() and avatar_error_wrong_size() for easier handling of the "pixels"-languages, as they are used quite often. PHPBB3-10345 --- phpBB/includes/acp/acp_users.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 38bcbf5ee3..3ae1278396 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1748,8 +1748,8 @@ class acp_users 'USER_AVATAR_WIDTH' => $user_row['user_avatar_width'], 'USER_AVATAR_HEIGHT' => $user_row['user_avatar_height'], - 'L_AVATAR_EXPLAIN' => sprintf($user->lang['AVATAR_EXPLAIN'], $config['avatar_max_width'], $config['avatar_max_height'], round($config['avatar_filesize'] / 1024))) - ); + 'L_AVATAR_EXPLAIN' => avatar_explanation_string() + )); break; @@ -1881,7 +1881,7 @@ class acp_users 'FLASH_STATUS' => ($config['allow_sig_flash']) ? $user->lang['FLASH_IS_ON'] : $user->lang['FLASH_IS_OFF'], 'URL_STATUS' => ($config['allow_sig_links']) ? $user->lang['URL_IS_ON'] : $user->lang['URL_IS_OFF'], - 'L_SIGNATURE_EXPLAIN' => sprintf($user->lang['SIGNATURE_EXPLAIN'], $config['max_sig_chars']), + 'L_SIGNATURE_EXPLAIN' => $user->lang('SIGNATURE_EXPLAIN', (int) $config['max_sig_chars']), 'S_BBCODE_ALLOWED' => $config['allow_sig_bbcode'], 'S_SMILIES_ALLOWED' => $config['allow_sig_smilies'], -- cgit v1.2.1 From c4aa8d8401420f8f36a622dc279587ee07466925 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 20 Sep 2011 23:29:52 +0200 Subject: [ticket/10345] Fix some last use cases of sprintf() to use $user->lang() PHPBB3-10345 --- phpBB/includes/acp/acp_users.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 3ae1278396..a41fd3d17a 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1010,8 +1010,8 @@ class acp_users $db->sql_freeresult($result); $template->assign_vars(array( - 'L_NAME_CHARS_EXPLAIN' => sprintf($user->lang[$config['allow_name_chars'] . '_EXPLAIN'], $config['min_name_chars'], $config['max_name_chars']), - 'L_CHANGE_PASSWORD_EXPLAIN' => sprintf($user->lang[$config['pass_complex'] . '_EXPLAIN'], $config['min_pass_chars'], $config['max_pass_chars']), + 'L_NAME_CHARS_EXPLAIN' => $user->lang($config['allow_name_chars'] . '_EXPLAIN', $user->lang('CHARACTERS', (int) $config['min_name_chars']), $user->lang('CHARACTERS', (int) $config['max_name_chars'])), + 'L_CHANGE_PASSWORD_EXPLAIN' => $user->lang($config['pass_complex'] . '_EXPLAIN', $user->lang('CHARACTERS', (int) $config['min_pass_chars']), $user->lang('CHARACTERS', (int) $config['max_pass_chars'])), 'L_POSTS_IN_QUEUE' => $user->lang('NUM_POSTS_IN_QUEUE', $user_row['posts_in_queue']), 'S_FOUNDER' => ($user->data['user_type'] == USER_FOUNDER) ? true : false, -- cgit v1.2.1 From b790d2e2839850c053b6fecc4f5d767746c47f20 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 30 Nov 2011 21:03:29 +0100 Subject: [ticket/10345] Add documentation and phpbb_ prefix to the new avatar functions PHPBB3-10345 --- phpBB/includes/acp/acp_users.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index a41fd3d17a..c1ad28ca14 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1748,7 +1748,7 @@ class acp_users 'USER_AVATAR_WIDTH' => $user_row['user_avatar_width'], 'USER_AVATAR_HEIGHT' => $user_row['user_avatar_height'], - 'L_AVATAR_EXPLAIN' => avatar_explanation_string() + 'L_AVATAR_EXPLAIN' => phpbb_avatar_explanation_string(), )); break; -- cgit v1.2.1 From 53617dfce57ba23caa163a871797cec26b88403b Mon Sep 17 00:00:00 2001 From: David King Date: Wed, 21 Dec 2011 03:28:00 +0000 Subject: [ticket/10541] Fixed empty drop-down menu bug PHPBB3-10541 --- phpBB/includes/acp/acp_users.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index c1ad28ca14..631d3bf272 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -120,7 +120,7 @@ class acp_users // Build modes dropdown list $sql = 'SELECT module_mode, module_auth FROM ' . MODULES_TABLE . " - WHERE module_basename = 'users' + WHERE module_basename = 'acp_users' AND module_enabled = 1 AND module_class = 'acp' ORDER BY left_id, module_mode"; -- cgit v1.2.1 From 4baa2bb52c47b0b0e316c3a25f34e7bc27075ffd Mon Sep 17 00:00:00 2001 From: David King Date: Fri, 23 Dec 2011 21:55:49 +0000 Subject: [ticket/10535] Removed email confirm field from acp_users module PHPBB3-10535 --- phpBB/includes/acp/acp_users.php | 7 ------- 1 file changed, 7 deletions(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index c1ad28ca14..cf5650a901 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -757,7 +757,6 @@ class acp_users 'username' => utf8_normalize_nfc(request_var('user', $user_row['username'], true)), 'user_founder' => request_var('user_founder', ($user_row['user_type'] == USER_FOUNDER) ? 1 : 0), 'email' => strtolower(request_var('user_email', $user_row['user_email'])), - 'email_confirm' => strtolower(request_var('email_confirm', '')), 'new_password' => request_var('new_password', '', true), 'password_confirm' => request_var('password_confirm', '', true), ); @@ -789,7 +788,6 @@ class acp_users array('string', false, 6, 60), array('email', $user_row['user_email']) ), - 'email_confirm' => array('string', true, 6, 60) ); } @@ -800,11 +798,6 @@ class acp_users $error[] = 'NEW_PASSWORD_ERROR'; } - if ($data['email'] != $user_row['user_email'] && $data['email_confirm'] != $data['email']) - { - $error[] = 'NEW_EMAIL_ERROR'; - } - if (!check_form_key($form_name)) { $error[] = 'FORM_INVALID'; -- cgit v1.2.1 From 7a04c9048c110f0bd21ea3e9e869e17b408d640e Mon Sep 17 00:00:00 2001 From: Unknown Date: Sat, 31 Dec 2011 13:32:52 +0000 Subject: [ticket/9916] Updating header license and removing Version $Id$ PHPBB3-9916 --- phpBB/includes/acp/acp_users.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index c1ad28ca14..d505f79a9f 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -2,9 +2,8 @@ /** * * @package acp -* @version $Id$ * @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ -- cgit v1.2.1 From ccdd176b72250be2e8f72bd13147679a5f2a263b Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev Date: Fri, 16 Mar 2012 04:56:41 -0400 Subject: [task/php54-ascraeus] Bring p_master#module_auth into PHP 5 era. Split module_auth into a static and a non-static version. Call the static version statically and the non-static version non-statically. PHPBB3-10615 --- phpBB/includes/acp/acp_users.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 97f4b1b5fd..cf6716c322 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -128,7 +128,7 @@ class acp_users $dropdown_modes = array(); while ($row = $db->sql_fetchrow($result)) { - if (!$this->p_master->module_auth($row['module_auth'])) + if (!$this->p_master->module_auth_self($row['module_auth'])) { continue; } -- cgit v1.2.1 From 4c699e0d0acc0aafab37e36206a92b1919282dac Mon Sep 17 00:00:00 2001 From: Cullen Walsh Date: Sun, 17 Apr 2011 19:29:28 -0700 Subject: [feature/avatars] Modularized Avatars A modularized avatar system that easily allows plugins to be created for various avatar services, such as Gravatar. This inital commit includes module support and is backwards compatible with 3.0 avatars, but does notcontain ACP or UCP modules for manipulating new avatars. PHPBB3-10018 --- phpBB/includes/acp/acp_users.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 97f4b1b5fd..390e421a51 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1715,7 +1715,7 @@ class acp_users } // Generate users avatar - $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'], 'USER_AVATAR', true) : ''; + $avatar_img = ($user_row['user_avatar']) ? get_user_avatar($user_row, 'USER_AVATAR', true) : ''; $display_gallery = (isset($_POST['display_gallery'])) ? true : false; $avatar_select = basename(request_var('avatar_select', '')); -- cgit v1.2.1 From 84099e5bc1f452e1a4643fd78658929875ab1eee Mon Sep 17 00:00:00 2001 From: Cullen Walsh Date: Wed, 20 Apr 2011 23:14:38 -0700 Subject: [feature/avatars] Support proper avatar deletion, stub ACP Fixing avatar deletion in the UCP and ACP, and stubbing the ACP configuration page. I'll admit I kind of got caught carried away, so this really should be a couple separate commits. PHPBB3-10018 --- phpBB/includes/acp/acp_users.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 390e421a51..5dc1829e8b 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -452,10 +452,10 @@ class acp_users { trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); } - + $sql_ary = array( 'user_avatar' => '', - 'user_avatar_type' => 0, + 'user_avatar_type' => '', 'user_avatar_width' => 0, 'user_avatar_height' => 0, ); @@ -466,9 +466,10 @@ class acp_users $db->sql_query($sql); // Delete old avatar if present - if ($user_row['user_avatar'] && $user_row['user_avatar_type'] != AVATAR_GALLERY) + $avatar_manager = new phpbb_avatar_manager($phpbb_root_path, $phpEx, $config, $cache->getDriver()); + if ($driver = $avatar_manager->get_driver($user_row['user_avatar_type'])) { - avatar_delete('user', $user_row); + $driver->delete($user_row); } add_log('admin', 'LOG_USER_DEL_AVATAR', $user_row['username']); -- cgit v1.2.1 From 22c864cb3a945b52fe9b91765d247abfe00b50bc Mon Sep 17 00:00:00 2001 From: Cullen Walsh Date: Wed, 15 Jun 2011 12:58:02 -0700 Subject: [feature/avatars] Dynamically list the avatar types in UCP and ACP List the avatar types more nicely, adding UCP modify user support PHPBB3-10018 --- phpBB/includes/acp/acp_users.php | 136 +++++++++++++++++++++++++++------------ 1 file changed, 94 insertions(+), 42 deletions(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 5dc1829e8b..9c8a1c683e 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1683,65 +1683,117 @@ class acp_users case 'avatar': include($phpbb_root_path . 'includes/functions_display.' . $phpEx); - include($phpbb_root_path . 'includes/functions_user.' . $phpEx); - - $can_upload = (file_exists($phpbb_root_path . $config['avatar_path']) && phpbb_is_writable($phpbb_root_path . $config['avatar_path']) && $file_uploads) ? true : false; - if ($submit) + $avatars_enabled = false; + if ($config['allow_avatar']) { + $avatar_manager = new phpbb_avatar_manager($phpbb_root_path, $phpEx, $config, $cache->getDriver()); - if (!check_form_key($form_name)) + if (isset($_POST['av_delete'])) { + if (!check_form_key($form_name)) + { trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + + $result = array( + 'user_avatar' => '', + 'user_avatar_type' => '', + 'user_avatar_height' => 0, + 'user_avatar_width' => 0, + ); + + if ($driver = $avatar_manager->get_driver($user_row['user_avatar_type'])) + { + $driver->delete($user_row); + } + + $sql = 'UPDATE ' . USERS_TABLE . ' + SET ' . $db->sql_build_array('UPDATE', $result) . ' + WHERE user_id = ' . $user_id; + + $db->sql_query($sql); + trigger_error($user->lang['USER_AVATAR_UPDATED'] . adm_back_link($this->u_action . '&u=' . $user_id)); } - if (avatar_process_user($error, $user_row, $can_upload)) + $avatar_drivers = $avatar_manager->get_valid_drivers(); + sort($avatar_drivers); + + foreach ($avatar_drivers as $driver) { - trigger_error($user->lang['USER_AVATAR_UPDATED'] . adm_back_link($this->u_action . '&u=' . $user_row['user_id'])); - } + if ($config["allow_avatar_$driver"]) + { + $avatars_enabled = true; + $template->set_filenames(array( + 'avatar' => "acp_avatar_options_$driver.html", + )); - // Replace "error" strings with their real, localised form - $error = array_map(array($user, 'lang'), $error); - } + $avatar = $avatar_manager->get_driver($driver); + if (isset($_POST["submit_av_$driver"])) + { + if (!check_form_key($form_name)) + { + trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } - if (!$config['allow_avatar'] && $user_row['user_avatar_type']) - { - $error[] = $user->lang['USER_AVATAR_NOT_ALLOWED']; - } - else if ((($user_row['user_avatar_type'] == AVATAR_UPLOAD) && !$config['allow_avatar_upload']) || - (($user_row['user_avatar_type'] == AVATAR_REMOTE) && !$config['allow_avatar_remote']) || - (($user_row['user_avatar_type'] == AVATAR_GALLERY) && !$config['allow_avatar_local'])) - { - $error[] = $user->lang['USER_AVATAR_TYPE_NOT_ALLOWED']; - } + $result = $avatar->process_form($template, $user_row, $error); - // Generate users avatar - $avatar_img = ($user_row['user_avatar']) ? get_user_avatar($user_row, 'USER_AVATAR', true) : ''; + if ($result && empty($error)) + { + // Success! Lets save the result in the database + $result['user_avatar_type'] = $driver; + $sql = 'UPDATE ' . USERS_TABLE . ' + SET ' . $db->sql_build_array('UPDATE', $result) . ' + WHERE user_id = ' . $user_id; - $display_gallery = (isset($_POST['display_gallery'])) ? true : false; - $avatar_select = basename(request_var('avatar_select', '')); - $category = basename(request_var('category', '')); + $db->sql_query($sql); + trigger_error($user->lang['USER_AVATAR_UPDATED'] . adm_back_link($this->u_action . '&u=' . $user_id)); + } + } - if ($config['allow_avatar_local'] && $display_gallery) + if ($avatar->prepare_form($template, $user_row, $error)) + { + $driver_u = strtoupper($driver); + $template->assign_block_vars('avatar_drivers', array( + 'L_TITLE' => $user->lang('AVATAR_DRIVER_' . $driver_u . '_TITLE'), // @TODO add lang values + 'L_EXPLAIN' => $user->lang('AVATAR_DRIVER_' . $driver_u . '_EXPLAIN'), + 'DRIVER' => $driver, + 'OUTPUT' => $template->assign_display('avatar'), + )); + } + } + } + } + + // Replace "error" strings with their real, localised form + $err = $error; + $error = array(); + foreach ($err as $e) { - avatar_gallery($category, $avatar_select, 4); + if (is_array($e)) + { + $key = array_shift($e); + $error[] = vsprintf($user->lang($key), $e); + } + else + { + $error[] = $user->lang((string) $e); + } } + + $avatar = get_user_avatar($user_row, 'USER_AVATAR', true); $template->assign_vars(array( - 'S_AVATAR' => true, - 'S_CAN_UPLOAD' => $can_upload, - 'S_UPLOAD_FILE' => ($config['allow_avatar'] && $can_upload && $config['allow_avatar_upload']) ? true : false, - 'S_REMOTE_UPLOAD' => ($config['allow_avatar'] && $can_upload && $config['allow_avatar_remote_upload']) ? true : false, - 'S_ALLOW_REMOTE' => ($config['allow_avatar'] && $config['allow_avatar_remote']) ? true : false, - 'S_DISPLAY_GALLERY' => ($config['allow_avatar'] && $config['allow_avatar_local'] && !$display_gallery) ? true : false, - 'S_IN_GALLERY' => ($config['allow_avatar'] && $config['allow_avatar_local'] && $display_gallery) ? true : false, - - 'AVATAR_IMAGE' => $avatar_img, - 'AVATAR_MAX_FILESIZE' => $config['avatar_filesize'], - 'USER_AVATAR_WIDTH' => $user_row['user_avatar_width'], - 'USER_AVATAR_HEIGHT' => $user_row['user_avatar_height'], - - 'L_AVATAR_EXPLAIN' => phpbb_avatar_explanation_string(), + 'S_AVATAR' => true, + 'ERROR' => (sizeof($error)) ? implode('
', $error) : '', + 'AVATAR' => (empty($avatar) ? '' : $avatar), + 'AV_SHOW_DELETE' => !empty($avatar), + + 'S_FORM_ENCTYPE' => ' enctype="multipart/form-data"', + + 'L_AVATAR_EXPLAIN' => sprintf($user->lang['AVATAR_EXPLAIN'], $config['avatar_max_width'], $config['avatar_max_height'], $config['avatar_filesize'] / 1024), + + 'S_AVATARS_ENABLED' => ($config['allow_avatar'] && $avatars_enabled), )); break; -- cgit v1.2.1 From d0bb14ded1960de47eb07d955a483d74fd9e0af2 Mon Sep 17 00:00:00 2001 From: Cullen Walsh Date: Sat, 18 Jun 2011 22:05:54 -0700 Subject: [feature/avatars] Update ACP manage users, fix gallery focus issue Updated ACP to match UCP with dropdown. Correctly determe which avatar to focus on by checking if the form was submitted and avatar_driver is set. PHPBB3-10018 --- phpBB/includes/acp/acp_users.php | 84 ++++++++++++++++++++-------------------- 1 file changed, 43 insertions(+), 41 deletions(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 9c8a1c683e..bcce458e20 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1689,53 +1689,17 @@ class acp_users { $avatar_manager = new phpbb_avatar_manager($phpbb_root_path, $phpEx, $config, $cache->getDriver()); - if (isset($_POST['av_delete'])) - { - if (!check_form_key($form_name)) - { - trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); - } - - $result = array( - 'user_avatar' => '', - 'user_avatar_type' => '', - 'user_avatar_height' => 0, - 'user_avatar_width' => 0, - ); - - if ($driver = $avatar_manager->get_driver($user_row['user_avatar_type'])) - { - $driver->delete($user_row); - } - - $sql = 'UPDATE ' . USERS_TABLE . ' - SET ' . $db->sql_build_array('UPDATE', $result) . ' - WHERE user_id = ' . $user_id; - - $db->sql_query($sql); - trigger_error($user->lang['USER_AVATAR_UPDATED'] . adm_back_link($this->u_action . '&u=' . $user_id)); - } - $avatar_drivers = $avatar_manager->get_valid_drivers(); sort($avatar_drivers); - foreach ($avatar_drivers as $driver) + if ($submit) { - if ($config["allow_avatar_$driver"]) + if (check_form_key($form_name)) { - $avatars_enabled = true; - $template->set_filenames(array( - 'avatar' => "acp_avatar_options_$driver.html", - )); - - $avatar = $avatar_manager->get_driver($driver); - if (isset($_POST["submit_av_$driver"])) + $driver = request_var('avatar_driver', ''); + if (in_array($driver, $avatar_drivers) && $config["allow_avatar_$driver"]) { - if (!check_form_key($form_name)) - { - trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); - } - + $avatar = $avatar_manager->get_driver($driver); $result = $avatar->process_form($template, $user_row, $error); if ($result && empty($error)) @@ -1750,6 +1714,42 @@ class acp_users trigger_error($user->lang['USER_AVATAR_UPDATED'] . adm_back_link($this->u_action . '&u=' . $user_id)); } } + else + { + // Removing the avatar + $result = array( + 'user_avatar' => '', + 'user_avatar_type' => '', + 'user_avatar_width' => 0, + 'user_avatar_height' => 0, + ); + + $sql = 'UPDATE ' . USERS_TABLE . ' + SET ' . $db->sql_build_array('UPDATE', $result) . ' + WHERE user_id = ' . $user_id; + + $db->sql_query($sql); + trigger_error($user->lang['USER_AVATAR_UPDATED'] . adm_back_link($this->u_action . '&u=' . $user_id)); + } + } + else + { + trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + } + + $focused_driver = request_var('avatar_driver', $user_row['user_avatar_type']); + + foreach ($avatar_drivers as $driver) + { + if ($config["allow_avatar_$driver"]) + { + $avatars_enabled = true; + $template->set_filenames(array( + 'avatar' => "acp_avatar_options_$driver.html", + )); + + $avatar = $avatar_manager->get_driver($driver); if ($avatar->prepare_form($template, $user_row, $error)) { @@ -1757,7 +1757,9 @@ class acp_users $template->assign_block_vars('avatar_drivers', array( 'L_TITLE' => $user->lang('AVATAR_DRIVER_' . $driver_u . '_TITLE'), // @TODO add lang values 'L_EXPLAIN' => $user->lang('AVATAR_DRIVER_' . $driver_u . '_EXPLAIN'), + 'DRIVER' => $driver, + 'SELECTED' => ($driver == $focused_driver), 'OUTPUT' => $template->assign_display('avatar'), )); } -- cgit v1.2.1 From 8416bf3dc9539df19530e3bef85352d40ac795f2 Mon Sep 17 00:00:00 2001 From: Cullen Walsh Date: Sat, 18 Jun 2011 23:49:04 -0700 Subject: [feature/avatars] Made ACP avatar gallery in Manage Users prettier Added row/column information so avatars can be displayed nicely in the ACP PHPBB3-10018 --- phpBB/includes/acp/acp_users.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index bcce458e20..9b5c52e28e 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1692,6 +1692,9 @@ class acp_users $avatar_drivers = $avatar_manager->get_valid_drivers(); sort($avatar_drivers); + // This is normalised data, without the user_ prefix + $avatar_data = phpbb_avatar_driver::clean_row($user_row, phpbb_avatar_driver::FROM_USER); + if ($submit) { if (check_form_key($form_name)) @@ -1700,12 +1703,17 @@ class acp_users if (in_array($driver, $avatar_drivers) && $config["allow_avatar_$driver"]) { $avatar = $avatar_manager->get_driver($driver); - $result = $avatar->process_form($template, $user_row, $error); + $result = $avatar->process_form($template, $avatar_data, $error); if ($result && empty($error)) { // Success! Lets save the result in the database - $result['user_avatar_type'] = $driver; + $result = array( + 'user_avatar_type' => $driver, + 'user_avatar' => $result['avatar'], + 'user_avatar_width' => $result['avatar_width'], + 'user_avatar_height' => $result['avatar_height'], + ); $sql = 'UPDATE ' . USERS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $result) . ' WHERE user_id = ' . $user_id; @@ -1751,7 +1759,7 @@ class acp_users $avatar = $avatar_manager->get_driver($driver); - if ($avatar->prepare_form($template, $user_row, $error)) + if ($avatar->prepare_form($template, $avatar_data, $error)) { $driver_u = strtoupper($driver); $template->assign_block_vars('avatar_drivers', array( -- cgit v1.2.1 From 48e61b1b45655b38660740abb0de9704234af849 Mon Sep 17 00:00:00 2001 From: Cullen Walsh Date: Mon, 4 Jul 2011 16:58:35 -0700 Subject: [feature/avatars] Support editing of group avatars in ACP Edited templates for group avatars so they can be properly modified in ACP PHPBB3-10018 --- phpBB/includes/acp/acp_users.php | 1 - 1 file changed, 1 deletion(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 9b5c52e28e..ad8e7532c0 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1797,7 +1797,6 @@ class acp_users 'S_AVATAR' => true, 'ERROR' => (sizeof($error)) ? implode('
', $error) : '', 'AVATAR' => (empty($avatar) ? '' : $avatar), - 'AV_SHOW_DELETE' => !empty($avatar), 'S_FORM_ENCTYPE' => ' enctype="multipart/form-data"', -- cgit v1.2.1 From 9236dd4c471a6f7655bd00ae422a13013a400ac4 Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Sat, 31 Mar 2012 02:54:39 +0200 Subject: [feature/class-prefix] Rename auth => phpbb_auth PHPBB3-10609 --- phpBB/includes/acp/acp_users.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index cf6716c322..44717452e8 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1554,7 +1554,7 @@ class acp_users || $user_row['user_allow_viewonline'] && !$sql_ary['user_allow_viewonline']) { // We also need to check if the user has the permission to cloak. - $user_auth = new auth(); + $user_auth = new phpbb_auth(); $user_auth->acl($user_row); $session_sql_ary = array( -- cgit v1.2.1 From e861bb0e04c08b03366ec7c58473b630acc91181 Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Sat, 7 Apr 2012 19:19:13 +0200 Subject: [feature/avatars] Use request object in avatar drivers PHPBB3-10018 --- phpBB/includes/acp/acp_users.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index c0da9b8ce0..12da482dbe 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -32,6 +32,7 @@ class acp_users { global $config, $db, $user, $auth, $template, $cache; global $phpbb_root_path, $phpbb_admin_path, $phpEx, $table_prefix, $file_uploads; + global $request; $user->add_lang(array('posting', 'ucp', 'acp/users')); $this->tpl_name = 'acp_users'; @@ -466,7 +467,7 @@ class acp_users $db->sql_query($sql); // Delete old avatar if present - $avatar_manager = new phpbb_avatar_manager($phpbb_root_path, $phpEx, $config, $cache->getDriver()); + $avatar_manager = new phpbb_avatar_manager($phpbb_root_path, $phpEx, $config, $request, $cache->getDriver()); if ($driver = $avatar_manager->get_driver($user_row['user_avatar_type'])) { $driver->delete($user_row); @@ -1687,7 +1688,7 @@ class acp_users $avatars_enabled = false; if ($config['allow_avatar']) { - $avatar_manager = new phpbb_avatar_manager($phpbb_root_path, $phpEx, $config, $cache->getDriver()); + $avatar_manager = new phpbb_avatar_manager($phpbb_root_path, $phpEx, $config, $request, $cache->getDriver()); $avatar_drivers = $avatar_manager->get_valid_drivers(); sort($avatar_drivers); -- cgit v1.2.1 From eea2ec50521e274b928d23f710108f37797cb22c Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Sun, 8 Apr 2012 16:27:09 +0200 Subject: [feature/avatars] Introduce global phpbb_avatar_manager PHPBB3-10018 --- phpBB/includes/acp/acp_users.php | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 12da482dbe..fac84ba40a 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -33,6 +33,7 @@ class acp_users global $config, $db, $user, $auth, $template, $cache; global $phpbb_root_path, $phpbb_admin_path, $phpEx, $table_prefix, $file_uploads; global $request; + global $phpbb_avatar_manager; $user->add_lang(array('posting', 'ucp', 'acp/users')); $this->tpl_name = 'acp_users'; @@ -467,8 +468,7 @@ class acp_users $db->sql_query($sql); // Delete old avatar if present - $avatar_manager = new phpbb_avatar_manager($phpbb_root_path, $phpEx, $config, $request, $cache->getDriver()); - if ($driver = $avatar_manager->get_driver($user_row['user_avatar_type'])) + if ($driver = $phpbb_avatar_manager->get_driver($user_row['user_avatar_type'])) { $driver->delete($user_row); } @@ -1688,9 +1688,7 @@ class acp_users $avatars_enabled = false; if ($config['allow_avatar']) { - $avatar_manager = new phpbb_avatar_manager($phpbb_root_path, $phpEx, $config, $request, $cache->getDriver()); - - $avatar_drivers = $avatar_manager->get_valid_drivers(); + $avatar_drivers = $phpbb_avatar_manager->get_valid_drivers(); sort($avatar_drivers); // This is normalised data, without the user_ prefix @@ -1703,7 +1701,7 @@ class acp_users $driver = request_var('avatar_driver', ''); if (in_array($driver, $avatar_drivers) && $config["allow_avatar_$driver"]) { - $avatar = $avatar_manager->get_driver($driver); + $avatar = $phpbb_avatar_manager->get_driver($driver); $result = $avatar->process_form($template, $avatar_data, $error); if ($result && empty($error)) @@ -1758,7 +1756,7 @@ class acp_users 'avatar' => "acp_avatar_options_$driver.html", )); - $avatar = $avatar_manager->get_driver($driver); + $avatar = $phpbb_avatar_manager->get_driver($driver); if ($avatar->prepare_form($template, $avatar_data, $error)) { -- cgit v1.2.1 From 81fb4268cd141259fe5b3bc9ad51adf2e29e0772 Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Sun, 8 Apr 2012 16:40:19 +0200 Subject: [feature/avatars] Introduce an avatar driver interface PHPBB3-10018 --- phpBB/includes/acp/acp_users.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index fac84ba40a..9c12116062 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1692,7 +1692,7 @@ class acp_users sort($avatar_drivers); // This is normalised data, without the user_ prefix - $avatar_data = phpbb_avatar_driver::clean_row($user_row, phpbb_avatar_driver::FROM_USER); + $avatar_data = phpbb_avatar_driver::clean_row($user_row, phpbb_avatar_driver_interface::FROM_USER); if ($submit) { -- cgit v1.2.1 From 3b71e81cfba726043063b05cb793e18186143252 Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Sun, 8 Apr 2012 21:29:52 +0200 Subject: [feature/avatars] Simplify clean_row, move it to avatar manager PHPBB3-10018 --- phpBB/includes/acp/acp_users.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 9c12116062..cd50b02ca1 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1692,7 +1692,7 @@ class acp_users sort($avatar_drivers); // This is normalised data, without the user_ prefix - $avatar_data = phpbb_avatar_driver::clean_row($user_row, phpbb_avatar_driver_interface::FROM_USER); + $avatar_data = phpbb_avatar_manager::clean_row($user_row); if ($submit) { -- cgit v1.2.1 From b2b812f1714fc924a7c9e595ccb8fbb35f20f203 Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Sun, 8 Apr 2012 22:13:10 +0200 Subject: [feature/avatars] Do not assign in an if statement PHPBB3-10018 --- phpBB/includes/acp/acp_users.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index cd50b02ca1..33a173b74d 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -468,7 +468,8 @@ class acp_users $db->sql_query($sql); // Delete old avatar if present - if ($driver = $phpbb_avatar_manager->get_driver($user_row['user_avatar_type'])) + $driver = $phpbb_avatar_manager->get_driver($user_row['user_avatar_type']); + if ($driver) { $driver->delete($user_row); } -- cgit v1.2.1 From f9bc8252641ec69983acfc6d392770934b7a37a4 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 4 Jun 2012 22:40:09 +0200 Subject: [feature/new-tz-handling] Fix timezone validation in ACP user section PHPBB3-9558 --- phpBB/includes/acp/acp_users.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 17687b05c7..825bba514f 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1458,7 +1458,7 @@ class acp_users $data = array( 'dateformat' => utf8_normalize_nfc(request_var('dateformat', $user_row['user_dateformat'], true)), 'lang' => basename(request_var('lang', $user_row['user_lang'])), - 'tz' => request_var('tz', (float) $user_row['user_timezone']), + 'tz' => request_var('tz', $user_row['user_timezone']), 'style' => request_var('style', $user_row['user_style']), 'dst' => request_var('dst', $user_row['user_dst']), 'viewemail' => request_var('viewemail', $user_row['user_allow_viewemail']), @@ -1495,7 +1495,7 @@ class acp_users $error = validate_data($data, array( 'dateformat' => array('string', false, 1, 30), 'lang' => array('match', false, '#^[a-z_\-]{2,}$#i'), - 'tz' => array('num', false, -14, 14), + 'tz' => array('timezone'), 'topic_sk' => array('string', false, 1, 1), 'topic_sd' => array('string', false, 1, 1), -- cgit v1.2.1 From 3c6272ff0475dc19cc67553f370ce227214d0613 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 4 Jun 2012 23:28:48 +0200 Subject: [feature/new-tz-handling] Remove appearances of board_dst and user_dst PHPBB3-9558 --- phpBB/includes/acp/acp_users.php | 3 --- 1 file changed, 3 deletions(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 825bba514f..b863a9ed80 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1460,7 +1460,6 @@ class acp_users 'lang' => basename(request_var('lang', $user_row['user_lang'])), 'tz' => request_var('tz', $user_row['user_timezone']), 'style' => request_var('style', $user_row['user_style']), - 'dst' => request_var('dst', $user_row['user_dst']), 'viewemail' => request_var('viewemail', $user_row['user_allow_viewemail']), 'massemail' => request_var('massemail', $user_row['user_allow_massemail']), 'hideonline' => request_var('hideonline', !$user_row['user_allow_viewonline']), @@ -1531,7 +1530,6 @@ class acp_users 'user_notify_type' => $data['notifymethod'], 'user_notify_pm' => $data['notifypm'], - 'user_dst' => $data['dst'], 'user_dateformat' => $data['dateformat'], 'user_lang' => $data['lang'], 'user_timezone' => $data['tz'], @@ -1654,7 +1652,6 @@ class acp_users 'NOTIFY_BOTH' => ($data['notifymethod'] == NOTIFY_BOTH) ? true : false, 'NOTIFY_PM' => $data['notifypm'], 'POPUP_PM' => $data['popuppm'], - 'DST' => $data['dst'], 'BBCODE' => $data['bbcode'], 'SMILIES' => $data['smilies'], 'ATTACH_SIG' => $data['sig'], -- cgit v1.2.1 From 5f96e5d374d1702d3d81591b7c69ede1cafebfa7 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 12 Jun 2012 19:54:26 +0200 Subject: [feature/new-tz-handling] Fix timezone option when editing a user in the ACP PHPBB3-9558 --- phpBB/includes/acp/acp_users.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index b863a9ed80..949109abaf 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1639,6 +1639,7 @@ class acp_users ${'s_sort_' . $sort_option . '_dir'} .= ''; } + $tz_select = tz_select($data['tz'], true, false); $template->assign_vars(array( 'S_PREFS' => true, 'S_JABBER_DISABLED' => ($config['jab_enable'] && $user_row['user_jabber'] && @extension_loaded('xml')) ? false : true, @@ -1678,7 +1679,8 @@ class acp_users 'S_LANG_OPTIONS' => language_select($data['lang']), 'S_STYLE_OPTIONS' => style_select($data['style']), - 'S_TZ_OPTIONS' => tz_select($data['tz'], true), + 'S_TZ_OPTIONS' => $tz_select['tz_select'], + 'S_TZ_DATE_OPTIONS' => $tz_select['tz_dates'], ) ); -- cgit v1.2.1 From 3637cd395e39c1fa5b7279222abe1da5d2abcd00 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 17 Jul 2012 16:09:05 +0200 Subject: [feature/new-tz-handling] Properly name new timezone selection function Marked the old one as deprecated and made it using the new function. PHPBB3-9558 --- phpBB/includes/acp/acp_users.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 949109abaf..a228e07c22 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1639,7 +1639,7 @@ class acp_users ${'s_sort_' . $sort_option . '_dir'} .= ''; } - $tz_select = tz_select($data['tz'], true, false); + $timezone_selects = phpbb_timezone_select($data['tz'], true, false); $template->assign_vars(array( 'S_PREFS' => true, 'S_JABBER_DISABLED' => ($config['jab_enable'] && $user_row['user_jabber'] && @extension_loaded('xml')) ? false : true, @@ -1679,8 +1679,8 @@ class acp_users 'S_LANG_OPTIONS' => language_select($data['lang']), 'S_STYLE_OPTIONS' => style_select($data['style']), - 'S_TZ_OPTIONS' => $tz_select['tz_select'], - 'S_TZ_DATE_OPTIONS' => $tz_select['tz_dates'], + 'S_TZ_OPTIONS' => $timezone_selects['tz_select'], + 'S_TZ_DATE_OPTIONS' => $timezone_selects['tz_dates'], ) ); -- cgit v1.2.1 From 922147f05a75d5a0e00b34f0102bc014583df984 Mon Sep 17 00:00:00 2001 From: Drae Date: Wed, 4 Jul 2012 23:19:59 +0100 Subject: [ticket/10968] Render pagination within the template Since phpBB 2 pagination has been rendered mostly within the source. This limits just what designers can do with pagination. The current form is also questionable in terms of "best practice". The aim is to move rendering completely to the template via the use of a block element. Enabling S_ template vars also allows for control over specific aspects of the pagination output such as next, previous, active and ellipsis. Related to this - merging the capabilities of the topic_generate_pagination with generate_pagination removes an element of duplication. PHPBB3-10968 --- phpBB/includes/acp/acp_users.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 17687b05c7..e98c015f8b 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1120,10 +1120,11 @@ class acp_users $log_count = 0; $start = view_log('user', $log_data, $log_count, $config['topics_per_page'], $start, 0, 0, $user_id, $sql_where, $sql_sort); + generate_pagination($this->u_action . "&u=$user_id&$u_sort_param", $log_count, $config['topics_per_page'], $start); + $template->assign_vars(array( 'S_FEEDBACK' => true, 'S_ON_PAGE' => on_page($log_count, $config['topics_per_page'], $start), - 'PAGINATION' => generate_pagination($this->u_action . "&u=$user_id&$u_sort_param", $log_count, $config['topics_per_page'], $start, true), 'S_LIMIT_DAYS' => $s_limit_days, 'S_SORT_KEY' => $s_sort_key, @@ -2035,14 +2036,14 @@ class acp_users } $db->sql_freeresult($result); + generate_pagination($this->u_action . "&u=$user_id&sk=$sort_key&sd=$sort_dir", $num_attachments, $config['topics_per_page'], $start); + $template->assign_vars(array( 'S_ATTACHMENTS' => true, 'S_ON_PAGE' => on_page($num_attachments, $config['topics_per_page'], $start), 'S_SORT_KEY' => $s_sort_key, 'S_SORT_DIR' => $s_sort_dir, - - 'PAGINATION' => generate_pagination($this->u_action . "&u=$user_id&sk=$sort_key&sd=$sort_dir", $num_attachments, $config['topics_per_page'], $start, true)) - ); + )); break; -- cgit v1.2.1 From dc71c0629e60acccd39b59538f2e7f5b09b32509 Mon Sep 17 00:00:00 2001 From: Drae Date: Thu, 5 Jul 2012 18:56:14 +0100 Subject: [feature/pagination-as-list] Various fixes and improvements Extracted common template code for prosilver as per subsilver2. Various other fixups and oversight corrections, changed name of the "new" template function and re-introduced existing version. Altered on_page to compensate for removal of some templating vars from pagination routine. PHPBB3-10968 --- phpBB/includes/acp/acp_users.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index e98c015f8b..227d566155 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1120,11 +1120,12 @@ class acp_users $log_count = 0; $start = view_log('user', $log_data, $log_count, $config['topics_per_page'], $start, 0, 0, $user_id, $sql_where, $sql_sort); - generate_pagination($this->u_action . "&u=$user_id&$u_sort_param", $log_count, $config['topics_per_page'], $start); + $base_url = $this->u_action . "&u=$user_id&$u_sort_param"; + generate_template_pagination($base_url, 'pagination', $log_count, $config['topics_per_page'], $start); $template->assign_vars(array( 'S_FEEDBACK' => true, - 'S_ON_PAGE' => on_page($log_count, $config['topics_per_page'], $start), + 'S_ON_PAGE' => on_page($base_url, $log_count, $config['topics_per_page'], $start), 'S_LIMIT_DAYS' => $s_limit_days, 'S_SORT_KEY' => $s_sort_key, @@ -2036,11 +2037,12 @@ class acp_users } $db->sql_freeresult($result); - generate_pagination($this->u_action . "&u=$user_id&sk=$sort_key&sd=$sort_dir", $num_attachments, $config['topics_per_page'], $start); + $base_url = $this->u_action . "&u=$user_id&sk=$sort_key&sd=$sort_dir"; + generate_template_pagination($base_url, 'pagination', $num_attachments, $config['topics_per_page'], $start); $template->assign_vars(array( 'S_ATTACHMENTS' => true, - 'S_ON_PAGE' => on_page($num_attachments, $config['topics_per_page'], $start), + 'S_ON_PAGE' => on_page($base_url, $num_attachments, $config['topics_per_page'], $start), 'S_SORT_KEY' => $s_sort_key, 'S_SORT_DIR' => $s_sort_dir, )); -- cgit v1.2.1 From cf4d6e926dd83d61073ac355cdaf7778a18dcbf8 Mon Sep 17 00:00:00 2001 From: Drae Date: Fri, 6 Jul 2012 14:44:04 +0100 Subject: [feature/pagination-as-list] Rename and deprecate functions Returned and marked deprecated topic_generate_pagination. Rename new function in line with coding guidelines. PHPBB3-10968 --- phpBB/includes/acp/acp_users.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 227d566155..d73fa46fdc 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1121,7 +1121,7 @@ class acp_users $start = view_log('user', $log_data, $log_count, $config['topics_per_page'], $start, 0, 0, $user_id, $sql_where, $sql_sort); $base_url = $this->u_action . "&u=$user_id&$u_sort_param"; - generate_template_pagination($base_url, 'pagination', $log_count, $config['topics_per_page'], $start); + phpbb_generate_template_pagination($base_url, 'pagination', $log_count, $config['topics_per_page'], $start); $template->assign_vars(array( 'S_FEEDBACK' => true, @@ -2038,7 +2038,7 @@ class acp_users $db->sql_freeresult($result); $base_url = $this->u_action . "&u=$user_id&sk=$sort_key&sd=$sort_dir"; - generate_template_pagination($base_url, 'pagination', $num_attachments, $config['topics_per_page'], $start); + phpbb_generate_template_pagination($base_url, 'pagination', $num_attachments, $config['topics_per_page'], $start); $template->assign_vars(array( 'S_ATTACHMENTS' => true, -- cgit v1.2.1 From 27d8aef528460e87efc90bc4fffc82c0d1fa87d9 Mon Sep 17 00:00:00 2001 From: Drae Date: Sun, 8 Jul 2012 21:07:28 +0100 Subject: [feature/pagination-as-list] Updates for nils comments Re-remove deprecated functions, change on_page to phpbb_on_page, add null returns, remove globals and pass as params. PHPBB3-10968 --- phpBB/includes/acp/acp_users.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index d73fa46fdc..869bb9cd72 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1121,11 +1121,11 @@ class acp_users $start = view_log('user', $log_data, $log_count, $config['topics_per_page'], $start, 0, 0, $user_id, $sql_where, $sql_sort); $base_url = $this->u_action . "&u=$user_id&$u_sort_param"; - phpbb_generate_template_pagination($base_url, 'pagination', $log_count, $config['topics_per_page'], $start); + phpbb_generate_template_pagination($template, $base_url, 'pagination', $log_count, $config['topics_per_page'], $start); $template->assign_vars(array( 'S_FEEDBACK' => true, - 'S_ON_PAGE' => on_page($base_url, $log_count, $config['topics_per_page'], $start), + 'S_ON_PAGE' => phpbb_on_page($template, $user, $base_url, $log_count, $config['topics_per_page'], $start), 'S_LIMIT_DAYS' => $s_limit_days, 'S_SORT_KEY' => $s_sort_key, @@ -2038,11 +2038,11 @@ class acp_users $db->sql_freeresult($result); $base_url = $this->u_action . "&u=$user_id&sk=$sort_key&sd=$sort_dir"; - phpbb_generate_template_pagination($base_url, 'pagination', $num_attachments, $config['topics_per_page'], $start); + phpbb_generate_template_pagination($template, $base_url, 'pagination', $num_attachments, $config['topics_per_page'], $start); $template->assign_vars(array( 'S_ATTACHMENTS' => true, - 'S_ON_PAGE' => on_page($base_url, $num_attachments, $config['topics_per_page'], $start), + 'S_ON_PAGE' => phpbb_on_page($template, $user, $base_url, $num_attachments, $config['topics_per_page'], $start), 'S_SORT_KEY' => $s_sort_key, 'S_SORT_DIR' => $s_sort_dir, )); -- cgit v1.2.1 From 584d49459d22ebf47239fc97ad8358a5404dacf4 Mon Sep 17 00:00:00 2001 From: Drae Date: Thu, 12 Jul 2012 02:36:00 +0100 Subject: [feature/pagination-as-list] New parameter for name of start var Add a new parameter to hold the name of the start variable. This fulfills ticket PHPBB3-8535. PHPBB3-10968 --- phpBB/includes/acp/acp_users.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 869bb9cd72..1f827d00aa 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1121,7 +1121,7 @@ class acp_users $start = view_log('user', $log_data, $log_count, $config['topics_per_page'], $start, 0, 0, $user_id, $sql_where, $sql_sort); $base_url = $this->u_action . "&u=$user_id&$u_sort_param"; - phpbb_generate_template_pagination($template, $base_url, 'pagination', $log_count, $config['topics_per_page'], $start); + phpbb_generate_template_pagination($template, $base_url, 'pagination', 'start', $log_count, $config['topics_per_page'], $start); $template->assign_vars(array( 'S_FEEDBACK' => true, @@ -2038,7 +2038,7 @@ class acp_users $db->sql_freeresult($result); $base_url = $this->u_action . "&u=$user_id&sk=$sort_key&sd=$sort_dir"; - phpbb_generate_template_pagination($template, $base_url, 'pagination', $num_attachments, $config['topics_per_page'], $start); + phpbb_generate_template_pagination($template, $base_url, 'pagination', 'start', $num_attachments, $config['topics_per_page'], $start); $template->assign_vars(array( 'S_ATTACHMENTS' => true, -- cgit v1.2.1 From 7df1c84447903ecc97a8418339ec6933bdfc9035 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 19 Jul 2012 17:41:27 +0200 Subject: [feature/new-tz-handling] Don't use global user but make it a parameter PHPBB3-9558 --- phpBB/includes/acp/acp_users.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index a228e07c22..3f05f216d9 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1639,7 +1639,7 @@ class acp_users ${'s_sort_' . $sort_option . '_dir'} .= ''; } - $timezone_selects = phpbb_timezone_select($data['tz'], true, false); + $timezone_selects = phpbb_timezone_select($user, $data['tz'], true); $template->assign_vars(array( 'S_PREFS' => true, 'S_JABBER_DISABLED' => ($config['jab_enable'] && $user_row['user_jabber'] && @extension_loaded('xml')) ? false : true, -- cgit v1.2.1 From 67665f59577092badf7eb0b5585e5ae39c52c8da Mon Sep 17 00:00:00 2001 From: Nathan Date: Sat, 14 Jul 2012 18:12:57 -0500 Subject: [ticket/10990] Use $user->lang['COMMA_SEPARATOR'] when appropriate PHPBB3-10990 --- phpBB/includes/acp/acp_users.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 79c91dd7ee..62968a17b7 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1943,7 +1943,7 @@ class acp_users $message = (sizeof($log_attachments) == 1) ? $user->lang['ATTACHMENT_DELETED'] : $user->lang['ATTACHMENTS_DELETED']; - add_log('admin', 'LOG_ATTACHMENTS_DELETED', implode(', ', $log_attachments)); + add_log('admin', 'LOG_ATTACHMENTS_DELETED', implode($user->lang['COMMA_SEPARATOR'], $log_attachments)); trigger_error($message . adm_back_link($this->u_action . '&u=' . $user_id)); } else -- cgit v1.2.1 From 5c0decf4cf7d6f73ffa686e8861aa3c444f51124 Mon Sep 17 00:00:00 2001 From: Michael Cullum Date: Fri, 16 Mar 2012 12:34:26 +0000 Subject: [feature/events] Adding core.acp_users_overview ledge PHPBB3-9550 --- phpBB/includes/acp/acp_users.php | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 79c91dd7ee..68077b4048 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1039,6 +1039,11 @@ class acp_users 'USER_INACTIVE_REASON' => $inactive_reason, )); + $vars = array('data', 'check_ary', 'sql_ary', 'user_row', 'quick_tool_ary'); + $event = new phpbb_event_data(compact($vars)); + $phpbb_dispatcher->dispatch('core.acp_users_overview', $event); + extract($event->get_data_filtered($vars)); + break; case 'feedback': -- cgit v1.2.1 From b966551e6bef9dfd272734587fe4bc9ca7e4611c Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sat, 17 Mar 2012 00:46:43 +0100 Subject: [feature/events] Fix ledges in ACP and apply coding guidelines PHPBB3-9550 --- phpBB/includes/acp/acp_users.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 68077b4048..f6c2ecfc87 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -30,7 +30,7 @@ class acp_users function main($id, $mode) { - global $config, $db, $user, $auth, $template, $cache; + global $config, $db, $user, $auth, $template, $cache, $phpbb_dispatcher; global $phpbb_root_path, $phpbb_admin_path, $phpEx, $table_prefix, $file_uploads; $user->add_lang(array('posting', 'ucp', 'acp/users')); -- cgit v1.2.1 From b04141b14f2fe5a804e55c6e4f94869b9f4e4a6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20Fr=C3=A8rejean?= Date: Tue, 10 Apr 2012 22:22:29 +0200 Subject: [feature/events] Correct core.acp_users_overview event The event still used the "old" method. PHPBB3-9550 --- phpBB/includes/acp/acp_users.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index f6c2ecfc87..de1e9afc83 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -30,8 +30,9 @@ class acp_users function main($id, $mode) { - global $config, $db, $user, $auth, $template, $cache, $phpbb_dispatcher; + global $config, $db, $user, $auth, $template, $cache; global $phpbb_root_path, $phpbb_admin_path, $phpEx, $table_prefix, $file_uploads; + global $phpbb_dispatcher; $user->add_lang(array('posting', 'ucp', 'acp/users')); $this->tpl_name = 'acp_users'; @@ -1040,9 +1041,7 @@ class acp_users )); $vars = array('data', 'check_ary', 'sql_ary', 'user_row', 'quick_tool_ary'); - $event = new phpbb_event_data(compact($vars)); - $phpbb_dispatcher->dispatch('core.acp_users_overview', $event); - extract($event->get_data_filtered($vars)); + extract($phpbb_dispatcher->trigger_event('core.acp_users_overview', compact($vars))); break; -- cgit v1.2.1 From 5db76ee8b0e42cb9773f1b100c533af8ce666098 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sun, 5 Aug 2012 15:03:08 +0200 Subject: [feature/php-events] Move and fix event core.acp_users_display_overview The event had some invalid variables, so the event was moved to give it some more power. PHPBB3-9550 --- phpBB/includes/acp/acp_users.php | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index de1e9afc83..20d93ed525 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -946,12 +946,6 @@ class acp_users } } - $s_action_options = ''; - foreach ($quick_tool_ary as $value => $lang) - { - $s_action_options .= ''; - } - if ($config['load_onlinetrack']) { $sql = 'SELECT MAX(session_time) AS session_time, MIN(session_viewonline) AS session_viewonline @@ -966,6 +960,23 @@ class acp_users unset($row); } + /** + * Add additional quick tool options and overwrite user data + * + * @event core.acp_users_display_overview + * @var array user_row Array with user data + * @var array quick_tool_ary Ouick tool options + * @since 3.1-A1 + */ + $vars = array('user_row', 'quick_tool_ary'); + extract($phpbb_dispatcher->trigger_event('core.acp_users_display_overview', compact($vars))); + + $s_action_options = ''; + foreach ($quick_tool_ary as $value => $lang) + { + $s_action_options .= ''; + } + $last_visit = (!empty($user_row['session_time'])) ? $user_row['session_time'] : $user_row['user_lastvisit']; $inactive_reason = ''; @@ -1040,9 +1051,6 @@ class acp_users 'USER_INACTIVE_REASON' => $inactive_reason, )); - $vars = array('data', 'check_ary', 'sql_ary', 'user_row', 'quick_tool_ary'); - extract($phpbb_dispatcher->trigger_event('core.acp_users_overview', compact($vars))); - break; case 'feedback': -- cgit v1.2.1 From be61bcb7b559d5804f4e6f666e55bf37cd199cb2 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sun, 5 Aug 2012 15:27:08 +0200 Subject: [feature/php-events] Add core.acp_users_overview_modify_data This event was split from core.acp_users_display_overview to make it work as expected. PHPBB3-9550 --- phpBB/includes/acp/acp_users.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 20d93ed525..ae345b99cf 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -856,6 +856,18 @@ class acp_users } } + /** + * Modify user data before we update it + * + * @event core.acp_users_overview_modify_data + * @var array user_row Current user data + * @var array data Submitted user data + * @var array sql_ary User data we udpate + * @since 3.1-A1 + */ + $vars = array('user_row', 'data', 'sql_ary'); + extract($phpbb_dispatcher->trigger_event('core.acp_users_overview_modify_data', compact($vars))); + if ($update_username !== false) { $sql_ary['username'] = $update_username; -- cgit v1.2.1 From 171c07a0847f695a1c8e2f1f35784c453c47546a Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sun, 5 Aug 2012 15:39:42 +0200 Subject: [feature/php-events] Add core.acp_users_overview_run_quicktool This event was split from core.acp_users_display_overview to make it work as expected. PHPBB3-9550 --- phpBB/includes/acp/acp_users.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index ae345b99cf..ceda41c764 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -750,6 +750,19 @@ class acp_users } break; + + default: + /** + * Run custom quicktool code + * + * @event core.acp_users_overview_run_quicktool + * @var array user_row Current user data + * @var string action Quick tool that should be run + * @since 3.1-A1 + */ + $vars = array('action', 'user_row'); + extract($phpbb_dispatcher->trigger_event('core.acp_users_overview_run_quicktool', compact($vars))); + break; } // Handle registration info updates -- cgit v1.2.1 From b8c55291ed7ed86565be2bc651bf20eb1a9ed4dd Mon Sep 17 00:00:00 2001 From: Josh Woody Date: Thu, 17 Jun 2010 23:58:18 -0500 Subject: [feature/soft-delete] Lay the groundwork for a soft-delete feature So far, I've added no new functionality. The biggest change here is adjusting the DB column names to "visibility" rather than "approved". Some things here are pretty likely to change, for example the name and location of the topic_visibility class. Happy birthday phpBB :) PHPBB3-9657 --- phpBB/includes/acp/acp_users.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index b54257b04a..304027df45 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -676,7 +676,7 @@ class acp_users 'topic_time' => time(), 'forum_id' => $new_forum_id, 'icon_id' => 0, - 'topic_approved' => 1, + 'topic_visibility' => ITEM_APPROVED, 'topic_title' => $post_ary['title'], 'topic_first_poster_name' => $user_row['username'], 'topic_type' => POST_NORMAL, @@ -1033,7 +1033,7 @@ class acp_users $sql = 'SELECT COUNT(post_id) as posts_in_queue FROM ' . POSTS_TABLE . ' WHERE poster_id = ' . $user_id . ' - AND post_approved = 0'; + AND post_visibility = ' . ITEM_UNAPPROVED; $result = $db->sql_query($sql); $user_row['posts_in_queue'] = (int) $db->sql_fetchfield('posts_in_queue'); $db->sql_freeresult($result); -- cgit v1.2.1 From b3cd5a649be62f175de651a16ae02c5f709ca2f4 Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Mon, 3 Sep 2012 13:32:33 -0500 Subject: [ticket/8713] Do not trim login inputs Create a function to request variables which are not trimmed. All requests for passwords (except forum passwords) now use the untrimmed request function. PHPBB3-8713 --- phpBB/includes/acp/acp_users.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index b54257b04a..b9958ed0f1 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -32,7 +32,7 @@ class acp_users { global $config, $db, $user, $auth, $template, $cache; global $phpbb_root_path, $phpbb_admin_path, $phpEx, $table_prefix, $file_uploads; - global $phpbb_dispatcher; + global $phpbb_dispatcher, $request; $user->add_lang(array('posting', 'ucp', 'acp/users')); $this->tpl_name = 'acp_users'; @@ -770,8 +770,8 @@ class acp_users 'username' => utf8_normalize_nfc(request_var('user', $user_row['username'], true)), 'user_founder' => request_var('user_founder', ($user_row['user_type'] == USER_FOUNDER) ? 1 : 0), 'email' => strtolower(request_var('user_email', $user_row['user_email'])), - 'new_password' => request_var('new_password', '', true), - 'password_confirm' => request_var('password_confirm', '', true), + 'new_password' => $request->untrimed_variable('new_password', '', true), + 'password_confirm' => $request->untrimed_variable('password_confirm', '', true), ); // Validation data - we do not check the password complexity setting here -- cgit v1.2.1 From f2607fc9e80c6f9ad7543b7be5ea6f294aa6c40a Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Sat, 8 Sep 2012 14:15:56 +0200 Subject: [ticket/8713] Rename untrimed_variable() to untrimmed_variable(). PHPBB3-8713 --- phpBB/includes/acp/acp_users.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index b9958ed0f1..2905b84d57 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -770,8 +770,8 @@ class acp_users 'username' => utf8_normalize_nfc(request_var('user', $user_row['username'], true)), 'user_founder' => request_var('user_founder', ($user_row['user_type'] == USER_FOUNDER) ? 1 : 0), 'email' => strtolower(request_var('user_email', $user_row['user_email'])), - 'new_password' => $request->untrimed_variable('new_password', '', true), - 'password_confirm' => $request->untrimed_variable('password_confirm', '', true), + 'new_password' => $request->untrimmed_variable('new_password', '', true), + 'password_confirm' => $request->untrimmed_variable('password_confirm', '', true), ); // Validation data - we do not check the password complexity setting here -- cgit v1.2.1 From 73a75fc3d387f8d923186c5c04b1ca7bc6cda4ef Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Sat, 8 Sep 2012 15:02:06 +0200 Subject: [ticket/8713] Revert changes to ucp_profile, ucp_register and acp_users. Currently only auth_db is supported there and the password needs to be trimmed for compatibility because user_password stores phpbb_hash(htmlspecialchars(trim($password))) Setting passwords for other auth modules is currently not supported. Once setting/changing passwords is supported by auth plugins, the untrimmed_variable() should be used here and the result should be passed to the auth plugin. PHPBB3-8713 --- phpBB/includes/acp/acp_users.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 2905b84d57..985a12d9ce 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -770,8 +770,8 @@ class acp_users 'username' => utf8_normalize_nfc(request_var('user', $user_row['username'], true)), 'user_founder' => request_var('user_founder', ($user_row['user_type'] == USER_FOUNDER) ? 1 : 0), 'email' => strtolower(request_var('user_email', $user_row['user_email'])), - 'new_password' => $request->untrimmed_variable('new_password', '', true), - 'password_confirm' => $request->untrimmed_variable('password_confirm', '', true), + 'new_password' => $request->variable('new_password', '', true), + 'password_confirm' => $request->variable('password_confirm', '', true), ); // Validation data - we do not check the password complexity setting here -- cgit v1.2.1 From ceb5a40eecbc60577ce0735254a4a189d719302e Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sat, 25 Aug 2012 14:53:21 +0200 Subject: [ticket/11023] Fix additional whitespaces that were added by PHPBB3-10968 PHPBB3-11023 --- phpBB/includes/acp/acp_users.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 985a12d9ce..82d8ef5cbb 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1159,7 +1159,7 @@ class acp_users $base_url = $this->u_action . "&u=$user_id&$u_sort_param"; phpbb_generate_template_pagination($template, $base_url, 'pagination', 'start', $log_count, $config['topics_per_page'], $start); - + $template->assign_vars(array( 'S_FEEDBACK' => true, 'S_ON_PAGE' => phpbb_on_page($template, $user, $base_url, $log_count, $config['topics_per_page'], $start), @@ -2075,7 +2075,7 @@ class acp_users $base_url = $this->u_action . "&u=$user_id&sk=$sort_key&sd=$sort_dir"; phpbb_generate_template_pagination($template, $base_url, 'pagination', 'start', $num_attachments, $config['topics_per_page'], $start); - + $template->assign_vars(array( 'S_ATTACHMENTS' => true, 'S_ON_PAGE' => phpbb_on_page($template, $user, $base_url, $num_attachments, $config['topics_per_page'], $start), -- cgit v1.2.1 From 168dd29f24843e97182c894a5d43a7d38f8a195c Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 22 Oct 2012 14:21:44 +0200 Subject: [feature/soft-delete] Fix sync() and some more functions to use the new fields PHPBB3-9567 --- phpBB/includes/acp/acp_users.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 304027df45..1a3511bc50 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -621,29 +621,31 @@ class acp_users $topic_id_ary = $move_topic_ary = $move_post_ary = $new_topic_id_ary = array(); $forum_id_ary = array($new_forum_id); - $sql = 'SELECT topic_id, COUNT(post_id) AS total_posts + $sql = 'SELECT topic_id, post_visibility, COUNT(post_id) AS total_posts FROM ' . POSTS_TABLE . " WHERE poster_id = $user_id AND forum_id <> $new_forum_id - GROUP BY topic_id"; + GROUP BY topic_id, post_visibility"; $result = $db->sql_query($sql); while ($row = $db->sql_fetchrow($result)) { - $topic_id_ary[$row['topic_id']] = $row['total_posts']; + $topic_id_ary[$row['topic_id']][$row['post_visibility']] = $row['total_posts']; } $db->sql_freeresult($result); if (sizeof($topic_id_ary)) { - $sql = 'SELECT topic_id, forum_id, topic_title, topic_replies, topic_replies_real, topic_attachment + $sql = 'SELECT topic_id, forum_id, topic_title, topic_posts, topic_posts_unapproved, topic_posts_softdeleted, topic_attachment FROM ' . TOPICS_TABLE . ' WHERE ' . $db->sql_in_set('topic_id', array_keys($topic_id_ary)); $result = $db->sql_query($sql); while ($row = $db->sql_fetchrow($result)) { - if (max($row['topic_replies'], $row['topic_replies_real']) + 1 == $topic_id_ary[$row['topic_id']]) + if ($topic_id_ary[$row['topic_id']][ITEM_APPROVED] == $row['topic_posts'] + && $topic_id_ary[$row['topic_id']][ITEM_UNAPPROVED] == $row['topic_posts_unapproved'] + && $topic_id_ary[$row['topic_id']][ITEM_DELETED] == $row['topic_posts_softdeleted']) { $move_topic_ary[] = $row['topic_id']; } -- cgit v1.2.1 From f77a6eaab5485329a3b13922649fb8902e6e397f Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sat, 10 Nov 2012 11:24:52 +0100 Subject: [feature/soft-delete] Fix the rest of *_approved and the delete_post unit test PHPBB3-9567 --- phpBB/includes/acp/acp_users.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 1a3511bc50..bb5b4a04d5 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -636,14 +636,14 @@ class acp_users if (sizeof($topic_id_ary)) { - $sql = 'SELECT topic_id, forum_id, topic_title, topic_posts, topic_posts_unapproved, topic_posts_softdeleted, topic_attachment + $sql = 'SELECT topic_id, forum_id, topic_title, topic_posts_approved, topic_posts_unapproved, topic_posts_softdeleted, topic_attachment FROM ' . TOPICS_TABLE . ' WHERE ' . $db->sql_in_set('topic_id', array_keys($topic_id_ary)); $result = $db->sql_query($sql); while ($row = $db->sql_fetchrow($result)) { - if ($topic_id_ary[$row['topic_id']][ITEM_APPROVED] == $row['topic_posts'] + if ($topic_id_ary[$row['topic_id']][ITEM_APPROVED] == $row['topic_posts_approved'] && $topic_id_ary[$row['topic_id']][ITEM_UNAPPROVED] == $row['topic_posts_unapproved'] && $topic_id_ary[$row['topic_id']][ITEM_DELETED] == $row['topic_posts_softdeleted']) { -- cgit v1.2.1 From c70cbfac4339529e196934405d0eb2f9672121d5 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sat, 17 Nov 2012 00:50:23 +0100 Subject: [feature/avatars] Fix acp front-end of user and group avatars Due to the changes to the avatar manager etc. these had to be updated. PHPBB3-10018 --- phpBB/includes/acp/acp_users.php | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 83c19b3ba6..562353b229 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1744,8 +1744,9 @@ class acp_users { if (check_form_key($form_name)) { - $driver = request_var('avatar_driver', ''); - if (in_array($driver, $avatar_drivers) && $config["allow_avatar_$driver"]) + $driver = str_replace('_', '.', request_var('avatar_driver', '')); + $config_name = preg_replace('#^avatar.driver.#', '', $driver); + if (in_array($driver, $avatar_drivers) && $config["allow_avatar_$config_name"]) { $avatar = $phpbb_avatar_manager->get_driver($driver); $result = $avatar->process_form($template, $avatar_data, $error); @@ -1791,27 +1792,30 @@ class acp_users } } - $focused_driver = request_var('avatar_driver', $user_row['user_avatar_type']); + $focused_driver = str_replace('_', '.', request_var('avatar_driver', $user_row['user_avatar_type'])); foreach ($avatar_drivers as $driver) { - if ($config["allow_avatar_$driver"]) + $avatar = $phpbb_avatar_manager->get_driver($driver); + + if ($avatar->is_enabled()) { $avatars_enabled = true; + $config_name = preg_replace('#^avatar.driver.#', '', $driver); $template->set_filenames(array( - 'avatar' => "acp_avatar_options_$driver.html", + 'avatar' => "acp_avatar_options_$config_name.html", )); - $avatar = $phpbb_avatar_manager->get_driver($driver); - if ($avatar->prepare_form($template, $avatar_data, $error)) { - $driver_u = strtoupper($driver); + $driver_n = str_replace('.', '_', $driver); + $driver_u = strtoupper($driver_n); + $template->assign_block_vars('avatar_drivers', array( - 'L_TITLE' => $user->lang('AVATAR_DRIVER_' . $driver_u . '_TITLE'), // @TODO add lang values - 'L_EXPLAIN' => $user->lang('AVATAR_DRIVER_' . $driver_u . '_EXPLAIN'), + 'L_TITLE' => $user->lang($driver_u . '_TITLE'), + 'L_EXPLAIN' => $user->lang($driver_u . '_EXPLAIN'), - 'DRIVER' => $driver, + 'DRIVER' => $driver_n, 'SELECTED' => ($driver == $focused_driver), 'OUTPUT' => $template->assign_display('avatar'), )); -- cgit v1.2.1 From 959bc183bf21e77c694ac0b68cbda5b93ae79cd0 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sun, 18 Nov 2012 23:09:09 +0100 Subject: [feature/avatars] Handle deletion of avatars Previously this wasn't handled correctly if at all. PHPBB3-10018 --- phpBB/includes/acp/acp_users.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 562353b229..fdad1df0fd 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1746,7 +1746,8 @@ class acp_users { $driver = str_replace('_', '.', request_var('avatar_driver', '')); $config_name = preg_replace('#^avatar.driver.#', '', $driver); - if (in_array($driver, $avatar_drivers) && $config["allow_avatar_$config_name"]) + $av_delete = $request->variable('av_delete', ''); + if (in_array($driver, $avatar_drivers) && $config["allow_avatar_$config_name"] && empty($av_delete)) { $avatar = $phpbb_avatar_manager->get_driver($driver); $result = $avatar->process_form($template, $avatar_data, $error); @@ -1770,6 +1771,11 @@ class acp_users } else { + if ($avatar = $phpbb_avatar_manager->get_driver($user->data['user_avatar_type'])) + { + $avatar->delete($avatar_data); + } + // Removing the avatar $result = array( 'user_avatar' => '', -- cgit v1.2.1 From ce44e3908eef5166e5e3e43d2642c5372379b6a6 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sun, 25 Nov 2012 00:54:34 +0100 Subject: [feature/avatars] Remove unnecessary abbreviations PHPBB3-10018 --- phpBB/includes/acp/acp_users.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index fdad1df0fd..2f7662982a 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1746,8 +1746,8 @@ class acp_users { $driver = str_replace('_', '.', request_var('avatar_driver', '')); $config_name = preg_replace('#^avatar.driver.#', '', $driver); - $av_delete = $request->variable('av_delete', ''); - if (in_array($driver, $avatar_drivers) && $config["allow_avatar_$config_name"] && empty($av_delete)) + $avatar_delete = $request->variable('avatar_delete', ''); + if (in_array($driver, $avatar_drivers) && $config["allow_avatar_$config_name"] && empty($avatar_delete)) { $avatar = $phpbb_avatar_manager->get_driver($driver); $result = $avatar->process_form($template, $avatar_data, $error); @@ -1814,15 +1814,15 @@ class acp_users if ($avatar->prepare_form($template, $avatar_data, $error)) { - $driver_n = str_replace('.', '_', $driver); - $driver_u = strtoupper($driver_n); + $driver_name = str_replace('.', '_', $driver); + $driver_upper = strtoupper($driver_name); $template->assign_block_vars('avatar_drivers', array( - 'L_TITLE' => $user->lang($driver_u . '_TITLE'), - 'L_EXPLAIN' => $user->lang($driver_u . '_EXPLAIN'), + 'L_TITLE' => $user->lang($driver_upper . '_TITLE'), + 'L_EXPLAIN' => $user->lang($driver_upper . '_EXPLAIN'), - 'DRIVER' => $driver_n, - 'SELECTED' => ($driver == $focused_driver), + 'DRIVER' => $driver_name, + 'SELECTED' => $driver == $focused_driver, 'OUTPUT' => $template->assign_display('avatar'), )); } -- cgit v1.2.1 From ce5e2f16777ae5319fcb902ee58005a4caced7e6 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sun, 25 Nov 2012 01:18:27 +0100 Subject: [feature/avatars] Miscellaneous fixes PHPBB3-10018 --- phpBB/includes/acp/acp_users.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 2f7662982a..8e194dc91d 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -454,7 +454,7 @@ class acp_users { trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); } - + $sql_ary = array( 'user_avatar' => '', 'user_avatar_type' => '', @@ -1745,7 +1745,7 @@ class acp_users if (check_form_key($form_name)) { $driver = str_replace('_', '.', request_var('avatar_driver', '')); - $config_name = preg_replace('#^avatar.driver.#', '', $driver); + $config_name = preg_replace('#^avatar\.driver.#', '', $driver); $avatar_delete = $request->variable('avatar_delete', ''); if (in_array($driver, $avatar_drivers) && $config["allow_avatar_$config_name"] && empty($avatar_delete)) { @@ -1761,6 +1761,7 @@ class acp_users 'user_avatar_width' => $result['avatar_width'], 'user_avatar_height' => $result['avatar_height'], ); + $sql = 'UPDATE ' . USERS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $result) . ' WHERE user_id = ' . $user_id; @@ -1771,7 +1772,8 @@ class acp_users } else { - if ($avatar = $phpbb_avatar_manager->get_driver($user->data['user_avatar_type'])) + $avatar = $phpbb_avatar_manager->get_driver($user->data['user_avatar_type']); + if ($avatar) { $avatar->delete($avatar_data); } @@ -1786,7 +1788,7 @@ class acp_users $sql = 'UPDATE ' . USERS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $result) . ' - WHERE user_id = ' . $user_id; + WHERE user_id = ' . (int) $user_id; $db->sql_query($sql); trigger_error($user->lang['USER_AVATAR_UPDATED'] . adm_back_link($this->u_action . '&u=' . $user_id)); @@ -1807,7 +1809,7 @@ class acp_users if ($avatar->is_enabled()) { $avatars_enabled = true; - $config_name = preg_replace('#^avatar.driver.#', '', $driver); + $config_name = preg_replace('#^avatar\.driver.#', '', $driver); $template->set_filenames(array( 'avatar' => "acp_avatar_options_$config_name.html", )); -- cgit v1.2.1 From 67c2e48d15d6e4ddd244dd2e126f906ed25be1ef Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sun, 25 Nov 2012 14:33:13 +0100 Subject: [feature/avatars] Only create avatar objects if necessary PHPBB3-10018 --- phpBB/includes/acp/acp_users.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 8e194dc91d..885233bbd3 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -33,7 +33,7 @@ class acp_users global $config, $db, $user, $auth, $template, $cache; global $phpbb_root_path, $phpbb_admin_path, $phpEx, $table_prefix, $file_uploads; global $phpbb_dispatcher, $request; - global $phpbb_avatar_manager; + global $phpbb_container; $user->add_lang(array('posting', 'ucp', 'acp/users')); $this->tpl_name = 'acp_users'; @@ -468,6 +468,7 @@ class acp_users $db->sql_query($sql); // Delete old avatar if present + $phpbb_avatar_manager = $phpbb_container->get('avatar.manager'); $driver = $phpbb_avatar_manager->get_driver($user_row['user_avatar_type']); if ($driver) { @@ -1732,6 +1733,8 @@ class acp_users include($phpbb_root_path . 'includes/functions_display.' . $phpEx); $avatars_enabled = false; + $phpbb_avatar_manager = $phpbb_container->get('avatar.manager'); + if ($config['allow_avatar']) { $avatar_drivers = $phpbb_avatar_manager->get_valid_drivers(); -- cgit v1.2.1 From 06639729ea2da6d0025da74ae7d4f3e88f211b67 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sun, 25 Nov 2012 16:04:59 +0100 Subject: [feature/avatars] Add static methods for handling driver names PHPBB3-10018 --- phpBB/includes/acp/acp_users.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 885233bbd3..44e4f14ae2 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1747,7 +1747,7 @@ class acp_users { if (check_form_key($form_name)) { - $driver = str_replace('_', '.', request_var('avatar_driver', '')); + $driver = $phpbb_avatar_manager->clean_driver_name($request->variable('avatar_driver', '')); $config_name = preg_replace('#^avatar\.driver.#', '', $driver); $avatar_delete = $request->variable('avatar_delete', ''); if (in_array($driver, $avatar_drivers) && $config["allow_avatar_$config_name"] && empty($avatar_delete)) @@ -1803,7 +1803,7 @@ class acp_users } } - $focused_driver = str_replace('_', '.', request_var('avatar_driver', $user_row['user_avatar_type'])); + $focused_driver = $phpbb_avatar_manager->clean_driver_name($request->variable('avatar_driver', $user_row['user_avatar_type'])); foreach ($avatar_drivers as $driver) { @@ -1819,7 +1819,7 @@ class acp_users if ($avatar->prepare_form($template, $avatar_data, $error)) { - $driver_name = str_replace('.', '_', $driver); + $driver_name = $phpbb_avatar_manager->prepare_driver_name($driver); $driver_upper = strtoupper($driver_name); $template->assign_block_vars('avatar_drivers', array( -- cgit v1.2.1 From f8256ed00f5ecc95fbf9f69fd2e8de2a92bccec6 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sun, 25 Nov 2012 16:18:51 +0100 Subject: [feature/avatars] Small cosmetic changes PHPBB3-10018 --- phpBB/includes/acp/acp_users.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 44e4f14ae2..823f001fe0 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1749,8 +1749,8 @@ class acp_users { $driver = $phpbb_avatar_manager->clean_driver_name($request->variable('avatar_driver', '')); $config_name = preg_replace('#^avatar\.driver.#', '', $driver); - $avatar_delete = $request->variable('avatar_delete', ''); - if (in_array($driver, $avatar_drivers) && $config["allow_avatar_$config_name"] && empty($avatar_delete)) + + if (in_array($driver, $avatar_drivers) && $config["allow_avatar_$config_name"] && !$request->is_set_post('avatar_delete')) { $avatar = $phpbb_avatar_manager->get_driver($driver); $result = $avatar->process_form($template, $avatar_data, $error); -- cgit v1.2.1 From a77fcdb5f93ed291c223c445a46a5641cfdb27ea Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sun, 25 Nov 2012 17:01:21 +0100 Subject: [feature/avatars] Implement better treatment of avatar errors PHPBB3-10018 --- phpBB/includes/acp/acp_users.php | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 823f001fe0..e0dcea6d58 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1836,21 +1836,19 @@ class acp_users } // Replace "error" strings with their real, localised form - $err = $error; - $error = array(); - foreach ($err as $e) + foreach ($error as $key => $lang) { - if (is_array($e)) + if (is_array($lang)) { - $key = array_shift($e); - $error[] = vsprintf($user->lang($key), $e); + $lang_key = array_shift($lang); + $error[$key] = vsprintf($user->lang($lang_key), $lang); } else { - $error[] = $user->lang((string) $e); + $error[$key] = $user->lang("$lang"); } } - + $avatar = get_user_avatar($user_row, 'USER_AVATAR', true); $template->assign_vars(array( -- cgit v1.2.1 From f4ad60e2cf18771200d99bc953449d6229a74818 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Thu, 29 Nov 2012 23:50:17 +0100 Subject: [feature/avatars] Get list of enabled drivers from avatar manager This shouldn't be done in the avatar drivers. We need to force the display all avatar drivers in the ACP or it won't be possible to enable avatars after they have been disabled. PHPBB3-10018 --- phpBB/includes/acp/acp_users.php | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index e0dcea6d58..d5532e35b6 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1809,28 +1809,25 @@ class acp_users { $avatar = $phpbb_avatar_manager->get_driver($driver); - if ($avatar->is_enabled()) - { - $avatars_enabled = true; - $config_name = preg_replace('#^avatar\.driver.#', '', $driver); - $template->set_filenames(array( - 'avatar' => "acp_avatar_options_$config_name.html", - )); + $avatars_enabled = true; + $config_name = preg_replace('#^avatar\.driver.#', '', $driver); + $template->set_filenames(array( + 'avatar' => "acp_avatar_options_$config_name.html", + )); - if ($avatar->prepare_form($template, $avatar_data, $error)) - { - $driver_name = $phpbb_avatar_manager->prepare_driver_name($driver); - $driver_upper = strtoupper($driver_name); + if ($avatar->prepare_form($template, $avatar_data, $error)) + { + $driver_name = $phpbb_avatar_manager->prepare_driver_name($driver); + $driver_upper = strtoupper($driver_name); - $template->assign_block_vars('avatar_drivers', array( - 'L_TITLE' => $user->lang($driver_upper . '_TITLE'), - 'L_EXPLAIN' => $user->lang($driver_upper . '_EXPLAIN'), + $template->assign_block_vars('avatar_drivers', array( + 'L_TITLE' => $user->lang($driver_upper . '_TITLE'), + 'L_EXPLAIN' => $user->lang($driver_upper . '_EXPLAIN'), - 'DRIVER' => $driver_name, - 'SELECTED' => $driver == $focused_driver, - 'OUTPUT' => $template->assign_display('avatar'), - )); - } + 'DRIVER' => $driver_name, + 'SELECTED' => $driver == $focused_driver, + 'OUTPUT' => $template->assign_display('avatar'), + )); } } } -- cgit v1.2.1 From 33b98dc5ba0b690fdae72acfd676dae5a897cb6a Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Fri, 30 Nov 2012 16:46:11 +0100 Subject: [feature/avatars] Fix variable names PHPBB3-10018 --- phpBB/includes/acp/acp_users.php | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index d5532e35b6..3df373a7d4 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1733,12 +1733,11 @@ class acp_users include($phpbb_root_path . 'includes/functions_display.' . $phpEx); $avatars_enabled = false; - $phpbb_avatar_manager = $phpbb_container->get('avatar.manager'); if ($config['allow_avatar']) { + $phpbb_avatar_manager = $phpbb_container->get('avatar.manager'); $avatar_drivers = $phpbb_avatar_manager->get_valid_drivers(); - sort($avatar_drivers); // This is normalised data, without the user_ prefix $avatar_data = phpbb_avatar_manager::clean_row($user_row); @@ -1747,19 +1746,18 @@ class acp_users { if (check_form_key($form_name)) { - $driver = $phpbb_avatar_manager->clean_driver_name($request->variable('avatar_driver', '')); - $config_name = preg_replace('#^avatar\.driver.#', '', $driver); + $driver_name = $phpbb_avatar_manager->clean_driver_name($request->variable('avatar_driver', '')); - if (in_array($driver, $avatar_drivers) && $config["allow_avatar_$config_name"] && !$request->is_set_post('avatar_delete')) + if (in_array($driver_name, $avatar_drivers) && !$request->is_set_post('avatar_delete')) { - $avatar = $phpbb_avatar_manager->get_driver($driver); - $result = $avatar->process_form($template, $avatar_data, $error); + $driver = $phpbb_avatar_manager->get_driver($driver_name); + $result = $driver->process_form($template, $avatar_data, $error); if ($result && empty($error)) { // Success! Lets save the result in the database $result = array( - 'user_avatar_type' => $driver, + 'user_avatar_type' => $driver_name, 'user_avatar' => $result['avatar'], 'user_avatar_width' => $result['avatar_width'], 'user_avatar_height' => $result['avatar_height'], @@ -1775,10 +1773,10 @@ class acp_users } else { - $avatar = $phpbb_avatar_manager->get_driver($user->data['user_avatar_type']); - if ($avatar) + $driver = $phpbb_avatar_manager->get_driver($user->data['user_avatar_type']); + if ($driver) { - $avatar->delete($avatar_data); + $driver->delete($avatar_data); } // Removing the avatar @@ -1805,19 +1803,19 @@ class acp_users $focused_driver = $phpbb_avatar_manager->clean_driver_name($request->variable('avatar_driver', $user_row['user_avatar_type'])); - foreach ($avatar_drivers as $driver) + foreach ($avatar_drivers as $current_driver) { - $avatar = $phpbb_avatar_manager->get_driver($driver); + $driver = $phpbb_avatar_manager->get_driver($current_driver); $avatars_enabled = true; - $config_name = preg_replace('#^avatar\.driver.#', '', $driver); + $config_name = preg_replace('#^avatar\.driver.#', '', $current_driver); $template->set_filenames(array( 'avatar' => "acp_avatar_options_$config_name.html", )); - if ($avatar->prepare_form($template, $avatar_data, $error)) + if ($driver->prepare_form($template, $avatar_data, $error)) { - $driver_name = $phpbb_avatar_manager->prepare_driver_name($driver); + $driver_name = $phpbb_avatar_manager->prepare_driver_name($current_driver); $driver_upper = strtoupper($driver_name); $template->assign_block_vars('avatar_drivers', array( @@ -1825,7 +1823,7 @@ class acp_users 'L_EXPLAIN' => $user->lang($driver_upper . '_EXPLAIN'), 'DRIVER' => $driver_name, - 'SELECTED' => $driver == $focused_driver, + 'SELECTED' => $current_driver == $focused_driver, 'OUTPUT' => $template->assign_display('avatar'), )); } @@ -1842,7 +1840,7 @@ class acp_users } else { - $error[$key] = $user->lang("$lang"); + $error[$key] = $user->lang($lang); } } -- cgit v1.2.1 From b42ca792fd7765eb415536c49b77c53c0897367e Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Tue, 4 Dec 2012 00:49:37 +0100 Subject: [feature/avatars] Minor variable naming fixes PHPBB3-10018 --- phpBB/includes/acp/acp_users.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 3df373a7d4..5c485b5996 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1801,7 +1801,7 @@ class acp_users } } - $focused_driver = $phpbb_avatar_manager->clean_driver_name($request->variable('avatar_driver', $user_row['user_avatar_type'])); + $selected_driver = $phpbb_avatar_manager->clean_driver_name($request->variable('avatar_driver', $user_row['user_avatar_type'])); foreach ($avatar_drivers as $current_driver) { @@ -1823,7 +1823,7 @@ class acp_users 'L_EXPLAIN' => $user->lang($driver_upper . '_EXPLAIN'), 'DRIVER' => $driver_name, - 'SELECTED' => $current_driver == $focused_driver, + 'SELECTED' => $current_driver == $selected_driver, 'OUTPUT' => $template->assign_display('avatar'), )); } -- cgit v1.2.1 From 8aaa3e055fdc50faeea6f590408a7bcbb03a8d92 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Tue, 4 Dec 2012 15:11:14 +0100 Subject: [feature/avatars] Use seperate function for retrieving the config name PHPBB3-10018 --- phpBB/includes/acp/acp_users.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 5c485b5996..b3cfd81949 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1808,7 +1808,7 @@ class acp_users $driver = $phpbb_avatar_manager->get_driver($current_driver); $avatars_enabled = true; - $config_name = preg_replace('#^avatar\.driver.#', '', $current_driver); + $config_name = $phpbb_avatar_manager->get_driver_config_name($driver); $template->set_filenames(array( 'avatar' => "acp_avatar_options_$config_name.html", )); -- cgit v1.2.1 From 2f47c99432c604a2adaad73821602a4b1763caa8 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Tue, 11 Dec 2012 21:02:37 +0100 Subject: [feature/avatars] Add more consistency to codebase PHPBB3-10018 --- phpBB/includes/acp/acp_users.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index b3cfd81949..b2ef43edbe 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1765,7 +1765,7 @@ class acp_users $sql = 'UPDATE ' . USERS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $result) . ' - WHERE user_id = ' . $user_id; + WHERE user_id = ' . (int) $user_id; $db->sql_query($sql); trigger_error($user->lang['USER_AVATAR_UPDATED'] . adm_back_link($this->u_action . '&u=' . $user_id)); @@ -1810,7 +1810,7 @@ class acp_users $avatars_enabled = true; $config_name = $phpbb_avatar_manager->get_driver_config_name($driver); $template->set_filenames(array( - 'avatar' => "acp_avatar_options_$config_name.html", + 'avatar' => "acp_avatar_options_{$config_name}.html", )); if ($driver->prepare_form($template, $avatar_data, $error)) -- cgit v1.2.1 From c865f98dcfe57c3dff231fdf3574f5d3356ab7f5 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Thu, 27 Dec 2012 20:42:05 +0100 Subject: [feature/avatars] Some more miscellaneous changes PHPBB3-10018 --- phpBB/includes/acp/acp_users.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index b2ef43edbe..0c29eb658f 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1737,7 +1737,7 @@ class acp_users if ($config['allow_avatar']) { $phpbb_avatar_manager = $phpbb_container->get('avatar.manager'); - $avatar_drivers = $phpbb_avatar_manager->get_valid_drivers(); + $avatar_drivers = $phpbb_avatar_manager->get_enabled_drivers(); // This is normalised data, without the user_ prefix $avatar_data = phpbb_avatar_manager::clean_row($user_row); -- cgit v1.2.1 From 7256a2d944df10ef649794c6174fea5ca69adea3 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Fri, 4 Jan 2013 15:10:43 +0100 Subject: [feature/avatars] Add phpbb prefix to new functions Although get_user_avatar() is not new, the phpbb prefix was prepended. This is due to the fact that it was entirely rewritten and is therefore more or less a completely new function. PHPBB3-10018 --- phpBB/includes/acp/acp_users.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 0c29eb658f..d742cad9f4 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1844,7 +1844,7 @@ class acp_users } } - $avatar = get_user_avatar($user_row, 'USER_AVATAR', true); + $avatar = phpbb_get_user_avatar($user_row, 'USER_AVATAR', true); $template->assign_vars(array( 'S_AVATAR' => true, -- cgit v1.2.1 From 41710c745d5507aa71e25b125b0ae1485cc7ecc1 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sun, 6 Jan 2013 21:09:07 +0100 Subject: [feature/avatars] Add function for localizing errors PHPBB3-10018 --- phpBB/includes/acp/acp_users.php | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index d742cad9f4..5960f33741 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1831,18 +1831,7 @@ class acp_users } // Replace "error" strings with their real, localised form - foreach ($error as $key => $lang) - { - if (is_array($lang)) - { - $lang_key = array_shift($lang); - $error[$key] = vsprintf($user->lang($lang_key), $lang); - } - else - { - $error[$key] = $user->lang($lang); - } - } + $error = $phpbb_avatar_manager->localize_errors($user, $error); $avatar = phpbb_get_user_avatar($user_row, 'USER_AVATAR', true); -- cgit v1.2.1 From 8867cb60b1f7074c9f83c0403e5259148da65204 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Mon, 7 Jan 2013 21:16:39 +0100 Subject: [feature/avatars] Use empty() instead of sizeof() PHPBB3-10018 --- phpBB/includes/acp/acp_users.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 5960f33741..122bbeb770 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1837,7 +1837,7 @@ class acp_users $template->assign_vars(array( 'S_AVATAR' => true, - 'ERROR' => (sizeof($error)) ? implode('
', $error) : '', + 'ERROR' => (!empty($error)) ? implode('
', $error) : '', 'AVATAR' => (empty($avatar) ? '' : $avatar), 'S_FORM_ENCTYPE' => ' enctype="multipart/form-data"', -- cgit v1.2.1 From 023d7a972dd5c279e0b0b24801f9e53e7865d39a Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Mon, 7 Jan 2013 22:49:48 +0100 Subject: [feature/avatars] Remove $request property and pass as argument if needed Remove the $request property from the phpbb_avatar_driver class and rather pass it as function argument if it's needed in a function. Currently this is only the case for the class methods prepare_form() and process_form(). PHPBB3-10018 --- phpBB/includes/acp/acp_users.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 122bbeb770..61b644e9f5 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1751,7 +1751,7 @@ class acp_users if (in_array($driver_name, $avatar_drivers) && !$request->is_set_post('avatar_delete')) { $driver = $phpbb_avatar_manager->get_driver($driver_name); - $result = $driver->process_form($template, $avatar_data, $error); + $result = $driver->process_form($request, $template, $avatar_data, $error); if ($result && empty($error)) { @@ -1813,7 +1813,7 @@ class acp_users 'avatar' => "acp_avatar_options_{$config_name}.html", )); - if ($driver->prepare_form($template, $avatar_data, $error)) + if ($driver->prepare_form($request, $template, $avatar_data, $error)) { $driver_name = $phpbb_avatar_manager->prepare_driver_name($current_driver); $driver_upper = strtoupper($driver_name); -- cgit v1.2.1 From 2302cd7a42004b288c5f6be6d0e4b63fe363a983 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Tue, 19 Feb 2013 12:24:21 +0100 Subject: [feature/avatars] Pass phpbb_user to prepare and process form functions The phpbb_user object might be used for language variables and other things. PHPBB3-10018 --- phpBB/includes/acp/acp_users.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 61b644e9f5..88becdb3a5 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1751,7 +1751,7 @@ class acp_users if (in_array($driver_name, $avatar_drivers) && !$request->is_set_post('avatar_delete')) { $driver = $phpbb_avatar_manager->get_driver($driver_name); - $result = $driver->process_form($request, $template, $avatar_data, $error); + $result = $driver->process_form($request, $template, $user, $avatar_data, $error); if ($result && empty($error)) { @@ -1813,7 +1813,7 @@ class acp_users 'avatar' => "acp_avatar_options_{$config_name}.html", )); - if ($driver->prepare_form($request, $template, $avatar_data, $error)) + if ($driver->prepare_form($request, $template, $user, $avatar_data, $error)) { $driver_name = $phpbb_avatar_manager->prepare_driver_name($current_driver); $driver_upper = strtoupper($driver_name); -- cgit v1.2.1 From a9e0aea4b1587ac5ff6c94d2dc7e4d05c304423d Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Tue, 19 Feb 2013 12:30:14 +0100 Subject: [feature/avatars] Remove trailing whitespace from avatar code PHPBB3-10018 --- phpBB/includes/acp/acp_users.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 88becdb3a5..8f4a22b61f 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1786,7 +1786,7 @@ class acp_users 'user_avatar_width' => 0, 'user_avatar_height' => 0, ); - + $sql = 'UPDATE ' . USERS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $result) . ' WHERE user_id = ' . (int) $user_id; @@ -1843,7 +1843,7 @@ class acp_users 'S_FORM_ENCTYPE' => ' enctype="multipart/form-data"', 'L_AVATAR_EXPLAIN' => sprintf($user->lang['AVATAR_EXPLAIN'], $config['avatar_max_width'], $config['avatar_max_height'], $config['avatar_filesize'] / 1024), - + 'S_AVATARS_ENABLED' => ($config['allow_avatar'] && $avatars_enabled), )); -- cgit v1.2.1 From fcdfe748b89426ed9d29c9e589fc5b98ed53a797 Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Wed, 24 Apr 2013 15:34:12 -0500 Subject: [ticket/11454] Use set_addresses in other applicable areas This should fix some other bugs that may not have yet been recognized--some areas only set to(), but sent according to user_notify_type, which is not necessarily email. PHPBB3-11454 --- phpBB/includes/acp/acp_users.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 8f4a22b61f..c8542ddbe7 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -347,7 +347,7 @@ class acp_users $messenger->template($email_template, $user_row['user_lang']); - $messenger->to($user_row['user_email'], $user_row['username']); + $messenger->set_addresses($user_row); $messenger->anti_abuse_headers($config, $user); @@ -402,7 +402,7 @@ class acp_users $messenger->template('admin_welcome_activated', $user_row['user_lang']); - $messenger->to($user_row['user_email'], $user_row['username']); + $messenger->set_addresses($user_row); $messenger->anti_abuse_headers($config, $user); -- cgit v1.2.1 From b95fdacdd378877d277e261465da73deb06e50da Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Tue, 10 Sep 2013 14:01:09 +0200 Subject: [ticket/11700] Move all recent code to namespaces PHPBB3-11700 --- phpBB/includes/acp/acp_users.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index cbfd578d87..8853200ddc 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1604,7 +1604,7 @@ class acp_users || $user_row['user_allow_viewonline'] && !$sql_ary['user_allow_viewonline']) { // We also need to check if the user has the permission to cloak. - $user_auth = new phpbb_auth(); + $user_auth = new \phpbb\auth\auth(); $user_auth->acl($user_row); $session_sql_ary = array( @@ -1742,7 +1742,7 @@ class acp_users $avatar_drivers = $phpbb_avatar_manager->get_enabled_drivers(); // This is normalised data, without the user_ prefix - $avatar_data = phpbb_avatar_manager::clean_row($user_row); + $avatar_data = \phpbb\avatar\manager::clean_row($user_row); if ($submit) { -- cgit v1.2.1 From 61f60d395a5f16105a18790f2f73eddcd830e475 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sun, 13 Oct 2013 16:32:37 +0200 Subject: [feature/passwords] Use passwords manager service instead of functions The old functions phpbb_hash() and phpbb_check_hash() have been replaced with the passwords manager service in all front-end related files. The phpBB2 converter and the release_3_0_5_rc1 migration file have not been changed. The same applies to the security/hash_test that still tests the function phpbb_check_hash(). This will however make sure that the old function still works. PHPBB3-11610 --- phpBB/includes/acp/acp_users.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 8853200ddc..2d560e41f3 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -821,9 +821,12 @@ class acp_users $error[] = 'FORM_INVALID'; } + // Instantiate passwords manager + $passwords_manager = $phpbb_container->get('passwords.manager'); + // Which updates do we need to do? $update_username = ($user_row['username'] != $data['username']) ? $data['username'] : false; - $update_password = ($data['new_password'] && !phpbb_check_hash($data['new_password'], $user_row['user_password'])) ? true : false; + $update_password = ($data['new_password'] && !$passwords_manager->check($data['new_password'], $user_row['user_password'])) ? true : false; $update_email = ($data['email'] != $user_row['user_email']) ? $data['email'] : false; if (!sizeof($error)) @@ -907,7 +910,7 @@ class acp_users if ($update_password) { $sql_ary += array( - 'user_password' => phpbb_hash($data['new_password']), + 'user_password' => $passwords_manager->hash($data['new_password']), 'user_passchg' => time(), 'user_pass_convert' => 0, ); -- cgit v1.2.1 From d607f1c927ed6fb54d6c46eb13b5bcd4133f8cfc Mon Sep 17 00:00:00 2001 From: Cesar G Date: Thu, 24 Oct 2013 02:37:20 -0700 Subject: [ticket/11746] Add "admin activation required" notification. PHPBB3-11746 --- phpBB/includes/acp/acp_users.php | 3 +++ 1 file changed, 3 insertions(+) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 8853200ddc..2a79ec05c0 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -396,6 +396,9 @@ class acp_users { if ($config['require_activation'] == USER_ACTIVATION_ADMIN) { + $phpbb_notifications = $phpbb_container->get('notification_manager'); + $phpbb_notifications->mark_notifications_read('admin_activate_user', $user_row['user_id'], false); + include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx); $messenger = new messenger(false); -- cgit v1.2.1 From 9d4d212e0f71789e1f0332046dd852d80ab9c8ba Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Thu, 24 Oct 2013 13:55:23 +0200 Subject: [ticket/11525] Only remove group or user prefix from given avatar data Until now, the user data had both user_id and group_id keys in the avatar data. As both group_ and user_ prefixes were removed the group_id was collapsed onto the user_id and therefore all users in the same group had the same prefix for their uploaded avatars. This patch will make sure that the correct id is used depending on whether it's a group's or user's avatar data. PHPBB3-11525 --- phpBB/includes/acp/acp_users.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 8853200ddc..9feb1074d0 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1742,7 +1742,7 @@ class acp_users $avatar_drivers = $phpbb_avatar_manager->get_enabled_drivers(); // This is normalised data, without the user_ prefix - $avatar_data = \phpbb\avatar\manager::clean_row($user_row); + $avatar_data = \phpbb\avatar\manager::clean_row($user_row, 'user'); if ($submit) { -- cgit v1.2.1 From c5fc8c43cbca82d2a064859828950477cfd5d767 Mon Sep 17 00:00:00 2001 From: Cesar G Date: Sat, 26 Oct 2013 01:01:08 -0700 Subject: [ticket/11746] Delete the notification after user is approved & fix language. PHPBB3-11746 --- phpBB/includes/acp/acp_users.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 2a79ec05c0..3f1f39724e 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -397,7 +397,7 @@ class acp_users if ($config['require_activation'] == USER_ACTIVATION_ADMIN) { $phpbb_notifications = $phpbb_container->get('notification_manager'); - $phpbb_notifications->mark_notifications_read('admin_activate_user', $user_row['user_id'], false); + $phpbb_notifications->delete_notifications('admin_activate_user', $user_row['user_id']); include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx); -- cgit v1.2.1 From ef1f99183796f8e246f96bca54ca439bf8ea1750 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Wed, 30 Oct 2013 13:37:29 +0100 Subject: [task/code-sniffer] Replace spaces with tabs. PHPBB3-11980 --- phpBB/includes/acp/acp_users.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 8853200ddc..52f9b7149d 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -647,8 +647,8 @@ class acp_users while ($row = $db->sql_fetchrow($result)) { if ($topic_id_ary[$row['topic_id']][ITEM_APPROVED] == $row['topic_posts_approved'] - && $topic_id_ary[$row['topic_id']][ITEM_UNAPPROVED] == $row['topic_posts_unapproved'] - && $topic_id_ary[$row['topic_id']][ITEM_DELETED] == $row['topic_posts_softdeleted']) + && $topic_id_ary[$row['topic_id']][ITEM_UNAPPROVED] == $row['topic_posts_unapproved'] + && $topic_id_ary[$row['topic_id']][ITEM_DELETED] == $row['topic_posts_softdeleted']) { $move_topic_ary[] = $row['topic_id']; } -- cgit v1.2.1 From 57ec9ee49e95fa45f8c5c441b4ed05095c3918a8 Mon Sep 17 00:00:00 2001 From: Lukasz Date: Thu, 7 Nov 2013 19:52:27 +0100 Subject: [ticket/12005] Remove PM popup setting from user preferences PHPBB3-12005 --- phpBB/includes/acp/acp_users.php | 3 --- 1 file changed, 3 deletions(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index fd9c17f171..c476b06c75 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1512,7 +1512,6 @@ class acp_users 'hideonline' => request_var('hideonline', !$user_row['user_allow_viewonline']), 'notifymethod' => request_var('notifymethod', $user_row['user_notify_type']), 'notifypm' => request_var('notifypm', $user_row['user_notify_pm']), - 'popuppm' => request_var('popuppm', $this->optionget($user_row, 'popuppm')), 'allowpm' => request_var('allowpm', $user_row['user_allow_pm']), 'topic_sk' => request_var('topic_sk', ($user_row['user_topic_sortby_type']) ? $user_row['user_topic_sortby_type'] : 't'), @@ -1556,7 +1555,6 @@ class acp_users if (!sizeof($error)) { - $this->optionset($user_row, 'popuppm', $data['popuppm']); $this->optionset($user_row, 'viewimg', $data['view_images']); $this->optionset($user_row, 'viewflash', $data['view_flash']); $this->optionset($user_row, 'viewsmilies', $data['view_smilies']); @@ -1699,7 +1697,6 @@ class acp_users 'NOTIFY_IM' => ($data['notifymethod'] == NOTIFY_IM) ? true : false, 'NOTIFY_BOTH' => ($data['notifymethod'] == NOTIFY_BOTH) ? true : false, 'NOTIFY_PM' => $data['notifypm'], - 'POPUP_PM' => $data['popuppm'], 'BBCODE' => $data['bbcode'], 'SMILIES' => $data['smilies'], 'ATTACH_SIG' => $data['sig'], -- cgit v1.2.1 From abb2def48d7a946fd4d0a67f88682c9fa2556223 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Wed, 4 Dec 2013 15:42:17 +0100 Subject: [ticket/11842] Use avatar_data for obtaining driver that should be deleted PHPBB3-11842 --- phpBB/includes/acp/acp_users.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index fbc1cc1f14..1a7bc2d186 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1775,7 +1775,7 @@ class acp_users } else { - $driver = $phpbb_avatar_manager->get_driver($user->data['user_avatar_type']); + $driver = $phpbb_avatar_manager->get_driver($avatar_data['avatar_type']); if ($driver) { $driver->delete($avatar_data); -- cgit v1.2.1 From cb8b2bab5f72023ad2de95bcb59f90e7121e6369 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 18 Dec 2013 18:27:17 +0100 Subject: [ticket/11849] Fix more function calls PHPBB3-11849 --- phpBB/includes/acp/acp_users.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index fbc1cc1f14..bfcddf253e 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1096,6 +1096,7 @@ class acp_users $deleteall = (isset($_POST['delall'])) ? true : false; $marked = request_var('mark', array(0)); $message = utf8_normalize_nfc(request_var('message', '', true)); + $pagination = $phpbb_container->get('pagination'); // Sort keys $sort_days = request_var('st', 0); @@ -1166,11 +1167,11 @@ class acp_users $start = view_log('user', $log_data, $log_count, $config['topics_per_page'], $start, 0, 0, $user_id, $sql_where, $sql_sort); $base_url = $this->u_action . "&u=$user_id&$u_sort_param"; - phpbb_generate_template_pagination($template, $base_url, 'pagination', 'start', $log_count, $config['topics_per_page'], $start); + $pagination->generate_template_pagination($base_url, 'pagination', 'start', $log_count, $config['topics_per_page'], $start); $template->assign_vars(array( 'S_FEEDBACK' => true, - 'S_ON_PAGE' => phpbb_on_page($template, $user, $base_url, $log_count, $config['topics_per_page'], $start), + 'S_ON_PAGE' => $pagination->on_page($base_url, $log_count, $config['topics_per_page'], $start), 'S_LIMIT_DAYS' => $s_limit_days, 'S_SORT_KEY' => $s_sort_key, @@ -1998,6 +1999,7 @@ class acp_users $start = request_var('start', 0); $deletemark = (isset($_POST['delmarked'])) ? true : false; $marked = request_var('mark', array(0)); + $pagination = $phpbb_container->get('pagination'); // Sort keys $sort_key = request_var('sk', 'a'); @@ -2134,11 +2136,11 @@ class acp_users $db->sql_freeresult($result); $base_url = $this->u_action . "&u=$user_id&sk=$sort_key&sd=$sort_dir"; - phpbb_generate_template_pagination($template, $base_url, 'pagination', 'start', $num_attachments, $config['topics_per_page'], $start); + $pagination->generate_template_pagination($base_url, 'pagination', 'start', $num_attachments, $config['topics_per_page'], $start); $template->assign_vars(array( 'S_ATTACHMENTS' => true, - 'S_ON_PAGE' => phpbb_on_page($template, $user, $base_url, $num_attachments, $config['topics_per_page'], $start), + 'S_ON_PAGE' => $pagination->on_page($base_url, $num_attachments, $config['topics_per_page'], $start), 'S_SORT_KEY' => $s_sort_key, 'S_SORT_DIR' => $s_sort_dir, )); -- cgit v1.2.1 From 808c54fa89f556e6f4701d4f8c6c418393ddfc13 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sun, 29 Dec 2013 16:33:09 +0100 Subject: [feature/passwords] Get rid of unneeded code complexity Simplified a little bit of code as pointed out by imkingdavid on github. PHPBB3-11610 --- phpBB/includes/acp/acp_users.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 8a3c7eabcc..d77152e0cf 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -829,7 +829,7 @@ class acp_users // Which updates do we need to do? $update_username = ($user_row['username'] != $data['username']) ? $data['username'] : false; - $update_password = ($data['new_password'] && !$passwords_manager->check($data['new_password'], $user_row['user_password'])) ? true : false; + $update_password = $data['new_password'] && !$passwords_manager->check($data['new_password'], $user_row['user_password']); $update_email = ($data['email'] != $user_row['user_email']) ? $data['email'] : false; if (!sizeof($error)) -- cgit v1.2.1 From 2471b19d73c38359ed70a7c9e3a82a297946c5b8 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 17 Sep 2013 15:17:54 +0200 Subject: [ticket/11201] Make profile field classes autoloadable PHPBB3-11201 --- phpBB/includes/acp/acp_users.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index b24adfc586..beb6fa1960 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1343,9 +1343,8 @@ class acp_users case 'profile': include($phpbb_root_path . 'includes/functions_user.' . $phpEx); - include($phpbb_root_path . 'includes/functions_profile_fields.' . $phpEx); - $cp = new custom_profile(); + $cp = $phpbb_container->get('profilefields'); $cp_data = $cp_error = array(); -- cgit v1.2.1 From 7bcbdfc1b15e0d014a22c76bb1eab6ccbc3d6dc7 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sun, 2 Feb 2014 12:53:29 +0100 Subject: [ticket/11201] Rename profilefields class to manager PHPBB3-11201 --- phpBB/includes/acp/acp_users.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index beb6fa1960..4153d78ed4 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1344,7 +1344,7 @@ class acp_users include($phpbb_root_path . 'includes/functions_user.' . $phpEx); - $cp = $phpbb_container->get('profilefields'); + $cp = $phpbb_container->get('profilefields.manager'); $cp_data = $cp_error = array(); -- cgit v1.2.1 From 1251b68668c656bc077fff3dd22661447e2905e3 Mon Sep 17 00:00:00 2001 From: Cesar G Date: Sun, 2 Feb 2014 13:19:57 -0800 Subject: [ticket/12153] Remove redundant calls to pagination.on_page(). PHPBB3-12153 --- phpBB/includes/acp/acp_users.php | 2 -- 1 file changed, 2 deletions(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index bf11e4f8fe..ad9a1c2d0c 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1174,7 +1174,6 @@ class acp_users $template->assign_vars(array( 'S_FEEDBACK' => true, - 'S_ON_PAGE' => $pagination->on_page($base_url, $log_count, $config['topics_per_page'], $start), 'S_LIMIT_DAYS' => $s_limit_days, 'S_SORT_KEY' => $s_sort_key, @@ -2142,7 +2141,6 @@ class acp_users $template->assign_vars(array( 'S_ATTACHMENTS' => true, - 'S_ON_PAGE' => $pagination->on_page($base_url, $num_attachments, $config['topics_per_page'], $start), 'S_SORT_KEY' => $s_sort_key, 'S_SORT_DIR' => $s_sort_dir, )); -- cgit v1.2.1 From 3c640e57c5815c970e706f724fb29a3114826352 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sun, 2 Feb 2014 15:41:49 +0100 Subject: [ticket/12115] Convert user occupation to a profile field PHPBB3-12115 --- phpBB/includes/acp/acp_users.php | 4 ---- 1 file changed, 4 deletions(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index bf11e4f8fe..d9c8ee42ae 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1368,7 +1368,6 @@ class acp_users 'jabber' => utf8_normalize_nfc(request_var('jabber', $user_row['user_jabber'], true)), 'website' => request_var('website', $user_row['user_website']), 'location' => utf8_normalize_nfc(request_var('location', $user_row['user_from'], true)), - 'occupation' => utf8_normalize_nfc(request_var('occupation', $user_row['user_occ'], true)), 'interests' => utf8_normalize_nfc(request_var('interests', $user_row['user_interests'], true)), 'bday_day' => 0, 'bday_month' => 0, @@ -1402,7 +1401,6 @@ class acp_users array('string', true, 12, 255), array('match', true, '#^http[s]?://(.*?\.)*?[a-z0-9\-]+\.[a-z]{2,4}#i')), 'location' => array('string', true, 2, 100), - 'occupation' => array('string', true, 2, 500), 'interests' => array('string', true, 2, 500), 'bday_day' => array('num', true, 1, 31), 'bday_month' => array('num', true, 1, 12), @@ -1432,7 +1430,6 @@ class acp_users 'user_jabber' => $data['jabber'], 'user_website' => $data['website'], 'user_from' => $data['location'], - 'user_occ' => $data['occupation'], 'user_interests'=> $data['interests'], 'user_birthday' => $data['user_birthday'], ); @@ -1484,7 +1481,6 @@ class acp_users 'JABBER' => $data['jabber'], 'WEBSITE' => $data['website'], 'LOCATION' => $data['location'], - 'OCCUPATION' => $data['occupation'], 'INTERESTS' => $data['interests'], 'S_BIRTHDAY_DAY_OPTIONS' => $s_birthday_day_options, -- cgit v1.2.1 From bbada27ee9e797c7f6ce997152bc1efb8c8f125d Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sun, 2 Feb 2014 21:45:59 +0100 Subject: [ticket/12115] Also port user interests to profile fields PHPBB3-12115 --- phpBB/includes/acp/acp_users.php | 4 ---- 1 file changed, 4 deletions(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index d9c8ee42ae..6a81f919e4 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1368,7 +1368,6 @@ class acp_users 'jabber' => utf8_normalize_nfc(request_var('jabber', $user_row['user_jabber'], true)), 'website' => request_var('website', $user_row['user_website']), 'location' => utf8_normalize_nfc(request_var('location', $user_row['user_from'], true)), - 'interests' => utf8_normalize_nfc(request_var('interests', $user_row['user_interests'], true)), 'bday_day' => 0, 'bday_month' => 0, 'bday_year' => 0, @@ -1401,7 +1400,6 @@ class acp_users array('string', true, 12, 255), array('match', true, '#^http[s]?://(.*?\.)*?[a-z0-9\-]+\.[a-z]{2,4}#i')), 'location' => array('string', true, 2, 100), - 'interests' => array('string', true, 2, 500), 'bday_day' => array('num', true, 1, 31), 'bday_month' => array('num', true, 1, 12), 'bday_year' => array('num', true, 1901, gmdate('Y', time())), @@ -1430,7 +1428,6 @@ class acp_users 'user_jabber' => $data['jabber'], 'user_website' => $data['website'], 'user_from' => $data['location'], - 'user_interests'=> $data['interests'], 'user_birthday' => $data['user_birthday'], ); @@ -1481,7 +1478,6 @@ class acp_users 'JABBER' => $data['jabber'], 'WEBSITE' => $data['website'], 'LOCATION' => $data['location'], - 'INTERESTS' => $data['interests'], 'S_BIRTHDAY_DAY_OPTIONS' => $s_birthday_day_options, 'S_BIRTHDAY_MONTH_OPTIONS' => $s_birthday_month_options, -- cgit v1.2.1 From 6bee91c42915dd613e9714016006b25fa51cb24a Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 6 Feb 2014 15:00:49 +0100 Subject: [ticket/12169] Convert user_from to profile field location Missing changes on memberlist view due to missing functionality PHPBB3-12169 --- phpBB/includes/acp/acp_users.php | 4 ---- 1 file changed, 4 deletions(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 6a81f919e4..fbff6a73da 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1367,7 +1367,6 @@ class acp_users 'yim' => request_var('yim', $user_row['user_yim']), 'jabber' => utf8_normalize_nfc(request_var('jabber', $user_row['user_jabber'], true)), 'website' => request_var('website', $user_row['user_website']), - 'location' => utf8_normalize_nfc(request_var('location', $user_row['user_from'], true)), 'bday_day' => 0, 'bday_month' => 0, 'bday_year' => 0, @@ -1399,7 +1398,6 @@ class acp_users 'website' => array( array('string', true, 12, 255), array('match', true, '#^http[s]?://(.*?\.)*?[a-z0-9\-]+\.[a-z]{2,4}#i')), - 'location' => array('string', true, 2, 100), 'bday_day' => array('num', true, 1, 31), 'bday_month' => array('num', true, 1, 12), 'bday_year' => array('num', true, 1901, gmdate('Y', time())), @@ -1427,7 +1425,6 @@ class acp_users 'user_yim' => $data['yim'], 'user_jabber' => $data['jabber'], 'user_website' => $data['website'], - 'user_from' => $data['location'], 'user_birthday' => $data['user_birthday'], ); @@ -1477,7 +1474,6 @@ class acp_users 'MSN' => $data['msn'], 'JABBER' => $data['jabber'], 'WEBSITE' => $data['website'], - 'LOCATION' => $data['location'], 'S_BIRTHDAY_DAY_OPTIONS' => $s_birthday_day_options, 'S_BIRTHDAY_MONTH_OPTIONS' => $s_birthday_month_options, -- cgit v1.2.1 From 76409388afcd6389b5a29bc54b49faaf6bc4b4a5 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 28 Feb 2014 15:11:17 +0100 Subject: [ticket/12234] Replace ICQ with custom profile field PHPBB3-12234 --- phpBB/includes/acp/acp_users.php | 6 ------ 1 file changed, 6 deletions(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 87582dcedb..634cd093f1 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1360,7 +1360,6 @@ class acp_users $user_row['iso_lang_id'] = $row['lang_id']; $data = array( - 'icq' => request_var('icq', $user_row['user_icq']), 'aim' => request_var('aim', $user_row['user_aim']), 'msn' => request_var('msn', $user_row['user_msnm']), 'yim' => request_var('yim', $user_row['user_yim']), @@ -1385,9 +1384,6 @@ class acp_users if ($submit) { $error = validate_data($data, array( - 'icq' => array( - array('string', true, 3, 15), - array('match', true, '#^[0-9]+$#i')), 'aim' => array('string', true, 3, 255), 'msn' => array('string', true, 5, 255), 'jabber' => array( @@ -1418,7 +1414,6 @@ class acp_users if (!sizeof($error)) { $sql_ary = array( - 'user_icq' => $data['icq'], 'user_aim' => $data['aim'], 'user_msnm' => $data['msn'], 'user_yim' => $data['yim'], @@ -1467,7 +1462,6 @@ class acp_users unset($now); $template->assign_vars(array( - 'ICQ' => $data['icq'], 'YIM' => $data['yim'], 'AIM' => $data['aim'], 'MSN' => $data['msn'], -- cgit v1.2.1 From 5b1fbfb2f2c901b89bb1163503b0468e11bbc307 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 3 Mar 2014 20:01:19 +0100 Subject: [ticket/12187] Remove user_website functionality PHPBB3-12187 --- phpBB/includes/acp/acp_users.php | 6 ------ 1 file changed, 6 deletions(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 634cd093f1..67f3267240 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1364,7 +1364,6 @@ class acp_users 'msn' => request_var('msn', $user_row['user_msnm']), 'yim' => request_var('yim', $user_row['user_yim']), 'jabber' => utf8_normalize_nfc(request_var('jabber', $user_row['user_jabber'], true)), - 'website' => request_var('website', $user_row['user_website']), 'bday_day' => 0, 'bday_month' => 0, 'bday_year' => 0, @@ -1390,9 +1389,6 @@ class acp_users array('string', true, 5, 255), array('jabber')), 'yim' => array('string', true, 5, 255), - 'website' => array( - array('string', true, 12, 255), - array('match', true, '#^http[s]?://(.*?\.)*?[a-z0-9\-]+\.[a-z]{2,4}#i')), 'bday_day' => array('num', true, 1, 31), 'bday_month' => array('num', true, 1, 12), 'bday_year' => array('num', true, 1901, gmdate('Y', time())), @@ -1418,7 +1414,6 @@ class acp_users 'user_msnm' => $data['msn'], 'user_yim' => $data['yim'], 'user_jabber' => $data['jabber'], - 'user_website' => $data['website'], 'user_birthday' => $data['user_birthday'], ); @@ -1466,7 +1461,6 @@ class acp_users 'AIM' => $data['aim'], 'MSN' => $data['msn'], 'JABBER' => $data['jabber'], - 'WEBSITE' => $data['website'], 'S_BIRTHDAY_DAY_OPTIONS' => $s_birthday_day_options, 'S_BIRTHDAY_MONTH_OPTIONS' => $s_birthday_month_options, -- cgit v1.2.1 From 83a7e632b9b21fed88a3dbea679580d0740664f7 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 4 Mar 2014 10:19:08 +0100 Subject: [ticket/12235] Convert WLM to custom profile field PHPBB3-12235 --- phpBB/includes/acp/acp_users.php | 4 ---- 1 file changed, 4 deletions(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 67f3267240..e5c82d0ca2 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1361,7 +1361,6 @@ class acp_users $data = array( 'aim' => request_var('aim', $user_row['user_aim']), - 'msn' => request_var('msn', $user_row['user_msnm']), 'yim' => request_var('yim', $user_row['user_yim']), 'jabber' => utf8_normalize_nfc(request_var('jabber', $user_row['user_jabber'], true)), 'bday_day' => 0, @@ -1384,7 +1383,6 @@ class acp_users { $error = validate_data($data, array( 'aim' => array('string', true, 3, 255), - 'msn' => array('string', true, 5, 255), 'jabber' => array( array('string', true, 5, 255), array('jabber')), @@ -1411,7 +1409,6 @@ class acp_users { $sql_ary = array( 'user_aim' => $data['aim'], - 'user_msnm' => $data['msn'], 'user_yim' => $data['yim'], 'user_jabber' => $data['jabber'], 'user_birthday' => $data['user_birthday'], @@ -1459,7 +1456,6 @@ class acp_users $template->assign_vars(array( 'YIM' => $data['yim'], 'AIM' => $data['aim'], - 'MSN' => $data['msn'], 'JABBER' => $data['jabber'], 'S_BIRTHDAY_DAY_OPTIONS' => $s_birthday_day_options, -- cgit v1.2.1 From 2e5106aae1bfe83ad8b2336a6d519da5aabc59d2 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 4 Mar 2014 11:22:55 +0100 Subject: [ticket/12237] Convert yahoo messanger to custom profile field PHPBB3-12237 --- phpBB/includes/acp/acp_users.php | 4 ---- 1 file changed, 4 deletions(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index e5c82d0ca2..aabdefeccf 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1361,7 +1361,6 @@ class acp_users $data = array( 'aim' => request_var('aim', $user_row['user_aim']), - 'yim' => request_var('yim', $user_row['user_yim']), 'jabber' => utf8_normalize_nfc(request_var('jabber', $user_row['user_jabber'], true)), 'bday_day' => 0, 'bday_month' => 0, @@ -1386,7 +1385,6 @@ class acp_users 'jabber' => array( array('string', true, 5, 255), array('jabber')), - 'yim' => array('string', true, 5, 255), 'bday_day' => array('num', true, 1, 31), 'bday_month' => array('num', true, 1, 12), 'bday_year' => array('num', true, 1901, gmdate('Y', time())), @@ -1409,7 +1407,6 @@ class acp_users { $sql_ary = array( 'user_aim' => $data['aim'], - 'user_yim' => $data['yim'], 'user_jabber' => $data['jabber'], 'user_birthday' => $data['user_birthday'], ); @@ -1454,7 +1451,6 @@ class acp_users unset($now); $template->assign_vars(array( - 'YIM' => $data['yim'], 'AIM' => $data['aim'], 'JABBER' => $data['jabber'], -- cgit v1.2.1 From f2059f52f3f8f430888366b70aa07c534abb35a1 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 5 Mar 2014 22:13:22 +0100 Subject: [ticket/12236] Move AOL Instant Messanger field to custom profile field PHPBB3-12236 --- phpBB/includes/acp/acp_users.php | 5 ----- 1 file changed, 5 deletions(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index aabdefeccf..603cb17941 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1360,7 +1360,6 @@ class acp_users $user_row['iso_lang_id'] = $row['lang_id']; $data = array( - 'aim' => request_var('aim', $user_row['user_aim']), 'jabber' => utf8_normalize_nfc(request_var('jabber', $user_row['user_jabber'], true)), 'bday_day' => 0, 'bday_month' => 0, @@ -1381,7 +1380,6 @@ class acp_users if ($submit) { $error = validate_data($data, array( - 'aim' => array('string', true, 3, 255), 'jabber' => array( array('string', true, 5, 255), array('jabber')), @@ -1406,7 +1404,6 @@ class acp_users if (!sizeof($error)) { $sql_ary = array( - 'user_aim' => $data['aim'], 'user_jabber' => $data['jabber'], 'user_birthday' => $data['user_birthday'], ); @@ -1451,9 +1448,7 @@ class acp_users unset($now); $template->assign_vars(array( - 'AIM' => $data['aim'], 'JABBER' => $data['jabber'], - 'S_BIRTHDAY_DAY_OPTIONS' => $s_birthday_day_options, 'S_BIRTHDAY_MONTH_OPTIONS' => $s_birthday_month_options, 'S_BIRTHDAY_YEAR_OPTIONS' => $s_birthday_year_options, -- cgit v1.2.1 From 7647b51d5d9653491098caec243bc939b2e4ae23 Mon Sep 17 00:00:00 2001 From: geetakshi Date: Sun, 16 Mar 2014 02:12:50 +0530 Subject: [ticket/11239] Including username before Overview title Adding username to the page title to avoid confusion while managing multiple users in ACP PHPBB3-11239 --- phpBB/includes/acp/acp_users.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index c944f5f96f..68ea324c59 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -37,7 +37,6 @@ class acp_users $user->add_lang(array('posting', 'ucp', 'acp/users')); $this->tpl_name = 'acp_users'; - $this->page_title = 'ACP_USER_' . strtoupper($mode); $error = array(); $username = utf8_normalize_nfc(request_var('username', '', true)); @@ -159,6 +158,8 @@ class acp_users trigger_error($user->lang['NOT_MANAGE_FOUNDER'] . adm_back_link($this->u_action), E_USER_WARNING); } + $this->page_title = $user_row['username'] . '\'s ' . $user->lang('ACP_USER_' . strtoupper($mode)); + switch ($mode) { case 'overview': -- cgit v1.2.1 From 0bf758f00f86fa3164439bd528a69d230b823397 Mon Sep 17 00:00:00 2001 From: geetakshi Date: Sun, 16 Mar 2014 03:37:21 +0530 Subject: [ticket/8309] Rename $last_visit to $last_activity PHPBB3-8309 --- phpBB/includes/acp/acp_users.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index c944f5f96f..f74d49efd9 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1018,7 +1018,7 @@ class acp_users $s_action_options .= ''; } - $last_visit = (!empty($user_row['session_time'])) ? $user_row['session_time'] : $user_row['user_lastvisit']; + $last_activity = (!empty($user_row['session_time'])) ? $user_row['session_time'] : $user_row['user_lastvisit']; $inactive_reason = ''; if ($user_row['user_type'] == USER_INACTIVE) @@ -1084,7 +1084,7 @@ class acp_users 'USER' => $user_row['username'], 'USER_REGISTERED' => $user->format_date($user_row['user_regdate']), 'REGISTERED_IP' => ($ip == 'hostname') ? gethostbyaddr($user_row['user_ip']) : $user_row['user_ip'], - 'USER_LASTACTIVE' => ($last_visit) ? $user->format_date($last_visit) : ' - ', + 'USER_LASTACTIVE' => ($last_activity) ? $user->format_date($last_activity) : ' - ', 'USER_EMAIL' => $user_row['user_email'], 'USER_WARNINGS' => $user_row['user_warnings'], 'USER_POSTS' => $user_row['user_posts'], -- cgit v1.2.1 From 4d191f254d7152376ed758a61ee037567b524f63 Mon Sep 17 00:00:00 2001 From: geetakshi Date: Sun, 16 Mar 2014 15:36:47 +0530 Subject: [ticket/11239] Removing hard-coded, language specific possessive PHPBB3-11239 --- phpBB/includes/acp/acp_users.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 68ea324c59..3e03efd4d7 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -158,7 +158,7 @@ class acp_users trigger_error($user->lang['NOT_MANAGE_FOUNDER'] . adm_back_link($this->u_action), E_USER_WARNING); } - $this->page_title = $user_row['username'] . '\'s ' . $user->lang('ACP_USER_' . strtoupper($mode)); + $this->page_title = $user_row['username'] . ' :: ' . $user->lang('ACP_USER_' . strtoupper($mode)); switch ($mode) { -- cgit v1.2.1 From 9a3011c2dd844a13d9d08192fe5463941a08ffcd Mon Sep 17 00:00:00 2001 From: geetakshi Date: Thu, 20 Mar 2014 01:48:52 +0530 Subject: [ticket/8309] Changing $last_activity to $last_active PHPBB3-8309 --- phpBB/includes/acp/acp_users.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index f74d49efd9..b1913eb6b3 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1018,7 +1018,7 @@ class acp_users $s_action_options .= ''; } - $last_activity = (!empty($user_row['session_time'])) ? $user_row['session_time'] : $user_row['user_lastvisit']; + $last_active = (!empty($user_row['session_time'])) ? $user_row['session_time'] : $user_row['user_lastvisit']; $inactive_reason = ''; if ($user_row['user_type'] == USER_INACTIVE) @@ -1084,7 +1084,7 @@ class acp_users 'USER' => $user_row['username'], 'USER_REGISTERED' => $user->format_date($user_row['user_regdate']), 'REGISTERED_IP' => ($ip == 'hostname') ? gethostbyaddr($user_row['user_ip']) : $user_row['user_ip'], - 'USER_LASTACTIVE' => ($last_activity) ? $user->format_date($last_activity) : ' - ', + 'USER_LASTACTIVE' => ($last_active) ? $user->format_date($last_active) : ' - ', 'USER_EMAIL' => $user_row['user_email'], 'USER_WARNINGS' => $user_row['user_warnings'], 'USER_POSTS' => $user_row['user_posts'], -- cgit v1.2.1 From f471831916fc14afcce81fef70db2037717dccd8 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 1 Apr 2014 22:43:30 +0200 Subject: [ticket/12113] Correctly use plurals when deleting user warnings PHPBB3-12113 --- phpBB/includes/acp/acp_users.php | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 1f61010d62..120a3529ee 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1253,17 +1253,13 @@ class acp_users WHERE user_id = $user_id"; $db->sql_query($sql); - switch ($log_warnings) + if ($log_warnings) { - case 2: - add_log('admin', 'LOG_WARNINGS_DELETED', $user_row['username'], $num_warnings); - break; - case 1: - add_log('admin', 'LOG_WARNING_DELETED', $user_row['username']); - break; - default: - add_log('admin', 'LOG_WARNINGS_DELETED_ALL', $user_row['username']); - break; + add_log('admin', 'LOG_WARNINGS_DELETED', $user_row['username'], $num_warnings); + } + else + { + add_log('admin', 'LOG_WARNINGS_DELETED_ALL', $user_row['username']); } } } -- cgit v1.2.1 From 71422e51801e81a69465530bfe9e8409fef0460f Mon Sep 17 00:00:00 2001 From: rxu Date: Tue, 15 Apr 2014 00:42:22 +0800 Subject: [ticket/12409] Add acp_users.php core events to modify users preferences data There're events to modify UCP user preferences in ucp_prefs.php, so it makes sense to add related events to acp_users.php to control new user's prefs via ACP. PHPBB3-12409 --- phpBB/includes/acp/acp_users.php | 90 +++++++++++++++++++++++++++++----------- 1 file changed, 65 insertions(+), 25 deletions(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index a720334ed2..67d5f62696 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1503,6 +1503,17 @@ class acp_users 'notify' => request_var('notify', $user_row['user_notify']), ); + /** + * Modify users preferences data + * + * @event core.acp_users_prefs_modify_data + * @var array data Array with users preferences data + * @var array user_row Array with user data + * @since 3.1.0-b3 + */ + $vars = array('data', 'user_row'); + extract($phpbb_dispatcher->trigger_event('core.acp_users_prefs_modify_data', compact($vars))); + if ($submit) { $error = validate_data($data, array( @@ -1559,37 +1570,53 @@ class acp_users 'user_notify' => $data['notify'], ); - $sql = 'UPDATE ' . USERS_TABLE . ' - SET ' . $db->sql_build_array('UPDATE', $sql_ary) . " - WHERE user_id = $user_id"; - $db->sql_query($sql); + /** + * Modify SQL query before users preferences are updated + * + * @event core.acp_users_prefs_modify_sql + * @var array data Array with users preferences data + * @var array user_row Array with user data + * @var array sql_ary SQL array with users preferences data to update + * @var array error Array with errors data + * @since 3.1.0-b3 + */ + $vars = array('data', 'user_row', 'sql_ary', 'error'); + extract($phpbb_dispatcher->trigger_event('core.acp_users_prefs_modify_sql', compact($vars))); - // Check if user has an active session - if ($user_row['session_id']) + if (!sizeof($error)) { - // We'll update the session if user_allow_viewonline has changed and the user is a bot - // Or if it's a regular user and the admin set it to hide the session - if ($user_row['user_allow_viewonline'] != $sql_ary['user_allow_viewonline'] && $user_row['user_type'] == USER_IGNORE - || $user_row['user_allow_viewonline'] && !$sql_ary['user_allow_viewonline']) + $sql = 'UPDATE ' . USERS_TABLE . ' + SET ' . $db->sql_build_array('UPDATE', $sql_ary) . " + WHERE user_id = $user_id"; + $db->sql_query($sql); + + // Check if user has an active session + if ($user_row['session_id']) { - // We also need to check if the user has the permission to cloak. - $user_auth = new \phpbb\auth\auth(); - $user_auth->acl($user_row); + // We'll update the session if user_allow_viewonline has changed and the user is a bot + // Or if it's a regular user and the admin set it to hide the session + if ($user_row['user_allow_viewonline'] != $sql_ary['user_allow_viewonline'] && $user_row['user_type'] == USER_IGNORE + || $user_row['user_allow_viewonline'] && !$sql_ary['user_allow_viewonline']) + { + // We also need to check if the user has the permission to cloak. + $user_auth = new \phpbb\auth\auth(); + $user_auth->acl($user_row); - $session_sql_ary = array( - 'session_viewonline' => ($user_auth->acl_get('u_hideonline')) ? $sql_ary['user_allow_viewonline'] : true, - ); + $session_sql_ary = array( + 'session_viewonline' => ($user_auth->acl_get('u_hideonline')) ? $sql_ary['user_allow_viewonline'] : true, + ); - $sql = 'UPDATE ' . SESSIONS_TABLE . ' - SET ' . $db->sql_build_array('UPDATE', $session_sql_ary) . " - WHERE session_user_id = $user_id"; - $db->sql_query($sql); + $sql = 'UPDATE ' . SESSIONS_TABLE . ' + SET ' . $db->sql_build_array('UPDATE', $session_sql_ary) . " + WHERE session_user_id = $user_id"; + $db->sql_query($sql); - unset($user_auth); + unset($user_auth); + } } - } - trigger_error($user->lang['USER_PREFS_UPDATED'] . adm_back_link($this->u_action . '&u=' . $user_id)); + trigger_error($user->lang['USER_PREFS_UPDATED'] . adm_back_link($this->u_action . '&u=' . $user_id)); + } } // Replace "error" strings with their real, localised form @@ -1653,7 +1680,7 @@ class acp_users } $timezone_selects = phpbb_timezone_select($user, $data['tz'], true); - $template->assign_vars(array( + $user_prefs_data = array( 'S_PREFS' => true, 'S_JABBER_DISABLED' => ($config['jab_enable'] && $user_row['user_jabber'] && @extension_loaded('xml')) ? false : true, @@ -1693,9 +1720,22 @@ class acp_users 'S_STYLE_OPTIONS' => style_select($data['style']), 'S_TZ_OPTIONS' => $timezone_selects['tz_select'], 'S_TZ_DATE_OPTIONS' => $timezone_selects['tz_dates'], - ) ); + /** + * Modify users preferences data before assigning it to the template + * + * @event core.acp_users_prefs_modify_template_data + * @var array data Array with users preferences data + * @var array user_row Array with user data + * @var array user_prefs_data Array with users preferences data to be assigned to the template + * @since 3.1.0-b3 + */ + $vars = array('data', 'user_row', 'user_prefs_data'); + extract($phpbb_dispatcher->trigger_event('core.acp_users_prefs_modify_template_data', compact($vars))); + + $template->assign_vars($user_prefs_data); + break; case 'avatar': -- cgit v1.2.1 From 2ec9c08a2bce2cb83c68339d2d07039cabc44d68 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 11 Apr 2014 14:10:58 +0200 Subject: [ticket/12052] Use different visibility when post was edited ... and needs to be reapproved. PHPBB3-12052 --- phpBB/includes/acp/acp_users.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index a720334ed2..3cd5e990cf 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -657,6 +657,7 @@ class acp_users { if ($topic_id_ary[$row['topic_id']][ITEM_APPROVED] == $row['topic_posts_approved'] && $topic_id_ary[$row['topic_id']][ITEM_UNAPPROVED] == $row['topic_posts_unapproved'] + && $topic_id_ary[$row['topic_id']][ITEM_REAPPROVE] == $row['topic_posts_unapproved'] && $topic_id_ary[$row['topic_id']][ITEM_DELETED] == $row['topic_posts_softdeleted']) { $move_topic_ary[] = $row['topic_id']; @@ -1050,7 +1051,7 @@ class acp_users $sql = 'SELECT COUNT(post_id) as posts_in_queue FROM ' . POSTS_TABLE . ' WHERE poster_id = ' . $user_id . ' - AND post_visibility = ' . ITEM_UNAPPROVED; + AND post_visibility = ' . $db->sql_in_set('post_visibility', array(ITEM_UNAPPROVED, ITEM_REAPPROVE)); $result = $db->sql_query($sql); $user_row['posts_in_queue'] = (int) $db->sql_fetchfield('posts_in_queue'); $db->sql_freeresult($result); -- cgit v1.2.1 From 8375c3f78909f8926ca48bb9649aa3e1f95bd117 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 11 Apr 2014 14:40:03 +0200 Subject: [ticket/12371] Fix SQL query PHPBB3-12371 --- phpBB/includes/acp/acp_users.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 3cd5e990cf..a139dad052 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1051,7 +1051,7 @@ class acp_users $sql = 'SELECT COUNT(post_id) as posts_in_queue FROM ' . POSTS_TABLE . ' WHERE poster_id = ' . $user_id . ' - AND post_visibility = ' . $db->sql_in_set('post_visibility', array(ITEM_UNAPPROVED, ITEM_REAPPROVE)); + AND ' . $db->sql_in_set('post_visibility', array(ITEM_UNAPPROVED, ITEM_REAPPROVE)); $result = $db->sql_query($sql); $user_row['posts_in_queue'] = (int) $db->sql_fetchfield('posts_in_queue'); $db->sql_freeresult($result); -- cgit v1.2.1 From b32895308d13d5d9b0cd954fd8ce871a1fa073da Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 25 Apr 2014 12:15:44 +0200 Subject: [ticket/12273] Update since version to 3.1.0-a* style PHPBB3-12273 --- phpBB/includes/acp/acp_users.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index a720334ed2..f6d46188b8 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -772,7 +772,7 @@ class acp_users * @event core.acp_users_overview_run_quicktool * @var array user_row Current user data * @var string action Quick tool that should be run - * @since 3.1-A1 + * @since 3.1.0-a1 */ $vars = array('action', 'user_row'); extract($phpbb_dispatcher->trigger_event('core.acp_users_overview_run_quicktool', compact($vars))); @@ -893,7 +893,7 @@ class acp_users * @var array user_row Current user data * @var array data Submitted user data * @var array sql_ary User data we udpate - * @since 3.1-A1 + * @since 3.1.0-a1 */ $vars = array('user_row', 'data', 'sql_ary'); extract($phpbb_dispatcher->trigger_event('core.acp_users_overview_modify_data', compact($vars))); @@ -1008,7 +1008,7 @@ class acp_users * @event core.acp_users_display_overview * @var array user_row Array with user data * @var array quick_tool_ary Ouick tool options - * @since 3.1-A1 + * @since 3.1.0-a1 */ $vars = array('user_row', 'quick_tool_ary'); extract($phpbb_dispatcher->trigger_event('core.acp_users_display_overview', compact($vars))); -- cgit v1.2.1 From 89391dec089e8085f486b768ad7654f62166f4a2 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Tue, 29 Apr 2014 17:51:21 +0200 Subject: [ticket/12458] Apply Squiz.WhiteSpace.SuperfluousWhitespace.* to legacy code. * There MUST NOT be trailing whitespace at the end of lines. * There MUST NOT be whitespace before the first content of a file. * There MUST NOT be whitespace after the last content of a file. * Functions MUST NOT contain multiple empty lines in a row. PHPBB3-12458 --- phpBB/includes/acp/acp_users.php | 4 ---- 1 file changed, 4 deletions(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index a720334ed2..2f97011c70 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -735,7 +735,6 @@ class acp_users sync('forum', 'forum_id', $forum_id_ary, false, true); } - add_log('admin', 'LOG_USER_MOVE_POSTS', $user_row['username'], $forum_info['forum_name']); add_log('user', $user_id, 'LOG_USER_MOVE_POSTS_USER', $forum_info['forum_name']); @@ -1329,7 +1328,6 @@ class acp_users } } - $template->assign_block_vars('warn', array( 'ID' => $row['warning_id'], 'USERNAME' => ($row['log_operation']) ? get_username_string('full', $row['mod_user_id'], $row['mod_username'], $row['mod_user_colour']) : '-', @@ -1379,7 +1377,6 @@ class acp_users $data['bday_year'] = request_var('bday_year', $data['bday_year']); $data['user_birthday'] = sprintf('%2d-%2d-%4d', $data['bday_day'], $data['bday_month'], $data['bday_year']); - if ($submit) { $error = validate_data($data, array( @@ -2243,7 +2240,6 @@ class acp_users $error = array(); } - $sql = 'SELECT ug.*, g.* FROM ' . GROUPS_TABLE . ' g, ' . USER_GROUP_TABLE . " ug WHERE ug.user_id = $user_id -- cgit v1.2.1 From a759704b39fc1c1353f865a633759b1369589b67 Mon Sep 17 00:00:00 2001 From: Yuriy Rusko Date: Tue, 27 May 2014 20:18:06 +0200 Subject: [ticket/12594] Remove @package tags and update file headers PHPBB3-12594 --- phpBB/includes/acp/acp_users.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index de8f1b48c6..b653ddd13b 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1,9 +1,13 @@ +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -15,9 +19,6 @@ if (!defined('IN_PHPBB')) exit; } -/** -* @package acp -*/ class acp_users { var $u_action; -- cgit v1.2.1 From 911725a5812cff5c1a0daa37b99767b5144e8a11 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 5 May 2014 16:59:55 +0200 Subject: [ticket/10073] Split email validation from email ban and taken checks PHPBB3-10073 --- phpBB/includes/acp/acp_users.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index b653ddd13b..83ab88d48c 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -814,7 +814,7 @@ class acp_users $check_ary += array( 'email' => array( array('string', false, 6, 60), - array('email', $user_row['user_email']) + array('user_email', $user_row['user_email']), ), ); } -- cgit v1.2.1 From 4698f6928e44a24a7a10ff8b4fed2c1a24cab338 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Fri, 30 May 2014 23:00:57 +0200 Subject: [ticket/12352] Remove usages of user_pass_convert column PHPBB3-12352 --- phpBB/includes/acp/acp_users.php | 1 - 1 file changed, 1 deletion(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index b653ddd13b..c25d6d36d1 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -922,7 +922,6 @@ class acp_users $sql_ary += array( 'user_password' => $passwords_manager->hash($data['new_password']), 'user_passchg' => time(), - 'user_pass_convert' => 0, ); $user->reset_login_keys($user_id); -- cgit v1.2.1 From ff6e026a403a622bd1aa498bff396a737735faed Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Thu, 26 Jun 2014 17:17:35 +0200 Subject: [ticket/12446] Unnecessary db connect inphpbb_bootstrap_enabled_exts PHPBB3-12446 --- phpBB/includes/acp/acp_users.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index d07120a65f..71880c2267 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -2384,7 +2384,7 @@ class acp_users // Select auth options $sql = 'SELECT auth_option, is_local, is_global FROM ' . ACL_OPTIONS_TABLE . ' - WHERE auth_option ' . $db->sql_like_expression($db->any_char . '_') . ' + WHERE auth_option ' . $db->sql_like_expression($db->get_any_char() . '_') . ' AND is_global = 1 ORDER BY auth_option'; $result = $db->sql_query($sql); @@ -2404,7 +2404,7 @@ class acp_users { $sql = 'SELECT auth_option, is_local, is_global FROM ' . ACL_OPTIONS_TABLE . " - WHERE auth_option " . $db->sql_like_expression($db->any_char . '_') . " + WHERE auth_option " . $db->sql_like_expression($db->get_any_char() . '_') . " AND is_local = 1 ORDER BY is_global DESC, auth_option"; $result = $db->sql_query($sql); -- cgit v1.2.1 From e0c2013bb921f04f032744c3bc351c015c759d8d Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Thu, 7 Aug 2014 17:19:08 +0200 Subject: [ticket/12822] Add method for deleting avatars and use confirm_box The method will take care of the actual deletion process in the avatar manager. Additionally, we'll be using a confirm box while deleting the avatar to prevent users from accidentally deleting their avatars. PHPBB3-12822 --- phpBB/includes/acp/acp_users.php | 58 +++++++++++++--------------------------- 1 file changed, 18 insertions(+), 40 deletions(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 71880c2267..58f9643dc9 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -465,25 +465,9 @@ class acp_users trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); } - $sql_ary = array( - 'user_avatar' => '', - 'user_avatar_type' => '', - 'user_avatar_width' => 0, - 'user_avatar_height' => 0, - ); - - $sql = 'UPDATE ' . USERS_TABLE . ' - SET ' . $db->sql_build_array('UPDATE', $sql_ary) . " - WHERE user_id = $user_id"; - $db->sql_query($sql); - // Delete old avatar if present $phpbb_avatar_manager = $phpbb_container->get('avatar.manager'); - $driver = $phpbb_avatar_manager->get_driver($user_row['user_avatar_type']); - if ($driver) - { - $driver->delete($user_row); - } + $phpbb_avatar_manager->handle_avatar_delete($db, $user, $phpbb_avatar_manager->clean_row($user_row, 'user'), USERS_TABLE, 'user_'); add_log('admin', 'LOG_USER_DEL_AVATAR', $user_row['username']); add_log('user', $user_id, 'LOG_USER_DEL_AVATAR_USER'); @@ -1779,29 +1763,6 @@ class acp_users trigger_error($user->lang['USER_AVATAR_UPDATED'] . adm_back_link($this->u_action . '&u=' . $user_id)); } } - else - { - $driver = $phpbb_avatar_manager->get_driver($avatar_data['avatar_type']); - if ($driver) - { - $driver->delete($avatar_data); - } - - // Removing the avatar - $result = array( - 'user_avatar' => '', - 'user_avatar_type' => '', - 'user_avatar_width' => 0, - 'user_avatar_height' => 0, - ); - - $sql = 'UPDATE ' . USERS_TABLE . ' - SET ' . $db->sql_build_array('UPDATE', $result) . ' - WHERE user_id = ' . (int) $user_id; - - $db->sql_query($sql); - trigger_error($user->lang['USER_AVATAR_UPDATED'] . adm_back_link($this->u_action . '&u=' . $user_id)); - } } else { @@ -1809,6 +1770,23 @@ class acp_users } } + // Handle deletion of avatars + if ($request->is_set_post('avatar_delete')) + { + if (!confirm_box(true)) + { + confirm_box(false, $user->lang('CONFIRM_AVATAR_DELETE'), build_hidden_fields(array( + 'avatar_delete' => true)) + ); + } + else + { + $phpbb_avatar_manager->handle_avatar_delete($db, $user, $avatar_data, USERS_TABLE, 'user_'); + + trigger_error($user->lang['USER_AVATAR_UPDATED'] . adm_back_link($this->u_action . '&u=' . $user_id)); + } + } + $selected_driver = $phpbb_avatar_manager->clean_driver_name($request->variable('avatar_driver', $user_row['user_avatar_type'])); foreach ($avatar_drivers as $current_driver) -- cgit v1.2.1 From fe8096753566f4beb708e9070d8789eebdd1e70b Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Sat, 16 Aug 2014 21:06:10 +0200 Subject: [ticket/12990] Use the full services name for the notification's types PHPBB3-12990 --- phpBB/includes/acp/acp_users.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 58f9643dc9..40d8218a07 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -404,7 +404,7 @@ class acp_users if ($config['require_activation'] == USER_ACTIVATION_ADMIN) { $phpbb_notifications = $phpbb_container->get('notification_manager'); - $phpbb_notifications->delete_notifications('admin_activate_user', $user_row['user_id']); + $phpbb_notifications->delete_notifications('notification.type.admin_activate_user', $user_row['user_id']); include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx); -- cgit v1.2.1 From 9ebee7de323eae3ac86f025f44429d2d4bc995b1 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Wed, 17 Sep 2014 14:15:16 +0200 Subject: [ticket/12858] Generate timezone selects with template loop PHPBB3-12858 --- phpBB/includes/acp/acp_users.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 40d8218a07..1874bca7fc 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1661,7 +1661,7 @@ class acp_users ${'s_sort_' . $sort_option . '_dir'} .= ''; } - $timezone_selects = phpbb_timezone_select($user, $data['tz'], true); + $timezone_selects = phpbb_timezone_select($template, $user, $data['tz'], true); $user_prefs_data = array( 'S_PREFS' => true, 'S_JABBER_DISABLED' => ($config['jab_enable'] && $user_row['user_jabber'] && @extension_loaded('xml')) ? false : true, -- cgit v1.2.1 From 6323180344b079013afe8a5ecaa0986a645f8829 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Wed, 17 Sep 2014 16:00:16 +0200 Subject: [ticket/12858] Fix timezone display on acp users page PHPBB3-12858 --- phpBB/includes/acp/acp_users.php | 2 -- 1 file changed, 2 deletions(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 1874bca7fc..c9239e534a 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1700,8 +1700,6 @@ class acp_users 'S_LANG_OPTIONS' => language_select($data['lang']), 'S_STYLE_OPTIONS' => style_select($data['style']), - 'S_TZ_OPTIONS' => $timezone_selects['tz_select'], - 'S_TZ_DATE_OPTIONS' => $timezone_selects['tz_dates'], ); /** -- cgit v1.2.1 From f4761b5e0847a95944aaf9b00057eaa059995b81 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Wed, 17 Sep 2014 19:07:24 +0200 Subject: [ticket/12858] Directly return and use timezone selects PHPBB3-12858 --- phpBB/includes/acp/acp_users.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index c9239e534a..31b033604d 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1661,7 +1661,7 @@ class acp_users ${'s_sort_' . $sort_option . '_dir'} .= ''; } - $timezone_selects = phpbb_timezone_select($template, $user, $data['tz'], true); + phpbb_timezone_select($template, $user, $data['tz'], true); $user_prefs_data = array( 'S_PREFS' => true, 'S_JABBER_DISABLED' => ($config['jab_enable'] && $user_row['user_jabber'] && @extension_loaded('xml')) ? false : true, -- cgit v1.2.1 From 179a7a4c715b13773805643a3b6e78f81c5673c8 Mon Sep 17 00:00:00 2001 From: Matt Friedman Date: Thu, 1 Jan 2015 17:38:51 -0800 Subject: [ticket/13439] Add event core.acp_users_overview_before PHPBB3-13439 --- phpBB/includes/acp/acp_users.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 31b033604d..ca9efc8d53 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -173,6 +173,21 @@ class acp_users $delete_type = request_var('delete_type', ''); $ip = request_var('ip', 'ip'); + /** + * Run code at beginning of ACP users overview + * + * @event core.acp_users_overview_before + * @var array user_row Current user data + * @var string mode Active module + * @var string action Module that should be run + * @var bool submit Do we display the form only + * or did the user press submit + * @var array error Array holding error messages + * @since 3.1.3 + */ + $vars = array('user_row', 'mode', 'action', 'submit', 'error'); + extract($phpbb_dispatcher->trigger_event('core.acp_users_overview_before', compact($vars))); + if ($submit) { if ($delete) -- cgit v1.2.1 From 86f66b5f72132afcfa1b4119a6620fea1008f8ae Mon Sep 17 00:00:00 2001 From: Matt Friedman Date: Sun, 4 Jan 2015 01:38:50 -0800 Subject: [ticket/13439] Update event version to 3.1.3-RC1 PHPBB3-13439 --- phpBB/includes/acp/acp_users.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index ca9efc8d53..881e50dd5a 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -183,7 +183,7 @@ class acp_users * @var bool submit Do we display the form only * or did the user press submit * @var array error Array holding error messages - * @since 3.1.3 + * @since 3.1.3-RC1 */ $vars = array('user_row', 'mode', 'action', 'submit', 'error'); extract($phpbb_dispatcher->trigger_event('core.acp_users_overview_before', compact($vars))); -- cgit v1.2.1 From be1b114114786d4084a77d153d92253a31ad1a8d Mon Sep 17 00:00:00 2001 From: rxu Date: Fri, 23 Jan 2015 00:35:02 +0700 Subject: [ticket/13536] Add core events to allow modifying user profile data on editing Event request: http://area51.phpbb.com/phpBB/viewtopic.php?f=111&t=33744 PHPBB3-13536 --- phpBB/includes/acp/acp_users.php | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 881e50dd5a..3c957a7093 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1377,6 +1377,19 @@ class acp_users $data['bday_year'] = request_var('bday_year', $data['bday_year']); $data['user_birthday'] = sprintf('%2d-%2d-%4d', $data['bday_day'], $data['bday_month'], $data['bday_year']); + /** + * Modify user data on editing profile in ACP + * + * @event core.acp_users_modify_profile + * @var array data Array with user profile data + * @var bool submit Flag indicating if submit button has been pressed + * @var int user_id The user id + * @var array user_row Array with the full user data + * @since 3.1.4-RC1 + */ + $vars = array('data', 'submit', 'user_id', 'user_row'); + extract($phpbb_dispatcher->trigger_event('core.acp_users_modify_profile', compact($vars))); + if ($submit) { $error = validate_data($data, array( @@ -1408,6 +1421,19 @@ class acp_users 'user_birthday' => $data['user_birthday'], ); + /** + * Modify profile data in ACP before submitting to the database + * + * @event core.acp_users_profile_modify_sql_ary + * @var array cp_data Array with the user custom profile fields data + * @var array data Array with user profile data + * @var int user_id The user id + * @var array user_row Array with the full user data + * @since 3.1.4-RC1 + */ + $vars = array('cp_data', 'data', 'user_id', 'user_row'); + extract($phpbb_dispatcher->trigger_event('core.acp_users_profile_modify_sql_ary', compact($vars))); + $sql = 'UPDATE ' . USERS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . " WHERE user_id = $user_id"; -- cgit v1.2.1 From b8dfbfe390590c16cc6a9a829ce17d55482ae230 Mon Sep 17 00:00:00 2001 From: MateBartus Date: Tue, 24 Feb 2015 21:06:53 +0100 Subject: [ticket/13636] Deleting inactive user in acp_users gives unexpected link Success message did not provide the expected "previous page" link (acp_inactive was expected, but the link took users to acp_users) if the acp_users module was accessed by navigating from the inactive user list to acp_users and then deleting inactive user. PHPBB3-13636 --- phpBB/includes/acp/acp_users.php | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 3c957a7093..05852bff6d 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -44,6 +44,10 @@ class acp_users $user_id = request_var('u', 0); $action = request_var('action', ''); + $referer = request_var('referer', ''); + $referer_tag = "referer=$referer"; + $referer_url = append_sid("{$phpbb_admin_path}index.$phpEx", "i=$referer"); + $submit = (isset($_POST['update']) && !isset($_POST['cancel'])) ? true : false; $form_name = 'acp_users'; @@ -146,9 +150,9 @@ class acp_users } $template->assign_vars(array( - 'U_BACK' => $this->u_action, + 'U_BACK' => ( (empty($referer)) ? $this->u_action : $referer_url ), 'U_MODE_SELECT' => append_sid("{$phpbb_admin_path}index.$phpEx", "i=$id&u=$user_id"), - 'U_ACTION' => $this->u_action . '&u=' . $user_id, + 'U_ACTION' => $this->u_action . '&u=' . $user_id . ( (empty($referer)) ? '' : '&' . $referer_tag ), 'S_FORM_OPTIONS' => $s_form_options, 'MANAGED_USERNAME' => $user_row['username']) ); @@ -221,19 +225,30 @@ class acp_users user_delete($delete_type, $user_id, $user_row['username']); add_log('admin', 'LOG_USER_DELETED', $user_row['username']); - trigger_error($user->lang['USER_DELETED'] . adm_back_link($this->u_action)); + trigger_error($user->lang['USER_DELETED'] . adm_back_link( + (empty($referer)) ? $this->u_action : $referer_url + ) + ); } else { - confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( + $delete_confirm_hidden_fields = array( 'u' => $user_id, 'i' => $id, 'mode' => $mode, 'action' => $action, 'update' => true, 'delete' => 1, - 'delete_type' => $delete_type)) + 'delete_type' => $delete_type ); + + // Checks if the redirection page is specified + if (!empty($referer)) + { + $delete_confirm_hidden_fields['referer'] = $referer; + } + + confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields($delete_confirm_hidden_fields)); } } else -- cgit v1.2.1 From 19fe32d5b2bad52cac9fd86de8f0120405b69119 Mon Sep 17 00:00:00 2001 From: MateBartus Date: Tue, 24 Feb 2015 21:23:58 +0100 Subject: [ticket/13636] Deleting inactive user in acp_users gives unexpected link Change "referer" to "redirect" in variable names and GET params as well. PHPBB3-13636 --- phpBB/includes/acp/acp_users.php | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 05852bff6d..26ea1a2c11 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -44,9 +44,10 @@ class acp_users $user_id = request_var('u', 0); $action = request_var('action', ''); - $referer = request_var('referer', ''); - $referer_tag = "referer=$referer"; - $referer_url = append_sid("{$phpbb_admin_path}index.$phpEx", "i=$referer"); + // Get referer to redirect user to the appropriate page after delete action + $redirect = request_var('redirect', ''); + $redirect_tag = "redirect=$redirect"; + $redirect_url = append_sid("{$phpbb_admin_path}index.$phpEx", "i=$redirect"); $submit = (isset($_POST['update']) && !isset($_POST['cancel'])) ? true : false; @@ -150,9 +151,9 @@ class acp_users } $template->assign_vars(array( - 'U_BACK' => ( (empty($referer)) ? $this->u_action : $referer_url ), + 'U_BACK' => ( (empty($redirect)) ? $this->u_action : $redirect_url ), 'U_MODE_SELECT' => append_sid("{$phpbb_admin_path}index.$phpEx", "i=$id&u=$user_id"), - 'U_ACTION' => $this->u_action . '&u=' . $user_id . ( (empty($referer)) ? '' : '&' . $referer_tag ), + 'U_ACTION' => $this->u_action . '&u=' . $user_id . ( (empty($redirect)) ? '' : '&' . $redirect_tag ), 'S_FORM_OPTIONS' => $s_form_options, 'MANAGED_USERNAME' => $user_row['username']) ); @@ -226,7 +227,7 @@ class acp_users add_log('admin', 'LOG_USER_DELETED', $user_row['username']); trigger_error($user->lang['USER_DELETED'] . adm_back_link( - (empty($referer)) ? $this->u_action : $referer_url + (empty($redirect)) ? $this->u_action : $redirect_url ) ); } @@ -243,9 +244,9 @@ class acp_users ); // Checks if the redirection page is specified - if (!empty($referer)) + if (!empty($redirect)) { - $delete_confirm_hidden_fields['referer'] = $referer; + $delete_confirm_hidden_fields['redirect'] = $redirect; } confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields($delete_confirm_hidden_fields)); -- cgit v1.2.1 From 6b87e062929c6a6bb115c99d1851b1d0cd3fa6ee Mon Sep 17 00:00:00 2001 From: Richard McGirr Date: Fri, 6 Mar 2015 07:26:35 -0500 Subject: [ticket/13675] Add validate to acp_profile event and add template events for acp users profile PHPBB3-13675 --- phpBB/includes/acp/acp_users.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 3c957a7093..8c17fb6311 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1414,6 +1414,18 @@ class acp_users $error[] = 'FORM_INVALID'; } + /** + * Validate profile data in ACP before submitting to the database + * + * @event core.acp_users_profile_validate + * @var bool submit Flag indicating if submit button has been pressed + * @var array data Array with user profile data + * @var array error Array with the form errors + * @since 3.1.4-RC1 + */ + $vars = array('submit', 'data', 'error'); + extract($phpbb_dispatcher->trigger_event('core.acp_users_profile_validate', compact($vars))); + if (!sizeof($error)) { $sql_ary = array( @@ -1429,9 +1441,10 @@ class acp_users * @var array data Array with user profile data * @var int user_id The user id * @var array user_row Array with the full user data + * @var array sql_ary Array with sql data * @since 3.1.4-RC1 */ - $vars = array('cp_data', 'data', 'user_id', 'user_row'); + $vars = array('cp_data', 'data', 'user_id', 'user_row', 'sql_ary'); extract($phpbb_dispatcher->trigger_event('core.acp_users_profile_modify_sql_ary', compact($vars))); $sql = 'UPDATE ' . USERS_TABLE . ' -- cgit v1.2.1 From cc29638bcc23bf62d8b379ebe31577cb8fea04fb Mon Sep 17 00:00:00 2001 From: MateBartus Date: Mon, 6 Apr 2015 13:15:39 +0200 Subject: [ticket/13636] Fix coding style PHPBB3-13636 --- phpBB/includes/acp/acp_users.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 26ea1a2c11..503f137433 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -151,9 +151,9 @@ class acp_users } $template->assign_vars(array( - 'U_BACK' => ( (empty($redirect)) ? $this->u_action : $redirect_url ), + 'U_BACK' => (empty($redirect)) ? $this->u_action : $redirect_url, 'U_MODE_SELECT' => append_sid("{$phpbb_admin_path}index.$phpEx", "i=$id&u=$user_id"), - 'U_ACTION' => $this->u_action . '&u=' . $user_id . ( (empty($redirect)) ? '' : '&' . $redirect_tag ), + 'U_ACTION' => $this->u_action . '&u=' . $user_id . ((empty($redirect)) ? '' : '&' . $redirect_tag), 'S_FORM_OPTIONS' => $s_form_options, 'MANAGED_USERNAME' => $user_row['username']) ); @@ -240,7 +240,7 @@ class acp_users 'action' => $action, 'update' => true, 'delete' => 1, - 'delete_type' => $delete_type + 'delete_type' => $delete_type, ); // Checks if the redirection page is specified -- cgit v1.2.1 From d003b53922624e7e923ed529726a7f89c3ef5afa Mon Sep 17 00:00:00 2001 From: Richard McGirr Date: Sun, 19 Apr 2015 08:07:45 -0400 Subject: [ticket/10572] Unguarded includes in acp files PHPBB3-10572 --- phpBB/includes/acp/acp_users.php | 58 +++++++++++++++++++++++++++++++--------- 1 file changed, 45 insertions(+), 13 deletions(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 644beda77b..4d0bbf5721 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -57,7 +57,10 @@ class acp_users // Whois (special case) if ($action == 'whois') { - include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + if (!function_exists('user_get_id_name')) + { + include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + } $this->page_title = 'WHOIS'; $this->tpl_name = 'simple_body'; @@ -170,7 +173,10 @@ class acp_users { case 'overview': - include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + if (!function_exists('user_get_id_name')) + { + include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + } $user->add_lang('acp/ban'); @@ -354,7 +360,10 @@ class acp_users if ($config['email_enable']) { - include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx); + if (!class_exists('messenger')) + { + include($phpbb_root_path . 'includes/functions_messenger.' . $phpEx); + } $server_url = generate_board_url(); @@ -437,7 +446,10 @@ class acp_users $phpbb_notifications = $phpbb_container->get('notification_manager'); $phpbb_notifications->delete_notifications('notification.type.admin_activate_user', $user_row['user_id']); - include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx); + if (!class_exists('messenger')) + { + include($phpbb_root_path . 'includes/functions_messenger.' . $phpEx); + } $messenger = new messenger(false); @@ -1361,7 +1373,10 @@ class acp_users case 'profile': - include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + if (!function_exists('user_get_id_name')) + { + include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + } $cp = $phpbb_container->get('profilefields.manager'); @@ -1520,7 +1535,10 @@ class acp_users case 'prefs': - include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + if (!function_exists('user_get_id_name')) + { + include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + } $data = array( 'dateformat' => utf8_normalize_nfc(request_var('dateformat', $user_row['user_dateformat'], true)), @@ -1790,8 +1808,6 @@ class acp_users case 'avatar': - include($phpbb_root_path . 'includes/functions_display.' . $phpEx); - $avatars_enabled = false; if ($config['allow_avatar']) @@ -1946,8 +1962,15 @@ class acp_users case 'sig': - include_once($phpbb_root_path . 'includes/functions_posting.' . $phpEx); - include_once($phpbb_root_path . 'includes/functions_display.' . $phpEx); + if (!function_exists('generate_smilies')) + { + include($phpbb_root_path . 'includes/functions_posting.' . $phpEx); + } + + if (!function_exists('display_custom_bbcodes')) + { + include($phpbb_root_path . 'includes/functions_display.' . $phpEx); + } $enable_bbcode = ($config['allow_sig_bbcode']) ? (bool) $this->optionget($user_row, 'sig_bbcode') : false; $enable_smilies = ($config['allow_sig_smilies']) ? (bool) $this->optionget($user_row, 'sig_smilies') : false; @@ -1958,7 +1981,10 @@ class acp_users if ($submit || $preview) { - include_once($phpbb_root_path . 'includes/message_parser.' . $phpEx); + if (!class_exists('messenger')) + { + include($phpbb_root_path . 'includes/message_parser.' . $phpEx); + } $enable_bbcode = ($config['allow_sig_bbcode']) ? ((request_var('disable_bbcode', false)) ? false : true) : false; $enable_smilies = ($config['allow_sig_smilies']) ? ((request_var('disable_smilies', false)) ? false : true) : false; @@ -2199,7 +2225,10 @@ class acp_users case 'groups': - include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + if (!function_exists('group_user_attributes')) + { + include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + } $user->add_lang(array('groups', 'acp/groups')); $group_id = request_var('g', 0); @@ -2415,7 +2444,10 @@ class acp_users case 'perm': - include_once($phpbb_root_path . 'includes/acp/auth.' . $phpEx); + if (!class_exists('auth_admin')) + { + include($phpbb_root_path . 'includes/acp/auth.' . $phpEx); + } $auth_admin = new auth_admin(); -- cgit v1.2.1 From 7705017f6381ec4fad769069ba84f12ba2e5c316 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Tue, 1 Dec 2015 14:59:43 +0100 Subject: [ticket/14272] Make sure phpbb_avatar_manager was defined PHPBB3-14272 --- phpBB/includes/acp/acp_users.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 4d0bbf5721..febdcb93ed 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1809,10 +1809,11 @@ class acp_users case 'avatar': $avatars_enabled = false; + /** @var \phpbb\avatar\manager $phpbb_avatar_manager */ + $phpbb_avatar_manager = $phpbb_container->get('avatar.manager'); if ($config['allow_avatar']) { - $phpbb_avatar_manager = $phpbb_container->get('avatar.manager'); $avatar_drivers = $phpbb_avatar_manager->get_enabled_drivers(); // This is normalised data, without the user_ prefix -- cgit v1.2.1 From f3c2c497d8443d7cb77eaaf9c8031db1cb3434d9 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Tue, 1 Dec 2015 15:15:43 +0100 Subject: [ticket/14272] Assign min and max values for avatar driver settings PHPBB3-14272 --- phpBB/includes/acp/acp_users.php | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index febdcb93ed..4dcf70010c 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1874,6 +1874,14 @@ class acp_users $selected_driver = $phpbb_avatar_manager->clean_driver_name($request->variable('avatar_driver', $user_row['user_avatar_type'])); + // Assign min and max values before generating avatar driver html + $template->assign_vars(array( + 'AVATAR_MIN_WIDTH' => $config['avatar_min_width'], + 'AVATAR_MAX_WIDTH' => $config['avatar_max_width'], + 'AVATAR_MIN_HEIGHT' => $config['avatar_min_height'], + 'AVATAR_MAX_HEIGHT' => $config['avatar_max_height'], + )); + foreach ($avatar_drivers as $current_driver) { $driver = $phpbb_avatar_manager->get_driver($current_driver); -- cgit v1.2.1 From 06f4b6926baaf27897b2f57f7938eed4acf5dedb Mon Sep 17 00:00:00 2001 From: javiexin Date: Thu, 30 Jul 2015 01:43:18 +0200 Subject: [ticket/14387] Extend avatar-driver by extension in ACP not possible Create two driver methods to provide the driver config name and the driver ACP template name, and use them within the manager method. Default driver config name and template name are the same as now. But new drivers are able to override the config name and template name with their own, including @vendor_extension. PHPBB3-14387 --- phpBB/includes/acp/acp_users.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 4d0bbf5721..ac31ac36a1 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1878,9 +1878,9 @@ class acp_users $driver = $phpbb_avatar_manager->get_driver($current_driver); $avatars_enabled = true; - $config_name = $phpbb_avatar_manager->get_driver_config_name($driver); + $template_name = $phpbb_avatar_manager->get_driver_template_name($driver); $template->set_filenames(array( - 'avatar' => "acp_avatar_options_{$config_name}.html", + 'avatar' => $template_name, )); if ($driver->prepare_form($request, $template, $user, $avatar_data, $error)) -- cgit v1.2.1 From 917c864bbf51309da4c8bda7ad03e1e00afc0764 Mon Sep 17 00:00:00 2001 From: javiexin Date: Thu, 30 Jul 2015 10:48:39 +0200 Subject: [ticket/14387] Extend avatar-driver by extension in ACP not possible Create two driver methods to provide the driver config name and the driver ACP template name, and use them directly when required. Default driver config name and template name are the same as now. But new drivers are able to override the config name and template name with their own, including @vendor_extension. Simplified manager interface by reducing unneeded methods. PHPBB3-14387 --- phpBB/includes/acp/acp_users.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index ac31ac36a1..aa4470fd0e 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1878,9 +1878,8 @@ class acp_users $driver = $phpbb_avatar_manager->get_driver($current_driver); $avatars_enabled = true; - $template_name = $phpbb_avatar_manager->get_driver_template_name($driver); $template->set_filenames(array( - 'avatar' => $template_name, + 'avatar' => $driver->get_acp_template_name(), )); if ($driver->prepare_form($request, $template, $user, $avatar_data, $error)) -- cgit v1.2.1 From 678ca5dcdc27f2df10c6042ce74d08f4196d5a02 Mon Sep 17 00:00:00 2001 From: Saeed Hubaishan Date: Sun, 29 Nov 2015 10:51:19 +0300 Subject: [ticket/13180] Increase dateformat field size [ticket/13180] Increase dateformat field size change field size to 64 in these files add new migration file to update the database schema PHPBB3-13180 --- phpBB/includes/acp/acp_users.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index aa4470fd0e..4c94b99b0d 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1587,7 +1587,7 @@ class acp_users if ($submit) { $error = validate_data($data, array( - 'dateformat' => array('string', false, 1, 30), + 'dateformat' => array('string', false, 1, 64), 'lang' => array('match', false, '#^[a-z_\-]{2,}$#i'), 'tz' => array('timezone'), -- cgit v1.2.1 From 68abcb9058e2eed57e2129192b5cf41fdc80f4bc Mon Sep 17 00:00:00 2001 From: rxu Date: Sun, 31 Jan 2016 23:45:24 +0700 Subject: [ticket/14439] Do not call avatar manager if avatars are disabled PHPBB3-14439 --- phpBB/includes/acp/acp_users.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 4c94b99b0d..d7cdd8030a 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1899,8 +1899,12 @@ class acp_users } } - // Replace "error" strings with their real, localised form - $error = $phpbb_avatar_manager->localize_errors($user, $error); + // Avatar manager is not initialized if avatars are disabled + if (isset($phpbb_avatar_manager)) + { + // Replace "error" strings with their real, localised form + $error = $phpbb_avatar_manager->localize_errors($user, $error); + } $avatar = phpbb_get_user_avatar($user_row, 'USER_AVATAR', true); -- cgit v1.2.1 From 4e5f29a21b79f58864669e0d1a62fa8287e11720 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Fri, 30 Sep 2016 23:26:04 +0100 Subject: [ticket/14789] Remove obsolete check_form_key() and add missing hashes PHPBB3-14789 --- phpBB/includes/acp/acp_users.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 1ea266815d..1e453e88ad 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -2274,6 +2274,12 @@ class acp_users { trigger_error($user->lang['NO_GROUP'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); } + + if (!check_link_hash($request->variable('hash', ''), 'acp_users')) + { + trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING); + } + group_user_attributes($action, $group_id, $user_id); if ($action == 'default') @@ -2431,8 +2437,8 @@ class acp_users { $template->assign_block_vars('group', array( '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"), - 'U_DEFAULT' => $this->u_action . "&action=default&u=$user_id&g=" . $data['group_id'], - 'U_DEMOTE_PROMOTE' => $this->u_action . '&action=' . (($data['group_leader']) ? 'demote' : 'promote') . "&u=$user_id&g=" . $data['group_id'], + 'U_DEFAULT' => $this->u_action . "&action=default&u=$user_id&g=" . $data['group_id'] . '&hash=' . generate_link_hash('acp_users'), + 'U_DEMOTE_PROMOTE' => $this->u_action . '&action=' . (($data['group_leader']) ? 'demote' : 'promote') . "&u=$user_id&g=" . $data['group_id'] . '&hash=' . generate_link_hash('acp_users'), 'U_DELETE' => $this->u_action . "&action=delete&u=$user_id&g=" . $data['group_id'], 'U_APPROVE' => ($group_type == 'pending') ? $this->u_action . "&action=approve&u=$user_id&g=" . $data['group_id'] : '', -- cgit v1.2.1 From 20148e4d062019f9a1024f9afae905a4851d9aff Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sun, 16 Oct 2016 11:16:06 +0200 Subject: [ticket/11483] Generate user act key if database entry is empty The force reactivation action in the ACP will no longer overwrite the generated activation key in case the key stored in the database is empty. It will also save the generated key back to the database to actually allow the activation by the user. PHPBB3-11483 --- phpBB/includes/acp/acp_users.php | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 1e453e88ad..008cc02471 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -373,11 +373,6 @@ class acp_users if ($user_row['user_type'] == USER_NORMAL) { user_active_flip('deactivate', $user_id, INACTIVE_REMIND); - - $sql = 'UPDATE ' . USERS_TABLE . " - SET user_actkey = '" . $db->sql_escape($user_actkey) . "' - WHERE user_id = $user_id"; - $db->sql_query($sql); } else { @@ -386,8 +381,18 @@ class acp_users FROM ' . USERS_TABLE . ' WHERE user_id = ' . $user_id; $result = $db->sql_query($sql); - $user_actkey = (string) $db->sql_fetchfield('user_actkey'); + $user_activation_key = (string) $db->sql_fetchfield('user_actkey'); $db->sql_freeresult($result); + + $user_actkey = empty($user_activation_key) ? $user_actkey : $user_activation_key; + } + + if ($user_row['user_type'] == USER_NORMAL || empty($user_activation_key)) + { + $sql = 'UPDATE ' . USERS_TABLE . " + SET user_actkey = '" . $db->sql_escape($user_actkey) . "' + WHERE user_id = $user_id"; + $db->sql_query($sql); } $messenger = new messenger(false); -- cgit v1.2.1 From ba5243ba7652049aa2c311a96bfdc94994ddaf4b Mon Sep 17 00:00:00 2001 From: Jakub Senko Date: Sun, 13 Nov 2016 15:47:54 +0100 Subject: [ticket/14842] Don't display filesize limit if there is none PHPBB3-14842 --- phpBB/includes/acp/acp_users.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes/acp/acp_users.php') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 1e453e88ad..9457ad18b8 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1924,7 +1924,7 @@ class acp_users 'S_FORM_ENCTYPE' => ' enctype="multipart/form-data"', - 'L_AVATAR_EXPLAIN' => sprintf($user->lang['AVATAR_EXPLAIN'], $config['avatar_max_width'], $config['avatar_max_height'], $config['avatar_filesize'] / 1024), + 'L_AVATAR_EXPLAIN' => $user->lang(($config['avatar_filesize'] == 0) ? 'AVATAR_EXPLAIN_NO_FILESIZE' : 'AVATAR_EXPLAIN', $config['avatar_max_width'], $config['avatar_max_height'], $config['avatar_filesize'] / 1024), 'S_AVATARS_ENABLED' => ($config['allow_avatar'] && $avatars_enabled), )); -- cgit v1.2.1