diff options
Diffstat (limited to 'program')
-rw-r--r-- | program/include/rcube_imap.php | 6 | ||||
-rw-r--r-- | program/steps/settings/save_folder.inc | 22 |
2 files changed, 18 insertions, 10 deletions
diff --git a/program/include/rcube_imap.php b/program/include/rcube_imap.php index 0e28b083a..6a35af0a8 100644 --- a/program/include/rcube_imap.php +++ b/program/include/rcube_imap.php @@ -3513,6 +3513,10 @@ class rcube_imap */ 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(); @@ -3574,6 +3578,8 @@ class rcube_imap $options['norename'] = $options['is_root'] || $options['namespace'] != 'personal'; } + $this->icache['options'] = $options; + return $options; } diff --git a/program/steps/settings/save_folder.inc b/program/steps/settings/save_folder.inc index 2f515627d..48c957239 100644 --- a/program/steps/settings/save_folder.inc +++ b/program/steps/settings/save_folder.inc @@ -55,16 +55,6 @@ else { } } -// Check access rights to the parent folder -if (!$error && strlen($path)) { - $parent_opts = $RCMAIL->imap->mailbox_info($path); - if ($parent_opts['namespace'] != 'personal' - && (empty($parent_opts['rights']) || !preg_match('/[ck]/', implode($parent_opts))) - ) { - $error = rcube_label('parentnotwritable'); - } -} - if ($error) { $OUTPUT->command('display_message', $error, 'error'); } @@ -78,7 +68,19 @@ else { else { $name_imap = $RCMAIL->imap->mod_mailbox($name_imap, 'in'); } +} + +// Check access rights to the parent folder +if (!$error && strlen($path) && (!strlen($old_imap) || $old_imap != $name_imap)) { + $parent_opts = $RCMAIL->imap->mailbox_info($path); + if ($parent_opts['namespace'] != 'personal' + && (empty($parent_opts['rights']) || !preg_match('/[ck]/', implode($parent_opts))) + ) { + $error = rcube_label('parentnotwritable'); + } +} +if (!$error) { $folder['name'] = $name_imap; $folder['oldname'] = $old_imap; $folder['class'] = ''; |