diff options
-rw-r--r-- | installer/index.php | 12 | ||||
-rw-r--r-- | installer/rcube_install.php | 6 | ||||
-rw-r--r-- | installer/test.php | 4 | ||||
-rw-r--r-- | installer/utils.php | 56 | ||||
-rw-r--r-- | plugins/password/drivers/dbmail.php | 2 | ||||
-rw-r--r-- | plugins/password/drivers/sasl.php | 2 | ||||
-rw-r--r-- | plugins/password/drivers/virtualmin.php | 2 | ||||
-rw-r--r-- | plugins/redundant_attachments/redundant_attachments.php | 2 | ||||
-rw-r--r-- | program/include/iniset.php | 12 | ||||
-rw-r--r-- | program/lib/Roundcube/bootstrap.php | 25 | ||||
-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 |
17 files changed, 72 insertions, 105 deletions
diff --git a/installer/index.php b/installer/index.php index 5e7d318ff..40dabc893 100644 --- a/installer/index.php +++ b/installer/index.php @@ -40,8 +40,8 @@ ini_set('error_reporting', E_ALL &~ (E_NOTICE | E_STRICT)); ini_set('display_errors', 1); define('INSTALL_PATH', realpath(dirname(__FILE__) . '/../').'/'); -define('RCMAIL_CONFIG_DIR', INSTALL_PATH . 'config'); -define('RCMAIL_CHARSET', 'UTF-8'); +define('RCUBE_INSTALL_PATH', INSTALL_PATH); +define('RCUBE_CONFIG_DIR', INSTALL_PATH . 'config'); $include_path = INSTALL_PATH . 'program/lib' . PATH_SEPARATOR; $include_path .= INSTALL_PATH . 'program' . PATH_SEPARATOR; @@ -50,10 +50,10 @@ $include_path .= ini_get('include_path'); set_include_path($include_path); -require_once 'utils.php'; -require_once 'rcube_shared.inc'; +require_once 'Roundcube/bootstrap.php'; +require_once 'rcube_install.php'; // deprecated aliases (to be removed) -require_once 'rcube_bc.inc'; +require_once 'bc.php'; session_start(); @@ -123,7 +123,7 @@ if ($RCI->configured && empty($_REQUEST['_step'])) { if ($RCI->configured && !$RCI->getprop('enable_installer') && !$_SESSION['allowinstaller']) { // header("HTTP/1.0 404 Not Found"); echo '<h2 class="error">The installer is disabled!</h2>'; - echo '<p>To enable it again, set <tt>$rcmail_config[\'enable_installer\'] = true;</tt> in RCMAIL_CONFIG_DIR/main.inc.php</p>'; + echo '<p>To enable it again, set <tt>$rcmail_config[\'enable_installer\'] = true;</tt> in RCUBE_CONFIG_DIR/main.inc.php</p>'; echo '</div></body></html>'; exit; } diff --git a/installer/rcube_install.php b/installer/rcube_install.php index e120366ab..b3208f037 100644 --- a/installer/rcube_install.php +++ b/installer/rcube_install.php @@ -109,12 +109,12 @@ class rcube_install */ function _load_config($suffix) { - if (is_readable($main_inc = RCMAIL_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 = RCMAIL_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 @@ class rcube_install */ function create_config($which, $force = false) { - $out = @file_get_contents(RCMAIL_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 28eb76940..836ef1365 100644 --- a/installer/test.php +++ b/installer/test.php @@ -3,8 +3,8 @@ <h3>Check config files</h3> <?php -$read_main = is_readable(RCMAIL_CONFIG_DIR.'/main.inc.php'); -$read_db = is_readable(RCMAIL_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/installer/utils.php b/installer/utils.php deleted file mode 100644 index 0e6cfecf3..000000000 --- a/installer/utils.php +++ /dev/null @@ -1,56 +0,0 @@ -<?php - -/* - +-------------------------------------------------------------------------+ - | Roundcube Webmail installer utilities | - | | - | Copyright (C) 2005-2011, The Roundcube Dev Team | - | | - | Licensed under the GNU General Public License version 3 or | - | any later version with exceptions for skins & plugins. | - | See the README file for a full license statement. | - | | - +-------------------------------------------------------------------------+ - | Author: Thomas Bruederli <roundcube@gmail.com> | - +-------------------------------------------------------------------------+ -*/ - -/** - * Use PHP5 autoload for dynamic class loading - * (copy from program/include/iniset.php) - */ -function __autoload($classname) -{ - $filename = preg_replace( - array( - '/Mail_(.+)/', - '/Net_(.+)/', - '/Auth_(.+)/', - '/^html_.+/', - '/^utf8$/' - ), - array( - 'Mail/\\1', - 'Net/\\1', - 'Auth/\\1', - 'html', - 'utf8.class' - ), - $classname - ); - include_once $filename. '.php'; -} - -/** - * Local callback function for PEAR errors - */ -function __pear_error($err) -{ - rcmail::raise_error(array( - 'code' => $err->getCode(), - 'message' => $err->getMessage(), - )); -} - -// set PEAR error handling (will also load the PEAR main class) -PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, '__pear_error'); diff --git a/plugins/password/drivers/dbmail.php b/plugins/password/drivers/dbmail.php index a7c2f46a3..e4c0d52e3 100644 --- a/plugins/password/drivers/dbmail.php +++ b/plugins/password/drivers/dbmail.php @@ -19,7 +19,7 @@ class rcube_dbmail_password { function password_save($currpass, $newpass) { - $curdir = INSTALL_PATH . 'plugins/password/helpers'; + $curdir = RCUBE_PLUGINS_DIR . 'password/helpers'; $username = escapeshellcmd($_SESSION['username']); $args = rcmail::get_instance()->config->get('password_dbmail_args', ''); diff --git a/plugins/password/drivers/sasl.php b/plugins/password/drivers/sasl.php index 957c1196c..9380cf838 100644 --- a/plugins/password/drivers/sasl.php +++ b/plugins/password/drivers/sasl.php @@ -20,7 +20,7 @@ class rcube_sasl_password { function save($currpass, $newpass) { - $curdir = INSTALL_PATH . 'plugins/password/helpers'; + $curdir = RCUBE_PLUGINS_DIR . 'password/helpers'; $username = escapeshellcmd($_SESSION['username']); $args = rcmail::get_instance()->config->get('password_saslpasswd_args', ''); diff --git a/plugins/password/drivers/virtualmin.php b/plugins/password/drivers/virtualmin.php index f9eca9633..69f1475d4 100644 --- a/plugins/password/drivers/virtualmin.php +++ b/plugins/password/drivers/virtualmin.php @@ -59,7 +59,7 @@ class rcube_virtualmin_password $username = escapeshellcmd($username); $domain = escapeshellcmd($domain); $newpass = escapeshellcmd($newpass); - $curdir = INSTALL_PATH . 'plugins/password/helpers'; + $curdir = RCUBE_PLUGINS_DIR . 'password/helpers'; exec("$curdir/chgvirtualminpasswd modify-user --domain $domain --user $username --pass $newpass", $output, $returnvalue); diff --git a/plugins/redundant_attachments/redundant_attachments.php b/plugins/redundant_attachments/redundant_attachments.php index 3c71dcb40..4ebc8dad7 100644 --- a/plugins/redundant_attachments/redundant_attachments.php +++ b/plugins/redundant_attachments/redundant_attachments.php @@ -31,7 +31,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -require_once(INSTALL_PATH . 'plugins/filesystem_attachments/filesystem_attachments.php'); +require_once(RCUBE_PLUGINS_DIR . 'filesystem_attachments/filesystem_attachments.php'); class redundant_attachments extends filesystem_attachments { diff --git a/program/include/iniset.php b/program/include/iniset.php index 3e718c9bf..0081aa021 100644 --- a/program/include/iniset.php +++ b/program/include/iniset.php @@ -20,6 +20,10 @@ +-----------------------------------------------------------------------+ */ +// application constants +define('RCMAIL_VERSION', '0.9-git'); +define('RCMAIL_START', microtime(true)); + $config = array( // Some users are not using Installer, so we'll check some // critical PHP settings here. Only these, which doesn't provide @@ -43,6 +47,14 @@ if (!defined('RCMAIL_CONFIG_DIR')) { define('RCMAIL_CONFIG_DIR', INSTALL_PATH . 'config'); } +if (!defined('RCUBE_LOCALIZATION_DIR')) { + define('RCUBE_LOCALIZATION_DIR', INSTALL_PATH . 'program/localization/'); +} + +define('RCUBE_INSTALL_PATH', INSTALL_PATH); +define('RCUBE_CONFIG_DIR', RCMAIL_CONFIG_DIR); + + // RC include folders MUST be included FIRST to avoid other // possible not compatible libraries (i.e PEAR) to be included // instead the ones provided by RC diff --git a/program/lib/Roundcube/bootstrap.php b/program/lib/Roundcube/bootstrap.php index bc0456cf3..e2fd2a732 100644 --- a/program/lib/Roundcube/bootstrap.php +++ b/program/lib/Roundcube/bootstrap.php @@ -47,17 +47,28 @@ foreach ($config as $optname => $optval) { } } -// application constants -define('RCMAIL_VERSION', '0.9-git'); +// framework constants +define('RCUBE_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); } |