diff options
author | Aleksander Machniak <alec@alec.pl> | 2013-06-05 19:31:34 +0200 |
---|---|---|
committer | Aleksander Machniak <alec@alec.pl> | 2013-06-05 19:32:46 +0200 |
commit | 55e60c6d85efa3e4b3679c8f9c0b97109ee31ca3 (patch) | |
tree | d25a6027e877ef3e671a032ec48b120f591a763b /program/lib | |
parent | 42574449577bd99b6feb662e1ea1eefb0fb698cc (diff) |
Fix legacy options handling
Conflicts:
CHANGELOG
Diffstat (limited to 'program/lib')
-rw-r--r-- | program/lib/Roundcube/rcube_config.php | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/program/lib/Roundcube/rcube_config.php b/program/lib/Roundcube/rcube_config.php index 2190dc4c2..f694877b0 100644 --- a/program/lib/Roundcube/rcube_config.php +++ b/program/lib/Roundcube/rcube_config.php @@ -174,7 +174,7 @@ class rcube_config ob_end_clean(); if (is_array($rcmail_config)) { - $this->prop = array_merge($this->prop, $rcmail_config, $this->userprefs); + $this->merge($rcmail_config); return true; } } @@ -195,9 +195,6 @@ class rcube_config 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 @@ class rcube_config public function merge($prefs) { $this->prop = array_merge($this->prop, $prefs, $this->userprefs); + $this->fix_legacy_props(); } @@ -273,6 +271,8 @@ class rcube_config $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') { $this->prop['_timezone_value'] = isset($_SESSION['timezone']) ? $this->client_timezone() : $this->prop['_timezone_value']; @@ -435,4 +435,18 @@ class rcube_config 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]); + } + } + } } |