Example #1
0
function errorHandler($code, $message, $file, $line)
{
    // Make sure this error code is included in error_reporting.
    if ((error_reporting() & $code) != $code) {
        return false;
    }
    ET::fatalError(new ErrorException($message, $code, 1, $file, $line));
}
set_error_handler("errorHandler", E_USER_ERROR);
set_exception_handler(array("ET", "fatalError"));
// Determine the relative path to this forum. For example, if the forum is at http://forum.com/test/forum/,
// the web path should be /test/forum.
$parts = explode("/", $_SERVER["PHP_SELF"]);
$key = array_search("index.php", $parts);
if ($key !== false) {
    ET::$webPath = implode("/", array_slice($parts, 0, $key));
}
// Undo register_globals.
undoRegisterGlobals();
// If magic quotes is on, strip the slashes that it added.
if (get_magic_quotes_gpc()) {
    $_REQUEST = array_map("undoMagicQuotes", $_REQUEST);
    $_GET = array_map("undoMagicQuotes", $_GET);
    $_POST = array_map("undoMagicQuotes", $_POST);
    $_COOKIE = array_map("undoMagicQuotes", $_COOKIE);
}
//***** 2. INCLUDE CONFIGURATION
// Include our config files.
ET::loadConfig(PATH_CORE . "/config.defaults.php");
// If the config path is different from the default, but there's still a config file at the default location, include it.
if (PATH_CONFIG != PATH_ROOT . "/config" and file_exists($file = PATH_ROOT . "/config/config.php")) {