diff options
author | tcitworld <thomas.citharet@gmail.com> | 2014-01-04 12:30:31 -0800 |
---|---|---|
committer | tcitworld <thomas.citharet@gmail.com> | 2014-01-04 12:30:31 -0800 |
commit | 7f667839764621b5aa01c9db8ce5dde2a29ef18f (patch) | |
tree | 93d8241ee81c87e18494325ae02f0589a8e328a2 /inc/3rdparty/Session.class.php | |
parent | a84f77d6ba15a64ff00453f5d5190c021ce460ed (diff) | |
parent | 2abcccb37180c17318f5226f5d4bc28f30b621ea (diff) | |
download | wallabag-7f667839764621b5aa01c9db8ce5dde2a29ef18f.tar.gz wallabag-7f667839764621b5aa01c9db8ce5dde2a29ef18f.tar.zst wallabag-7f667839764621b5aa01c9db8ce5dde2a29ef18f.zip |
Merge pull request #1 from inthepoche/dev
Dev
Diffstat (limited to 'inc/3rdparty/Session.class.php')
-rw-r--r-- | inc/3rdparty/Session.class.php | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/inc/3rdparty/Session.class.php b/inc/3rdparty/Session.class.php index df913a06..32624559 100644 --- a/inc/3rdparty/Session.class.php +++ b/inc/3rdparty/Session.class.php | |||
@@ -32,6 +32,8 @@ class Session | |||
32 | // If the user does not access any page within this time, | 32 | // If the user does not access any page within this time, |
33 | // his/her session is considered expired (3600 sec. = 1 hour) | 33 | // his/her session is considered expired (3600 sec. = 1 hour) |
34 | public static $inactivityTimeout = 3600; | 34 | public static $inactivityTimeout = 3600; |
35 | // Extra timeout for long sessions (if enabled) (82800 sec. = 23 hours) | ||
36 | public static $longSessionTimeout = 82800; | ||
35 | // If you get disconnected often or if your IP address changes often. | 37 | // If you get disconnected often or if your IP address changes often. |
36 | // Let you disable session cookie hijacking protection | 38 | // Let you disable session cookie hijacking protection |
37 | public static $disableSessionProtection = false; | 39 | public static $disableSessionProtection = false; |
@@ -106,6 +108,7 @@ class Session | |||
106 | $password, | 108 | $password, |
107 | $loginTest, | 109 | $loginTest, |
108 | $passwordTest, | 110 | $passwordTest, |
111 | $longlastingsession, | ||
109 | $pValues = array()) | 112 | $pValues = array()) |
110 | { | 113 | { |
111 | self::banInit(); | 114 | self::banInit(); |
@@ -118,7 +121,11 @@ class Session | |||
118 | $_SESSION['username'] = $login; | 121 | $_SESSION['username'] = $login; |
119 | // Set session expiration. | 122 | // Set session expiration. |
120 | $_SESSION['expires_on'] = time() + self::$inactivityTimeout; | 123 | $_SESSION['expires_on'] = time() + self::$inactivityTimeout; |
121 | 124 | if ($longlastingsession) { | |
125 | $_SESSION['longlastingsession'] = self::$longSessionTimeout; | ||
126 | $_SESSION['expires_on'] += $_SESSION['longlastingsession']; | ||
127 | } | ||
128 | |||
122 | foreach ($pValues as $key => $value) { | 129 | foreach ($pValues as $key => $value) { |
123 | $_SESSION[$key] = $value; | 130 | $_SESSION[$key] = $value; |
124 | } | 131 | } |
@@ -136,7 +143,7 @@ class Session | |||
136 | */ | 143 | */ |
137 | public static function logout() | 144 | public static function logout() |
138 | { | 145 | { |
139 | unset($_SESSION['uid'],$_SESSION['ip'],$_SESSION['expires_on'],$_SESSION['tokens'], $_SESSION['login'], $_SESSION['pass'], $_SESSION['poche_user']); | 146 | unset($_SESSION['uid'],$_SESSION['ip'],$_SESSION['expires_on'],$_SESSION['tokens'], $_SESSION['login'], $_SESSION['pass'], $_SESSION['longlastingsession'], $_SESSION['poche_user']); |
140 | } | 147 | } |
141 | 148 | ||
142 | /** | 149 | /** |