37 public static function is_set ($name)
39 return isset($_SESSION[$name]);
47 return static::is_set($name);
57 public static function set ($name, $value)
59 $_SESSION[$name] = $value;
67 static::set($name, $value);
75 public static function get ($name)
77 if (isset($_SESSION[$name])) {
78 return $_SESSION[$name];
89 return static::get($name);
99 return $_SESSION[$name];
105 public static function delete ($name)
107 return static::un_set($name);
115 return static::un_set($name);
125 if (isset($_SESSION[$name])) {
126 unset($_SESSION[$name]);
135 return static::un_set($name);
141 public static function start ($id = NULL)
143 session_name(
"FusionDirectory");
145 session_set_cookie_params(24 * 60 * 60);
148 session_cache_expire(60 * 24);
153 ini_set(
"session.gc_maxlifetime", 24 * 60 * 60);
159 ini_set(
"session.cookie_httponly",
"1");
167 if (isset($_SESSION[
'HTTP_USER_AGENT'])) {
168 if ($_SESSION[
'HTTP_USER_AGENT'] != md5($_SERVER[
'HTTP_USER_AGENT'])) {
170 session_name(
"FusionDirectory");
174 $_SESSION[
'HTTP_USER_AGENT'] = md5($_SERVER[
'HTTP_USER_AGENT']);
178 if (!isset($_SESSION[
'started'])) {
179 session_regenerate_id();
180 $_SESSION[
'started'] = TRUE;
187 public static function destroy (
string $reason =
'')
192 $ui = static::get(
'ui');
202 sprintf(
'Logged out (%s)', $reason)
204 } elseif (!empty($reason)) {
210 sprintf(
'Session destroyed (%s)', $reason)
This class contains all the function needed to manage sessions.
static destroy(string $reason='')
Destroy a session.
static start($id=NULL)
Start a session.
static log(string $action, string $objecttype, string $object, array $changes=[], string $result='')
logging method
static & get_ref($name)
Accessor of a session var by reference.
static global_un_set($name)
Deprecated.
static global_set($name, $value)
Deprecated.
static un_set($name)
Unset a session.
static global_delete($name)
Deprecated.
static global_get($name)
Deprecated.
static global_is_set($name)
Deprecated.
static is_set($name)
Check if the name of the session is set.