30 private $cookiePrefix =
'';
38 if (!headers_sent()) {
40 ini_set(
'session.cookie_lifetime', 0);
41 ini_set(
'session.use_cookies', 1);
42 ini_set(
'session.use_only_cookies', 1);
43 ini_set(
'session.use_strict_mode', 1);
44 ini_set(
'session.cookie_httponly', 1);
46 ini_set(
'session.use_trans_sid', 0);
47 ini_set(
'session.cache_limiter',
'nocache');
48 ini_set(
'session.hash_function', 1);
49 if (in_array(
'sha256', hash_algos())) {
50 ini_set(
'session.hash_function',
'sha256');
54 session_name($this->getCookieName());
59 session_write_close();
66 return isset($_COOKIE[$this->getCookieName()]);
79 public function get($key, $default=
null) {
82 if (isset($_SESSION[$key])) {
83 $value = $_SESSION[$key];
91 public function set($key, $value) {
93 $_SESSION[$key] = $value;
99 public function remove($key) {
101 unset($_SESSION[$key]);
109 $result = isset($_SESSION[$key]);
136 if (session_status() === PHP_SESSION_ACTIVE && !headers_sent()) {
137 session_regenerate_id(
true);
147 if ($this->
exist(self::AUTH_USER_NAME)) {
156 private function start() {
157 if (session_status() == PHP_SESSION_NONE) {
159 if (!headers_sent()) {
170 return $this->cookiePrefix;
177 private function getCookieName() {
178 return $this->cookiePrefix.
'-session';
__construct(Configuration $configuration)
Constructor.
Session is the interface for session implementations and defines access to session variables.
getCookiePrefix()
Get the cookie prefix.
StringUtil provides support for string manipulation.
getValue($key, $section)
Get a configuration value.
Implementations of Configuration give access to the application configuration.
static slug($string)
Converts all accent characters to ASCII characters.
URIUtil provides support for uri manipulation.
DefaultSession uses the default PHP session implementation: