define('RCUBE_CONFIG_DIR', INSTALL_PATH . 'config/'); $include_path = INSTALL_PATH . 'program/lib' . PATH_SEPARATOR; $include_path .= INSTALL_PATH . 'program/include' . PATH_SEPARATOR; $include_path .= ini_get('include_path'); set_include_path($include_path); // include composer autoloader (if available) if (@file_exists(INSTALL_PATH . 'vendor/autoload.php')) { require INSTALL_PATH . 'vendor/autoload.php'; } require_once 'Roundcube/bootstrap.php'; // deprecated aliases (to be removed) require_once 'bc.php'; if (function_exists('session_start')) { session_start(); } $RCI = rcmail_install::get_instance(); $RCI->load_config(); if (isset($_GET['_getconfig'])) { $filename = 'config.inc.php'; if (!empty($_SESSION['config'])) { header('Content-type: text/plain'); header('Content-Disposition: attachment; filename="' . $filename . '"'); echo $_SESSION['config']; exit; } else { header('HTTP/1.0 404 Not found'); die("The requested configuration was not found. Please run the installer from the beginning."); } } if ($RCI->configured && ($RCI->getprop('enable_installer') || $_SESSION['allowinstaller']) && !empty($_GET['_mergeconfig'])) { $filename = 'config.inc.php';
/** * Throw system error (and show error page). * * @param array Named parameters * - code: Error code (required) * - type: Error type [php|db|imap|javascript] (required) * - message: Error message * - file: File where error occurred * - line: Line where error occurred * @param boolean True to log the error * @param boolean Terminate script execution */ public static function raise_error($arg = array(), $log = false, $terminate = false) { // handle PHP exceptions if (is_object($arg) && is_a($arg, 'Exception')) { $arg = array('code' => $arg->getCode(), 'line' => $arg->getLine(), 'file' => $arg->getFile(), 'message' => $arg->getMessage()); } else { if (is_string($arg)) { $arg = array('message' => $arg); } } if (empty($arg['code'])) { $arg['code'] = 500; } // installer if (class_exists('rcmail_install', false)) { $rci = rcmail_install::get_instance(); $rci->raise_error($arg); return; } $cli = php_sapi_name() == 'cli'; if (($log || $terminate) && !$cli && $arg['message']) { $arg['fatal'] = $terminate; self::log_bug($arg); } // terminate script if ($terminate) { // display error page if (is_object(self::$instance->output)) { self::$instance->output->raise_error($arg['code'], $arg['message']); } else { if ($cli) { fwrite(STDERR, 'ERROR: ' . $arg['message']); } } exit(1); } else { if ($cli) { fwrite(STDERR, 'ERROR: ' . $arg['message']); } } }