Store modification time in special session entry
authorMichael M Slusarz <slusarz@curecanti.org>
Wed, 3 Nov 2010 05:18:14 +0000 (23:18 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Thu, 4 Nov 2010 19:39:33 +0000 (13:39 -0600)
framework/Core/lib/Horde/Session.php

index b862012..be7aff6 100644 (file)
@@ -17,6 +17,7 @@ class Horde_Session implements ArrayAccess
 {
     /* Class constants. */
     const DATA = '_d';
+    const MODIFIED = '_m';
     const PRUNE = '_p';
     const SERIALIZED = '_s';
 
@@ -103,6 +104,9 @@ class Horde_Session implements ArrayAccess
 
             /* Create internal data arrays. */
             if (!isset($_SESSION[self::SERIALIZED])) {
+                /* Last modification time of session. */
+                $_SESSION[self::MODIFIED] = 0;
+
                 /* Is this key serialized? */
                 $_SESSION[self::SERIALIZED] = array();
             }
@@ -116,8 +120,8 @@ class Horde_Session implements ArrayAccess
              * we are accessing the server via a periodic mechanism (think
              * folder refreshing in IMP) that we will catch this refresh. */
             $curr_time = time();
-            if ($curr_time >= intval($this['horde:session_mod'])) {
-                $this['horde:session_mod'] = $curr_time + (ini_get('session.gc_maxlifetime') / 2);
+            if ($curr_time >= $_SESSION[self::MODIFIED]) {
+                $_SESSION[self::MODIFIED] = intval($curr_time + (ini_get('session.gc_maxlifetime') / 2));
                 $this->sessionHandler->changed = true;
             }
         }