From 5926684aab72265d243142010d9dfa8d642efdb9 Mon Sep 17 00:00:00 2001
From: Thomas Bruederli <thomas@roundcube.net>
Date: Sun, 25 Nov 2012 11:57:39 -0500
Subject: [PATCH] Unify path schema in global constants: paths always end with a /. Keep RCMAIL_CONFIG_DIR for backwards compatibility

---
 installer/rcube_install.php                 |    6 +++---
 program/lib/Roundcube/bootstrap.php         |    2 +-
 program/lib/Roundcube/rcube_output_html.php |    2 +-
 installer/test.php                          |    4 ++--
 program/lib/Roundcube/rcube_config.php      |    6 +++---
 program/include/iniset.php                  |    2 +-
 installer/index.php                         |    2 +-
 7 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/installer/index.php b/installer/index.php
index 40dabc8..7a78736 100644
--- a/installer/index.php
+++ b/installer/index.php
@@ -41,7 +41,7 @@
 
 define('INSTALL_PATH', realpath(dirname(__FILE__) . '/../').'/');
 define('RCUBE_INSTALL_PATH', INSTALL_PATH);
-define('RCUBE_CONFIG_DIR', INSTALL_PATH . 'config');
+define('RCUBE_CONFIG_DIR', INSTALL_PATH . 'config/');
 
 $include_path  = INSTALL_PATH . 'program/lib' . PATH_SEPARATOR;
 $include_path .= INSTALL_PATH . 'program' . PATH_SEPARATOR;
diff --git a/installer/rcube_install.php b/installer/rcube_install.php
index b3208f0..dfd6356 100644
--- a/installer/rcube_install.php
+++ b/installer/rcube_install.php
@@ -109,12 +109,12 @@
    */
   function _load_config($suffix)
   {
-    if (is_readable($main_inc = RCUBE_CONFIG_DIR . '/main.inc' . $suffix)) {
+    if (is_readable($main_inc = RCUBE_CONFIG_DIR . 'main.inc' . $suffix)) {
       include($main_inc);
       if (is_array($rcmail_config))
         $this->config += $rcmail_config;
     }
-    if (is_readable($db_inc = RCUBE_CONFIG_DIR . '/db.inc'. $suffix)) {
+    if (is_readable($db_inc = RCUBE_CONFIG_DIR . 'db.inc'. $suffix)) {
       include($db_inc);
       if (is_array($rcmail_config))
         $this->config += $rcmail_config;
@@ -149,7 +149,7 @@
    */
   function create_config($which, $force = false)
   {
-    $out = @file_get_contents(RCUBE_CONFIG_DIR . "/{$which}.inc.php.dist");
+    $out = @file_get_contents(RCUBE_CONFIG_DIR . $which . '.inc.php.dist');
 
     if (!$out)
       return '[Warning: could not read the config template file]';
diff --git a/installer/test.php b/installer/test.php
index 836ef13..e266bf0 100644
--- a/installer/test.php
+++ b/installer/test.php
@@ -3,8 +3,8 @@
 <h3>Check config files</h3>
 <?php
 
-$read_main = is_readable(RCUBE_CONFIG_DIR.'/main.inc.php');
-$read_db = is_readable(RCUBE_CONFIG_DIR.'/db.inc.php');
+$read_main = is_readable(RCUBE_CONFIG_DIR . 'main.inc.php');
+$read_db = is_readable(RCUBE_CONFIG_DIR . 'db.inc.php');
 
 if ($read_main && !empty($RCI->config)) {
   $RCI->pass('main.inc.php');
diff --git a/program/include/iniset.php b/program/include/iniset.php
index 0081aa0..25ae018 100644
--- a/program/include/iniset.php
+++ b/program/include/iniset.php
@@ -52,7 +52,7 @@
 }
 
 define('RCUBE_INSTALL_PATH', INSTALL_PATH);
-define('RCUBE_CONFIG_DIR',  RCMAIL_CONFIG_DIR);
+define('RCUBE_CONFIG_DIR',  RCMAIL_CONFIG_DIR.'/');
 
 
 // RC include folders MUST be included FIRST to avoid other
diff --git a/program/lib/Roundcube/bootstrap.php b/program/lib/Roundcube/bootstrap.php
index e2fd2a7..47020c1 100644
--- a/program/lib/Roundcube/bootstrap.php
+++ b/program/lib/Roundcube/bootstrap.php
@@ -60,7 +60,7 @@
 }
 
 if (!defined('RCUBE_CONFIG_DIR')) {
-    define('RCUBE_CONFIG_DIR', RCUBE_INSTALL_PATH . 'config');
+    define('RCUBE_CONFIG_DIR', RCUBE_INSTALL_PATH . 'config/');
 }
 
 if (!defined('RCUBE_PLUGINS_DIR')) {
diff --git a/program/lib/Roundcube/rcube_config.php b/program/lib/Roundcube/rcube_config.php
index 6d208ba..8112d2e 100644
--- a/program/lib/Roundcube/rcube_config.php
+++ b/program/lib/Roundcube/rcube_config.php
@@ -71,11 +71,11 @@
     private function load()
     {
         // load main config file
-        if (!$this->load_from_file(RCUBE_CONFIG_DIR . '/main.inc.php'))
+        if (!$this->load_from_file(RCUBE_CONFIG_DIR . 'main.inc.php'))
             $this->errors[] = 'main.inc.php was not found.';
 
         // load database config
-        if (!$this->load_from_file(RCUBE_CONFIG_DIR . '/db.inc.php'))
+        if (!$this->load_from_file(RCUBE_CONFIG_DIR . 'db.inc.php'))
             $this->errors[] = 'db.inc.php was not found.';
 
         // load host-specific configuration
@@ -156,7 +156,7 @@
         }
 
         if ($fname) {
-            $this->load_from_file(RCUBE_CONFIG_DIR . '/' . $fname);
+            $this->load_from_file(RCUBE_CONFIG_DIR . $fname);
         }
     }
 
diff --git a/program/lib/Roundcube/rcube_output_html.php b/program/lib/Roundcube/rcube_output_html.php
index f5c6397..0d51eaf 100644
--- a/program/lib/Roundcube/rcube_output_html.php
+++ b/program/lib/Roundcube/rcube_output_html.php
@@ -1760,7 +1760,7 @@
             'about.html',
         );
         foreach ($filenames as $file) {
-            $fn = RCUBE_CONFIG_DIR . '/' . $file;
+            $fn = RCUBE_CONFIG_DIR . $file;
             if (is_readable($fn)) {
                 $content = file_get_contents($fn);
                 $content = $this->parse_conditions($content);

--
Gitblit v1.9.1