当前位置: 首页>>代码示例>>PHP>>正文


PHP user_update_name函数代码示例

本文整理汇总了PHP中user_update_name函数的典型用法代码示例。如果您正苦于以下问题:PHP user_update_name函数的具体用法?PHP user_update_name怎么用?PHP user_update_name使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了user_update_name函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: main


//.........这里部分代码省略.........
                        }
                        /**
                         * 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.0-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;
                            $sql_ary['username_clean'] = utf8_clean_string($update_username);
                            $phpbb_log->add('user', $user->data['user_id'], $user->ip, 'LOG_USER_UPDATE_NAME', false, array('reportee_id' => $user_id, $user_row['username'], $update_username));
                        }
                        if ($update_email !== false) {
                            $sql_ary += array('user_email' => $update_email, 'user_email_hash' => phpbb_email_hash($update_email));
                            $phpbb_log->add('user', $user->data['user_id'], $user->ip, 'LOG_USER_UPDATE_EMAIL', false, array('reportee_id' => $user_id, $user_row['username'], $user_row['user_email'], $update_email));
                        }
                        if ($update_password) {
                            $sql_ary += array('user_password' => $passwords_manager->hash($data['new_password']), 'user_passchg' => time());
                            $user->reset_login_keys($user_id);
                            $phpbb_log->add('user', $user->data['user_id'], $user->ip, 'LOG_USER_NEW_PASSWORD', false, array('reportee_id' => $user_id, $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);
                        $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_USER_USER_UPDATE', false, array($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 = array_map(array($user, 'lang'), $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';
                    }
                }
                if ($config['load_onlinetrack']) {
                    $sql = 'SELECT MAX(session_time) AS session_time, MIN(session_viewonline) AS session_viewonline
开发者ID:bantu,项目名称:phpbb,代码行数:67,代码来源:acp_users.php

示例2: main


//.........这里部分代码省略.........

						if ($update_email !== false)
						{
							$sql_ary += array(
								'user_email'		=> $update_email,
								'user_email_hash'	=> crc32($update_email) . strlen($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');
				}
				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'));
					}
					
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:66,代码来源:acp_users.php

示例3: main


//.........这里部分代码省略.........
                        if ($user_row['user_type'] != USER_FOUNDER || $user->data['user_type'] == USER_FOUNDER) {
                            if ($update_warning) {
                                $sql_ary['user_warnings'] = $data['warnings'];
                            }
                            if ($user_row['user_type'] == USER_FOUNDER && !$data['user_founder'] || $user_row['user_type'] != USER_FOUNDER && $data['user_founder']) {
                                $sql_ary['user_type'] = $data['user_founder'] ? USER_FOUNDER : USER_NORMAL;
                            }
                        }
                        if ($update_username !== false) {
                            $sql_ary['username'] = $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' => crc32(strtolower($update_email)) . strlen($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' => md5($data['user_password']), 'user_passchg' => time());
                            $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);
                        }
                        /**
                         * @todo adjust every data based in the number of user warnings
                         */
                        if ($update_warning) {
                        }
                        if ($update_username) {
                            user_update_name($user_row['username'], $update_username);
                        }
                        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);
                }
                $user_char_ary = array('.*' => 'USERNAME_CHARS_ANY', '[\\w]+' => 'USERNAME_ALPHA_ONLY', '[\\w_\\+\\. \\-\\[\\]]+' => 'USERNAME_ALPHA_SPACERS');
                $quick_tool_ary = array('banuser' => 'BAN_USER', 'banemail' => 'BAN_EMAIL', 'banip' => 'BAN_IP', 'active' => $user_row['user_type'] == USER_INACTIVE ? 'ACTIVATE' : 'DEACTIVATE', 'delsig' => 'DEL_SIG', 'delavatar' => 'DEL_AVATAR', 'moveposts' => 'MOVE_POSTS', 'delposts' => 'DEL_POSTS', 'delattach' => 'DEL_ATTACH');
                if ($config['email_enable']) {
                    $quick_tool_ary['reactivate'] = 'FORCE';
                }
                $s_action_options = '<option class="sep" value="">' . $user->lang['SELECT_OPTION'] . '</option>';
                foreach ($quick_tool_ary as $value => $lang) {
                    $s_action_options .= '<option value="' . $value . '">' . $user->lang['USER_ADMIN_' . $lang] . '</option>';
                }
                $template->assign_vars(array('L_NAME_CHARS_EXPLAIN' => sprintf($user->lang[$user_char_ary[$config['allow_name_chars']] . '_EXPLAIN'], $config['min_name_chars'], $config['max_name_chars']), 'L_CHANGE_PASSWORD_EXPLAIN' => sprintf($user->lang['CHANGE_PASSWORD_EXPLAIN'], $config['min_pass_chars'], $config['max_pass_chars']), '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, 'U_SHOW_IP' => $this->u_action . "&amp;u={$user_id}&amp;ip=" . ($ip == 'ip' ? 'hostname' : 'ip'), 'U_WHOIS' => $this->u_action . "&amp;action=whois&amp;user_ip={$user_row['user_ip']}", '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&amp;u={$user_row['user_id']}") : '', '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' => $user_row['user_lastvisit'] ? $user->format_date($user_row['user_lastvisit']) : ' - ', 'USER_EMAIL' => $user_row['user_email'], 'USER_WARNINGS' => $user_row['user_warnings']));
                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 = 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')) {
开发者ID:yunsite,项目名称:gloryroad,代码行数:67,代码来源:acp_users.php

示例4: array

									}
									echo '</div>';
								}

								if (!$errors)
								{
									$sql = 'UPDATE ' . USERS_TABLE . '
										SET ' . $db->sql_build_array('UPDATE', array(
												'username' => $data['username'],
												'username_clean' => utf8_clean_string($data['username'])
											)) . '
										WHERE user_id = ' . $user_id;
									$db->sql_query($sql);

									add_log('user', $user_id, 'LOG_USER_UPDATE_NAME', $row['username'], $data['username']);
									user_update_name($row['username'], $data['username']);
								}
							}
						}
					break;

					case 'delete_retain':
					case 'delete_remove':
						if ($user_id != ANONYMOUS && $row['user_type'] != USER_FOUNDER)
						{
							user_delete(substr($row['action'], 7), $user_id, $row['username']);
							add_log('admin', 'LOG_USER_DELETED', $row['username']);
						}
					break;
				}
			}
开发者ID:BackupTheBerlios,项目名称:phpbb-hu-svn,代码行数:31,代码来源:database_update.php

