From 66510e20d36cb8da4f3012ef063de7bfce9b51aa Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Wed, 09 May 2012 07:52:28 -0400
Subject: [PATCH] Merge pull request #1 from Brianetta/de-svn

---
 program/include/rcube.php |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/program/include/rcube.php b/program/include/rcube.php
index 6064a72..272136f 100644
--- a/program/include/rcube.php
+++ b/program/include/rcube.php
@@ -236,7 +236,7 @@
    *
    * @param string $name   Cache identifier
    * @param string $type   Cache type ('db', 'apc' or 'memcache')
-   * @param int    $ttl    Expiration time for cache items in seconds
+   * @param string $ttl    Expiration time for cache items
    * @param bool   $packed Enables/disables data serialization
    *
    * @return rcube_cache Cache object
@@ -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];
@@ -347,6 +348,7 @@
       $options['port']     = $_SESSION['storage_port'];
       $options['ssl']      = $_SESSION['storage_ssl'];
       $options['password'] = $this->decrypt($_SESSION['password']);
+      $_SESSION[$driver.'_host'] = $_SESSION['storage_host'];
     }
 
     $options = $this->plugins->exec_hook("storage_init", $options);
@@ -474,7 +476,7 @@
             $this->session->set_keep_alive($keep_alive);
         }
 
-        $this->session->set_secret($this->config->get('des_key') . $_SERVER['HTTP_USER_AGENT']);
+        $this->session->set_secret($this->config->get('des_key') . dirname($_SERVER['SCRIPT_NAME']));
         $this->session->set_ip_check($this->config->get('ip_check'));
     }
 
@@ -486,7 +488,7 @@
     public function temp_gc()
     {
         $tmp = unslashify($this->config->get('temp_dir'));
-        $expire = mktime() - 172800;  // expire in 48 hours
+        $expire = time() - 172800;  // expire in 48 hours
 
         if ($tmp && ($dir = opendir($tmp))) {
             while (($fname = readdir($dir)) !== false) {
@@ -629,7 +631,7 @@
         $this->texts = array_merge($this->texts, $messages);
 
       // include user language files
-      if ($lang != 'en' && is_dir(INSTALL_PATH . 'program/localization/' . $lang)) {
+      if ($lang != 'en' && $lang != 'en_US' && is_dir(INSTALL_PATH . 'program/localization/' . $lang)) {
         include_once(INSTALL_PATH . 'program/localization/' . $lang . '/labels.inc');
         include_once(INSTALL_PATH . 'program/localization/' . $lang . '/messages.inc');
 
@@ -1171,6 +1173,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