Esempio n. 1
0
define("CACHE_DIR", false);
define("CACHE_HTTP", false);
define("VERSION", 'trunk');
define("SCORE_VERSION", 's2hack/' . VERSION);
define("COOKIE_PREFIX", 'shm');
define("SPEED_HAX", false);
define("FORCE_NICE_URLS", false);
define("WH_SPLITS", 1);
require_once "core/util.inc.php";
require_once "lib/context.php";
if (CONTEXT) {
    ctx_set_log(CONTEXT);
}
ctx_log_start($_SERVER["REQUEST_URI"], true, true);
if (COVERAGE) {
    _start_coverage();
    register_shutdown_function("_end_coverage");
}
_version_check();
_sanitise_environment();
_start_cache();
try {
    // load base files
    ctx_log_start("Initialisation");
    ctx_log_start("Opening files");
    $files = array_merge(glob("core/*.php"), glob("ext/*/main.php"));
    foreach ($files as $filename) {
        require_once $filename;
    }
    ctx_log_endok();
    ctx_log_start("Connecting to DB");
Esempio n. 2
0
function _sanitise_environment()
{
    if (TIMEZONE) {
        date_default_timezone_set(TIMEZONE);
    }
    if (DEBUG) {
        error_reporting(E_ALL);
    }
    if (CONTEXT) {
        ctx_set_log(CONTEXT);
        ctx_log_start(@$_SERVER["REQUEST_URI"], true, true);
    }
    if (COVERAGE) {
        _start_coverage();
        register_shutdown_function("_end_coverage");
    }
    assert_options(ASSERT_ACTIVE, 1);
    assert_options(ASSERT_BAIL, 1);
    ob_start();
    if (get_magic_quotes_gpc()) {
        $_GET = _stripslashes_r($_GET);
        $_POST = _stripslashes_r($_POST);
        $_COOKIE = _stripslashes_r($_COOKIE);
    }
    if (is_cli()) {
        if (isset($_SERVER['REMOTE_ADDR'])) {
            die("CLI with remote addr? Confused, not taking the risk.");
        }
        $_SERVER['REMOTE_ADDR'] = "0.0.0.0";
        $_SERVER['HTTP_HOST'] = "<cli command>";
    }
}
Esempio n. 3
0
function _sanitise_environment()
{
    if (TIMEZONE) {
        date_default_timezone_set(TIMEZONE);
    }
    if (DEBUG) {
        error_reporting(E_ALL);
        assert_options(ASSERT_ACTIVE, 1);
        assert_options(ASSERT_BAIL, 1);
        assert_options(ASSERT_WARNING, 0);
        assert_options(ASSERT_QUIET_EVAL, 1);
        assert_options(ASSERT_CALLBACK, 'score_assert_handler');
    }
    if (CONTEXT) {
        ctx_set_log(CONTEXT);
    }
    if (COVERAGE) {
        _start_coverage();
        register_shutdown_function("_end_coverage");
    }
    ob_start();
    if (PHP_SAPI === 'cli') {
        if (isset($_SERVER['REMOTE_ADDR'])) {
            die("CLI with remote addr? Confused, not taking the risk.");
        }
        $_SERVER['REMOTE_ADDR'] = "0.0.0.0";
        $_SERVER['HTTP_HOST'] = "<cli command>";
    }
}