示例#1
0
 /**
  * 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;
     }
 }
示例#2
0
 /**
  * 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'));
 }
示例#3
0
 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);
 }
示例#4
0
 public function logout()
 {
     // Check if we are an admin
     if ($this->getVisitor()->get('is_admin')) {
         // Logout admin
         $this->adminLogout();
     }
     // Logout user
     XenForo_Model::create('XenForo_Model_Session')->processLastActivityUpdateForLogOut($this->getVisitor()->getUserId());
     $this->getSession()->delete();
     XenForo_Helper_Cookie::deleteAllCookies(array('session'), array('user' => array('httpOnly' => false)));
     $this->getVisitor()->setup(0);
     return true;
 }
示例#5
0
文件: Login.php 项目: Sywooch/forums
 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);
 }