/** * Set default httponly * * Sets the default cookie httponly flag to use with the {@link * AeCookie::set()} method * * @param bool $http * * @return bool */ public static function setHttp($http) { if (!version_compare(PHP_VERSION, '5.2.0', '>=')) { return false; } if ($http instanceof AeScalar) { $http = $http->toBoolean()->value; } self::$_http = (bool) $http; return true; }
/** * Set session options * * Sets the session options to the values passed. See {@link * AeSession::__construct() session constructor} for details on the * available session options. * * @param AeArray $options * * @return bool */ protected function _setOptions(AeArray $options) { // *** Set some options if (isset($options['name'])) { session_name((string) $options['name']); } if (isset($options['id'])) { session_id((string) $options['id']); } if (isset($options['lifetime'])) { $this->_lifetime = (int) $options['lifetime']->toInteger()->value; } else { $this->_lifetime = (int) ini_get('session.gc_maxlifetime'); } // *** get security options $this->_validate = array('remote-address' => false, 'user-agent' => false); if (isset($options['validate'])) { if (isset($options['validate']['address'])) { $this->_validate['remote-address'] = (bool) $options['validate']['address']->getValue(); } if (isset($options['validate']['agent'])) { $this->_validate['user-agent'] = (bool) $options['validate']['agent']->getValue(); } } // *** Sync the session maxlifetime ini_set('session.gc_maxlifetime', $this->_lifetime); $cookie = session_get_cookie_params(); $expire = isset($options['expire']) ? $options['expire']->toBoolean()->getValue() : false; $args = array(); $args[] = $expire ? 0 : $this->_lifetime; $args[] = isset($options['path']) ? (string) $options['path'] : (string) AeCookie::getPath($cookie['path']); $args[] = isset($options['domain']) ? (string) $options['domain'] : (string) AeCookie::getDomain($cookie['domain']); $args[] = isset($options['secure']) ? (bool) $options['secure']->toBoolean()->value : (bool) AeCookie::getSecure(new AeBoolean($cookie['secure']))->toBoolean()->value; if (version_compare(PHP_VERSION, '5.2.0', '>=')) { $args[] = isset($options['http']) ? (bool) $options['http']->toBoolean()->value : (bool) AeCookie::getHttp(new AeBoolean((bool) @$cookie['http']))->toBoolean()->value; } return @call_user_func_array('session_set_cookie_params', $args); }