summaryrefslogtreecommitdiff
path: root/program/include
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2011-02-28 17:59:13 +0000
committeralecpl <alec@alec.pl>2011-02-28 17:59:13 +0000
commitbbce3edd61d05e0aa0bade7364315f7840549d9e (patch)
tree508f91a4f17288b0d71e3b653d13209889205f6e /program/include
parent29c54229cfbc104930e7743cecc212f53aed8a15 (diff)
- Add simple ACL rights/namespace handling in folder manager (display folder's namespace, modify edit form fields according to MYRIGHTS)
Diffstat (limited to 'program/include')
-rw-r--r--program/include/rcube_imap.php32
1 files changed, 32 insertions, 0 deletions
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
@@ -3321,6 +3321,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
*
* @param string $mbox_name Folder name