diff options
author | thomascube <thomas@roundcube.net> | 2010-02-18 18:01:53 +0000 |
---|---|---|
committer | thomascube <thomas@roundcube.net> | 2010-02-18 18:01:53 +0000 |
commit | b545d3e8388d18a64d50b6f7879804cf4e7812ca (patch) | |
tree | 2f77722307e65126464f77de9cd6e8ec5ed7dbad | |
parent | 030db5b6c0489158b5a4cf1ab6d2542db0519de8 (diff) |
Fix loading of plugin configs: user prefs will always survive (#1486368)
-rw-r--r-- | CHANGELOG | 1 | ||||
-rw-r--r-- | program/include/rcmail.php | 2 | ||||
-rw-r--r-- | program/include/rcube_config.php | 18 | ||||
-rw-r--r-- | program/include/rcube_plugin.php | 2 | ||||
-rw-r--r-- | program/include/rcube_user.php | 2 |
5 files changed, 20 insertions, 5 deletions
@@ -1,6 +1,7 @@ CHANGELOG RoundCube Webmail =========================== +- Fix merging of configuration parameters: user prefs always survive (#1486368) - Fix quota indicator value after folder purge/expunge (#1486488) - Fix external mailto links support for use as protocol handler (#1486037) - Fix attachment excessive memory use, support messages of any size (#1484660) diff --git a/program/include/rcmail.php b/program/include/rcmail.php index 68ab5004c..5d20989b2 100644 --- a/program/include/rcmail.php +++ b/program/include/rcmail.php @@ -178,7 +178,7 @@ class rcmail $GLOBALS['USER'] = $this->user; // overwrite config with user preferences - $this->config->merge((array)$this->user->get_prefs()); + $this->config->set_user_prefs((array)$this->user->get_prefs()); } $_SESSION['language'] = $this->user->language = $this->language_prop($this->config->get('language', $_SESSION['language'])); diff --git a/program/include/rcube_config.php b/program/include/rcube_config.php index 85ff714bf..1e2aae33a 100644 --- a/program/include/rcube_config.php +++ b/program/include/rcube_config.php @@ -28,6 +28,7 @@ class rcube_config { private $prop = array(); private $errors = array(); + private $userprefs = array(); /** @@ -132,12 +133,12 @@ class rcube_config * @param string Full path to the config file to be loaded * @return booelan True on success, false on failure */ - public function load_from_file($fpath, $merge = true) + public function load_from_file($fpath) { if (is_file($fpath) && is_readable($fpath)) { include($fpath); if (is_array($rcmail_config)) { - $this->prop = $merge ? array_merge($this->prop, $rcmail_config) : $this->prop + $rcmail_config; + $this->prop = array_merge($this->prop, $rcmail_config, $this->userprefs); return true; } } @@ -178,6 +179,19 @@ class rcube_config */ public function merge($prefs) { + $this->prop = array_merge($this->prop, $prefs, $this->userprefs); + } + + + /** + * Merge the given prefs over the current config + * and make sure that they survive further merging. + * + * @param array Hash array with user prefs + */ + public function set_user_prefs($prefs) + { + $this->userprefs = $prefs; $this->prop = array_merge($this->prop, $prefs); } diff --git a/program/include/rcube_plugin.php b/program/include/rcube_plugin.php index c5eb88439..8001c4cff 100644 --- a/program/include/rcube_plugin.php +++ b/program/include/rcube_plugin.php @@ -59,7 +59,7 @@ abstract class rcube_plugin { $fpath = $this->home.'/'.$fname; $rcmail = rcmail::get_instance(); - if (is_file($fpath) && !$rcmail->config->load_from_file($fpath, false)) { + if (is_file($fpath) && !$rcmail->config->load_from_file($fpath)) { raise_error(array('code' => 527, 'type' => 'php', 'file' => __FILE__, 'line' => __LINE__, 'message' => "Failed to load config from $fpath"), true, false); diff --git a/program/include/rcube_user.php b/program/include/rcube_user.php index 54987098e..41a8bb531 100644 --- a/program/include/rcube_user.php +++ b/program/include/rcube_user.php @@ -123,7 +123,7 @@ class rcube_user $this->language = $_SESSION['language']; if ($this->db->affected_rows()) { - $config->merge($a_user_prefs); + $config->set_user_prefs($a_user_prefs); return true; } |