From bbce3edd61d05e0aa0bade7364315f7840549d9e Mon Sep 17 00:00:00 2001 From: alecpl Date: Mon, 28 Feb 2011 17:59:13 +0000 Subject: - Add simple ACL rights/namespace handling in folder manager (display folder's namespace, modify edit form fields according to MYRIGHTS) --- program/include/rcube_imap.php | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'program/include') diff --git a/program/include/rcube_imap.php b/program/include/rcube_imap.php index f5a936890..b8cb01748 100644 --- a/program/include/rcube_imap.php +++ b/program/include/rcube_imap.php @@ -3320,6 +3320,38 @@ class rcube_imap } + /** + * Returns the namespace where the folder is in + * + * @param string $mbox_name Folder name + * + * @return string One of 'personal', 'other' or 'shared' + * @access public + */ + function mailbox_namespace($mbox_name) + { + if ($mbox_name == 'INBOX') { + return 'personal'; + } + + foreach ($this->namespace as $type => $namespace) { + if (is_array($namespace)) { + foreach ($namespace as $ns) { + if (strlen($ns[0])) { + if ((strlen($ns[0])>1 && $mbox_name == substr($ns[0], 0, -1)) + || strpos($mbox_name, $ns[0]) === 0 + ) { + return $type; + } + } + } + } + } + + return 'personal'; + } + + /** * Modify folder name for input/output according to root dir and namespace * -- cgit v1.2.3