From 78a58162d8e9c46a90c8406605f4e58bd6ca54fe Mon Sep 17 00:00:00 2001
From: Marc-Oliver Teschke <marcoliverteschke@mac.com>
Date: Mon, 14 Apr 2014 11:08:01 -0400
Subject: [PATCH] When checking if DB schema is up-to-date, limit the checks to tables in our current schema. Otherwise installer might return false positives when DB user has access to multiple schemas.

---
 program/include/rcmail.php |   30 ++++++++++++++++++++----------
 1 files changed, 20 insertions(+), 10 deletions(-)

diff --git a/program/include/rcmail.php b/program/include/rcmail.php
index 81fe7d7..1fd0776 100644
--- a/program/include/rcmail.php
+++ b/program/include/rcmail.php
@@ -839,6 +839,9 @@
 
         // write performance stats to logs/console
         if ($this->config->get('devel_mode')) {
+            // make sure logged numbers use unified format
+            setlocale(LC_NUMERIC, 'en_US.utf8', 'en_US.UTF-8', 'en_US', 'C');
+
             if (function_exists('memory_get_usage'))
                 $mem = $this->show_bytes(memory_get_usage());
             if (function_exists('memory_get_peak_usage'))
@@ -1603,9 +1606,13 @@
      *
      * @return string Localized folder name in UTF-8 encoding
      */
-    public function localize_foldername($name, $with_path = true)
+    public function localize_foldername($name, $with_path = false)
     {
         $realnames = $this->config->get('show_real_foldernames');
+
+        if (!$realnames && ($folder_class = $this->folder_classname($name))) {
+            return $this->gettext($folder_class);
+        }
 
         // try to localize path of the folder
         if ($with_path && !$realnames) {
@@ -1623,10 +1630,6 @@
                     }
                 }
             }
-        }
-
-        if (!$realnames && ($folder_class = $this->folder_classname($name))) {
-            return $this->gettext($folder_class);
         }
 
         return rcube_charset::convert($name, 'UTF7-IMAP');
@@ -2025,8 +2028,9 @@
         $_uid  = $uids ?: rcube_utils::get_input_value('_uid', RCUBE_INPUT_GPC);
         $_mbox = $mbox ?: (string)rcube_utils::get_input_value('_mbox', RCUBE_INPUT_GPC);
 
-        if (is_array($uid)) {
-            return $uid;
+        // already a hash array
+        if (is_array($_uid) && !isset($_uid[0])) {
+            return $_uid;
         }
 
         $result = array();
@@ -2040,12 +2044,18 @@
             }
         }
         else {
+            if (is_string($_uid))
+                $_uid = explode(',', $_uid);
+
             // create a per-folder UIDs array
-            foreach (explode(',', $_uid) as $uid) {
+            foreach ((array)$_uid as $uid) {
                 list($uid, $mbox) = explode('-', $uid, 2);
-                if (empty($mbox))
+                if (!strlen($mbox))
                     $mbox = $_mbox;
-                $result[$mbox][] = $uid;
+                if ($uid == '*')
+                    $result[$mbox] = $uid;
+                else
+                    $result[$mbox][] = $uid;
             }
         }
 

--
Gitblit v1.9.1