From 8603bbba2e0bb3dfe171c0241bf97ab7ef9575fc Mon Sep 17 00:00:00 2001
From: thomascube <thomas@roundcube.net>
Date: Sun, 26 Sep 2010 07:17:03 -0400
Subject: [PATCH] Fix base url resolution + better order for condition checks in rcube_mdb2 + updated changelog

---
 CHANGELOG                        |    1 +
 program/include/rcube_mdb2.php   |    8 ++++----
 program/include/rcube_shared.inc |    2 +-
 3 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index 6281b82..4069a81 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,7 @@
 CHANGELOG Roundcube Webmail
 ===========================
 
+- Make alias setting in squirrelmail_usercopy plugin configurable (patch by pommi, #1487007)
 - Prevent from saving a non-existing skin path in user prefs (#1486936)
 - Improve handling of single-part messages with bogus BODYSTRUCTURE (#1486898)
 - Fix path to SQL files when using pgsql/mysqli/sqlsrv drivers (#1486902)
diff --git a/program/include/rcube_mdb2.php b/program/include/rcube_mdb2.php
index 0769b63..a2baf33 100644
--- a/program/include/rcube_mdb2.php
+++ b/program/include/rcube_mdb2.php
@@ -123,15 +123,15 @@
     {
         // Already connected
         if ($this->db_connected) {
+            // connected to read-write db, current connection is ok
+            if ($this->db_mode == 'w')
+                return;
+
             // no replication, current connection is ok for read and write
             if (empty($this->db_dsnr) || $this->db_dsnw == $this->db_dsnr) {
                 $this->db_mode = 'w';
                 return;
             }
-
-            // connected to read-write db, current connection is ok
-            if ($this->db_mode == 'w')
-                return;
 
             // Same mode, current connection is ok
             if ($this->db_mode == $mode)
diff --git a/program/include/rcube_shared.inc b/program/include/rcube_shared.inc
index 429969e..575a28a 100644
--- a/program/include/rcube_shared.inc
+++ b/program/include/rcube_shared.inc
@@ -227,7 +227,7 @@
   // cut base_url to the last directory
   if (strrpos($base_url, '/')>7)
   {
-    $host_url = substr($base_url, 0, strpos($base_url, '/'));
+    $host_url = substr($base_url, 0, strpos($base_url, '/', 7));
     $base_url = substr($base_url, 0, strrpos($base_url, '/'));
   }
 

--
Gitblit v1.9.1