/** * Get resource instance * * @return Core_Model_Resource_Abstract */ protected function _getResource() { if (empty($this->_resourceName)) { App_Main::throwException('Resource is not set'); } return App_Main::getResourceSingleton($this->_resourceName); }
/** * Conigure and start session * * @param string $sessionName * @return Core_Model_Session_Abstract */ public function start($sessionName = null) { if (isset($_SESSION)) { return $this; } if (is_writable($this->getSessionSavePath())) { session_save_path($this->getSessionSavePath()); } switch ($this->getSessionSaveMethod()) { case 'db': ini_set('session.save_handler', 'user'); $sessionResource = App_Main::getResourceSingleton('core/session'); $sessionResource->setSaveHandler(); break; case 'memcache': ini_set('session.save_handler', 'memcache'); session_save_path($this->getSessionSavePath()); break; default: session_module_name('files'); break; } /*if ($sessionName == 'backend') { $adminSessionLifetime = App_Main::SESSION_ADMIN_LIFETIME; if ($adminSessionLifetime > 60) { App_Main::getSingleton('core/cookie')->setLifetime($adminSessionLifetime); } }*/ // set session cookie params session_set_cookie_params($this->getCookie()->getLifetime(), $this->getCookie()->getPath(), $this->getCookie()->getDomain(), $this->getCookie()->isSecure(), $this->getCookie()->getHttponly()); /*tmp vers */ $a = $this->getCookie()->getLifetime(); $b = $this->getCookie()->getPath(); $c = $this->getCookie()->getDomain(); $d = $this->getCookie()->isSecure(); $e = $this->getCookie()->getHttponly(); if (!empty($sessionName)) { $this->setSessionName($sessionName); } // potential custom logic for session id (ex. switching between hosts) $this->setSessionId(); /*if ($sessionCacheLimiter = App_Main::SESSION_CACHE_LIMITER) { session_cache_limiter((string)$sessionCacheLimiter); }*/ session_start(); return $this; }