+ /**
+ * Returns extended information about the folder
+ *
+ * @param string $mailbox Folder name
+ *
+ * @return array Data
+ */
+ function mailbox_info($mailbox)
+ {
+ if ($this->icache['options'] && $this->icache['options']['name'] == $mailbox) {
+ return $this->icache['options'];
+ }
+
+ $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) {
+ if (!empty($ns)) {
+ foreach ($ns as $item) {
+ if ($item[0] === $mbox) {
+ $options['is_root'] = true;
+ break 2;
+ }
+ }
+ }
+ }
+ }
+ // check if the folder is other user virtual-root
+ if (!$options['is_root'] && !empty($namespace) && !empty($namespace['other'])) {
+ $parts = explode($this->delimiter, $mailbox);
+ if (count($parts) == 2) {
+ $mbox = $parts[0] . $this->delimiter;
+ foreach ($namespace['other'] 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);
+
+ // Set 'noselect' and 'norename' flags
+ 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('d', $options['rights']);
+
+ if (!$options['noselect']) {
+ $options['noselect'] = !in_array('r', $options['rights']);
+ }
+ }
+ else {
+ $options['norename'] = $options['is_root'] || $options['namespace'] != 'personal';
+ }
+
+ $this->icache['options'] = $options;
+
+ return $options;
+ }
+
+