From b79cc545ec020f7dd4bd83dcd06af3cf2b1fcaff Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Tue, 28 Aug 2012 05:20:20 -0400
Subject: [PATCH] Improvements/fixes for Larry skin

---
 program/include/rcube_config.php |   39 +++++++++++++++++++++++++++++----------
 1 files changed, 29 insertions(+), 10 deletions(-)

diff --git a/program/include/rcube_config.php b/program/include/rcube_config.php
index 34c61c5..41acc80 100644
--- a/program/include/rcube_config.php
+++ b/program/include/rcube_config.php
@@ -26,6 +26,8 @@
  */
 class rcube_config
 {
+    const DEFAULT_SKIN = 'larry';
+
     private $prop = array();
     private $errors = array();
     private $userprefs = array();
@@ -40,6 +42,7 @@
         'default_folders'      => 'default_imap_folders',
         'mail_pagesize'        => 'pagesize',
         'addressbook_pagesize' => 'pagesize',
+        'reply_mode'           => 'top_posting',
     );
 
 
@@ -49,6 +52,11 @@
     public function __construct()
     {
         $this->load();
+
+        // Defaults, that we do not require you to configure,
+        // but contain information that is used in various
+        // locations in the code:
+        $this->set('contactlist_fields', array('name', 'firstname', 'surname', 'email'));
     }
 
 
@@ -71,10 +79,18 @@
         $this->load_host_config();
 
         // set skin (with fallback to old 'skin_path' property)
-        if (empty($this->prop['skin']) && !empty($this->prop['skin_path']))
-            $this->prop['skin'] = str_replace('skins/', '', unslashify($this->prop['skin_path']));
-        else if (empty($this->prop['skin']))
-            $this->prop['skin'] = 'default';
+        if (empty($this->prop['skin'])) {
+            if (!empty($this->prop['skin_path'])) {
+                $this->prop['skin'] = str_replace('skins/', '', unslashify($this->prop['skin_path']));
+            }
+            else {
+                $this->prop['skin'] = self::DEFAULT_SKIN;
+            }
+        }
+
+        // larry is the new default skin :-)
+        if ($this->prop['skin'] == 'default')
+            $this->prop['skin'] = self::DEFAULT_SKIN;
 
         // fix paths
         $this->prop['log_dir'] = $this->prop['log_dir'] ? realpath(unslashify($this->prop['log_dir'])) : INSTALL_PATH . 'logs';
@@ -229,16 +245,19 @@
         // Honor the dont_override setting for any existing user preferences
         $dont_override = $this->get('dont_override');
         if (is_array($dont_override) && !empty($dont_override)) {
-            foreach ($prefs as $key => $pref) {
-                if (in_array($key, $dont_override)) {
-                    unset($prefs[$key]);
-                }
+            foreach ($dont_override as $key) {
+                unset($prefs[$key]);
             }
         }
 
         // convert user's timezone into the new format
         if (is_numeric($prefs['timezone'])) {
             $prefs['timezone'] = timezone_name_from_abbr('', $prefs['timezone'] * 3600, 0);
+        }
+
+        // larry is the new default skin :-)
+        if ($prefs['skin'] == 'default') {
+            $prefs['skin'] = self::DEFAULT_SKIN;
         }
 
         $this->userprefs = $prefs;
@@ -306,7 +325,7 @@
         if (strlen($key) != 24) {
             rcube::raise_error(array(
                 'code' => 500, 'type' => 'php',
-	            'file' => __FILE__, 'line' => __LINE__,
+                'file' => __FILE__, 'line' => __LINE__,
                 'message' => "Configured crypto key '$key' is not exactly 24 bytes long"
             ), true, true);
         }
@@ -330,7 +349,7 @@
             else
                 rcube::raise_error(array(
                     'code' => 500, 'type' => 'php',
-	                'file' => __FILE__, 'line' => __LINE__,
+                    'file' => __FILE__, 'line' => __LINE__,
                     'message' => "Invalid mail_header_delimiter setting"
                 ), true, false);
         }

--
Gitblit v1.9.1