*/ ini_set('error_reporting', E_ALL & ~(E_NOTICE | E_STRICT)); ini_set('display_errors', 1); define('INSTALL_PATH', realpath(dirname(__FILE__) . '/../') . '/'); 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/include' . PATH_SEPARATOR; $include_path .= ini_get('include_path'); set_include_path($include_path); require_once 'Roundcube/bootstrap.php'; require_once 'rcube_install.php'; // deprecated aliases (to be removed) require_once 'bc.php'; session_start(); $RCI = rcube_install::get_instance(); $RCI->load_config(); if (isset($_GET['_getfile']) && in_array($_GET['_getfile'], array('main', 'db'))) { $filename = $_GET['_getfile'] . '.inc.php'; if (!empty($_SESSION[$filename])) { header('Content-type: text/plain'); header('Content-Disposition: attachment; filename="' . $filename . '"'); echo $_SESSION[$filename]; 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']) && isset($_GET['_mergeconfig']) && in_array($_GET['_mergeconfig'], array('main', 'db'))) { $filename = $_GET['_mergeconfig'] . '.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('rcube_install', false)) { $rci = rcube_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); } }
/** * 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 occured * - line: Line where error occured * @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')) { $err = array('type' => 'php', 'code' => $arg->getCode(), 'line' => $arg->getLine(), 'file' => $arg->getFile(), 'message' => $arg->getMessage()); $arg = $err; } // installer if (class_exists('rcube_install', false)) { $rci = rcube_install::get_instance(); $rci->raise_error($arg); return; } if (($log || $terminate) && $arg['type'] && $arg['message']) { $arg['fatal'] = $terminate; self::log_bug($arg); } // display error page and terminate script if ($terminate && is_object(self::$instance->output)) { self::$instance->output->raise_error($arg['code'], $arg['message']); } }
/** * Fake internal error handler to catch errors */ function raise_error($p) { $rci = rcube_install::get_instance(); $rci->raise_error($p); }