90 if ($this->started && !$this->closed) {
94 if (!session_start()) {
95 throw new RuntimeException(
'Failed to start the session');
98 $this->started =
true;
99 $this->closed =
false;
107 public function regenerate($destroy =
false, $lifetime = null) {
108 if (null !== $lifetime) {
109 ini_set(
'session.cookie_lifetime', $lifetime);
112 return session_regenerate_id($destroy);
119 session_write_close();
121 $this->closed =
true;
135 if (!$this->started) {
146 if ($this->started) {
147 throw new RuntimeException(
'Cannot change the ID of an active session');
157 return session_name();
171 if (!$this->started) {
175 return array_key_exists(
$name, $_SESSION);
182 if (!$this->started) {
192 if (!$this->started) {
202 if (!$this->started) {
212 if (!$this->started) {
225 if (!$this->started) {
229 if (array_key_exists(
$name, $_SESSION)) {
230 $retval = $_SESSION[
$name];
231 unset($_SESSION[
$name]);
241 if (!$this->started) {
258 $validOptions = array_flip(array(
259 'cache_limiter',
'cookie_domain',
'cookie_httponly',
260 'cookie_lifetime',
'cookie_path',
'cookie_secure',
261 'entropy_file',
'entropy_length',
'gc_divisor',
262 'gc_maxlifetime',
'gc_probability',
'hash_bits_per_character',
263 'hash_function',
'name',
'referer_check',
264 'serialize_handler',
'use_cookies',
265 'use_only_cookies',
'use_trans_sid',
'upload_progress.enabled',
266 'upload_progress.cleanup',
'upload_progress.prefix',
'upload_progress.name',
267 'upload_progress.freq',
'upload_progress.min-freq',
'url_rewriter.tags',
271 if (isset($validOptions[
$key])) {
272 ini_set(
'session.' . $key,
$value);
284 session_set_save_handler(
regenerate($destroy=false, $lifetime=null)
{Regenerates id that represents this storage.This method must invoke session_regenerate_id($destroy) ...
if($guid==elgg_get_logged_in_user_guid()) $name
setOptions(array $options)
Sets session.
setHandler($handler)
Set the session handler class with PHP.
save()
{Force the session to be saved and closed.This method must invoke session_write_close() unless this i...
start()
{Starts the session.boolean True if started. If something goes wrong starting the session...
all()
{Returns all attributes.array Attributes}
__construct(array $options=array(), Elgg_Http_SessionHandler $handler=null)
Constructor.
getName()
{Returns the session name.string The session name.}
has($name)
{Checks if an attribute is defined.The attribute nameboolean}
isStarted()
{Checks if the session is started.boolean True if started, false otherwise.}
replace(array $attributes)
{Replaces all attributes.Attributes void}
if(!$collection_name) $id
setId($id)
{Sets the session ID.Session string void}
clear()
{Clears all attributes.void}
setName($name)
{Sets the session name.Session name. void}
getId()
{Returns the session ID.string The session ID or empty.}