示例5: main

    function main($id, $mode)
    {
        global $config, $db, $user, $auth, $template, $phpbb_root_path, $phpEx;
        $user->add_lang('posting');
        $preview = !empty($_POST['preview']) ? true : false;
        $submit = !empty($_POST['submit']) ? true : false;
        $delete = !empty($_POST['delete']) ? true : false;
        $error = $data = array();
        $s_hidden_fields = '';
        switch ($mode) {
            case 'reg_details':
                $data = array('username' => utf8_normalize_nfc(request_var('username', $user->data['username'], true)), 'email' => strtolower(request_var('email', $user->data['user_email'])), 'email_confirm' => strtolower(request_var('email_confirm', '')), 'new_password' => request_var('new_password', '', true), 'cur_password' => request_var('cur_password', '', true), 'password_confirm' => request_var('password_confirm', '', true));
                add_form_key('ucp_reg_details');
                if ($submit) {
                    // Do not check cur_password, it is the old one.
                    $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']), 'email' => array(array('string', false, 6, 60), array('email')), 'email_confirm' => array('string', true, 6, 60));
                    if ($auth->acl_get('u_chgname') && $config['allow_namechange']) {
                        $check_ary['username'] = array(array('string', false, $config['min_name_chars'], $config['max_name_chars']), array('username'));
                    }
                    $error = validate_data($data, $check_ary);
                    if ($auth->acl_get('u_chgemail') && $data['email'] != $user->data['user_email'] && $data['email_confirm'] != $data['email']) {
                        $error[] = $data['email_confirm'] ? 'NEW_EMAIL_ERROR' : 'NEW_EMAIL_CONFIRM_EMPTY';
                    }
                    if ($auth->acl_get('u_chgpasswd') && $data['new_password'] && $data['password_confirm'] != $data['new_password']) {
                        $error[] = $data['password_confirm'] ? 'NEW_PASSWORD_ERROR' : 'NEW_PASSWORD_CONFIRM_EMPTY';
                    }
                    // Only check the new password against the previous password if there have been no errors
                    if (!sizeof($error) && $auth->acl_get('u_chgpasswd') && $data['new_password'] && phpbb_check_hash($data['new_password'], $user->data['user_password'])) {
                        $error[] = 'SAME_PASSWORD_ERROR';
                    }
                    if (!phpbb_check_hash($data['cur_password'], $user->data['user_password'])) {
                        $error[] = $data['cur_password'] ? 'CUR_PASSWORD_ERROR' : 'CUR_PASSWORD_EMPTY';
                    }
                    if (!check_form_key('ucp_reg_details')) {
                        $error[] = 'FORM_INVALID';
                    }
                    if (!sizeof($error)) {
                        $sql_ary = array('username' => $auth->acl_get('u_chgname') && $config['allow_namechange'] ? $data['username'] : $user->data['username'], 'username_clean' => $auth->acl_get('u_chgname') && $config['allow_namechange'] ? utf8_clean_string($data['username']) : $user->data['username_clean'], 'user_email' => $auth->acl_get('u_chgemail') ? $data['email'] : $user->data['user_email'], 'user_email_hash' => $auth->acl_get('u_chgemail') ? phpbb_email_hash($data['email']) : $user->data['user_email_hash'], 'user_password' => $auth->acl_get('u_chgpasswd') && $data['new_password'] ? phpbb_hash($data['new_password']) : $user->data['user_password'], 'user_passchg' => $auth->acl_get('u_chgpasswd') && $data['new_password'] ? time() : 0);
                        if ($auth->acl_get('u_chgname') && $config['allow_namechange'] && $data['username'] != $user->data['username']) {
                            add_log('user', $user->data['user_id'], 'LOG_USER_UPDATE_NAME', $user->data['username'], $data['username']);
                        }
                        if ($auth->acl_get('u_chgpasswd') && $data['new_password'] && !phpbb_check_hash($data['new_password'], $user->data['user_password'])) {
                            $user->reset_login_keys();
                            add_log('user', $user->data['user_id'], 'LOG_USER_NEW_PASSWORD', $data['username']);
                        }
                        if ($auth->acl_get('u_chgemail') && $data['email'] != $user->data['user_email']) {
                            add_log('user', $user->data['user_id'], 'LOG_USER_UPDATE_EMAIL', $data['username'], $user->data['user_email'], $data['email']);
                        }
                        $message = 'PROFILE_UPDATED';
                        if ($auth->acl_get('u_chgemail') && $config['email_enable'] && $data['email'] != $user->data['user_email'] && $user->data['user_type'] != USER_FOUNDER && ($config['require_activation'] == USER_ACTIVATION_SELF || $config['require_activation'] == USER_ACTIVATION_ADMIN)) {
                            $message = $config['require_activation'] == USER_ACTIVATION_SELF ? 'ACCOUNT_EMAIL_CHANGED' : 'ACCOUNT_EMAIL_CHANGED_ADMIN';
                            include_once $phpbb_root_path . 'includes/functions_messenger.' . $phpEx;
                            $server_url = generate_board_url();
                            $user_actkey = gen_rand_string(mt_rand(6, 10));
                            $messenger = new messenger(false);
                            $template_file = $config['require_activation'] == USER_ACTIVATION_ADMIN ? 'user_activate_inactive' : 'user_activate';
                            $messenger->template($template_file, $user->data['user_lang']);
                            $messenger->to($data['email'], $data['username']);
                            $messenger->anti_abuse_headers($config, $user);
                            $messenger->assign_vars(array('USERNAME' => htmlspecialchars_decode($data['username']), 'U_ACTIVATE' => "{$server_url}/ucp.{$phpEx}?mode=activate&u={$user->data['user_id']}&k={$user_actkey}"));
                            $messenger->send(NOTIFY_EMAIL);
                            if ($config['require_activation'] == USER_ACTIVATION_ADMIN) {
                                // Grab an array of user_id's with a_user permissions ... these users can activate a user
                                $admin_ary = $auth->acl_get_list(false, 'a_user', false);
                                $admin_ary = !empty($admin_ary[0]['a_user']) ? $admin_ary[0]['a_user'] : array();
                                // Also include founders
                                $where_sql = ' WHERE user_type = ' . USER_FOUNDER;
                                if (sizeof($admin_ary)) {
                                    $where_sql .= ' OR ' . $db->sql_in_set('user_id', $admin_ary);
                                }
                                $sql = 'SELECT user_id, username, user_email, user_lang, user_jabber, user_notify_type
									FROM ' . USERS_TABLE . ' ' . $where_sql;
                                $result = $db->sql_query($sql);
                                while ($row = $db->sql_fetchrow($result)) {
                                    $messenger->template('admin_activate', $row['user_lang']);
                                    $messenger->to($row['user_email'], $row['username']);
                                    $messenger->im($row['user_jabber'], $row['username']);
                                    $messenger->assign_vars(array('USERNAME' => htmlspecialchars_decode($data['username']), 'U_USER_DETAILS' => "{$server_url}/memberlist.{$phpEx}?mode=viewprofile&u={$user->data['user_id']}", 'U_ACTIVATE' => "{$server_url}/ucp.{$phpEx}?mode=activate&u={$user->data['user_id']}&k={$user_actkey}"));
                                    $messenger->send($row['user_notify_type']);
                                }
                                $db->sql_freeresult($result);
                            }
                            user_active_flip('deactivate', $user->data['user_id'], INACTIVE_PROFILE);
                            // Because we want the profile to be reactivated we set user_newpasswd to empty (else the reactivation will fail)
                            $sql_ary['user_actkey'] = $user_actkey;
                            $sql_ary['user_newpasswd'] = '';
                        }
                        if (sizeof($sql_ary)) {
                            $sql = 'UPDATE ' . USERS_TABLE . '
								SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
								WHERE user_id = ' . $user->data['user_id'];
                            $db->sql_query($sql);
                        }
                        // Need to update config, forum, topic, posting, messages, etc.
                        if ($data['username'] != $user->data['username'] && $auth->acl_get('u_chgname') && $config['allow_namechange']) {
                            user_update_name($user->data['username'], $data['username']);
                        }
                        // Now, we can remove the user completely (kill the session) - NOT BEFORE!!!
                        if (!empty($sql_ary['user_actkey'])) {
                            meta_refresh(5, append_sid($phpbb_root_path . 'index.' . $phpEx));
//.........这里部分代码省略.........
开发者ID:ahmatjan,项目名称:Crimson,代码行数:101,代码来源:ucp_profile.php

示例6: main


//.........这里部分代码省略.........
									FROM ' . USERS_TABLE . ' ' . $where_sql;
                                $result = $db->sql_query($sql);
                                while ($row = $db->sql_fetchrow($result)) {
                                    $messenger->template('admin_activate', $row['user_lang']);
                                    $messenger->set_addresses($row);
                                    $messenger->assign_vars(array('USERNAME' => htmlspecialchars_decode($data['username']), 'U_USER_DETAILS' => "{$server_url}/memberlist.{$phpEx}?mode=viewprofile&u={$user->data['user_id']}", 'U_ACTIVATE' => "{$server_url}/ucp.{$phpEx}?mode=activate&u={$user->data['user_id']}&k={$user_actkey}"));
                                    $messenger->send($row['user_notify_type']);
                                }
                                $db->sql_freeresult($result);
                            }
                            user_active_flip('deactivate', $user->data['user_id'], INACTIVE_PROFILE);
                            // Because we want the profile to be reactivated we set user_newpasswd to empty (else the reactivation will fail)
                            $sql_ary['user_actkey'] = $user_actkey;
                            $sql_ary['user_newpasswd'] = '';
                        }
                        /**
                         * Modify user registration data before submitting it to the database
                         *
                         * @event core.ucp_profile_reg_details_sql_ary
                         * @var	array	data		Array with current or updated user registration data
                         * @var	array	sql_ary		Array with user registration data to submit to the database
                         * @since 3.1.4-RC1
                         */
                        $vars = array('data', 'sql_ary');
                        extract($phpbb_dispatcher->trigger_event('core.ucp_profile_reg_details_sql_ary', compact($vars)));
                        if (sizeof($sql_ary)) {
                            $sql = 'UPDATE ' . USERS_TABLE . '
								SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
								WHERE user_id = ' . $user->data['user_id'];
                            $db->sql_query($sql);
                        }
                        // Need to update config, forum, topic, posting, messages, etc.
                        if ($data['username'] != $user->data['username'] && $auth->acl_get('u_chgname') && $config['allow_namechange']) {
                            user_update_name($user->data['username'], $data['username']);
                        }
                        // Now, we can remove the user completely (kill the session) - NOT BEFORE!!!
                        if (!empty($sql_ary['user_actkey'])) {
                            meta_refresh(5, append_sid($phpbb_root_path . 'index.' . $phpEx));
                            $message = $user->lang[$message] . '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], '<a href="' . append_sid($phpbb_root_path . 'index.' . $phpEx) . '">', '</a>');
                            // Because the user gets deactivated we log him out too, killing his session
                            $user->session_kill();
                        } else {
                            meta_refresh(3, $this->u_action);
                            $message = $user->lang[$message] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>');
                        }
                        trigger_error($message);
                    }
                    // Replace "error" strings with their real, localised form
                    $error = array_map(array($user, 'lang'), $error);
                }
                $template->assign_vars(array('ERROR' => sizeof($error) ? implode('<br />', $error) : '', 'USERNAME' => $data['username'], 'EMAIL' => $data['email'], 'PASSWORD_CONFIRM' => $data['password_confirm'], 'NEW_PASSWORD' => $data['new_password'], 'CUR_PASSWORD' => '', 'L_USERNAME_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'])), 'S_FORCE_PASSWORD' => $auth->acl_get('u_chgpasswd') && $config['chg_passforce'] && $user->data['user_passchg'] < time() - $config['chg_passforce'] * 86400 ? true : false, 'S_CHANGE_USERNAME' => $config['allow_namechange'] && $auth->acl_get('u_chgname') ? true : false, 'S_CHANGE_EMAIL' => $auth->acl_get('u_chgemail') ? true : false, 'S_CHANGE_PASSWORD' => $auth->acl_get('u_chgpasswd') ? true : false));
                break;
            case 'profile_info':
                // Do not display profile information panel if not authed to do so
                if (!$auth->acl_get('u_chgprofileinfo')) {
                    trigger_error('NO_AUTH_PROFILEINFO');
                }
                /* @var $cp \phpbb\profilefields\manager */
                $cp = $phpbb_container->get('profilefields.manager');
                $cp_data = $cp_error = array();
                $data = array('jabber' => $request->variable('jabber', $user->data['user_jabber'], true));
                if ($config['allow_birthdays']) {
                    $data['bday_day'] = $data['bday_month'] = $data['bday_year'] = 0;
                    if ($user->data['user_birthday']) {
                        list($data['bday_day'], $data['bday_month'], $data['bday_year']) = explode('-', $user->data['user_birthday']);
                    }
开发者ID:hgchen,项目名称:phpbb,代码行数:67,代码来源:ucp_profile.php

示例7: main


//.........这里部分代码省略.........
                        if (!$bot_row) {
                            $error[] = $user->lang['NO_BOT'];
                        } else {
                            $bot_name = $row['username_clean'];
                        }
                    }
                    if (!$this->validate_botname($bot_row['bot_name'], $bot_name)) {
                        $error[] = $user->lang['BOT_NAME_TAKEN'];
                    }
                    if (!sizeof($error)) {
                        // New bot? Create a new user and group entry
                        if ($action == 'add') {
                            $sql = 'SELECT group_id, group_colour
								FROM ' . GROUPS_TABLE . "\n\t\t\t\t\t\t\t\tWHERE group_name = 'BOTS'\n\t\t\t\t\t\t\t\t\tAND group_type = " . GROUP_SPECIAL;
                            $result = $db->sql_query($sql);
                            $group_row = $db->sql_fetchrow($result);
                            $db->sql_freeresult($result);
                            if (!$group_row) {
                                trigger_error($user->lang['NO_BOT_GROUP'] . adm_back_link($this->u_action . "&amp;id={$bot_id}&amp;action={$action}"), E_USER_WARNING);
                            }
                            $user_id = user_add(array('user_type' => (int) USER_IGNORE, 'group_id' => (int) $group_row['group_id'], 'username' => (string) $bot_row['bot_name'], 'user_regdate' => time(), 'user_password' => '', 'user_colour' => (string) $group_row['group_colour'], 'user_email' => '', 'user_lang' => (string) $bot_row['bot_lang'], 'user_style' => (int) $bot_row['bot_style'], 'user_allow_massemail' => 0));
                            $sql = 'INSERT INTO ' . BOTS_TABLE . ' ' . $db->sql_build_array('INSERT', array('user_id' => (int) $user_id, 'bot_name' => (string) $bot_row['bot_name'], 'bot_active' => (int) $bot_row['bot_active'], 'bot_agent' => (string) $bot_row['bot_agent'], 'bot_ip' => (string) $bot_row['bot_ip']));
                            $db->sql_query($sql);
                            $log = 'ADDED';
                        } else {
                            if ($bot_id) {
                                $sql = 'SELECT user_id, bot_name
								FROM ' . BOTS_TABLE . "\n\t\t\t\t\t\t\t\tWHERE bot_id = {$bot_id}";
                                $result = $db->sql_query($sql);
                                $row = $db->sql_fetchrow($result);
                                $db->sql_freeresult($result);
                                if (!$row) {
                                    trigger_error($user->lang['NO_BOT'] . adm_back_link($this->u_action . "&amp;id={$bot_id}&amp;action={$action}"), E_USER_WARNING);
                                }
                                $sql_ary = array('user_style' => (int) $bot_row['bot_style'], 'user_lang' => (string) $bot_row['bot_lang']);
                                if ($bot_row['bot_name'] !== $row['bot_name']) {
                                    $sql_ary['username'] = (string) $bot_row['bot_name'];
                                    $sql_ary['username_clean'] = (string) utf8_clean_string($bot_row['bot_name']);
                                }
                                $sql = 'UPDATE ' . USERS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . " WHERE user_id = {$row['user_id']}";
                                $db->sql_query($sql);
                                $sql = 'UPDATE ' . BOTS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', array('bot_name' => (string) $bot_row['bot_name'], 'bot_active' => (int) $bot_row['bot_active'], 'bot_agent' => (string) $bot_row['bot_agent'], 'bot_ip' => (string) $bot_row['bot_ip'])) . " WHERE bot_id = {$bot_id}";
                                $db->sql_query($sql);
                                // Updated username?
                                if ($bot_row['bot_name'] !== $row['bot_name']) {
                                    user_update_name($row['bot_name'], $bot_row['bot_name']);
                                }
                                $log = 'UPDATED';
                            }
                        }
                        $cache->destroy('_bots');
                        add_log('admin', 'LOG_BOT_' . $log, $bot_row['bot_name']);
                        trigger_error($user->lang['BOT_' . $log] . adm_back_link($this->u_action));
                    }
                } else {
                    if ($bot_id) {
                        $sql = 'SELECT b.*, u.user_lang, u.user_style
						FROM ' . BOTS_TABLE . ' b, ' . USERS_TABLE . " u\n\t\t\t\t\t\tWHERE b.bot_id = {$bot_id}\n\t\t\t\t\t\t\tAND u.user_id = b.user_id";
                        $result = $db->sql_query($sql);
                        $bot_row = $db->sql_fetchrow($result);
                        $db->sql_freeresult($result);
                        if (!$bot_row) {
                            trigger_error($user->lang['NO_BOT'] . adm_back_link($this->u_action . "&amp;id={$bot_id}&amp;action={$action}"), E_USER_WARNING);
                        }
                        $bot_row['bot_lang'] = $bot_row['user_lang'];
                        $bot_row['bot_style'] = $bot_row['user_style'];
                        unset($bot_row['user_lang'], $bot_row['user_style']);
                    }
                }
                $s_active_options = '';
                $_options = array('0' => 'NO', '1' => 'YES');
                foreach ($_options as $value => $lang) {
                    $selected = $bot_row['bot_active'] == $value ? ' selected="selected"' : '';
                    $s_active_options .= '<option value="' . $value . '"' . $selected . '>' . $user->lang[$lang] . '</option>';
                }
                $style_select = style_select($bot_row['bot_style'], true);
                $lang_select = language_select($bot_row['bot_lang']);
                $l_title = $action == 'edit' ? 'EDIT' : 'ADD';
                $template->assign_vars(array('L_TITLE' => $user->lang['BOT_' . $l_title], 'U_ACTION' => $this->u_action . "&amp;id={$bot_id}&amp;action={$action}", 'U_BACK' => $this->u_action, 'ERROR_MSG' => sizeof($error) ? implode('<br />', $error) : '', 'BOT_NAME' => $bot_row['bot_name'], 'BOT_IP' => $bot_row['bot_ip'], 'BOT_AGENT' => $bot_row['bot_agent'], 'S_EDIT_BOT' => true, 'S_ACTIVE_OPTIONS' => $s_active_options, 'S_STYLE_OPTIONS' => $style_select, 'S_LANG_OPTIONS' => $lang_select, 'S_ERROR' => sizeof($error) ? true : false));
                return;
                break;
        }
        $s_options = '';
        $_options = array('activate' => 'BOT_ACTIVATE', 'deactivate' => 'BOT_DEACTIVATE', 'delete' => 'DELETE');
        foreach ($_options as $value => $lang) {
            $s_options .= '<option value="' . $value . '">' . $user->lang[$lang] . '</option>';
        }
        $template->assign_vars(array('U_ACTION' => $this->u_action, 'S_BOT_OPTIONS' => $s_options));
        $sql = 'SELECT b.bot_id, b.bot_name, b.bot_active, u.user_lastvisit
			FROM ' . BOTS_TABLE . ' b, ' . USERS_TABLE . ' u
			WHERE u.user_id = b.user_id
			ORDER BY u.user_lastvisit DESC, b.bot_name ASC';
        $result = $db->sql_query($sql);
        while ($row = $db->sql_fetchrow($result)) {
            $active_lang = !$row['bot_active'] ? 'BOT_ACTIVATE' : 'BOT_DEACTIVATE';
            $active_value = !$row['bot_active'] ? 'activate' : 'deactivate';
            $template->assign_block_vars('bots', array('BOT_NAME' => $row['bot_name'], 'BOT_ID' => $row['bot_id'], 'LAST_VISIT' => $row['user_lastvisit'] ? $user->format_date($row['user_lastvisit']) : $user->lang['BOT_NEVER'], 'U_ACTIVATE_DEACTIVATE' => $this->u_action . "&amp;id={$row['bot_id']}&amp;action={$active_value}", 'L_ACTIVATE_DEACTIVATE' => $user->lang[$active_lang], 'U_EDIT' => $this->u_action . "&amp;id={$row['bot_id']}&amp;action=edit", 'U_DELETE' => $this->u_action . "&amp;id={$row['bot_id']}&amp;action=delete"));
        }
        $db->sql_freeresult($result);
    }
