diff options
Diffstat (limited to 'program/steps/settings')
-rw-r--r-- | program/steps/settings/folders.inc | 14 | ||||
-rw-r--r-- | program/steps/settings/save_folder.inc | 16 |
2 files changed, 24 insertions, 6 deletions
diff --git a/program/steps/settings/folders.inc b/program/steps/settings/folders.inc index 6ca704998..3231ed644 100644 --- a/program/steps/settings/folders.inc +++ b/program/steps/settings/folders.inc @@ -85,6 +85,11 @@ else if ($RCMAIL->action == 'delete-folder') else { $deleted = $plugin['result']; } + + // #1488692: update session + if ($deleted && $_SESSION['mbox'] === $mbox) { + $RCMAIL->session->remove('mbox'); + } } if ($OUTPUT->ajax_call && $deleted) { @@ -393,15 +398,20 @@ function rcmail_rename_folder($oldname, $newname) foreach ($a_threaded as $key => $val) { if ($key == $oldname) { unset($a_threaded[$key]); - $a_threaded[$newname] = true; + $a_threaded[$newname] = true; } else if (preg_match($oldprefix, $key)) { unset($a_threaded[$key]); - $a_threaded[preg_replace($oldprefix, $newname.$delimiter, $key)] = true; + $a_threaded[preg_replace($oldprefix, $newname.$delimiter, $key)] = true; } } $RCMAIL->user->save_prefs(array('message_threading' => $a_threaded)); + // #1488692: update session + if ($_SESSION['mbox'] === $oldname) { + $_SESSION['mbox'] = $newname; + } + return true; } diff --git a/program/steps/settings/save_folder.inc b/program/steps/settings/save_folder.inc index 09f76ac27..877b0fbbe 100644 --- a/program/steps/settings/save_folder.inc +++ b/program/steps/settings/save_folder.inc @@ -1,11 +1,11 @@ <?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-2012, The Roundcube Dev Team | | | | Licensed under the GNU General Public License version 3 or | | any later version with exceptions for skins & plugins. | @@ -80,7 +80,10 @@ if (!$error && strlen($path) && (!strlen($old_imap) || $old_imap != $name_imap)) } } -if (!$error) { +if ($error) { + $OUTPUT->command('display_message', $error, 'error'); +} +else { $folder['name'] = $name_imap; $folder['oldname'] = $old_imap; $folder['class'] = ''; @@ -167,7 +170,7 @@ else if (!$error) { } 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; } } } @@ -180,7 +183,12 @@ else if (!$error) { } $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'); } |