From f65890773147ee513647b0e0062e05748bd788c9 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak <alec@alec.pl> Date: Wed, 05 Jun 2013 13:31:34 -0400 Subject: [PATCH] Fix legacy options handling --- CHANGELOG | 1 + program/lib/Roundcube/rcube_config.php | 22 ++++++++++++++++++---- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 7713afe..2ecda06 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,7 @@ CHANGELOG Roundcube Webmail =========================== +- Fix legacy options handling - Fix "duplicate entry" errors on inserts to imap cache tables (#1489146) - Fix so bounces addresses in Sender headers are skipped on Reply-All (#1489011) - Fix bug where serialized strings were truncated in PDO::quote() (#1489142) diff --git a/program/lib/Roundcube/rcube_config.php b/program/lib/Roundcube/rcube_config.php index 2190dc4..f694877 100644 --- a/program/lib/Roundcube/rcube_config.php +++ b/program/lib/Roundcube/rcube_config.php @@ -174,7 +174,7 @@ ob_end_clean(); if (is_array($rcmail_config)) { - $this->prop = array_merge($this->prop, $rcmail_config, $this->userprefs); + $this->merge($rcmail_config); return true; } } @@ -194,9 +194,6 @@ { if (isset($this->prop[$name])) { $result = $this->prop[$name]; - } - else if (isset($this->legacy_props[$name])) { - return $this->get($this->legacy_props[$name], $def); } else { $result = $def; @@ -241,6 +238,7 @@ public function merge($prefs) { $this->prop = array_merge($this->prop, $prefs, $this->userprefs); + $this->fix_legacy_props(); } @@ -272,6 +270,8 @@ $this->userprefs = $prefs; $this->prop = array_merge($this->prop, $prefs); + + $this->fix_legacy_props(); // override timezone settings with client values if ($this->prop['timezone'] == 'auto') { @@ -435,4 +435,18 @@ return date_default_timezone_get(); } + /** + * Convert legacy options into new ones + */ + private function fix_legacy_props() + { + foreach ($this->legacy_props as $new => $old) { + if (isset($this->prop[$old])) { + if (!isset($this->prop[$new])) { + $this->prop[$new] = $this->prop[$old]; + } + unset($this->prop[$old]); + } + } + } } -- Gitblit v1.9.1