コード例 #1
0
ファイル: ezsession.php プロジェクト: legende91/ez
 /**
  * Register the needed session functions, this is called automatically by
  * {@link eZSession::start()}, so only call this if you don't start the session.
  *
  * @since 4.1
  * @return bool Depending on if eZSession is registrated as session handler.
  */
 protected static function registerFunctions()
 {
     if (self::$hasStarted || self::$handlerInstance !== null) {
         return false;
     }
     $ini = eZINI::instance();
     if ($ini->variable('Session', 'SessionNameHandler') === 'custom') {
         $sessionName = $ini->variable('Session', 'SessionNamePrefix');
         if ($ini->variable('Session', 'SessionNamePerSiteAccess') === 'enabled') {
             $access = $GLOBALS['eZCurrentAccess'];
             // Use md5 to make sure name is only consistent of alphanumeric characters
             $sessionName .= md5($access['name']);
         }
         session_name($sessionName);
     } else {
         $sessionName = session_name();
     }
     // See if user has session, used to avoid reading from db if no session.
     // Allow session bye post params for use by flash, but use $_POST directly
     // to avoid session double start issues ( #014686 ) caused by eZHTTPTool
     if (isset($_POST[$sessionName])) {
         // First use session id from post params (for use in flash upload)
         session_id($_POST[$sessionName]);
         self::$hasSessionCookie = true;
     } else {
         // else check cookie as used by default
         self::$hasSessionCookie = isset($_COOKIE[$sessionName]);
     }
     return self::getHandlerInstance()->setSaveHandler();
 }