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

trac at roundcube.net trac at roundcube.net
Mon Jun 27 09:09:30 CEST 2011


Author: alec
Date: 2011-06-27 02:09:15 -0500 (Mon, 27 Jun 2011)
New Revision: 4879

Modified:
   trunk/roundcubemail/program/include/rcube_imap.php
Log:
- Fix PHP warning in mailbox_info(),
- Set namespace/delimiter in constructor (this way some methods could be used before connecting to IMAP server)


Modified: trunk/roundcubemail/program/include/rcube_imap.php
===================================================================
--- trunk/roundcubemail/program/include/rcube_imap.php	2011-06-24 18:46:37 UTC (rev 4878)
+++ trunk/roundcubemail/program/include/rcube_imap.php	2011-06-27 07:09:15 UTC (rev 4879)
@@ -121,6 +121,13 @@
     function __construct()
     {
         $this->conn = new rcube_imap_generic();
+
+        // Set namespace and delimiter from session,
+        // so some methods would work before connection
+        if (isset($_SESSION['imap_namespace']))
+            $this->namespace = $_SESSION['imap_namespace'];
+        if (isset($_SESSION['imap_delimiter']))
+            $this->delimiter = $_SESSION['imap_delimiter'];
     }
 
 
@@ -552,12 +559,6 @@
             return;
         }
 
-        if (isset($_SESSION['imap_namespace']) && isset($_SESSION['imap_delimiter'])) {
-            $this->namespace = $_SESSION['imap_namespace'];
-            $this->delimiter = $_SESSION['imap_delimiter'];
-            return;
-        }
-
         $config = rcmail::get_instance()->config;
         $imap_personal  = $config->get('imap_ns_personal');
         $imap_other     = $config->get('imap_ns_other');
@@ -3505,10 +3506,12 @@
         if (!empty($namespace)) {
             $mbox = $mailbox . $this->delimiter;
             foreach ($namespace as $ns) {
-                foreach ($ns as $item) {
-                    if ($item[0] === $mbox) {
-                        $options['is_root'] = true;
-                        break;
+                if (!empty($ns)) {
+                    foreach ($ns as $item) {
+                        if ($item[0] === $mbox) {
+                            $options['is_root'] = true;
+                            break;
+                        }
                     }
                 }
             }

_______________________________________________
http://lists.roundcube.net/mailman/listinfo/svn



More information about the Svn mailing list