From fc52af24f1418d6590a2d37a0d8cc31b123e38f6 Mon Sep 17 00:00:00 2001
From: Thomas Bruederli <thomas@roundcube.net>
Date: Tue, 19 Aug 2014 12:08:35 -0400
Subject: [PATCH] Fix merge error that disabled contact drag'n'drop

---
 program/lib/Roundcube/rcube_config.php |   26 ++++++++++++++++----------
 1 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/program/lib/Roundcube/rcube_config.php b/program/lib/Roundcube/rcube_config.php
index f694877..53d22e1 100644
--- a/program/lib/Roundcube/rcube_config.php
+++ b/program/lib/Roundcube/rcube_config.php
@@ -192,7 +192,7 @@
      */
     public function get($name, $def = null)
     {
-        if (isset($this->prop[$name])) {
+        if (array_key_exists($name, $this->prop)) {
             $result = $this->prop[$name];
         }
         else {
@@ -237,8 +237,8 @@
      */
     public function merge($prefs)
     {
+        $prefs = $this->fix_legacy_props($prefs);
         $this->prop = array_merge($this->prop, $prefs, $this->userprefs);
-        $this->fix_legacy_props();
     }
 
 
@@ -250,6 +250,8 @@
      */
     public function set_user_prefs($prefs)
     {
+        $prefs = $this->fix_legacy_props($prefs);
+
         // Honor the dont_override setting for any existing user preferences
         $dont_override = $this->get('dont_override');
         if (is_array($dont_override) && !empty($dont_override)) {
@@ -271,8 +273,6 @@
         $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'];
@@ -285,7 +285,7 @@
     /**
      * Getter for all config options
      *
-     * @return array  Hash array containg all config properties
+     * @return array  Hash array containing all config properties
      */
     public function all()
     {
@@ -437,16 +437,22 @@
 
     /**
      * Convert legacy options into new ones
+     *
+     * @param array $props Hash array with config props
+     *
+     * @return array Converted config props
      */
-    private function fix_legacy_props()
+    private function fix_legacy_props($props)
     {
         foreach ($this->legacy_props as $new => $old) {
-            if (isset($this->prop[$old])) {
-                if (!isset($this->prop[$new])) {
-                    $this->prop[$new] = $this->prop[$old];
+            if (isset($props[$old])) {
+                if (!isset($props[$new])) {
+                    $props[$new] = $props[$old];
                 }
-                unset($this->prop[$old]);
+                unset($props[$old]);
             }
         }
+
+        return $props;
     }
 }

--
Gitblit v1.9.1