From 08f6c867732260c2f05322a101662d2efcfd3872 Mon Sep 17 00:00:00 2001 From: Boris Gulay Date: Mon, 10 Oct 2016 00:34:16 +0300 Subject: [PATCH] Fix restoring STORAGE options for default identity. Closes #8. --- ident_switch.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ident_switch.php b/ident_switch.php index c1fa911..d2525e2 100644 --- a/ident_switch.php +++ b/ident_switch.php @@ -369,12 +369,14 @@ class ident_switch extends rcube_plugin { // Switch to main account $rc->write_log($this->my_log, 'Switching mailbox back to default.'); + // Restore everything with STORAGE*my_postfix foreach ($_SESSION as $k => $v) { if (strncasecmp($k, 'storage', 7) === 0 && substr_compare($k, $this->my_postfix, -$my_postfix_len, $my_postfix_len) === 0) { - $_SESSION[$k] = $_SESSION[$k . $this->my_postfix]; - $rc->session->remove($k . $this->my_postfix); + $realKey = substr($k, 0, -$my_postfix_len); + $_SESSION[$realKey] = $_SESSION[$k]; + $rc->session->remove($k); } } $_SESSION['username'] = $rc->user->data['username'];