aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/install/index.php
diff options
context:
space:
mode:
authorIgor Wiedler <igor@wiedler.ch>2011-07-13 19:20:16 +0200
committerIgor Wiedler <igor@wiedler.ch>2011-07-15 22:34:24 +0200
commit0bf6966c5228d446c4f0d3862619db0f619c7369 (patch)
tree3f8adfb570262a9296e7a4fdb191804bfde7a4c0 /phpBB/install/index.php
parent09e0460e5b53f83f4c06703c8bd8f1cb0f22eb48 (diff)
downloadforums-0bf6966c5228d446c4f0d3862619db0f619c7369.tar
forums-0bf6966c5228d446c4f0d3862619db0f619c7369.tar.gz
forums-0bf6966c5228d446c4f0d3862619db0f619c7369.tar.bz2
forums-0bf6966c5228d446c4f0d3862619db0f619c7369.tar.xz
forums-0bf6966c5228d446c4f0d3862619db0f619c7369.zip
[feature/request-class] Add server(), header() and is_ajax() to request
Extend the request class with helpers for reading server vars (server()) and HTTP request headers (header()). Refactor the existing code base to make use of these helpers, make $_SERVER a deactivated super global. Also introduce an is_ajax() method, which checks the X-Requested-With header for the value 'XMLHttpRequest', which is sent by JavaScript libraries, such as jQuery. PHPBB3-9716
Diffstat (limited to 'phpBB/install/index.php')
-rw-r--r--phpBB/install/index.php16
1 files changed, 9 insertions, 7 deletions
diff --git a/phpBB/install/index.php b/phpBB/install/index.php
index e8a63e857e..9928638fc4 100644
--- a/phpBB/install/index.php
+++ b/phpBB/install/index.php
@@ -100,9 +100,9 @@ request_var('', 0, false, false, $request); // "dependency injection" for a func
// Try and load an appropriate language if required
$language = basename(request_var('language', ''));
-if (!empty($_SERVER['HTTP_ACCEPT_LANGUAGE']) && !$language)
+if ($request->header('Accept-Language') && !$language)
{
- $accept_lang_ary = explode(',', strtolower($_SERVER['HTTP_ACCEPT_LANGUAGE']));
+ $accept_lang_ary = explode(',', strtolower($request->header('Accept-Language')));
foreach ($accept_lang_ary as $accept_lang)
{
// Set correct format ... guess full xx_yy form
@@ -428,15 +428,17 @@ class module
*/
function redirect($page)
{
+ global $request;
+
// HTTP_HOST is having the correct browser url in most cases...
- $server_name = (!empty($_SERVER['HTTP_HOST'])) ? strtolower($_SERVER['HTTP_HOST']) : ((!empty($_SERVER['SERVER_NAME'])) ? $_SERVER['SERVER_NAME'] : getenv('SERVER_NAME'));
- $server_port = (!empty($_SERVER['SERVER_PORT'])) ? (int) $_SERVER['SERVER_PORT'] : (int) getenv('SERVER_PORT');
- $secure = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 1 : 0;
+ $server_name = strtolower($request->header('Host', $request->server('SERVER_NAME')));
+ $server_port = $request->server('SERVER_PORT', 0);
+ $secure = ($request->server('HTTPS') == 'on') ? 1 : 0;
- $script_name = (!empty($_SERVER['PHP_SELF'])) ? $_SERVER['PHP_SELF'] : getenv('PHP_SELF');
+ $script_name = $request->server('PHP_SELF');
if (!$script_name)
{
- $script_name = (!empty($_SERVER['REQUEST_URI'])) ? $_SERVER['REQUEST_URI'] : getenv('REQUEST_URI');
+ $script_name = $request->server('REQUEST_URI');
}
// Replace backslashes and doubled slashes (could happen on some proxy setups)