コード例 #1
0
ファイル: core.inc.php プロジェクト: joseph-mudloff/pixie-cms
function bb2_start($settings)
{
    // Gather up all the information we need, first of all.
    $headers = bb2_load_headers();
    // Postprocess the headers to mixed-case
    // TODO: get the world to stop using PHP as CGI
    $headers_mixed = array();
    foreach ($headers as $h => $v) {
        $headers_mixed[uc_all($h)] = $v;
    }
    // IPv6 - IPv4 compatibility mode hack
    $_SERVER['REMOTE_ADDR'] = preg_replace("/^::ffff:/", "", $_SERVER['REMOTE_ADDR']);
    // Reconstruct the HTTP entity, if present.
    $request_entity = array();
    if (!strcasecmp($_SERVER['REQUEST_METHOD'], "POST") || !strcasecmp($_SERVER['REQUEST_METHOD'], "PUT")) {
        foreach ($_POST as $h => $v) {
            $request_entity[$h] = $v;
        }
    }
    @($package = array('ip' => $_SERVER['REMOTE_ADDR'], 'headers' => $headers, 'headers_mixed' => $headers_mixed, 'request_method' => $_SERVER['REQUEST_METHOD'], 'request_uri' => $_SERVER['REQUEST_URI'], 'server_protocol' => $_SERVER['SERVER_PROTOCOL'], 'request_entity' => $request_entity, 'user_agent' => $_SERVER['HTTP_USER_AGENT'], 'is_browser' => false));
    $result = bb2_screen($settings, $package);
    if ($result && !defined('BB2_TEST')) {
        bb2_banned($settings, $package, $result);
    }
    return $result;
}
コード例 #2
0
ファイル: core.inc.php プロジェクト: eFiction/v5_1-vaporware
function bb2_start($settings)
{
    // Gather up all the information we need, first of all.
    $headers = bb2_load_headers();
    // Postprocess the headers to mixed-case
    // TODO: get the world to stop using PHP as CGI
    $headers_mixed = array();
    foreach ($headers as $h => $v) {
        $headers_mixed[uc_all($h)] = $v;
    }
    // IPv6 - IPv4 compatibility mode hack
    $_SERVER['REMOTE_ADDR'] = preg_replace("/^::ffff:/", "", $_SERVER['REMOTE_ADDR']);
    // Reconstruct the HTTP entity, if present.
    $request_entity = array();
    if (!strcasecmp($_SERVER['REQUEST_METHOD'], "POST") || !strcasecmp($_SERVER['REQUEST_METHOD'], "PUT")) {
        foreach ($_POST as $h => $v) {
            if (is_array($v)) {
                # Workaround, see Bug #12
                $v = "Array";
            }
            $request_entity[$h] = $v;
        }
    }
    $request_uri = $_SERVER["REQUEST_URI"];
    if (!$request_uri) {
        $request_uri = $_SERVER['SCRIPT_NAME'];
    }
    # IIS
    if ($settings['reverse_proxy'] && ($ip = bb2_reverse_proxy($settings, $headers_mixed))) {
        $headers['X-Bad-Behavior-Remote-Address'] = $_SERVER['REMOTE_ADDR'];
        $headers_mixed['X-Bad-Behavior-Remote-Address'] = $_SERVER['REMOTE_ADDR'];
    } else {
        $ip = $_SERVER['REMOTE_ADDR'];
    }
    @($package = array('ip' => $ip, 'headers' => $headers, 'headers_mixed' => $headers_mixed, 'request_method' => $_SERVER['REQUEST_METHOD'], 'request_uri' => $request_uri, 'server_protocol' => $_SERVER['SERVER_PROTOCOL'], 'request_entity' => $request_entity, 'user_agent' => $_SERVER['HTTP_USER_AGENT'], 'is_browser' => false));
    $result = bb2_screen($settings, $package);
    if ($result && !defined('BB2_TEST')) {
        bb2_banned($settings, $package, $result);
    }
    return $result;
}