[Svn] r3274 - in trunk/roundcubemail: . program/include

trac at roundcube.net trac at roundcube.net
Thu Feb 18 19:01:53 CET 2010


Author: thomasb
Date: 2010-02-18 12:01:53 -0600 (Thu, 18 Feb 2010)
New Revision: 3274

Modified:
   trunk/roundcubemail/CHANGELOG
   trunk/roundcubemail/program/include/rcmail.php
   trunk/roundcubemail/program/include/rcube_config.php
   trunk/roundcubemail/program/include/rcube_plugin.php
   trunk/roundcubemail/program/include/rcube_user.php
Log:
Fix loading of plugin configs: user prefs will always survive (#1486368)

Modified: trunk/roundcubemail/CHANGELOG
===================================================================
--- trunk/roundcubemail/CHANGELOG	2010-02-18 18:01:31 UTC (rev 3273)
+++ trunk/roundcubemail/CHANGELOG	2010-02-18 18:01:53 UTC (rev 3274)
@@ -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)

Modified: trunk/roundcubemail/program/include/rcmail.php
===================================================================
--- trunk/roundcubemail/program/include/rcmail.php	2010-02-18 18:01:31 UTC (rev 3273)
+++ trunk/roundcubemail/program/include/rcmail.php	2010-02-18 18:01:53 UTC (rev 3274)
@@ -178,7 +178,7 @@
       $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']));

Modified: trunk/roundcubemail/program/include/rcube_config.php
===================================================================
--- trunk/roundcubemail/program/include/rcube_config.php	2010-02-18 18:01:31 UTC (rev 3273)
+++ trunk/roundcubemail/program/include/rcube_config.php	2010-02-18 18:01:53 UTC (rev 3274)
@@ -28,6 +28,7 @@
 {
   private $prop = array();
   private $errors = array();
+  private $userprefs = array();
 
 
   /**
@@ -132,12 +133,12 @@
    * @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 @@
    */
   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);
   }
 

Modified: trunk/roundcubemail/program/include/rcube_plugin.php
===================================================================
--- trunk/roundcubemail/program/include/rcube_plugin.php	2010-02-18 18:01:31 UTC (rev 3273)
+++ trunk/roundcubemail/program/include/rcube_plugin.php	2010-02-18 18:01:53 UTC (rev 3274)
@@ -59,7 +59,7 @@
   {
     $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);

Modified: trunk/roundcubemail/program/include/rcube_user.php
===================================================================
--- trunk/roundcubemail/program/include/rcube_user.php	2010-02-18 18:01:31 UTC (rev 3273)
+++ trunk/roundcubemail/program/include/rcube_user.php	2010-02-18 18:01:53 UTC (rev 3274)
@@ -123,7 +123,7 @@
 
     $this->language = $_SESSION['language'];
     if ($this->db->affected_rows()) {
-      $config->merge($a_user_prefs);
+      $config->set_user_prefs($a_user_prefs);
       return true;
     }
 

_______________________________________________
http://lists.roundcube.net/mailman/listinfo/svn



More information about the Svn mailing list