Unify path schema in global constants: paths always end with a /. Keep RCMAIL_CONFIG_DIR for backwards compatibility

pull/66/head
Thomas Bruederli 12 years ago
parent 92964a4a6c
commit 5926684aab

@ -41,7 +41,7 @@ ini_set('display_errors', 1);
define('INSTALL_PATH', realpath(dirname(__FILE__) . '/../').'/'); define('INSTALL_PATH', realpath(dirname(__FILE__) . '/../').'/');
define('RCUBE_INSTALL_PATH', INSTALL_PATH); 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/lib' . PATH_SEPARATOR;
$include_path .= INSTALL_PATH . 'program' . PATH_SEPARATOR; $include_path .= INSTALL_PATH . 'program' . PATH_SEPARATOR;

@ -109,12 +109,12 @@ class rcube_install
*/ */
function _load_config($suffix) 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); include($main_inc);
if (is_array($rcmail_config)) if (is_array($rcmail_config))
$this->config += $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); include($db_inc);
if (is_array($rcmail_config)) if (is_array($rcmail_config))
$this->config += $rcmail_config; $this->config += $rcmail_config;
@ -149,7 +149,7 @@ class rcube_install
*/ */
function create_config($which, $force = false) 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) if (!$out)
return '[Warning: could not read the config template file]'; return '[Warning: could not read the config template file]';

@ -3,8 +3,8 @@
<h3>Check config files</h3> <h3>Check config files</h3>
<?php <?php
$read_main = is_readable(RCUBE_CONFIG_DIR.'/main.inc.php'); $read_main = is_readable(RCUBE_CONFIG_DIR . 'main.inc.php');
$read_db = is_readable(RCUBE_CONFIG_DIR.'/db.inc.php'); $read_db = is_readable(RCUBE_CONFIG_DIR . 'db.inc.php');
if ($read_main && !empty($RCI->config)) { if ($read_main && !empty($RCI->config)) {
$RCI->pass('main.inc.php'); $RCI->pass('main.inc.php');

@ -52,7 +52,7 @@ if (!defined('RCUBE_LOCALIZATION_DIR')) {
} }
define('RCUBE_INSTALL_PATH', INSTALL_PATH); 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 // RC include folders MUST be included FIRST to avoid other

@ -60,7 +60,7 @@ if (!defined('RCUBE_INSTALL_PATH')) {
} }
if (!defined('RCUBE_CONFIG_DIR')) { 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')) { if (!defined('RCUBE_PLUGINS_DIR')) {

@ -71,11 +71,11 @@ class rcube_config
private function load() private function load()
{ {
// load main config file // 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.'; $this->errors[] = 'main.inc.php was not found.';
// load database config // 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.'; $this->errors[] = 'db.inc.php was not found.';
// load host-specific configuration // load host-specific configuration
@ -156,7 +156,7 @@ class rcube_config
} }
if ($fname) { if ($fname) {
$this->load_from_file(RCUBE_CONFIG_DIR . '/' . $fname); $this->load_from_file(RCUBE_CONFIG_DIR . $fname);
} }
} }

@ -1760,7 +1760,7 @@ class rcube_output_html extends rcube_output
'about.html', 'about.html',
); );
foreach ($filenames as $file) { foreach ($filenames as $file) {
$fn = RCUBE_CONFIG_DIR . '/' . $file; $fn = RCUBE_CONFIG_DIR . $file;
if (is_readable($fn)) { if (is_readable($fn)) {
$content = file_get_contents($fn); $content = file_get_contents($fn);
$content = $this->parse_conditions($content); $content = $this->parse_conditions($content);

Loading…
Cancel
Save