diff options
| author | 2014-08-13 00:09:48 +0200 | |
|---|---|---|
| committer | 2014-08-13 00:09:48 +0200 | |
| commit | ee1b8f6f72e8c2cbd3e0ad7b4322a4bb6863c028 (patch) | |
| tree | 464ff98e55a41955ac6a18e7cdcfc31698247eba /lib | |
| parent | 775ff40780935471dcd74b0d81c04b80e3e4603c (diff) | |
Long term cookie to keep session open
Token system
https://github.com/marienfressinaud/FreshRSS/issues/465
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/Minz/Session.php | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/lib/Minz/Session.php b/lib/Minz/Session.php index 906acc03c..af4de75bb 100644 --- a/lib/Minz/Session.php +++ b/lib/Minz/Session.php @@ -65,11 +65,8 @@ class Minz_Session { * @param $l la durée de vie */ public static function keepCookie($l) { - $cookie_dir = dirname( - empty($_SERVER['REQUEST_URI']) ? '' : $_SERVER['REQUEST_URI'] - ) . '/'; - session_set_cookie_params($l, $cookie_dir, $_SERVER['HTTP_HOST'], - false, true); + $cookie_dir = empty($_SERVER['REQUEST_URI']) ? '' : $_SERVER['REQUEST_URI']; + session_set_cookie_params($l, $cookie_dir, '', false, true); } @@ -81,4 +78,16 @@ class Minz_Session { session_regenerate_id(true); } + public static function deleteLongTermCookie($name) { + setcookie($name, '', 1, '', '', false, true); + } + + public static function setLongTermCookie($name, $value, $expire) { + setcookie($name, $value, $expire, '', '', false, true); + } + + public static function getLongTermCookie($name) { + return isset($_COOKIE[$name]) ? $_COOKIE[$name] : null; + } + } |
