Unify path schema in global constants: paths always end with a /. Keep RCMAIL_CONFIG_DIR for backwards compatibility
| | |
| | | |
| | | 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; |
| | |
| | | */ |
| | | 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; |
| | |
| | | */ |
| | | 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]'; |
| | |
| | | <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'); |
| | |
| | | } |
| | | |
| | | 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 |
| | |
| | | } |
| | | |
| | | 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')) { |
| | |
| | | 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 |
| | |
| | | } |
| | | |
| | | if ($fname) { |
| | | $this->load_from_file(RCUBE_CONFIG_DIR . '/' . $fname); |
| | | $this->load_from_file(RCUBE_CONFIG_DIR . $fname); |
| | | } |
| | | } |
| | | |
| | |
| | | '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); |