[Svn] r6105 - trunk/roundcubemail/program/include

trac at roundcube.net trac at roundcube.net
Fri Apr 20 13:52:43 CEST 2012


Author: alec
Date: 2012-04-20 06:52:43 -0500 (Fri, 20 Apr 2012)
New Revision: 6105

Modified:
   trunk/roundcubemail/program/include/rcube.php
Log:
- Use user object instead of session, if possible, to get user ID when creating cache object


Modified: trunk/roundcubemail/program/include/rcube.php
===================================================================
--- trunk/roundcubemail/program/include/rcube.php	2012-04-19 09:42:01 UTC (rev 6104)
+++ trunk/roundcubemail/program/include/rcube.php	2012-04-20 11:52:43 UTC (rev 6105)
@@ -244,7 +244,8 @@
   public function get_cache($name, $type='db', $ttl=0, $packed=true)
   {
     if (!isset($this->caches[$name])) {
-      $this->caches[$name] = new rcube_cache($type, $_SESSION['user_id'], $name, $ttl, $packed);
+      $userid = $this->get_user_id();
+      $this->caches[$name] = new rcube_cache($type, $userid, $name, $ttl, $packed);
     }
 
     return $this->caches[$name];
@@ -1171,6 +1172,9 @@
         if (is_object($this->user)) {
             return $this->user->ID;
         }
+        else if (isset($_SESSION['user_id'])) {
+            return $_SESSION['user_id'];
+        }
 
         return null;
     }



More information about the svn mailing list