summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsvncommit <devs@roundcube.net>2007-10-15 10:05:45 +0000
committersvncommit <devs@roundcube.net>2007-10-15 10:05:45 +0000
commitc685105ef21a3c06b2dc91c778c4fc4223494da8 (patch)
treee06d1d667f978fbbe202cff84e8462e9e270dce1
parentfdbb1916ef7298b2641ac2ed665e660f6a9fa066 (diff)
After renaming/moving a folder, rename/move the children as well.
-rw-r--r--program/steps/settings/manage_folders.inc12
1 files changed, 12 insertions, 0 deletions
diff --git a/program/steps/settings/manage_folders.inc b/program/steps/settings/manage_folders.inc
index 4d5882f6e..84e992801 100644
--- a/program/steps/settings/manage_folders.inc
+++ b/program/steps/settings/manage_folders.inc
@@ -71,6 +71,9 @@ else if ($_action=='create-folder')
// rename a mailbox
else if ($_action=='rename-folder')
{
+ $a_mboxes = array_merge($IMAP->list_mailboxes(), $IMAP->list_unsubscribed());
+ $delimiter = $IMAP->get_hierarchy_delimiter();
+
if (!empty($_POST['_folder_oldname']) && !empty($_POST['_folder_newname']))
$rename = $IMAP->rename_mailbox(($oldname = get_input_value('_folder_oldname', RCUBE_INPUT_POST)), trim(get_input_value('_folder_newname', RCUBE_INPUT_POST, FALSE, 'UTF-7')));
@@ -81,6 +84,15 @@ else if ($_action=='rename-folder')
$level = count($foldersplit) - 1;
$display_rename = str_repeat('&nbsp;&nbsp;&nbsp;&nbsp;', $level) . rcube_charset_convert($foldersplit[$level], 'UTF-7');
$OUTPUT->command('replace_folder_row', $oldname, $rename, $display_rename);
+ foreach ($a_mboxes as $mbox)
+ if (preg_match('/^'.preg_quote($oldname.$delimiter).'/', $mbox))
+ {
+ $c_rename = preg_replace('/^'.preg_quote($oldname).'/', $rename, $mbox);
+ $foldersplit = explode($delimiter, $c_rename);
+ $level = count($foldersplit) - 1;
+ $display_rename = str_repeat('&nbsp;&nbsp;&nbsp;&nbsp;', $level) . rcube_charset_convert($foldersplit[$level], 'UTF-7');
+ $OUTPUT->command('replace_folder_row', $mbox, $c_rename, $display_rename);
+ }
$OUTPUT->command('reset_folder_rename');
$OUTPUT->send();
}