diff options
author | Thomas Bruederli <thomas@roundcube.net> | 2012-11-25 17:35:53 +0100 |
---|---|---|
committer | Thomas Bruederli <thomas@roundcube.net> | 2012-11-25 17:35:53 +0100 |
commit | 9be2f43d02cd54340fc64c9b2cee9cfa94b49034 (patch) | |
tree | 6972efcd24b6ac12643a93ae19fbcab5411938fd /program/lib | |
parent | 5352b55779aadc8b4c665daf69c7a27767f17d78 (diff) |
Define more (uniquely prefixed) constants for Roundcube directories in order to enhance the interoperability of the Roundcube framework
Diffstat (limited to 'program/lib')
-rw-r--r-- | program/lib/Roundcube/bootstrap.php | 20 | ||||
-rw-r--r-- | program/lib/Roundcube/rcube.php | 22 | ||||
-rw-r--r-- | program/lib/Roundcube/rcube_config.php | 10 | ||||
-rw-r--r-- | program/lib/Roundcube/rcube_csv2vcard.php | 4 | ||||
-rw-r--r-- | program/lib/Roundcube/rcube_db_sqlite.php | 2 | ||||
-rw-r--r-- | program/lib/Roundcube/rcube_mime.php | 2 | ||||
-rw-r--r-- | program/lib/Roundcube/rcube_output_html.php | 8 | ||||
-rw-r--r-- | program/lib/Roundcube/rcube_plugin_api.php | 6 |
8 files changed, 43 insertions, 31 deletions
diff --git a/program/lib/Roundcube/bootstrap.php b/program/lib/Roundcube/bootstrap.php index bc0456cf3..018701d08 100644 --- a/program/lib/Roundcube/bootstrap.php +++ b/program/lib/Roundcube/bootstrap.php @@ -52,12 +52,24 @@ define('RCMAIL_VERSION', '0.9-git'); define('RCMAIL_CHARSET', 'UTF-8'); define('RCMAIL_START', microtime(true)); -if (!defined('INSTALL_PATH')) { - define('INSTALL_PATH', dirname($_SERVER['SCRIPT_FILENAME']).'/'); +if (!defined('RCUBE_LIB_DIR')) { + define('RCUBE_LIB_DIR', dirname(__FILE__).'/'); } -if (!defined('RCMAIL_CONFIG_DIR')) { - define('RCMAIL_CONFIG_DIR', INSTALL_PATH . 'config'); +if (!defined('RCUBE_INSTALL_PATH')) { + define('RCUBE_INSTALL_PATH', RCUBE_LIB_DIR); +} + +if (!defined('RCUBE_CONFIG_DIR')) { + define('RCUBE_CONFIG_DIR', RCUBE_INSTALL_PATH . 'config'); +} + +if (!defined('RCUBE_PLUGINS_DIR')) { + define('RCUBE_PLUGINS_DIR', RCUBE_INSTALL_PATH . 'plugins/'); +} + +if (!defined('RCUBE_LOCALIZATION_DIR')) { + define('RCUBE_LOCALIZATION_DIR', RCUBE_INSTALL_PATH . 'localization/'); } // set internal encoding for mbstring extension diff --git a/program/lib/Roundcube/rcube.php b/program/lib/Roundcube/rcube.php index 9c1a6d84a..0eed6cf67 100644 --- a/program/lib/Roundcube/rcube.php +++ b/program/lib/Roundcube/rcube.php @@ -596,8 +596,8 @@ class rcube ob_start(); // get english labels (these should be complete) - @include(INSTALL_PATH . 'program/localization/en_US/labels.inc'); - @include(INSTALL_PATH . 'program/localization/en_US/messages.inc'); + @include(RCUBE_LOCALIZATION_DIR . 'en_US/labels.inc'); + @include(RCUBE_LOCALIZATION_DIR . 'en_US/messages.inc'); if (is_array($labels)) $this->texts = $labels; @@ -605,9 +605,9 @@ class rcube $this->texts = array_merge($this->texts, $messages); // include user language files - if ($lang != 'en' && $lang != 'en_US' && is_dir(INSTALL_PATH . 'program/localization/' . $lang)) { - include_once(INSTALL_PATH . 'program/localization/' . $lang . '/labels.inc'); - include_once(INSTALL_PATH . 'program/localization/' . $lang . '/messages.inc'); + if ($lang != 'en' && $lang != 'en_US' && is_dir(RCUBE_LOCALIZATION_DIR . $lang)) { + include_once(RCUBE_LOCALIZATION_DIR . $lang . '/labels.inc'); + include_once(RCUBE_LOCALIZATION_DIR . $lang . '/messages.inc'); if (is_array($labels)) $this->texts = array_merge($this->texts, $labels); @@ -645,7 +645,7 @@ class rcube } if (empty($rcube_languages)) { - @include(INSTALL_PATH . 'program/localization/index.inc'); + @include(RCUBE_LOCALIZATION_DIR . 'index.inc'); } // check if we have an alias for that language @@ -666,7 +666,7 @@ class rcube } } - if (!isset($rcube_languages[$lang]) || !is_dir(INSTALL_PATH . 'program/localization/' . $lang)) { + if (!isset($rcube_languages[$lang]) || !is_dir(RCUBE_LOCALIZATION_DIR . $lang)) { $lang = 'en_US'; } @@ -684,11 +684,11 @@ class rcube static $sa_languages = array(); if (!sizeof($sa_languages)) { - @include(INSTALL_PATH . 'program/localization/index.inc'); + @include(RCUBE_LOCALIZATION_DIR . 'index.inc'); - if ($dh = @opendir(INSTALL_PATH . 'program/localization')) { + if ($dh = @opendir(RCUBE_LOCALIZATION_DIR)) { while (($name = readdir($dh)) !== false) { - if ($name[0] == '.' || !is_dir(INSTALL_PATH . 'program/localization/' . $name)) { + if ($name[0] == '.' || !is_dir(RCUBE_LOCALIZATION_DIR . $name)) { continue; } @@ -1017,7 +1017,7 @@ class rcube $log_dir = self::$instance ? self::$instance->config->get('log_dir') : null; if (empty($log_dir)) { - $log_dir = INSTALL_PATH . 'logs'; + $log_dir = RCUBE_INSTALL_PATH . 'logs'; } // try to open specific log file for writing diff --git a/program/lib/Roundcube/rcube_config.php b/program/lib/Roundcube/rcube_config.php index 7d206ffdc..6d208ba3a 100644 --- a/program/lib/Roundcube/rcube_config.php +++ b/program/lib/Roundcube/rcube_config.php @@ -71,11 +71,11 @@ class rcube_config private function load() { // load main config file - if (!$this->load_from_file(RCMAIL_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(RCMAIL_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 @@ -96,8 +96,8 @@ class rcube_config $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'; - $this->prop['temp_dir'] = $this->prop['temp_dir'] ? realpath(unslashify($this->prop['temp_dir'])) : INSTALL_PATH . 'temp'; + $this->prop['log_dir'] = $this->prop['log_dir'] ? realpath(unslashify($this->prop['log_dir'])) : RCUBE_INSTALL_PATH . 'logs'; + $this->prop['temp_dir'] = $this->prop['temp_dir'] ? realpath(unslashify($this->prop['temp_dir'])) : RCUBE_INSTALL_PATH . 'temp'; // fix default imap folders encoding foreach (array('drafts_mbox', 'junk_mbox', 'sent_mbox', 'trash_mbox') as $folder) @@ -156,7 +156,7 @@ class rcube_config } if ($fname) { - $this->load_from_file(RCMAIL_CONFIG_DIR . '/' . $fname); + $this->load_from_file(RCUBE_CONFIG_DIR . '/' . $fname); } } diff --git a/program/lib/Roundcube/rcube_csv2vcard.php b/program/lib/Roundcube/rcube_csv2vcard.php index 114d36d85..ec7a3ab41 100644 --- a/program/lib/Roundcube/rcube_csv2vcard.php +++ b/program/lib/Roundcube/rcube_csv2vcard.php @@ -244,8 +244,8 @@ class rcube_csv2vcard { // Localize fields map if ($lang && $lang != 'en_US') { - if (file_exists(INSTALL_PATH . "program/localization/$lang/csv2vcard.inc")) { - include INSTALL_PATH . "program/localization/$lang/csv2vcard.inc"; + if (file_exists(RCUBE_LOCALIZATION_DIR . "$lang/csv2vcard.inc")) { + include RCUBE_LOCALIZATION_DIR . "$lang/csv2vcard.inc"; } if (!empty($map)) { diff --git a/program/lib/Roundcube/rcube_db_sqlite.php b/program/lib/Roundcube/rcube_db_sqlite.php index 9aa67d0fd..65dcb6d6e 100644 --- a/program/lib/Roundcube/rcube_db_sqlite.php +++ b/program/lib/Roundcube/rcube_db_sqlite.php @@ -66,7 +66,7 @@ class rcube_db_sqlite extends rcube_db // Initialize database structure in file is empty if (!empty($dsn['database']) && !filesize($dsn['database'])) { - $data = file_get_contents(INSTALL_PATH . 'SQL/sqlite.initial.sql'); + $data = file_get_contents(RCUBE_INSTALL_PATH . 'SQL/sqlite.initial.sql'); if (strlen($data)) { $this->debug('INITIALIZE DATABASE'); diff --git a/program/lib/Roundcube/rcube_mime.php b/program/lib/Roundcube/rcube_mime.php index 7ce7c90fe..25ee31d64 100644 --- a/program/lib/Roundcube/rcube_mime.php +++ b/program/lib/Roundcube/rcube_mime.php @@ -653,7 +653,7 @@ class rcube_mime { $mime_type = null; $mime_magic = rcube::get_instance()->config->get('mime_magic'); - $mime_ext = @include RCMAIL_CONFIG_DIR . '/mimetypes.php'; + $mime_ext = @include RCUBE_CONFIG_DIR . '/mimetypes.php'; // use file name suffix with hard-coded mime-type map if (is_array($mime_ext) && $name) { diff --git a/program/lib/Roundcube/rcube_output_html.php b/program/lib/Roundcube/rcube_output_html.php index d751eb294..f5c639707 100644 --- a/program/lib/Roundcube/rcube_output_html.php +++ b/program/lib/Roundcube/rcube_output_html.php @@ -592,7 +592,7 @@ class rcube_output_html extends rcube_output $ERROR_CODE = $code; $ERROR_MESSAGE = $message; - include INSTALL_PATH . 'program/steps/utils/error.inc'; + include RCUBE_INSTALL_PATH . 'program/steps/utils/error.inc'; exit; } @@ -921,11 +921,11 @@ class rcube_output_html extends rcube_output } else if ($object == 'version') { $ver = (string)RCMAIL_VERSION; - if (is_file(INSTALL_PATH . '.svn/entries')) { + if (is_file(RCUBE_INSTALL_PATH . '.svn/entries')) { if (preg_match('/Revision:\s(\d+)/', @shell_exec('svn info'), $regs)) $ver .= ' [SVN r'.$regs[1].']'; } - else if (is_file(INSTALL_PATH . '.git/index')) { + else if (is_file(RCUBE_INSTALL_PATH . '.git/index')) { if (preg_match('/Date:\s+([^\n]+)/', @shell_exec('git log -1'), $regs)) { if ($date = date('Ymd.Hi', strtotime($regs[1]))) { $ver .= ' [GIT '.$date.']'; @@ -1760,7 +1760,7 @@ class rcube_output_html extends rcube_output 'about.html', ); foreach ($filenames as $file) { - $fn = RCMAIL_CONFIG_DIR . '/' . $file; + $fn = RCUBE_CONFIG_DIR . '/' . $file; if (is_readable($fn)) { $content = file_get_contents($fn); $content = $this->parse_conditions($content); diff --git a/program/lib/Roundcube/rcube_plugin_api.php b/program/lib/Roundcube/rcube_plugin_api.php index 51daf2797..a8f83a2b6 100644 --- a/program/lib/Roundcube/rcube_plugin_api.php +++ b/program/lib/Roundcube/rcube_plugin_api.php @@ -20,8 +20,8 @@ */ // location where plugins are loade from -if (!defined('RCMAIL_PLUGINS_DIR')) - define('RCMAIL_PLUGINS_DIR', INSTALL_PATH . 'plugins/'); +if (!defined('RCUBE_PLUGINS_DIR')) + define('RCUBE_PLUGINS_DIR', RCUBE_INSTALL_PATH . 'plugins/'); /** @@ -101,7 +101,7 @@ class rcube_plugin_api */ protected function __construct() { - $this->dir = slashify(RCMAIL_PLUGINS_DIR); + $this->dir = slashify(RCUBE_PLUGINS_DIR); } |