diff options
author | Nils Adermann <naderman@naderman.de> | 2011-08-18 19:15:00 -0400 |
---|---|---|
committer | Nils Adermann <naderman@naderman.de> | 2011-08-18 19:15:00 -0400 |
commit | 052e33823b98ec3e51fdb424937e72dd1f33d11f (patch) | |
tree | 975749ed51ac43c98940b7dd7b0ed03a9f99d7a6 /phpBB/includes/functions.php | |
parent | d06dcd69e60bc3e6eafb4a11dfb1639fa4e4646b (diff) | |
parent | b05382d226d2c5d68ff5a483d8885f65e754c90d (diff) | |
download | forums-052e33823b98ec3e51fdb424937e72dd1f33d11f.tar forums-052e33823b98ec3e51fdb424937e72dd1f33d11f.tar.gz forums-052e33823b98ec3e51fdb424937e72dd1f33d11f.tar.bz2 forums-052e33823b98ec3e51fdb424937e72dd1f33d11f.tar.xz forums-052e33823b98ec3e51fdb424937e72dd1f33d11f.zip |
Merge remote-tracking branch 'github-igorw/feature/request-class' into develop
* github-igorw/feature/request-class:
[feature/request-class] Fix session_testable_factory
[feature/request-class] Adjust code base to do html decoding manually
[feature/request-class] Remove $html_encode arg, force manual decoding
[feature/request-class] Do not html escape user agent in header_filename
[feature/request-class] Make use of the is_secure() method
[feature/request-class] Add is_secure method to request for HTTPS
[feature/request-class] Make server() use the $html_encode parameter
[feature/request-class] Remove useless condition
[feature/request-class] Minor spacing CS adjustments
[feature/request-class] Add server(), header() and is_ajax() to request
Diffstat (limited to 'phpBB/includes/functions.php')
-rw-r--r-- | phpBB/includes/functions.php | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 9d27a24c92..b0c89bdceb 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -830,6 +830,8 @@ function phpbb_is_absolute($path) */ function phpbb_own_realpath($path) { + global $request; + // Now to perform funky shizzle // Switch to use UNIX slashes @@ -873,11 +875,12 @@ function phpbb_own_realpath($path) $path_prefix = ''; } } - else if (isset($_SERVER['SCRIPT_FILENAME']) && !empty($_SERVER['SCRIPT_FILENAME'])) + else if ($request->server('SCRIPT_FILENAME')) { // Warning: If chdir() has been used this will lie! // Warning: This has some problems sometime (CLI can create them easily) - $path = str_replace(DIRECTORY_SEPARATOR, '/', dirname($_SERVER['SCRIPT_FILENAME'])) . '/' . $path; + $filename = htmlspecialchars_decode($request->server('SCRIPT_FILENAME')); + $path = str_replace(DIRECTORY_SEPARATOR, '/', dirname($filename)) . '/' . $path; $absolute = true; $path_prefix = ''; } @@ -2097,10 +2100,10 @@ function append_sid($url, $params = false, $is_amp = true, $session_id = false) */ function generate_board_url($without_script_path = false) { - global $config, $user; + global $config, $user, $request; $server_name = $user->host; - $server_port = (!empty($_SERVER['SERVER_PORT'])) ? (int) $_SERVER['SERVER_PORT'] : (int) getenv('SERVER_PORT'); + $server_port = $request->server('SERVER_PORT', 0); // Forcing server vars is the only way to specify/override the protocol if ($config['force_server_vars'] || !$server_name) @@ -2116,7 +2119,7 @@ function generate_board_url($without_script_path = false) else { // Do not rely on cookie_secure, users seem to think that it means a secured cookie instead of an encrypted connection - $cookie_secure = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 1 : 0; + $cookie_secure = $request->is_secure() ? 1 : 0; $url = (($cookie_secure) ? 'https://' : 'http://') . $server_name; $script_path = $user->page['root_script_path']; @@ -2468,6 +2471,8 @@ function meta_refresh($time, $url, $disable_cd_check = false) */ function send_status_line($code, $message) { + global $request; + if (substr(strtolower(@php_sapi_name()), 0, 3) === 'cgi') { // in theory, we shouldn't need that due to php doing it. Reality offers a differing opinion, though @@ -2475,9 +2480,9 @@ function send_status_line($code, $message) } else { - if (!empty($_SERVER['SERVER_PROTOCOL'])) + if ($request->server('SERVER_PROTOCOL')) { - $version = $_SERVER['SERVER_PROTOCOL']; + $version = $request->server('SERVER_PROTOCOL'); } else { @@ -4196,7 +4201,7 @@ function phpbb_optionset($bit, $set, $data) */ function phpbb_http_login($param) { - global $auth, $user; + global $auth, $user, $request; global $config; $param_defaults = array( @@ -4236,9 +4241,9 @@ function phpbb_http_login($param) $username = null; foreach ($username_keys as $k) { - if (isset($_SERVER[$k])) + if ($request->is_set($k, phpbb_request_interface::SERVER)) { - $username = $_SERVER[$k]; + $username = htmlspecialchars_decode($request->server($k)); break; } } @@ -4246,9 +4251,9 @@ function phpbb_http_login($param) $password = null; foreach ($password_keys as $k) { - if (isset($_SERVER[$k])) + if ($request->is_set($k, phpbb_request_interface::SERVER)) { - $password = $_SERVER[$k]; + $password = htmlspecialchars_decode($request->server($k)); break; } } |