Use LassoSPKitSessionPHP_key instead of LassoSPKitSessionFile_key

This commit is contained in:
Benjamin Dauvergne 2010-04-19 11:46:22 +02:00
parent 9e250c37dd
commit 796a21551d
1 changed files with 12 additions and 12 deletions

View File

@ -2,20 +2,20 @@
require_once('lassospkit_datadir.inc.php'); require_once('lassospkit_datadir.inc.php');
require_once('lassospkit_debug.inc.php'); require_once('lassospkit_debug.inc.php');
$LassoSPKitSessionFile_key = "__LassoSPKitSessionObject"; $LassoSPKitSessionPHP_key = "__LassoSPKitSessionObject";
class LassoSPKitSessionPHP { class LassoSPKitSessionPHP {
function retrieve($session, $timeout) { function retrieve($session, $timeout) {
global $LassoSPKitSessionPHP_key; global $LassoSPKitSessionPHP_key;
$content = null; $content = null;
if (! isset($_SESSION)) { #if (! isset($_SESSION)) {
throw new Exception("LassoSPKit cannot work without PHP sessions if use_session is TRUE."); # throw new Exception("LassoSPKit cannot work without PHP sessions if use_session is TRUE.");
} #}
if (isset($_SESSION[$LassoSPKitSessionFile_key])) { if (isset($_SESSION[$LassoSPKitSessionPHP_key])) {
$content = $_SESSION[$LassoSPKitSessionFile_key]; $content = $_SESSION[$LassoSPKitSessionPHP_key];
if (! isset($_SESSION[$LassoSPKitSessionFile_key . '_time']) || if (! isset($_SESSION[$LassoSPKitSessionPHP_key . '_time']) ||
$_SESSION[$LassoSPKitSessionFile_key . '_time'] - time() > $timeout) { $_SESSION[$LassoSPKitSessionPHP_key . '_time'] - time() > $timeout) {
$content = null; $content = null;
self::delete($session); self::delete($session);
} }
@ -24,11 +24,11 @@ class LassoSPKitSessionPHP {
} }
function store($session, $content) { function store($session, $content) {
global $LassoSPKitSessionPHP_key; global $LassoSPKitSessionPHP_key;
$_SESSION[$LassoSPKitSessionFile_key] = $content; $_SESSION[$LassoSPKitSessionPHP_key] = $content;
$_SESSION[$LassoSPKitSessionFile_key . '_time'] = time(); $_SESSION[$LassoSPKitSessionPHP_key . '_time'] = time();
} }
function delete($session) { function delete($session) {
unset($_SESSION[$LassoSPKitSessionFile_key]); unset($_SESSION[$LassoSPKitSessionPHP_key]);
unset($_SESSION[$LassoSPKitSessionFile_key . '_time']); unset($_SESSION[$LassoSPKitSessionPHP_key . '_time']);
} }
} }