From 9220169bf1f25aab8ef82cb6bf8d830ac905f036 Mon Sep 17 00:00:00 2001 From: alecpl Date: Wed, 6 Jul 2011 07:50:34 +0000 Subject: - Fix handling of other users namespace roots --- program/include/rcube_imap.php | 15 ++++++++++++++- program/steps/settings/edit_folder.inc | 2 +- program/steps/settings/folders.inc | 15 ++++++++++++++- 3 files changed, 29 insertions(+), 3 deletions(-) (limited to 'program') diff --git a/program/include/rcube_imap.php b/program/include/rcube_imap.php index 411be5202..710a434f2 100644 --- a/program/include/rcube_imap.php +++ b/program/include/rcube_imap.php @@ -3508,12 +3508,25 @@ class rcube_imap foreach ($ns as $item) { if ($item[0] === $mbox) { $options['is_root'] = true; - break; + 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); diff --git a/program/steps/settings/edit_folder.inc b/program/steps/settings/edit_folder.inc index 093b8dfac..440a11999 100644 --- a/program/steps/settings/edit_folder.inc +++ b/program/steps/settings/edit_folder.inc @@ -79,7 +79,7 @@ function rcmail_folder_form($attrib) // Location (name) if ($options['protected']) { - $foldername = Q(rcmail_localize_foldername($mbox_imap)); + $foldername = Q(str_replace($delimiter, ' » ', rcmail_localize_folderpath($mbox_imap))); } else if ($options['norename']) { $foldername = Q($folder); diff --git a/program/steps/settings/folders.inc b/program/steps/settings/folders.inc index ed1fb79bf..239413f1a 100644 --- a/program/steps/settings/folders.inc +++ b/program/steps/settings/folders.inc @@ -280,11 +280,24 @@ function rcube_subscription_form($attrib) foreach ($ns as $item) { if ($item[0] === $fname) { $disabled = true; - break; + break 2; } } } } + // check if the folder is an other users virtual-root folder, then disable subscription option on it + if (!$disabled && $folder['virtual'] && $folder['level'] == 1 + && !empty($namespace) && !empty($namespace['other']) + ) { + $parts = explode($delimiter, $folder['id']); + $fname = $parts[0] . $delimiter; + foreach ($namespace['other'] as $item) { + if ($item[0] === $fname) { + $disabled = true; + break; + } + } + } $table->add_row(array('id' => 'rcmrow'.$idx, 'class' => join(' ', $classes), 'foldername' => $folder['id'])); -- cgit v1.2.3