| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | program/steps/settings/save_folder.inc | |
| | | | | |
| | |
| | | // init IMAP connection |
| | | $STORAGE = $RCMAIL->get_storage(); |
| | | |
| | | $name = trim(rcube_utils::get_input_value('_name', rcube_utils::INPUT_POST, true)); |
| | | $old = rcube_utils::get_input_value('_mbox', rcube_utils::INPUT_POST, true); |
| | | $path = rcube_utils::get_input_value('_parent', rcube_utils::INPUT_POST, true); |
| | | |
| | | $name = trim(rcube_utils::get_input_value('_name', rcube_utils::INPUT_POST, true)); |
| | | $path = rcube_utils::get_input_value('_parent', rcube_utils::INPUT_POST, true); |
| | | $old_imap = rcube_utils::get_input_value('_mbox', rcube_utils::INPUT_POST, true); |
| | | $name_imap = rcube_charset::convert($name, RCUBE_CHARSET, 'UTF7-IMAP'); |
| | | $old_imap = rcube_charset::convert($old, RCUBE_CHARSET, 'UTF7-IMAP'); |
| | | // $path is in UTF7-IMAP already |
| | | |
| | | $delimiter = $STORAGE->get_hierarchy_delimiter(); |
| | |
| | | } |
| | | else if (mb_strlen($name) > 128) { |
| | | $error = $RCMAIL->gettext('nametoolong'); |
| | | } |
| | | else if ($name[0] == '.' && $RCMAIL->config->get('imap_skip_hidden_folders')) { |
| | | $error = $RCMAIL->gettext('namedotforbidden'); |
| | | } |
| | | else { |
| | | // these characters are problematic e.g. when used in LIST/LSUB |
| | |
| | | } |
| | | |
| | | // Check access rights to the parent folder |
| | | if (!$error && strlen($path) && (!strlen($old_imap) || $old_imap != $name_imap)) { |
| | | if (!$error && strlen($path) && (!strlen($old_imap) || $old_imap != $name_imap) |
| | | && $STORAGE->get_capability('ACL') |
| | | ) { |
| | | $parent_opts = $STORAGE->folder_info($path); |
| | | if ($parent_opts['namespace'] != 'personal' |
| | | && (empty($parent_opts['rights']) || !preg_match('/[ck]/', implode($parent_opts['rights']))) |
| | |
| | | } |
| | | |
| | | // create a new mailbox |
| | | if (!$error && !strlen($old)) { |
| | | if (!$error && !strlen($old_imap)) { |
| | | $folder['subscribe'] = true; |
| | | |
| | | $plugin = $RCMAIL->plugins->exec_hook('folder_create', array('record' => $folder)); |
| | |
| | | } |
| | | else { |
| | | // show error message |
| | | $OUTPUT->show_message($plugin['message'] ? $plugin['message'] : 'errorsaving', 'error', null, false); |
| | | $OUTPUT->show_message($plugin['message'] ?: 'errorsaving', 'error', null, false); |
| | | } |
| | | } |
| | | // update a mailbox |
| | |
| | | } |
| | | |
| | | $OUTPUT->show_message('folderupdated', 'confirmation'); |
| | | $OUTPUT->set_env('folder', $folder['name']); |
| | | |
| | | if ($rename) { |
| | | // #1488692: update session |
| | |
| | | } |
| | | else { |
| | | // show error message |
| | | $OUTPUT->show_message($plugin['message'] ? $plugin['message'] : 'errorsaving', 'error', null, false); |
| | | $OUTPUT->show_message($plugin['message'] ?: 'errorsaving', 'error', null, false); |
| | | } |
| | | } |
| | | |