Exemplo n.º 1
0
 /**
  * Starts shop session, generates unique session ID, extracts user IP.
  */
 public function start()
 {
     $myConfig = $this->getConfig();
     $sid = null;
     if ($this->isAdmin()) {
         $this->setName("admin_sid");
     } else {
         $this->setName("sid");
     }
     $sForceSidParam = $myConfig->getRequestParameter($this->getForcedName());
     $sSidParam = $myConfig->getRequestParameter($this->getName());
     //forcing sid for SSL<->nonSSL transitions
     if ($sForceSidParam) {
         $sid = $sForceSidParam;
     } elseif ($this->_getSessionUseCookies() && $this->_getCookieSid()) {
         $sid = $this->_getCookieSid();
     } elseif ($sSidParam) {
         $sid = $sSidParam;
     }
     //starting session if only we can
     if ($this->_allowSessionStart()) {
         //creating new sid
         if (!$sid) {
             self::$_blIsNewSession = true;
             $this->initNewSession();
         } else {
             self::$_blIsNewSession = false;
             $this->_setSessionId($sid);
             $this->_sessionStart();
         }
         //special handling for new ZP cluster session, as in that case session_start() regenerates id
         if ($this->_sId != session_id()) {
             $this->_setSessionId(session_id());
         }
         //checking for swapped client
         $blSwapped = $this->_isSwappedClient();
         if (!self::$_blIsNewSession && $blSwapped) {
             $this->initNewSession();
             // passing notification about session problems
             if ($this->_sErrorMsg && $myConfig->getConfigParam('iDebug')) {
                 oxRegistry::get("oxUtilsView")->addErrorToDisplay(oxNew("oxException", $this->_sErrorMsg));
             }
         } elseif (!$blSwapped) {
             // transferring cookies between hosts
             oxRegistry::get("oxUtilsServer")->loadSessionCookies();
         }
     }
 }