[Svn] r4875 - in trunk/roundcubemail/program: include steps/settings

trac at roundcube.net trac at roundcube.net
Thu Jun 23 19:43:45 CEST 2011


Author: alec
Date: 2011-06-23 12:43:44 -0500 (Thu, 23 Jun 2011)
New Revision: 4875

Modified:
   trunk/roundcubemail/program/include/rcube_imap.php
   trunk/roundcubemail/program/steps/settings/func.inc
Log:
- Add rcube_imap::mailbox_info()


Modified: trunk/roundcubemail/program/include/rcube_imap.php
===================================================================
--- trunk/roundcubemail/program/include/rcube_imap.php	2011-06-22 22:07:06 UTC (rev 4874)
+++ trunk/roundcubemail/program/include/rcube_imap.php	2011-06-23 17:43:44 UTC (rev 4875)
@@ -3489,6 +3489,62 @@
 
 
     /**
+     * Returns extended information about the folder
+     *
+     * @param string $mailbox Folder name
+     *
+     * @return array Data
+     */
+    function mailbox_info($mailbox)
+    {
+        $acl       = $this->get_capability('ACL');
+        $namespace = $this->get_namespace();
+        $options   = array();
+
+        // check if the folder is a namespace prefix
+        if (!empty($namespace)) {
+            $mbox = $mailbox . $this->delimiter;
+            foreach ($namespace as $ns) {
+                foreach ($ns as $item) {
+                    if ($item[0] === $mbox) {
+                        $options['is_root'] = true;
+                        break;
+                    }
+                }
+            }
+        }
+
+        $options['name']      = $mailbox;
+        $options['options']   = $this->mailbox_options($mailbox, true);
+        $options['namespace'] = $this->mailbox_namespace($mailbox);
+        $options['rights']    = $acl && !$options['is_root'] ? (array)$this->my_rights($mailbox) : array();
+        $options['special']   = in_array($mailbox, $this->default_folders);
+
+        if (is_array($options['options'])) {
+            foreach ($options['options'] as $opt) {
+                $opt = strtolower($opt);
+                if ($opt == '\noselect' || $opt == '\nonexistent') {
+                    $options['noselect'] = true;
+                }
+            }
+        }
+        else {
+            $options['noselect'] = true;
+        }
+
+        if (!empty($options['rights'])) {
+            $options['norename'] = !in_array('x', $options['rights']) &&
+                (!in_array('c', $options['rights']) || !in_array('d', $options['rights']));
+            if (!$options['noselect']) {
+                $options['noselect'] = !in_array('r', $options['rights']);
+            }
+        }
+
+        return $options;
+    }
+
+
+    /**
      * Get message header names for rcube_imap_generic::fetchHeader(s)
      *
      * @return string Space-separated list of header names

Modified: trunk/roundcubemail/program/steps/settings/func.inc
===================================================================
--- trunk/roundcubemail/program/steps/settings/func.inc	2011-06-22 22:07:06 UTC (rev 4874)
+++ trunk/roundcubemail/program/steps/settings/func.inc	2011-06-23 17:43:44 UTC (rev 4875)
@@ -788,52 +788,9 @@
 {
     global $RCMAIL;
 
-    $acl             = $RCMAIL->imap->get_capability('ACL');
-    $default_folders = (array) $RCMAIL->config->get('default_imap_folders');
-    $delimiter       = $RCMAIL->imap->get_hierarchy_delimiter();
-    $namespace       = $RCMAIL->imap->get_namespace();
-    $options         = array();
-
-    // check if the folder is a namespace prefix
-    if (!empty($namespace)) {
-        $mbox = $mailbox . $delimiter;
-        foreach ($namespace as $ns) {
-            foreach ($ns as $item) {
-                if ($item[0] === $mbox) {
-                    $options['is_root'] = true;
-                    break;
-                }
-            }
-        }
-    }
-
-    $options['name']      = $mailbox;
-    $options['options']   = $RCMAIL->imap->mailbox_options($mailbox, true);
-    $options['namespace'] = $RCMAIL->imap->mailbox_namespace($mailbox);
-    $options['rights']    = $acl && !$options['is_root'] ? (array)$RCMAIL->imap->my_rights($mailbox) : array();
-    $options['special']   = in_array($mailbox, $default_folders);
+    $options = $RCMAIL->imap->mailbox_info($mailbox);
     $options['protected'] = $options['is_root'] || ($options['special'] && $RCMAIL->config->get('protect_default_folders'));
 
-    if (is_array($options['options'])) {
-        foreach ($options['options'] as $opt) {
-            $opt = strtolower($opt);
-            if ($opt == '\noselect' || $opt == '\nonexistent') {
-                $options['noselect'] = true;
-            }
-        }
-    }
-    else {
-        $options['noselect'] = true;
-    }
-
-    if (!empty($options['rights'])) {
-        $options['norename'] = !in_array('x', $options['rights']) &&
-            (!in_array('c', $options['rights']) || !in_array('d', $options['rights']));
-        if (!$options['noselect']) {
-            $options['noselect'] = !in_array('r', $options['rights']);
-        }
-    }
-
     return $options;
 }
 

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



More information about the Svn mailing list