mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-31 05:50:42 +02:00
[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
This commit is contained in:
@@ -333,7 +333,7 @@ class messenger
|
||||
*/
|
||||
function error($type, $msg)
|
||||
{
|
||||
global $user, $phpEx, $phpbb_root_path, $config;
|
||||
global $user, $phpEx, $phpbb_root_path, $config, $request;
|
||||
|
||||
// Session doesn't exist, create it
|
||||
if (!isset($user->session_id) || $user->session_id === '')
|
||||
@@ -341,7 +341,7 @@ class messenger
|
||||
$user->session_begin();
|
||||
}
|
||||
|
||||
$calling_page = (!empty($_SERVER['PHP_SELF'])) ? $_SERVER['PHP_SELF'] : $_ENV['PHP_SELF'];
|
||||
$calling_page = $request->server('PHP_SELF');
|
||||
|
||||
$message = '';
|
||||
switch ($type)
|
||||
|
Reference in New Issue
Block a user