function apache_specific_request_path() { if (!apache_specific_is_rewrite_engine_on()) { return default_request_path(); } return _apache_specific_request_path(server_var('REQUEST_URI'), uri_path(server_var('PHP_SELF'))); }
function request_($override = array()) { static $request; if (!isset($request) or !empty($override)) { $request = array('method' => array_val($override, 'method', strtoupper(server_var('REQUEST_METHOD'))), 'path' => array_val($override, 'path', rawurldecode('/' . ltrim(webserver_specific('request_path'), '/'))), 'query' => array_val($override, 'query', $_GET), 'form' => array_val($override, 'form', $_POST), 'server_vars' => array_val($override, 'server_vars', $_SERVER), 'headers' => array_val($override, 'headers', webserver_specific('request_headers')), 'body' => array_val($override, 'body', valid_body_(file_get_contents('php://input')))); } return $request; }
* * Bombay is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * To read the license please visit http://www.gnu.org/copyleft/gpl.html * * *-------10--------20--------30--------40--------50--------60---------72 */ requires('helpers', 'webserver'); define('URI_SCHEME', uri_scheme(server_var('HTTPS'))); define('URI_HOST', uri_host(server_var('HTTP_HOST'))); define('URI_PORT', uri_port(server_var('HTTP_HOST'))); define('URI_PATH', uri_path(server_var('PHP_SELF'))); define('URI_ABSOLUTE_BASE', uri_absolute_base(URI_SCHEME, URI_HOST, URI_PORT, URI_PATH)); define('URI_RELATIVE_BASE', uri_relative_base(URI_PATH)); define('URI_SECURE_ABSOLUTE_BASE', uri_absolute_base('https', URI_HOST, URI_PORT, URI_PATH)); function uri_scheme($https) { $ssl = !is_null($https) and is_equal('on', $https); $scheme = $ssl ? 'https' : 'http'; return $scheme; } function uri_host($http_host) { $pieces = explode(':', $http_host); if (str_contains(':', $http_host)) { $host = array_shift($pieces); } else {
public static function getIP() { if (server_var('HTTP_CLIENT_IP') != '') { $ip = $_SERVER['HTTP_CLIENT_IP']; } elseif (server_var('HTTP_X_FORWARDED_FOR') != '') { $ip = server_var('HTTP_X_FORWARDED_FOR'); } else { $ip = server_var('REMOTE_ADDR'); } return $ip; }
function request_() { return array('method' => request_method_(server_var('REQUEST_METHOD')), 'path' => request_path_(webserver_specific('request_path')), 'query' => $_GET, 'form' => $_POST, 'server_vars' => $_SERVER, 'headers' => webserver_specific('request_headers'), 'body' => request_body_(file_get_contents('php://input'))); }
* Bombay is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at * your option) any later version. * * Bombay is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * To read the license please visit http://www.gnu.org/copyleft/gpl.html * * *-------10--------20--------30--------40--------50--------60---------72 */ define('WEBSERVER', webserver(server_var('SERVER_SOFTWARE'))); require_webserver_adapter('default'); require_webserver_adapter(WEBSERVER); function webserver($server_software) { $server_softwares = array('Apache' => 'apache', 'Microsoft-IIS' => 'iis', 'Microsoft-PWS' => 'pws', 'Xitami' => 'xitami', 'Zeus' => 'zeus', 'OmniHTTPd' => 'omnihttpd'); foreach ($server_softwares as $key => $value) { if (str_contains($key, $server_software)) { return $value; } } return 'unknown'; } function require_webserver_adapter($webserver_adapter) { $webserver_adapter_file = webserver_adapter_file($webserver_adapter);