/**
  * Event onUserLogout
  * 
  * @access public
  * @param array $user
  * @param array $options
  * @return bool
  */
 public function onUserLogout($user = null, $options = array())
 {
     // Check if we can run this event or not
     if (MageBridgePluginHelper::allowEvent('onUserLogout', $options) == false) {
         return;
     }
     // Get system variables
     $application = JFactory::getApplication();
     $session = JFactory::getSession();
     $bridge = MageBridgeModelBridge::getInstance();
     $register = MageBridgeModelRegister::getInstance();
     // Remove the frontend-cookie
     setcookie('frontend', NULL, -1);
     $session->set('magento_session', null);
     // Build the bridge and fetch the result
     $arguments = array('disable_events' => 1);
     $id = $register->add('logout', null, $arguments);
     $bridge->build();
     // Check whether SSO is enabled
     if ($this->getParam('enable_sso') == 1 && isset($user['username'])) {
         if ($application->isSite() && $this->getParam('enable_auth_frontend') == 1) {
             MageBridgeModelUserSSO::doSSOLogout($user['username']);
         } else {
             if ($application->isAdmin() && $this->getParam('enable_auth_backend') == 1) {
                 MageBridgeModelUserSSO::doSSOLogout($user['username']);
             }
         }
     }
     return true;
 }
Пример #2
0
 /**
  * Event onUserAfterLogout
  *
  * @param array $options
  *
  * @return bool
  */
 public function onUserAfterLogout($options = array())
 {
     $application = JFactory::getApplication();
     // Check if we can run this event or not
     if (MageBridgePluginHelper::allowEvent('onUserLogout', $options) == false) {
         return true;
     }
     // Check whether SSO is enabled
     if ($this->getParam('enable_sso') == 1 && isset($options['username'])) {
         if ($application->isSite() && $this->getParam('enable_auth_frontend') == 1) {
             MageBridgeModelUserSSO::doSSOLogout($options['username']);
         } else {
             if ($application->isAdmin() && $this->getParam('enable_auth_backend') == 1) {
                 MageBridgeModelUserSSO::doSSOLogout($options['username']);
             }
         }
     }
     return true;
 }