开发者ID:puring0815,项目名称:OpenKore,代码行数:101,代码来源:acp_bots.php

示例8: main


//.........这里部分代码省略.........
        if ($auth->acl_get('u_chgname') && $config['allow_namechange']) {
            $check_ary['username'] = array(array('string', false, $config['min_name_chars'], $config['max_name_chars']), array('username'));
        }
        $error = validate_data($data, $check_ary);
        if ($auth->acl_get('u_chgemail') && $data['email'] != $user->data['user_email'] && $data['email_confirm'] != $data['email']) {
            $error[] = $data['email_confirm'] ? 'NEW_EMAIL_ERROR' : 'NEW_EMAIL_CONFIRM_EMPTY';
        }
        if ($auth->acl_get('u_chgpasswd') && $data['new_password'] && $data['password_confirm'] != $data['new_password']) {
            $error[] = $data['password_confirm'] ? 'NEW_PASSWORD_ERROR' : 'NEW_PASSWORD_CONFIRM_EMPTY';
        }
        // Only check the new password against the previous password if there have been no errors
        if (!sizeof($error) && $auth->acl_get('u_chgpasswd') && $data['new_password'] && phpbb_check_hash($data['new_password'], $user->data['user_password'])) {
            $error[] = 'SAME_PASSWORD_ERROR';
        }
        if (!$verify_result && !phpbb_check_hash($data['cur_password'], $user->data['user_password'])) {
            $error[] = $data['cur_password'] ? 'CUR_PASSWORD_ERROR' : 'CUR_PASSWORD_EMPTY';
        }
        if (!sizeof($error)) {
            $sql_ary = array('username' => $auth->acl_get('u_chgname') && $config['allow_namechange'] ? $data['username'] : $user->data['username'], 'username_clean' => $auth->acl_get('u_chgname') && $config['allow_namechange'] ? utf8_clean_string($data['username']) : $user->data['username_clean'], 'user_email' => $auth->acl_get('u_chgemail') ? $data['email'] : $user->data['user_email'], 'user_email_hash' => $auth->acl_get('u_chgemail') ? phpbb_email_hash($data['email']) : $user->data['user_email_hash'], 'user_password' => $auth->acl_get('u_chgpasswd') && $data['new_password'] ? phpbb_hash($data['new_password']) : $user->data['user_password'], 'user_passchg' => $auth->acl_get('u_chgpasswd') && $data['new_password'] ? time() : 0);
            if ($auth->acl_get('u_chgname') && $config['allow_namechange'] && $data['username'] != $user->data['username']) {
                add_log('user', $user->data['user_id'], 'LOG_USER_UPDATE_NAME', $user->data['username'], $data['username']);
            }
            if ($auth->acl_get('u_chgpasswd') && $data['new_password'] && !phpbb_check_hash($data['new_password'], $user->data['user_password'])) {
                $user->reset_login_keys();
                add_log('user', $user->data['user_id'], 'LOG_USER_NEW_PASSWORD', $data['username']);
            }
            if ($auth->acl_get('u_chgemail') && $data['email'] != $user->data['user_email']) {
                add_log('user', $user->data['user_id'], 'LOG_USER_UPDATE_EMAIL', $data['username'], $user->data['user_email'], $data['email']);
            }
            $message = 'PROFILE_UPDATED';
            if ($auth->acl_get('u_chgemail') && $config['email_enable'] && $data['email'] != $user->data['user_email'] && $user->data['user_type'] != USER_FOUNDER && ($config['require_activation'] == USER_ACTIVATION_SELF || $config['require_activation'] == USER_ACTIVATION_ADMIN)) {
                $message = $config['require_activation'] == USER_ACTIVATION_SELF ? 'ACCOUNT_EMAIL_CHANGED' : 'ACCOUNT_EMAIL_CHANGED_ADMIN';
                include_once $phpbb_root_path . 'includes/functions_messenger.' . $phpEx;
                $server_url = generate_board_url();
                $user_actkey = gen_rand_string(mt_rand(6, 10));
                $messenger = new messenger(false);
                $template_file = $config['require_activation'] == USER_ACTIVATION_ADMIN ? 'user_activate_inactive' : 'user_activate';
                $messenger->template($template_file, $user->data['user_lang']);
                $messenger->to($data['email'], $data['username']);
                if (!method_exists($messenger, 'anti_abuse_headers')) {
                    $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);
                } else {
                    $messenger->anti_abuse_headers($config, $user);
                }
                $messenger->assign_vars(array('USERNAME' => htmlspecialchars_decode($data['username']), 'U_ACTIVATE' => "{$server_url}/ucp.{$phpEx}?mode=activate&u={$user->data['user_id']}&k={$user_actkey}"));
                $messenger->send(NOTIFY_EMAIL);
                if ($config['require_activation'] == USER_ACTIVATION_ADMIN) {
                    // Grab an array of user_id's with a_user permissions ... these users can activate a user
                    $admin_ary = $auth->acl_get_list(false, 'a_user', false);
                    $admin_ary = !empty($admin_ary[0]['a_user']) ? $admin_ary[0]['a_user'] : array();
                    // Also include founders
                    $where_sql = ' WHERE user_type = ' . USER_FOUNDER;
                    if (sizeof($admin_ary)) {
                        $where_sql .= ' OR ' . $db->sql_in_set('user_id', $admin_ary);
                    }
                    $sql = 'SELECT user_id, username, user_email, user_lang, user_jabber, user_notify_type
						FROM ' . USERS_TABLE . ' ' . $where_sql;
                    $result = $db->sql_query($sql);
                    while ($row = $db->sql_fetchrow($result)) {
                        $messenger->template('admin_activate', $row['user_lang']);
                        $messenger->to($row['user_email'], $row['username']);
                        $messenger->im($row['user_jabber'], $row['username']);
                        $messenger->assign_vars(array('USERNAME' => htmlspecialchars_decode($data['username']), 'U_USER_DETAILS' => "{$server_url}/memberlist.{$phpEx}?mode=viewprofile&u={$user->data['user_id']}", 'U_ACTIVATE' => "{$server_url}/ucp.{$phpEx}?mode=activate&u={$user->data['user_id']}&k={$user_actkey}"));
                        $messenger->send($row['user_notify_type']);
                    }
                    $db->sql_freeresult($result);
                }
                user_active_flip('deactivate', $user->data['user_id'], INACTIVE_PROFILE);
                // Because we want the profile to be reactivated we set user_newpasswd to empty (else the reactivation will fail)
                $sql_ary['user_actkey'] = $user_actkey;
                $sql_ary['user_newpasswd'] = '';
            }
            if (sizeof($sql_ary)) {
                $sql = 'UPDATE ' . USERS_TABLE . '
					SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
					WHERE user_id = ' . $user->data['user_id'];
                $db->sql_query($sql);
            }
            // Need to update config, forum, topic, posting, messages, etc.
            if ($data['username'] != $user->data['username'] && $auth->acl_get('u_chgname') && $config['allow_namechange']) {
                user_update_name($user->data['username'], $data['username']);
            }
            // Now, we can remove the user completely (kill the session) - NOT BEFORE!!!
            if (!empty($sql_ary['user_actkey'])) {
                // Because the user gets deactivated we log him out too, killing his session
                $user->session_kill();
            }
        }
        // Replace "error" strings with their real, localised form
        $error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error);
        if (!empty($error)) {
            $this->result_text = $error[0];
            $this->result = false;
            return;
        }
        $this->result = true;
    }
