| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | program/steps/settings/save_folder.inc | |
| | | | | |
| | | | This file is part of the Roundcube Webmail client | |
| | | | Copyright (C) 2005-2009, The Roundcube Dev Team | |
| | | | Copyright (C) 2005-2013, The Roundcube Dev Team | |
| | | | | |
| | | | Licensed under the GNU General Public License version 3 or | |
| | | | any later version with exceptions for skins & plugins. | |
| | |
| | | +-----------------------------------------------------------------------+ |
| | | | Author: Aleksander Machniak <alec@alec.pl> | |
| | | +-----------------------------------------------------------------------+ |
| | | |
| | | $Id$ |
| | | |
| | | */ |
| | | |
| | | // WARNING: folder names in UI are encoded with RCMAIL_CHARSET |
| | |
| | | |
| | | |
| | | $name = trim(get_input_value('_name', RCUBE_INPUT_POST, true)); |
| | | $old = trim(get_input_value('_mbox', RCUBE_INPUT_POST, true)); |
| | | $path = trim(get_input_value('_parent', RCUBE_INPUT_POST, true)); |
| | | $old = get_input_value('_mbox', RCUBE_INPUT_POST, true); |
| | | $path = get_input_value('_parent', RCUBE_INPUT_POST, true); |
| | | |
| | | $name_imap = rcube_charset_convert($name, RCMAIL_CHARSET, 'UTF7-IMAP'); |
| | | $old_imap = rcube_charset_convert($old, RCMAIL_CHARSET, 'UTF7-IMAP'); |
| | |
| | | if ($options['protected'] || $options['norename']) { |
| | | } |
| | | else if (!strlen($name)) { |
| | | $error = rcube_label('cannotbeempty'); |
| | | $error = rcube_label('namecannotbeempty'); |
| | | } |
| | | else if (mb_strlen($name) > 128) { |
| | | $error = rcube_label('nametoolong'); |
| | |
| | | } |
| | | } |
| | | |
| | | if (!$error) { |
| | | if ($error) { |
| | | $OUTPUT->command('display_message', $error, 'error'); |
| | | } |
| | | else { |
| | | $folder['name'] = $name_imap; |
| | | $folder['oldname'] = $old_imap; |
| | | $folder['class'] = ''; |
| | |
| | | } |
| | | else if (preg_match($oldprefix, $key)) { |
| | | unset($a_threaded[$key]); |
| | | $a_threaded[preg_replace($oldprefix, $folder['name'].$delimiter, $key)] = true; |
| | | $a_threaded[preg_replace($oldprefix, $folder['name'].$delimiter, $key)] = true; |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | $OUTPUT->show_message('folderupdated', 'confirmation'); |
| | | |
| | | if ($rename) { |
| | | // #1488692: update session |
| | | if ($_SESSION['mbox'] === $folder['oldname']) { |
| | | $_SESSION['mbox'] = $folder['name']; |
| | | } |
| | | rcmail_update_folder_row($folder['name'], $folder['oldname'], $folder['subscribe'], $folder['class']); |
| | | $OUTPUT->send('iframe'); |
| | | } |