From a2f896bdeb2bebd09e85742c2918c79020830212 Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Fri, 20 Apr 2012 07:52:43 -0400
Subject: [PATCH] - Use user object instead of session, if possible, to get user ID when creating cache object
---
program/include/rcube.php | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/program/include/rcube.php b/program/include/rcube.php
index 780f9b6..66715ed 100644
--- a/program/include/rcube.php
+++ b/program/include/rcube.php
@@ -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;
}
--
Gitblit v1.9.1