From 55e60c6d85efa3e4b3679c8f9c0b97109ee31ca3 Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Wed, 05 Jun 2013 13:32:46 -0400
Subject: [PATCH] Fix legacy options handling
---
CHANGELOG | 1 +
program/lib/Roundcube/rcube_config.php | 22 ++++++++++++++++++----
2 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/CHANGELOG b/CHANGELOG
index 73e463c..92466b2 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -2,6 +2,7 @@
===========================
- Fix "null" instead of empty string on messages list in IE10 (#1489145)
+- Fix legacy options handling
- Fix so bounces addresses in Sender headers are skipped on Reply-All (#1489011)
- Fix bug where serialized strings were truncated in PDO::quote() (#1489142)
- Fix displaying messages with invalid self-closing HTML tags (#1489137)
diff --git a/program/lib/Roundcube/rcube_config.php b/program/lib/Roundcube/rcube_config.php
index 2190dc4..f694877 100644
--- a/program/lib/Roundcube/rcube_config.php
+++ b/program/lib/Roundcube/rcube_config.php
@@ -174,7 +174,7 @@
ob_end_clean();
if (is_array($rcmail_config)) {
- $this->prop = array_merge($this->prop, $rcmail_config, $this->userprefs);
+ $this->merge($rcmail_config);
return true;
}
}
@@ -194,9 +194,6 @@
{
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 @@
public function merge($prefs)
{
$this->prop = array_merge($this->prop, $prefs, $this->userprefs);
+ $this->fix_legacy_props();
}
@@ -272,6 +270,8 @@
$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') {
@@ -435,4 +435,18 @@
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]);
+ }
+ }
+ }
}
--
Gitblit v1.9.1