开发者ID:danielgospodinow,项目名称:GamingZone,代码行数:101,代码来源:mobi_ucp_profile.php

示例9: ucp_profile

    function ucp_profile($id, $mode)
    {
        global $config, $_CLASS, $site_file_root, $_CORE_CONFIG;
        $preview = isset($_POST['preview']);
        $submit = isset($_POST['submit']);
        $module_link = generate_link("Control_Panel&amp;i={$id}&amp;mode={$mode}");
        $error = $data = array();
        $s_hidden_fields = '';
        switch ($mode) {
            case 'reg_details':
                if ($submit) {
                    $var_ary = array('username' => $_CLASS['core_user']->data['username'], 'email' => $_CLASS['core_user']->data['user_email'], 'email_confirm' => (string) '', 'new_password' => (string) '', 'cur_password' => (string) '', 'password_confirm' => (string) '');
                    foreach ($var_ary as $var => $default) {
                        $data[$var] = request_var($var, $default);
                    }
                    $var_ary = array('username' => array(array('string', false, $_CORE_CONFIG['user']['min_name_chars'], $_CORE_CONFIG['user']['max_name_chars']), array('username', $data['username'])), 'password_confirm' => array('string', true, $_CORE_CONFIG['user']['min_pass_chars'], $_CORE_CONFIG['user']['max_pass_chars']), 'new_password' => array('string', true, $_CORE_CONFIG['user']['min_pass_chars'], $_CORE_CONFIG['user']['max_pass_chars']), 'email' => array(array('string', false, 6, 60), array('email', $data['email'])), 'email_confirm' => array('string', true, 6, 60));
                    $error = validate_data($data, $var_ary);
                    extract($data);
                    unset($data);
                    if ($new_password && $password_confirm != $new_password) {
                        $error[] = 'NEW_PASSWORD_ERROR';
                    }
                    if (($new_password || $_CLASS['auth']->acl_get('u_chgemail') && $email != $_CLASS['core_user']->data['user_email'] || $username != $_CLASS['core_user']->data['username'] && $_CLASS['auth']->acl_get('u_chgname') && $_CORE_CONFIG['user']['allow_namechange']) && encode_password($cur_password, $_CLASS['core_user']->data['user_password_encoding']) != $_CLASS['core_user']->data['user_password']) {
                        $error[] = 'CUR_PASSWORD_ERROR';
                    }
                    if ($_CLASS['auth']->acl_get('u_chgemail') && $email != $_CLASS['core_user']->data['user_email'] && $email_confirm != $email) {
                        $error[] = 'NEW_EMAIL_ERROR';
                    }
                    if (!sizeof($error)) {
                        $sql_ary = array('user_email' => $_CLASS['auth']->acl_get('u_chgemail') ? $email : $_CLASS['core_user']->data['user_email']);
                        if ($_CORE_CONFIG['email']['email_enable'] && $email != $_CLASS['core_user']->data['user_email'] && ($_CORE_CONFIG['user']['require_activation'] == USER_ACTIVATION_SELF || $_CORE_CONFIG['user']['require_activation'] == USER_ACTIVATION_ADMIN)) {
                            $template_file = $config['require_activation'] == USER_ACTIVATION_ADMIN ? 'user_activate_inactive.html' : 'user_activate.html';
                            $mailer = new core_mailer();
                            $messenger->template($template_file, $_CLASS['core_user']->data['user_lang']);
                            $mailer->subject($subject);
                            $messenger->to($email, $username);
                            $messenger->headers('X-AntiAbuse: Board servername - ' . $config['server_name']);
                            $messenger->headers('X-AntiAbuse: User_id - ' . $_CLASS['core_user']->data['user_id']);
                            $messenger->headers('X-AntiAbuse: Username - ' . $_CLASS['core_user']->data['username']);
                            $messenger->headers('X-AntiAbuse: User IP - ' . $_CLASS['core_user']->ip);
                            $messenger->assign_vars(array('SITENAME' => $_CORE_CONFIG['global']['sitename'], 'USERNAME' => $username, 'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $config['board_email_sig']), 'U_ACTIVATE' => generate_link("Control_Panel&amp;mode=activate&u={$_CLASS['core_user']->data['user_id']}&k={$user_actkey}", array('full' => true))));
                            $body = trim($_CLASS['core_template']->display('modules/Contact/email/index.html', true));
                            $messenger->send(NOTIFY_EMAIL);
                            if ($_CORE_CONFIG['user']['require_activation'] == USER_ACTIVATION_ADMIN) {
                                // Grab an array of user_id's with a_user permissions
                                $admin_ary = $_CLASS['auth']->acl_get_list(false, 'a_user', false);
                                $sql = 'SELECT user_id, username, user_email, user_lang, user_jabber, user_notify_type
									FROM ' . USERS_TABLE . ' 
									WHERE user_id IN (' . implode(', ', $admin_ary[0]['a_user']) . ')';
                                $result = $_CLASS['core_db']->sql_query($sql);
                                while ($row = $_CLASS['core_db']->sql_fetchrow($result)) {
                                    $messenger->template('admin_activate', $row['user_lang']);
                                    $messenger->replyto($config['board_contact']);
                                    $messenger->to($row['user_email'], $row['username']);
                                    $messenger->im($row['user_jabber'], $row['username']);
                                    $messenger->assign_vars(array('USERNAME' => $username, 'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $config['board_email_sig']), 'U_ACTIVATE' => generate_link("Control_Panel&amp;mode=activate&u={$_CLASS['core_user']->data['user_id']}&k={$user_actkey}", array('full' => true))));
                                    $messenger->send($row['user_notify_type']);
                                }
                                $_CLASS['core_db']->sql_freeresult($result);
                            }
                            $messenger->save_queue();
                            $sql_ary += array('user_type' => USER_INACTIVE, 'user_actkey' => $user_actkey);
                        }
                        $sql = 'UPDATE ' . USERS_TABLE . ' 
							SET ' . $_CLASS['core_db']->sql_build_array('UPDATE', $sql_ary) . ' 
							WHERE user_id = ' . $_CLASS['core_user']->data['user_id'];
                        $_CLASS['core_db']->sql_query($sql);
                        // Need to update config, forum, topic, posting, messages, etc.
                        if ($username != $_CLASS['core_user']->data['username'] && $_CLASS['auth']->acl_get('u_chgname') && $_CORE_CONFIG['user']['allow_namechange']) {
                            user_update_name($_CLASS['core_user']->data['username'], $username);
                        }
                        $_CLASS['core_display']->meta_refresh(3, $module_link);
                        $message = $_CLASS['core_user']->lang['PROFILE_UPDATED'] . '<br /><br />' . sprintf($_CLASS['core_user']->lang['RETURN_UCP'], '<a href="' . $module_link . '">', '</a>');
                        trigger_error($message);
                    }
                    // Replace "error" strings with their real, localised form
                    $error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$_CLASS['core_user']->lang['\\1'])) ? \$_CLASS['core_user']->lang['\\1'] : '\\1'", $error);
                }
                $user_char_ary = array('.*' => 'USERNAME_CHARS_ANY', '[\\w]+' => 'USERNAME_ALPHA_ONLY', '[\\w_\\+\\. \\-\\[\\]]+' => 'USERNAME_ALPHA_SPACERS');
                $_CLASS['core_template']->assign(array('ERROR' => sizeof($error) ? implode('<br />', $error) : '', 'USERNAME' => isset($username) ? $username : $_CLASS['core_user']->data['username'], 'EMAIL' => isset($email) ? $email : $_CLASS['core_user']->data['user_email'], 'CONFIRM_EMAIL' => '', 'PASSWORD_CONFIRM' => isset($password_confirm) ? $password_confirm : '', 'NEW_PASSWORD' => isset($new_password) ? $new_password : '', 'CUR_PASSWORD' => '', 'L_USERNAME_EXPLAIN' => sprintf($_CLASS['core_user']->lang[$user_char_ary[str_replace('\\\\', '\\', $_CORE_CONFIG['user']['allow_name_chars'])] . '_EXPLAIN'], $_CORE_CONFIG['user']['min_name_chars'], $_CORE_CONFIG['user']['max_name_chars']), 'L_CHANGE_PASSWORD_EXPLAIN' => sprintf($_CLASS['core_user']->lang['CHANGE_PASSWORD_EXPLAIN'], $_CORE_CONFIG['user']['min_pass_chars'], $_CORE_CONFIG['user']['max_pass_chars']), 'S_FORCE_PASSWORD' => $_CORE_CONFIG['user']['chg_passforce'] && $this->data['user_passchg'] < time() - $_CORE_CONFIG['user']['chg_passforce'] ? true : false, 'S_CHANGE_USERNAME' => $_CORE_CONFIG['user']['allow_namechange'] && $_CLASS['auth']->acl_get('u_chgname') ? true : false, 'S_CHANGE_EMAIL' => $_CLASS['auth']->acl_get('u_chgemail') ? true : false, 'S_CHANGE_PASSWORD' => true));
                break;
            case 'profile_info':
                $error = array();
                $this_year = gmdate('Y', time());
                if ($submit) {
                    $icq = get_variable('icq', 'POST', null);
                    $aim = get_variable('aim', 'POST', null);
                    $msn = get_variable('msn', 'POST', null);
                    $yim = get_variable('yim', 'POST', null);
                    $jabber = get_variable('jabber', 'POST', null);
                    //$google = get_variable('google', 'POST', null);
                    $website = get_variable('website', 'POST', null);
                    $location = get_variable('location', 'POST', null);
                    $occupation = get_variable('occupation', 'POST', null);
                    $interests = get_variable('interests', 'POST', null);
                    $bday_day = get_variable('bday_day', 'POST', false);
                    $bday_month = get_variable('bday_month', 'POST', false);
                    $bday_year = get_variable('bday_year', 'POST', false);
                    if ($bday_day || $bday_month || $bday_year) {
                        if ($bday_day < 1 || $bday_day > 31 || $bday_month < 1 || $bday_month > 12 || $bday_year < $this_year - 100 || $bday_month > $this_year) {
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:viperals-svn,代码行数:101,代码来源:ucp_profile.php

示例10: main

    function main($id, $mode)
    {
        global $config, $db, $user, $auth, $template, $phpbb_root_path, $phpEx;
        $user->add_lang('posting');
        $preview = !empty($_POST['preview']) ? true : false;
        $submit = !empty($_POST['submit']) ? true : false;
        $delete = !empty($_POST['delete']) ? true : false;
        $error = $data = array();
        $s_hidden_fields = '';
        switch ($mode) {
            case 'reg_details':
                if ($submit) {
                    $var_ary = array('username' => $user->data['username'], 'email' => $user->data['user_email'], 'email_confirm' => (string) '', 'new_password' => (string) '', 'cur_password' => (string) '', 'password_confirm' => (string) '');
                    foreach ($var_ary as $var => $default) {
                        $data[$var] = request_var($var, $default);
                    }
                    $var_ary = array('password_confirm' => array('string', true, $config['min_pass_chars'], $config['max_pass_chars']), 'new_password' => array('string', true, $config['min_pass_chars'], $config['max_pass_chars']), 'cur_password' => array('string', true, $config['min_pass_chars'], $config['max_pass_chars']), 'email' => array(array('string', false, 6, 60), array('email', $data['email'])), 'email_confirm' => array('string', true, 6, 60));
                    if ($auth->acl_get('u_chgname') && $config['allow_namechange']) {
                        $var_ary['username'] = array(array('string', false, $config['min_name_chars'], $config['max_name_chars']), array('username', $data['username']));
                    }
                    $error = validate_data($data, $var_ary);
                    extract($data);
                    unset($data);
                    if ($auth->acl_get('u_chgpasswd') && $new_password && $password_confirm != $new_password) {
                        $error[] = 'NEW_PASSWORD_ERROR';
                    }
                    if (($new_password || $auth->acl_get('u_chgemail') && $email != $user->data['user_email'] || $username != $user->data['username'] && $auth->acl_get('u_chgname') && $config['allow_namechange']) && md5($cur_password) != $user->data['user_password']) {
                        $error[] = 'CUR_PASSWORD_ERROR';
                    }
                    if ($auth->acl_get('u_chgemail') && $email != $user->data['user_email'] && $email_confirm != $email) {
                        $error[] = 'NEW_EMAIL_ERROR';
                    }
                    if (!sizeof($error)) {
                        $sql_ary = array('username' => $auth->acl_get('u_chgname') && $config['allow_namechange'] ? $username : $user->data['username'], 'user_email' => $auth->acl_get('u_chgemail') ? $email : $user->data['user_email'], 'user_email_hash' => $auth->acl_get('u_chgemail') ? crc32(strtolower($email)) . strlen($email) : $user->data['user_email_hash'], 'user_password' => $auth->acl_get('u_chgpasswd') && $new_password ? md5($new_password) : $user->data['user_password'], 'user_passchg' => $auth->acl_get('u_chgpasswd') && $new_password ? time() : 0);
                        if ($auth->acl_get('u_chgname') && $config['allow_namechange'] && $username != $user->data['username']) {
                            add_log('user', $user->data['user_id'], 'LOG_USER_UPDATE_NAME', $user->data['username'], $username);
                        }
                        if ($auth->acl_get('u_chgpasswd') && $new_password && md5($new_password) != $user->data['user_password']) {
                            $user->reset_login_keys();
                            add_log('user', $user->data['user_id'], 'LOG_USER_NEW_PASSWORD', $username);
                        }
                        if ($auth->acl_get('u_chgemail') && $email != $user->data['user_email']) {
                            add_log('user', $user->data['user_id'], 'LOG_USER_UPDATE_EMAIL', $username, $user->data['user_email'], $email);
                        }
                        if ($config['email_enable'] && $email != $user->data['user_email'] && ($config['require_activation'] == USER_ACTIVATION_SELF || $config['require_activation'] == USER_ACTIVATION_ADMIN)) {
                            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);
                            $messenger = new messenger();
                            $template_file = $config['require_activation'] == USER_ACTIVATION_ADMIN ? 'user_activate_inactive' : 'user_activate';
                            $messenger->template($template_file, $user->data['user_lang']);
                            $messenger->replyto($config['board_contact']);
                            $messenger->to($email, $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('SITENAME' => $config['sitename'], 'USERNAME' => html_entity_decode($username), 'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $config['board_email_sig']), 'U_ACTIVATE' => "{$server_url}/ucp.{$phpEx}?mode=activate&u={$user->data['user_id']}&k={$user_actkey}"));
                            $messenger->send(NOTIFY_EMAIL);
                            if ($config['require_activation'] == USER_ACTIVATION_ADMIN) {
                                // Grab an array of user_id's with a_user permissions
                                $admin_ary = $auth->acl_get_list(false, 'a_user', false);
                                $sql = 'SELECT user_id, username, user_email, user_lang, user_jabber, user_notify_type
									FROM ' . USERS_TABLE . '
									WHERE user_id IN (' . implode(', ', $admin_ary[0]['a_user']) . ')';
                                $result = $db->sql_query($sql);
                                while ($row = $db->sql_fetchrow($result)) {
                                    $messenger->template('admin_activate', $row['user_lang']);
                                    $messenger->replyto($config['board_contact']);
                                    $messenger->to($row['user_email'], $row['username']);
                                    $messenger->im($row['user_jabber'], $row['username']);
                                    $messenger->assign_vars(array('USERNAME' => html_entity_decode($username), 'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $config['board_email_sig']), 'U_ACTIVATE' => "{$server_url}/ucp.{$phpEx}?mode=activate&u={$user->data['user_id']}&k={$user_actkey}"));
                                    $messenger->send($row['user_notify_type']);
                                }
                                $db->sql_freeresult($result);
                            }
                            $messenger->save_queue();
                            $sql_ary += array('user_type' => USER_INACTIVE, 'user_actkey' => $user_actkey);
                        }
                        if (sizeof($sql_ary)) {
                            $sql = 'UPDATE ' . USERS_TABLE . '
								SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
								WHERE user_id = ' . $user->data['user_id'];
                            $db->sql_query($sql);
                        }
                        // Need to update config, forum, topic, posting, messages, etc.
                        if ($username != $user->data['username'] && $auth->acl_get('u_chgname') && $config['allow_namechange']) {
                            user_update_name($user->data['username'], $username);
                        }
                        meta_refresh(3, $this->u_action);
                        $message = $user->lang['PROFILE_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>');
                        trigger_error($message);
                    }
                    // Replace "error" strings with their real, localised form
                    $error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error);
                }
                $user_char_ary = array('.*' => 'USERNAME_CHARS_ANY', '[\\w]+' => 'USERNAME_ALPHA_ONLY', '[\\w_\\+\\. \\-\\[\\]]+' => 'USERNAME_ALPHA_SPACERS');
//.........这里部分代码省略.........
开发者ID:yunsite,项目名称:gloryroad,代码行数:101,代码来源:ucp_profile.php

示例11: user_update

 public function user_update($phpbb_vars, $old_name)
 {
     global $phpbb_root_path, $phpEx, $db, $config, $user, $auth, $cache, $template;
     //fail presumtion
     $phpbb_result = "FAIL";
     //general info
     $this->init(false);
     //user functions
     require_once $phpbb_root_path . "includes/functions_user." . $phpEx;
     //get user_id if possible
     // w produkcjach Hanza/Neart Email jest niezmienny
     if (!isset($phpbb_vars["user_id"])) {
         if (!($phpbb_vars["user_id"] = $this->get_user_id_from_name($phpbb_vars["username"]))) {
             return $phpbb_result;
         }
     }
     $this->get_table_fields(USERS_TABLE);
     $phpbb_vars['username_clean'] = utf8_clean_string($phpbb_vars['username']);
     $ignore_fields = array("user_id");
     //if(isset($phpbb_vars["user_password"])) $phpbb_vars["user_password"] = md5($phpbb_vars["user_password"]);
     if (isset($phpbb_vars["user_newpasswd"])) {
         $phpbb_vars["user_newpasswd"] = md5($phpbb_vars["user_newpasswd"]);
     }
     $sql = "";
     //generate sql
     for ($i = 0; $i < count($this->table_fields[USERS_TABLE]); $i++) {
         if (isset($phpbb_vars[$this->table_fields[USERS_TABLE][$i]]) && !in_array($this->table_fields[USERS_TABLE][$i], $ignore_fields)) {
             $sql .= ", " . $this->table_fields[USERS_TABLE][$i] . " = '" . $db->sql_escape($phpbb_vars[$this->table_fields[USERS_TABLE][$i]]) . "'";
         }
     }
     if (strlen($sql) != 0) {
         $db->sql_query("UPDATE " . USERS_TABLE . " SET " . substr($sql, 2) . " WHERE user_id = '" . $phpbb_vars["user_id"] . "'");
         $phpbb_result = "SUCCESS";
     }
     user_update_name($old_name, $phpbb_vars["username"]);
     update_last_username();
     return $phpbb_result;
 }
开发者ID:hukumonline,项目名称:idh,代码行数:38,代码来源:Forum.php

示例12: onAfterStoreUser

    /**
     * Sync the user data with phpBB
     *
     * Method is called after user data is stored in the database
     *
     * @param 	array	  	holds the old user data
     * @param 	boolean		true if a new user is stored
     * @param	boolean		true if user was succesfully stored in the database
     * @param	string		message
     */
    function onAfterStoreUser($user_data, $isnew, $succes, $msg)
    {
        global $phpbb_root_path, $phpEx;
        global $auth, $user, $template, $cache, $db, $config;
        //Don't continue if the user wasn't stored succesfully
        if (!$succes) {
            return false;
        }
        //Don't handle new users, syncing happens assynchronously
        if ($isnew) {
            return true;
        }
        $table =& JTable::getInstance('component');
        $table->loadByOption('com_rokbridge');
        $params = new JParameter($table->params, JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_rokbridge' . DS . 'config.xml');
        $path = JPATH_ROOT . DS . $params->get('bridge_path');
        if (!file_exists($path . DS . 'includes' . DS . 'helper.php')) {
            return;
        }
        //Include the bridge configuration
        require_once $path . DS . 'includes' . DS . 'helper.php';
        JForumHelper::loadPHPBB3($path);
        require_once $phpbb_root_path . DS . 'includes/functions_user.php';
        $username = $GLOBALS['TEMP_USER']['username'];
        $fullname = $this->_fullNameSupport();
        $userid = $this->_getUserId($username, $fullname);
        // Don't try to store a user which doesn't exist yet in phpBB
        if (intval($userid) == 0) {
            return true;
        }
        //Activate/Deactivate the user
        $mode = $user_data['block'] ? 'deactivate' : 'activate';
        user_active_flip($mode, $userid['user_id']);
        if (!empty($fullname)) {
            //Update the username if it was changed
            if ($user_data['name'] != $GLOBALS['TEMP_USER']['name']) {
                user_update_name($GLOBALS['TEMP_USER']['name'], $user_data['name']);
            }
            //Store the user information
            $sql_ary = array('login_name' => $user_data['username'], 'username' => $user_data['name'], 'username_clean' => utf8_clean_string($user_data['name']), 'user_email' => $user_data['email'], 'user_email_hash' => crc32($user_data['email']) . strlen($user_data['email']));
        } else {
            //Update the username if it was changed
            if ($user_data['username'] != $GLOBALS['TEMP_USER']['username']) {
                user_update_name($GLOBALS['TEMP_USER']['username'], $user_data['username']);
            }
            //Store the user information
            $sql_ary = array('username' => $user_data['username'], 'username_clean' => utf8_clean_string($user_data['username']), 'user_email' => $user_data['email'], 'user_email_hash' => crc32($user_data['email']) . strlen($user_data['email']));
        }
        $sql = 'UPDATE ' . USERS_TABLE . '
			SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
			WHERE user_id = ' . $userid['user_id'];
        $db->sql_query($sql);
        //Unset the temp user global
        unset($GLOBALS['TEMP_USER']);
    }
开发者ID:skyview059,项目名称:e-learning-website,代码行数:65,代码来源:phpbb3_user.php


注:本文中的user_update_name函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。