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:31:34 +0200 |
commit | f65890773147ee513647b0e0062e05748bd788c9 (patch) | |
tree | 948320d33d5a40489e51df34960d89a7ceb7b752 /program | |
parent | aa44ce6e9703ab15bb5270251358fb756a347f17 (diff) |
Fix legacy options handling
Diffstat (limited to 'program')
-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]); + } + } + } } |