本文整理汇总了PHP中XenForo_Visitor::setup方法的典型用法代码示例。如果您正苦于以下问题:PHP XenForo_Visitor::setup方法的具体用法?PHP XenForo_Visitor::setup怎么用?PHP XenForo_Visitor::setup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XenForo_Visitor
的用法示例。
在下文中一共展示了XenForo_Visitor::setup方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionConfirm
/**
* Confirms a lost password reset request and resets the password.
*
* @return XenForo_ControllerResponse_Abstract
*/
public function actionConfirm()
{
$userId = $this->_input->filterSingle('user_id', XenForo_Input::UINT);
if (!$userId) {
return $this->responseError(new XenForo_Phrase('no_account_specified'));
}
$confirmationModel = $this->_getUserConfirmationModel();
$confirmation = $confirmationModel->getUserConfirmationRecord($userId, 'password');
if (!$confirmation) {
if (XenForo_Visitor::getUserId()) {
// probably already been reset
return $this->responseRedirect(XenForo_ControllerResponse_Redirect::RESOURCE_CANONICAL, XenForo_Link::buildPublicLink('index'));
} else {
return $this->responseError(new XenForo_Phrase('your_password_could_not_be_reset'));
}
}
$confirmationKey = $this->_input->filterSingle('c', XenForo_Input::STRING);
if ($confirmationKey) {
$accountConfirmed = $confirmationModel->validateUserConfirmationRecord($confirmationKey, $confirmation);
} else {
$accountConfirmed = false;
}
if ($accountConfirmed) {
$confirmationModel->resetPassword($userId);
$confirmationModel->deleteUserConfirmationRecord($userId, 'password');
XenForo_Visitor::setup(0);
return $this->responseMessage(new XenForo_Phrase('your_password_has_been_reset'));
} else {
return $this->responseError(new XenForo_Phrase('your_password_could_not_be_reset'));
}
}
示例2: login
public function login($username, $password)
{
/**
* @var $loginModel XenForo_Model_Login
* @var $userModel XenForo_Model_User
* @var $session XenForo_Session
*/
$loginModel = XenForo_Model::create('XenForo_Model_Login');
$userModel = XenForo_Model::create('XenForo_Model_User');
$userId = $userModel->validateAuthentication($username, $password, $this->error);
//var_dump($userId);
//die;
if (!$userId) {
$loginModel->logLoginAttempt($username);
return false;
}
$loginModel->clearLoginAttempts($username);
/* if ($data['remember'])
{
$userModel->setUserRememberCookie($userId);
} */
XenForo_Model_Ip::log($userId, 'user', $userId, 'login');
$userModel->deleteSessionActivity(0, $this->getClientIp(false));
$session = XenForo_Application::get('session');
//die('aaabb');
/*if(!$this->session){
$this->session = XenForo_Application::get('session');
}*/
$session->changeUserId($userId);
XenForo_Visitor::setup($userId);
$this->visitor = XenForo_Visitor::getInstance();
$userInfo = $userModel->getFullUserById($this->visitor->getUserId());
return $userInfo;
}
示例3: actionExternal
public function actionExternal()
{
$this->_assertPostOnly();
$providerCode = $this->_input->filterSingle('provider', XenForo_Input::STRING);
$provider = bdApiConsumer_Option::getProviderByCode($providerCode);
if (empty($provider)) {
return $this->responseNoPermission();
}
$externalUserId = $this->_input->filterSingle('external_user_id', XenForo_Input::UINT);
if (empty($externalUserId)) {
return $this->responseNoPermission();
}
if (!bdApiConsumer_Helper_Api::verifyJsSdkSignature($provider, $_REQUEST)) {
return $this->responseNoPermission();
}
$userModel = $this->_getUserModel();
/** @var bdApiConsumer_XenForo_Model_UserExternal $userExternalModel */
$userExternalModel = $this->getModelFromCache('XenForo_Model_UserExternal');
$existingAssoc = $userExternalModel->getExternalAuthAssociation($userExternalModel->bdApiConsumer_getProviderCode($provider), $externalUserId);
if (!empty($existingAssoc)) {
$accessToken = $userExternalModel->bdApiConsumer_getAccessTokenFromAuth($provider, $existingAssoc);
if (empty($accessToken)) {
// no access token in the auth, consider no auth at all
$existingAssoc = null;
}
}
if (empty($existingAssoc)) {
$autoRegister = bdApiConsumer_Option::get('autoRegister');
if ($autoRegister === 'on' or $autoRegister === 'id_sync') {
// we have to do a refresh here
return $this->responseRedirect(XenForo_ControllerResponse_Redirect::SUCCESS, XenForo_Link::buildPublicLink('canonical:register/external', null, array('provider' => $providerCode, 'reg' => 1, 'redirect' => $this->getDynamicRedirect())), new XenForo_Phrase('bdapi_consumer_being_auto_login_auto_register_x', array('provider' => $provider['name'])));
}
}
if (!$existingAssoc) {
return $this->responseError(new XenForo_Phrase('bdapi_consumer_auto_login_with_x_failed', array('provider' => $provider['name'])));
}
$user = $userModel->getFullUserById($existingAssoc['user_id']);
if (empty($user)) {
return $this->responseError(new XenForo_Phrase('requested_user_not_found'));
}
if (XenForo_Application::$versionId > 1050000) {
/** @var XenForo_ControllerHelper_Login $loginHelper */
$loginHelper = $this->getHelper('Login');
if ($loginHelper->userTfaConfirmationRequired($user)) {
$loginHelper->setTfaSessionCheck($user['user_id']);
return $this->responseMessage(new XenForo_Phrase('bdapi_consumer_auto_login_user_x_requires_tfa', array('username' => $user['username'], 'twoStepLink' => XenForo_Link::buildPublicLink('login/two-step', null, array('redirect' => $this->getDynamicRedirect(), 'remember' => 1)))));
}
}
$userModel->setUserRememberCookie($user['user_id']);
XenForo_Model_Ip::log($user['user_id'], 'user', $user['user_id'], 'login_api_consumer');
$userModel->deleteSessionActivity(0, $this->_request->getClientIp(false));
if (XenForo_Application::$versionId < 1050000) {
XenForo_Application::getSession()->changeUserId($user['user_id']);
XenForo_Visitor::setup($user['user_id']);
} else {
$visitor = XenForo_Visitor::setup($user['user_id']);
XenForo_Application::getSession()->userLogin($user['user_id'], $visitor['password_date']);
}
return $this->responseRedirect(XenForo_ControllerResponse_Redirect::SUCCESS, $this->getDynamicRedirect(), new XenForo_Phrase('bdapi_consumer_auto_login_with_x_succeeded_y', array('provider' => $provider['name'], 'username' => $user['username'])));
}
示例4: actionApi
public function actionApi()
{
$input = $this->_input->filter(array('redirect' => XenForo_Input::STRING, 'timestamp' => XenForo_Input::UINT, 'user_id' => XenForo_Input::STRING));
$userId = 0;
if (!empty($input['user_id']) && !empty($input['timestamp'])) {
try {
$userId = intval(bdApi_Crypt::decryptTypeOne($input['user_id'], $input['timestamp']));
} catch (XenForo_Exception $e) {
if (XenForo_Application::debugMode()) {
$this->_response->setHeader('X-Api-Exception', $e->getMessage());
}
}
}
if ($userId > 0) {
$this->_response->setHeader('X-Api-Login-User', $userId);
$this->_getUserModel()->setUserRememberCookie($userId);
XenForo_Model_Ip::log($userId, 'user', $userId, 'login_api');
$this->_getUserModel()->deleteSessionActivity(0, $this->_request->getClientIp(false));
$session = XenForo_Application::get('session');
$session->changeUserId($userId);
XenForo_Visitor::setup($userId);
}
if (empty($input['redirect'])) {
$input['redirect'] = $this->getDynamicRedirectIfNot(XenForo_Link::buildPublicLink('login'));
}
return $this->responseRedirect(XenForo_ControllerResponse_Redirect::SUCCESS, $input['redirect']);
}
示例5: actionIndex
/**
* Single-stage logout procedure
*/
public function actionIndex()
{
$csrfToken = $this->_input->filterSingle('_xfToken', XenForo_Input::STRING);
$redirectResponse = $this->responseRedirect(XenForo_ControllerResponse_Redirect::SUCCESS, $this->getDynamicRedirect(false, false));
$userId = XenForo_Visitor::getUserId();
if (!$userId) {
return $redirectResponse;
}
if ($this->_noRedirect() || !$csrfToken) {
// request is likely from JSON, probably XenForo.OverlayTrigger, so show a confirmation dialog
return $this->responseView('XenForo_ViewPublic_LogOut', 'log_out');
} else {
$this->_checkCsrfFromToken($csrfToken);
// remove an admin session if we're logged in as the same person
if (XenForo_Visitor::getInstance()->get('is_admin')) {
$class = XenForo_Application::resolveDynamicClass('XenForo_Session');
$adminSession = new $class(array('admin' => true));
$adminSession->start();
if ($adminSession->get('user_id') == $userId) {
$adminSession->delete();
}
}
$this->getModelFromCache('XenForo_Model_Session')->processLastActivityUpdateForLogOut(XenForo_Visitor::getUserId());
XenForo_Application::get('session')->delete();
XenForo_Helper_Cookie::deleteAllCookies($this->_getRetainedCookies(), array('user' => array('httpOnly' => false)));
XenForo_Visitor::setup(0);
return $redirectResponse;
}
}
示例6: _setupSession
/**
* Setup the session.
*
* @param string $action
*/
protected function _setupSession($action)
{
if (XenForo_Application::isRegistered('session')) {
return;
}
$session = new XenForo_Session(array('admin' => true));
XenForo_Application::set('session', $session);
$session->start();
XenForo_Visitor::setup($session->get('user_id'));
}
示例7: actionLogin
public function actionLogin()
{
$data = $this->_input->filter(array('login' => XenForo_Input::STRING, 'password' => XenForo_Input::STRING, 'remember' => XenForo_Input::UINT, 'register' => XenForo_Input::UINT, 'redirect' => XenForo_Input::STRING, 'cookie_check' => XenForo_Input::UINT, 'postData' => XenForo_Input::JSON_ARRAY));
if ($data['register'] || $data['password'] === '') {
return $this->responseReroute('XenForo_ControllerPublic_Register', 'index');
}
$redirect = $data['redirect'] ? $data['redirect'] : $this->getDynamicRedirectIfNot(XenForo_Link::buildPublicLink('login'));
if (XenForo_Visitor::getUserId()) {
return $this->responseRedirect(XenForo_ControllerResponse_Redirect::SUCCESS, $redirect);
}
$this->_assertPostOnly();
$loginModel = $this->_getLoginModel();
if ($data['cookie_check'] && count($_COOKIE) == 0) {
// login came from a page, so we should at least have a session cookie.
// if we don't, assume that cookies are disabled
return $this->_loginErrorResponse(new XenForo_Phrase('cookies_required_to_log_in_to_site'), $data['login'], true, $redirect);
}
$needCaptcha = $loginModel->requireLoginCaptcha($data['login']);
if ($needCaptcha) {
switch (XenForo_Application::getOptions()->loginLimit) {
case 'captcha':
if (!XenForo_Captcha_Abstract::validateDefault($this->_input, true)) {
return $this->_loginErrorResponse(new XenForo_Phrase('did_not_complete_the_captcha_verification_properly'), $data['login'], true, $redirect, $data['postData']);
}
break;
case 'block':
return $this->_loginErrorResponse(new XenForo_Phrase('your_account_has_temporarily_been_locked_due_to_failed_login_attempts'), $data['login'], true, $redirect, $data['postData']);
break;
}
}
$userModel = $this->_getUserModel();
$userId = $userModel->validateAuthentication($data['login'], $data['password'], $error);
if (!$userId) {
$loginModel->logLoginAttempt($data['login']);
return $this->_loginErrorResponse($error, $data['login'], $needCaptcha || $loginModel->requireLoginCaptcha($data['login']), $redirect, $data['postData']);
}
$loginModel->clearLoginAttempts($data['login']);
if ($data['remember']) {
$userModel->setUserRememberCookie($userId);
}
XenForo_Model_Ip::log($userId, 'user', $userId, 'login');
$userModel->deleteSessionActivity(0, $this->_request->getClientIp(false));
$visitor = XenForo_Visitor::setup($userId);
XenForo_Application::getSession()->userLogin($userId, $visitor['password_date']);
if ($data['postData']) {
return $this->responseView('XenForo_ViewPublic_Login_PostRedirect', 'login_post_redirect', array('postData' => $data['postData'], 'redirect' => $redirect));
} else {
return $this->responseRedirect(XenForo_ControllerResponse_Redirect::SUCCESS, $redirect);
}
}
示例8: actionExternal
public function actionExternal()
{
$this->_assertPostOnly();
$providerCode = $this->_input->filterSingle('provider', XenForo_Input::STRING);
$provider = bdApiConsumer_Option::getProviderByCode($providerCode);
if (empty($provider)) {
return $this->responseNoPermission();
}
$externalUserId = $this->_input->filterSingle('external_user_id', XenForo_Input::UINT);
if (empty($externalUserId)) {
return $this->responseNoPermission();
}
if (!bdApiConsumer_Helper_Api::verifyJsSdkSignature($provider, $_REQUEST)) {
return $this->responseNoPermission();
}
$userModel = $this->_getUserModel();
$userExternalModel = $this->getModelFromCache('XenForo_Model_UserExternal');
$existingAssoc = $userExternalModel->getExternalAuthAssociation($userExternalModel->bdApiConsumer_getProviderCode($provider), $externalUserId);
if (!empty($existingAssoc)) {
$accessToken = $userExternalModel->bdApiConsumer_getAccessTokenFromAuth($provider, $existingAssoc);
if (empty($accessToken)) {
// no access token in the auth, consider no auth at all
$existingAssoc = null;
}
}
if (empty($existingAssoc)) {
$autoRegister = bdApiConsumer_Option::get('autoRegister');
if ($autoRegister === 'on' or $autoRegister === 'id_sync') {
// we have to do a refresh here
return $this->responseRedirect(XenForo_ControllerResponse_Redirect::SUCCESS, XenForo_Link::buildPublicLink('canonical:register/external', null, array('provider' => $providerCode, 'reg' => 1, 'redirect' => $this->getDynamicRedirect())), new XenForo_Phrase('bdapi_consumer_being_auto_login_auto_register_x', array('provider' => $provider['name'])));
}
}
if ($existingAssoc and $user = $userModel->getUserById($existingAssoc['user_id'])) {
$userModel->setUserRememberCookie($user['user_id']);
XenForo_Model_Ip::log($user['user_id'], 'user', $user['user_id'], 'login_api_consumer');
$userModel->deleteSessionActivity(0, $this->_request->getClientIp(false));
$session = XenForo_Application::get('session');
$session->changeUserId($user['user_id']);
XenForo_Visitor::setup($user['user_id']);
$message = new XenForo_Phrase('bdapi_consumer_auto_login_with_x_succeeded_y', array('provider' => $provider['name'], 'username' => $user['username']));
return $this->responseRedirect(XenForo_ControllerResponse_Redirect::SUCCESS, $this->getDynamicRedirect(), $message);
} else {
return $this->responseError(new XenForo_Phrase('bdapi_consumer_auto_login_with_x_failed', array('provider' => $provider['name'])));
}
}
示例9: logout
public static function logout()
{
self::start();
if (!self::userLoad()) {
return;
}
if (XenForo_Visitor::getInstance()->get('is_admin')) {
$adminSession = new XenForo_Session(array('admin' => true));
$adminSession->start();
if ($adminSession->get('user_id') == XenForo_Visitor::getUserId()) {
$adminSession->delete();
}
}
XenForo_Model::create('XenForo_Model_Session')->processLastActivityUpdateForLogOut(XenForo_Visitor::getUserId());
XenForo_Application::get('session')->delete();
XenForo_Helper_Cookie::deleteAllCookies(array('session'), array('user' => array('httpOnly' => false)));
XenForo_Visitor::setup(0);
}
示例10: actionIndex
/**
* Single-stage logout procedure
*/
public function actionIndex()
{
$this->_checkCsrfFromToken($this->_input->filterSingle('_xfToken', XenForo_Input::STRING));
// remove an admin session if we're logged in as the same person
if (XenForo_Visitor::getInstance()->get('is_admin')) {
$adminSession = new XenForo_Session(array('admin' => true));
$adminSession->start();
if ($adminSession->get('user_id') == XenForo_Visitor::getUserId()) {
$adminSession->delete();
}
}
$this->getModelFromCache('XenForo_Model_Session')->processLastActivityUpdateForLogOut(XenForo_Visitor::getUserId());
XenForo_Application::get('session')->delete();
XenForo_Helper_Cookie::deleteAllCookies(array('session'), array('user' => array('httpOnly' => false)));
XenForo_Visitor::setup(0);
$redirect = $this->_input->filterSingle('redirect', XenForo_Input::STRING);
return $this->responseRedirect(XenForo_ControllerResponse_Redirect::SUCCESS, $redirect ? $redirect : XenForo_Link::buildPublicLink('index'));
}
示例11: _executePromotionUpdate
protected function _executePromotionUpdate($force = false)
{
if (!XenForo_Application::isRegistered('session') || XenForo_Application::getSession()->get('promotionChecked')) {
return;
}
$visitor = XenForo_Visitor::getInstance();
if (!$visitor['user_id'] || $visitor['last_activity'] > XenForo_Application::$time - 1800 && !$force) {
// guest or we've been active recently, so let the cron do it
return;
}
XenForo_Application::getSession()->set('promotionChecked', true);
/** @var $promotionModel XenForo_Model_UserGroupPromotion */
$promotionModel = $this->getModelFromCache('XenForo_Model_UserGroupPromotion');
if ($promotionModel->updatePromotionsForUser($visitor->toArray())) {
// awarded promotions, reload
XenForo_Visitor::setup($visitor['user_id'], XenForo_Visitor::getVisitorSetupOptions());
}
}
示例12: _postSaveAfterTransaction
protected function _postSaveAfterTransaction()
{
parent::_postSaveAfterTransaction();
if (SV_UserPromoOnUpdate_Globals::$RunPromotion) {
// ensure we don't attempt to run the promotion twice in the same request
SV_UserPromoOnUpdate_Globals::$RunPromotion = false;
$user = $this->getMergedData();
/** @var $promotionModel XenForo_Model_UserGroupPromotion */
$promotionModel = $this->getModelFromCache('XenForo_Model_UserGroupPromotion');
if ($promotionModel->updatePromotionsForUser($user)) {
$visitor = XenForo_Visitor::getInstance();
// awarded promotions, reload session
if (XenForo_Application::isRegistered('session') && $visitor['user_id'] && $visitor['user_id'] == $user['user_id']) {
XenForo_Application::getSession()->set('promotionChecked', true);
XenForo_Visitor::setup($user['user_id'], XenForo_Visitor::getVisitorSetupOptions());
}
}
}
}
示例13: actionLogin
public function actionLogin()
{
$this->_assertPostOnly();
$data = $this->_input->filter(array('login' => XenForo_Input::STRING, 'password' => XenForo_Input::STRING, 'remember' => XenForo_Input::UINT, 'register' => XenForo_Input::UINT, 'redirect' => XenForo_Input::STRING, 'cookie_check' => XenForo_Input::UINT));
if ($data['register'] || $data['password'] === '') {
return $this->responseReroute('XenForo_ControllerPublic_Register', 'index');
}
$redirect = $data['redirect'] ? $data['redirect'] : $this->getDynamicRedirect();
$loginModel = $this->_getLoginModel();
if ($data['cookie_check'] && count($_COOKIE) == 0) {
// login came from a page, so we should at least have a session cookie.
// if we don't, assume that cookies are disabled
return $this->_loginErrorResponse(new XenForo_Phrase('cookies_required_to_log_in_to_site'), $data['login'], true, $redirect);
}
$needCaptcha = $loginModel->requireLoginCaptcha($data['login']);
if ($needCaptcha) {
if (!XenForo_Captcha_Abstract::validateDefault($this->_input, true)) {
$loginModel->logLoginAttempt($data['login']);
return $this->_loginErrorResponse(new XenForo_Phrase('did_not_complete_the_captcha_verification_properly'), $data['login'], true, $redirect);
}
}
$userModel = $this->_getUserModel();
$userId = $userModel->validateAuthentication($data['login'], $data['password'], $error);
if (!$userId) {
$loginModel->logLoginAttempt($data['login']);
return $this->_loginErrorResponse($error, $data['login'], $needCaptcha || $loginModel->requireLoginCaptcha($data['login']), $redirect);
}
$loginModel->clearLoginAttempts($data['login']);
if ($data['remember']) {
$userModel->setUserRememberCookie($userId);
}
XenForo_Model_Ip::log($userId, 'user', $userId, 'login');
$userModel->deleteSessionActivity(0, $this->_request->getClientIp(false));
$session = XenForo_Application::get('session');
$session->changeUserId($userId);
XenForo_Visitor::setup($userId);
return $this->responseRedirect(XenForo_ControllerResponse_Redirect::SUCCESS, $redirect);
}
示例14: actionExternalRegister
public function actionExternalRegister()
{
$this->_assertPostOnly();
$redirect = $this->_bdApiConsumer_getRedirect();
$userModel = $this->_getUserModel();
/** @var bdApiConsumer_XenForo_Model_UserExternal $userExternalModel */
$userExternalModel = $this->_getUserExternalModel();
$providerCode = $this->_input->filterSingle('provider', XenForo_Input::STRING);
$provider = bdApiConsumer_Option::getProviderByCode($providerCode);
if (empty($provider)) {
return $this->responseNoPermission();
}
$doAssoc = $this->_input->filterSingle('associate', XenForo_Input::STRING) || $this->_input->filterSingle('force_assoc', XenForo_Input::UINT);
$userId = 0;
if ($doAssoc) {
$associate = $this->_input->filter(array('associate_login' => XenForo_Input::STRING, 'associate_password' => XenForo_Input::STRING));
$loginModel = $this->_getLoginModel();
if ($loginModel->requireLoginCaptcha($associate['associate_login'])) {
return $this->responseError(new XenForo_Phrase('your_account_has_temporarily_been_locked_due_to_failed_login_attempts'));
}
$userId = $userModel->validateAuthentication($associate['associate_login'], $associate['associate_password'], $error);
if (!$userId) {
$loginModel->logLoginAttempt($associate['associate_login']);
return $this->responseError($error);
}
}
$refreshToken = $this->_input->filterSingle('refresh_token', XenForo_Input::STRING);
$externalToken = bdApiConsumer_Helper_Api::getAccessTokenFromRefreshToken($provider, $refreshToken);
if (empty($externalToken)) {
return $this->responseError(new XenForo_Phrase('bdapi_consumer_error_occurred_while_connecting_with_x', array('provider' => $provider['name'])));
}
$externalVisitor = bdApiConsumer_Helper_Api::getVisitor($provider, $externalToken['access_token']);
if (empty($externalVisitor)) {
return $this->responseError(new XenForo_Phrase('bdapi_consumer_error_occurred_while_connecting_with_x', array('provider' => $provider['name'])));
}
if (empty($externalVisitor['user_email'])) {
return $this->responseError(new XenForo_Phrase('bdapi_consumer_x_returned_unknown_error', array('provider' => $provider['name'])));
}
if (isset($externalVisitor['user_is_valid']) and isset($externalVisitor['user_is_verified'])) {
if (empty($externalVisitor['user_is_valid']) or empty($externalVisitor['user_is_verified'])) {
return $this->responseError(new XenForo_Phrase('bdapi_consumer_x_account_not_good_standing', array('provider' => $provider['name'])));
}
}
if ($doAssoc) {
$userExternalModel->bdApiConsumer_updateExternalAuthAssociation($provider, $externalVisitor['user_id'], $userId, array_merge($externalVisitor, array('token' => $externalToken)));
XenForo_Application::getSession()->changeUserId($userId);
XenForo_Visitor::setup($userId);
return $this->responseRedirect(XenForo_ControllerResponse_Redirect::SUCCESS, $redirect);
}
if (bdApiConsumer_Option::get('bypassRegistrationActive')) {
// do not check for registration active option
} else {
$this->_assertRegistrationActive();
}
$data = $this->_input->filter(array('username' => XenForo_Input::STRING, 'timezone' => XenForo_Input::STRING));
// TODO: custom fields
if (XenForo_Dependencies_Public::getTosUrl() && !$this->_input->filterSingle('agree', XenForo_Input::UINT)) {
return $this->responseError(new XenForo_Phrase('you_must_agree_to_terms_of_service'));
}
$user = bdApiConsumer_Helper_AutoRegister::createUser($data, $provider, $externalToken, $externalVisitor, $this->_getUserExternalModel());
XenForo_Application::getSession()->changeUserId($user['user_id']);
XenForo_Visitor::setup($user['user_id']);
$viewParams = array('user' => $user, 'redirect' => $redirect);
return $this->responseView('XenForo_ViewPublic_Register_Process', 'register_process', $viewParams, $this->_getRegistrationContainerParams());
}
示例15: actionLogout
public function actionLogout()
{
$fr_username = $this->_input->filterSingle('fr_username', XenForo_Input::STRING);
if (XenForo_Visitor::getInstance()->get('is_admin')) {
$admin = new XenForo_Session(array('admin' => true));
$admin->start();
if ($admin->get('user_id') == XenForo_Visitor::getUserId()) {
$admin->delete();
}
}
fr_remove_push_user();
$this->getModelFromCache('XenForo_Model_Session')->processLastActivityUpdateForLogOut(XenForo_Visitor::getUserId());
XenForo_Application::get('session')->delete();
XenForo_Helper_Cookie::deleteAllCookies(array('session'), array('user' => array('httpOnly' => false)));
XenForo_Visitor::setup(0);
$requires_authentication = false;
if (!XenForo_Visitor::getInstance()->hasPermission('general', 'view')) {
$requires_authentication = true;
}
$options = XenForo_Application::get('options');
if (!$options->boardActive) {
$requires_authentication = true;
}
return array('success' => true, 'requires_authentication' => $requires_authentication);
}