mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-30 21:40:43 +02:00
[ticket/11700] Modify all code to use the new interface names
PHPBB3-11700
This commit is contained in:
@@ -29,23 +29,23 @@ class phpbb_request_deactivated_super_global implements ArrayAccess, Countable,
|
||||
private $name;
|
||||
|
||||
/**
|
||||
* @var phpbb_request_interface::POST|GET|REQUEST|COOKIE Super global constant.
|
||||
* @var phpbb_request_request_interface::POST|GET|REQUEST|COOKIE Super global constant.
|
||||
*/
|
||||
private $super_global;
|
||||
|
||||
/**
|
||||
* @var phpbb_request_interface The request class instance holding the actual request data.
|
||||
* @var phpbb_request_request_interface The request class instance holding the actual request data.
|
||||
*/
|
||||
private $request;
|
||||
|
||||
/**
|
||||
* Constructor generates an error message fitting the super global to be used within the other functions.
|
||||
*
|
||||
* @param phpbb_request_interface $request A request class instance holding the real super global data.
|
||||
* @param phpbb_request_request_interface $request A request class instance holding the real super global data.
|
||||
* @param string $name Name of the super global this is a replacement for - e.g. '_GET'.
|
||||
* @param phpbb_request_interface::POST|GET|REQUEST|COOKIE $super_global The variable's super global constant.
|
||||
* @param phpbb_request_request_interface::POST|GET|REQUEST|COOKIE $super_global The variable's super global constant.
|
||||
*/
|
||||
public function __construct(phpbb_request_interface $request, $name, $super_global)
|
||||
public function __construct(phpbb_request_request_interface $request, $name, $super_global)
|
||||
{
|
||||
$this->request = $request;
|
||||
$this->name = $name;
|
||||
|
@@ -23,18 +23,18 @@ if (!defined('IN_PHPBB'))
|
||||
*
|
||||
* @package phpbb_request
|
||||
*/
|
||||
class phpbb_request implements phpbb_request_interface
|
||||
class phpbb_request implements phpbb_request_request_interface
|
||||
{
|
||||
/**
|
||||
* @var array The names of super global variables that this class should protect if super globals are disabled.
|
||||
*/
|
||||
protected $super_globals = array(
|
||||
phpbb_request_interface::POST => '_POST',
|
||||
phpbb_request_interface::GET => '_GET',
|
||||
phpbb_request_interface::REQUEST => '_REQUEST',
|
||||
phpbb_request_interface::COOKIE => '_COOKIE',
|
||||
phpbb_request_interface::SERVER => '_SERVER',
|
||||
phpbb_request_interface::FILES => '_FILES',
|
||||
phpbb_request_request_interface::POST => '_POST',
|
||||
phpbb_request_request_interface::GET => '_GET',
|
||||
phpbb_request_request_interface::REQUEST => '_REQUEST',
|
||||
phpbb_request_request_interface::COOKIE => '_COOKIE',
|
||||
phpbb_request_request_interface::SERVER => '_SERVER',
|
||||
phpbb_request_request_interface::FILES => '_FILES',
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -78,8 +78,8 @@ class phpbb_request implements phpbb_request_interface
|
||||
}
|
||||
|
||||
// simulate request_order = GP
|
||||
$this->original_request = $this->input[phpbb_request_interface::REQUEST];
|
||||
$this->input[phpbb_request_interface::REQUEST] = $this->input[phpbb_request_interface::POST] + $this->input[phpbb_request_interface::GET];
|
||||
$this->original_request = $this->input[phpbb_request_request_interface::REQUEST];
|
||||
$this->input[phpbb_request_request_interface::REQUEST] = $this->input[phpbb_request_request_interface::POST] + $this->input[phpbb_request_request_interface::GET];
|
||||
|
||||
if ($disable_super_globals)
|
||||
{
|
||||
@@ -144,10 +144,10 @@ class phpbb_request implements phpbb_request_interface
|
||||
* @param string $var_name The name of the variable that shall be overwritten
|
||||
* @param mixed $value The value which the variable shall contain.
|
||||
* If this is null the variable will be unset.
|
||||
* @param phpbb_request_interface::POST|GET|REQUEST|COOKIE $super_global
|
||||
* @param phpbb_request_request_interface::POST|GET|REQUEST|COOKIE $super_global
|
||||
* Specifies which super global shall be changed
|
||||
*/
|
||||
public function overwrite($var_name, $value, $super_global = phpbb_request_interface::REQUEST)
|
||||
public function overwrite($var_name, $value, $super_global = phpbb_request_request_interface::REQUEST)
|
||||
{
|
||||
if (!isset($this->super_globals[$super_global]))
|
||||
{
|
||||
@@ -193,13 +193,13 @@ class phpbb_request implements phpbb_request_interface
|
||||
* This function will always return a value of the same type as the default.
|
||||
* @param bool $multibyte If $default is a string this paramater has to be true if the variable may contain any UTF-8 characters
|
||||
* Default is false, causing all bytes outside the ASCII range (0-127) to be replaced with question marks
|
||||
* @param phpbb_request_interface::POST|GET|REQUEST|COOKIE $super_global
|
||||
* @param phpbb_request_request_interface::POST|GET|REQUEST|COOKIE $super_global
|
||||
* Specifies which super global should be used
|
||||
*
|
||||
* @return mixed The value of $_REQUEST[$var_name] run through {@link set_var set_var} to ensure that the type is the
|
||||
* the same as that of $default. If the variable is not set $default is returned.
|
||||
*/
|
||||
public function variable($var_name, $default, $multibyte = false, $super_global = phpbb_request_interface::REQUEST)
|
||||
public function variable($var_name, $default, $multibyte = false, $super_global = phpbb_request_request_interface::REQUEST)
|
||||
{
|
||||
return $this->_variable($var_name, $default, $multibyte, $super_global, true);
|
||||
}
|
||||
@@ -217,13 +217,13 @@ class phpbb_request implements phpbb_request_interface
|
||||
* This function will always return a value of the same type as the default.
|
||||
* @param bool $multibyte If $default is a string this paramater has to be true if the variable may contain any UTF-8 characters
|
||||
* Default is false, causing all bytes outside the ASCII range (0-127) to be replaced with question marks
|
||||
* @param phpbb_request_interface::POST|GET|REQUEST|COOKIE $super_global
|
||||
* @param phpbb_request_request_interface::POST|GET|REQUEST|COOKIE $super_global
|
||||
* Specifies which super global should be used
|
||||
*
|
||||
* @return mixed The value of $_REQUEST[$var_name] run through {@link set_var set_var} to ensure that the type is the
|
||||
* the same as that of $default. If the variable is not set $default is returned.
|
||||
*/
|
||||
public function untrimmed_variable($var_name, $default, $multibyte, $super_global = phpbb_request_interface::REQUEST)
|
||||
public function untrimmed_variable($var_name, $default, $multibyte, $super_global = phpbb_request_request_interface::REQUEST)
|
||||
{
|
||||
return $this->_variable($var_name, $default, $multibyte, $super_global, false);
|
||||
}
|
||||
@@ -234,8 +234,8 @@ class phpbb_request implements phpbb_request_interface
|
||||
* Also fall back to getenv(), some CGI setups may need it (probably not, but
|
||||
* whatever).
|
||||
*
|
||||
* @param string|array $var_name See phpbb_request_interface::variable
|
||||
* @param mixed $Default See phpbb_request_interface::variable
|
||||
* @param string|array $var_name See phpbb_request_request_interface::variable
|
||||
* @param mixed $Default See phpbb_request_request_interface::variable
|
||||
*
|
||||
* @return mixed The server variable value.
|
||||
*/
|
||||
@@ -243,9 +243,9 @@ class phpbb_request implements phpbb_request_interface
|
||||
{
|
||||
$multibyte = true;
|
||||
|
||||
if ($this->is_set($var_name, phpbb_request_interface::SERVER))
|
||||
if ($this->is_set($var_name, phpbb_request_request_interface::SERVER))
|
||||
{
|
||||
return $this->variable($var_name, $default, $multibyte, phpbb_request_interface::SERVER);
|
||||
return $this->variable($var_name, $default, $multibyte, phpbb_request_request_interface::SERVER);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -259,7 +259,7 @@ class phpbb_request implements phpbb_request_interface
|
||||
* Shortcut method to retrieve the value of client HTTP headers.
|
||||
*
|
||||
* @param string|array $header_name The name of the header to retrieve.
|
||||
* @param mixed $default See phpbb_request_interface::variable
|
||||
* @param mixed $default See phpbb_request_request_interface::variable
|
||||
*
|
||||
* @return mixed The header value.
|
||||
*/
|
||||
@@ -279,7 +279,7 @@ class phpbb_request implements phpbb_request_interface
|
||||
*/
|
||||
public function file($form_name)
|
||||
{
|
||||
return $this->variable($form_name, array('name' => 'none'), false, phpbb_request_interface::FILES);
|
||||
return $this->variable($form_name, array('name' => 'none'), false, phpbb_request_request_interface::FILES);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -294,7 +294,7 @@ class phpbb_request implements phpbb_request_interface
|
||||
*/
|
||||
public function is_set_post($name)
|
||||
{
|
||||
return $this->is_set($name, phpbb_request_interface::POST);
|
||||
return $this->is_set($name, phpbb_request_request_interface::POST);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -302,12 +302,12 @@ class phpbb_request implements phpbb_request_interface
|
||||
* arrays.
|
||||
*
|
||||
* @param string $var Name of the variable
|
||||
* @param phpbb_request_interface::POST|GET|REQUEST|COOKIE $super_global
|
||||
* @param phpbb_request_request_interface::POST|GET|REQUEST|COOKIE $super_global
|
||||
* Specifies the super global which shall be checked
|
||||
*
|
||||
* @return bool True if the variable was sent as input
|
||||
*/
|
||||
public function is_set($var, $super_global = phpbb_request_interface::REQUEST)
|
||||
public function is_set($var, $super_global = phpbb_request_request_interface::REQUEST)
|
||||
{
|
||||
return isset($this->input[$super_global][$var]);
|
||||
}
|
||||
@@ -335,13 +335,13 @@ class phpbb_request implements phpbb_request_interface
|
||||
/**
|
||||
* Returns all variable names for a given super global
|
||||
*
|
||||
* @param phpbb_request_interface::POST|GET|REQUEST|COOKIE $super_global
|
||||
* @param phpbb_request_request_interface::POST|GET|REQUEST|COOKIE $super_global
|
||||
* The super global from which names shall be taken
|
||||
*
|
||||
* @return array All variable names that are set for the super global.
|
||||
* Pay attention when using these, they are unsanitised!
|
||||
*/
|
||||
public function variable_names($super_global = phpbb_request_interface::REQUEST)
|
||||
public function variable_names($super_global = phpbb_request_request_interface::REQUEST)
|
||||
{
|
||||
if (!isset($this->input[$super_global]))
|
||||
{
|
||||
@@ -362,14 +362,14 @@ class phpbb_request implements phpbb_request_interface
|
||||
* This function will always return a value of the same type as the default.
|
||||
* @param bool $multibyte If $default is a string this paramater has to be true if the variable may contain any UTF-8 characters
|
||||
* Default is false, causing all bytes outside the ASCII range (0-127) to be replaced with question marks
|
||||
* @param phpbb_request_interface::POST|GET|REQUEST|COOKIE $super_global
|
||||
* @param phpbb_request_request_interface::POST|GET|REQUEST|COOKIE $super_global
|
||||
* Specifies which super global should be used
|
||||
* @param bool $trim Indicates whether trim() should be applied to string values.
|
||||
*
|
||||
* @return mixed The value of $_REQUEST[$var_name] run through {@link set_var set_var} to ensure that the type is the
|
||||
* the same as that of $default. If the variable is not set $default is returned.
|
||||
*/
|
||||
protected function _variable($var_name, $default, $multibyte = false, $super_global = phpbb_request_interface::REQUEST, $trim = true)
|
||||
protected function _variable($var_name, $default, $multibyte = false, $super_global = phpbb_request_request_interface::REQUEST, $trim = true)
|
||||
{
|
||||
$path = false;
|
||||
|
||||
|
@@ -43,10 +43,10 @@ interface phpbb_request_request_interface
|
||||
* @param string $var_name The name of the variable that shall be overwritten
|
||||
* @param mixed $value The value which the variable shall contain.
|
||||
* If this is null the variable will be unset.
|
||||
* @param phpbb_request_interface::POST|GET|REQUEST|COOKIE $super_global
|
||||
* @param phpbb_request_request_interface::POST|GET|REQUEST|COOKIE $super_global
|
||||
* Specifies which super global shall be changed
|
||||
*/
|
||||
public function overwrite($var_name, $value, $super_global = phpbb_request_interface::REQUEST);
|
||||
public function overwrite($var_name, $value, $super_global = phpbb_request_request_interface::REQUEST);
|
||||
|
||||
/**
|
||||
* Central type safe input handling function.
|
||||
@@ -60,19 +60,19 @@ interface phpbb_request_request_interface
|
||||
* This function will always return a value of the same type as the default.
|
||||
* @param bool $multibyte If $default is a string this paramater has to be true if the variable may contain any UTF-8 characters
|
||||
* Default is false, causing all bytes outside the ASCII range (0-127) to be replaced with question marks
|
||||
* @param phpbb_request_interface::POST|GET|REQUEST|COOKIE $super_global
|
||||
* @param phpbb_request_request_interface::POST|GET|REQUEST|COOKIE $super_global
|
||||
* Specifies which super global should be used
|
||||
*
|
||||
* @return mixed The value of $_REQUEST[$var_name] run through {@link set_var set_var} to ensure that the type is the
|
||||
* the same as that of $default. If the variable is not set $default is returned.
|
||||
*/
|
||||
public function variable($var_name, $default, $multibyte = false, $super_global = phpbb_request_interface::REQUEST);
|
||||
public function variable($var_name, $default, $multibyte = false, $super_global = phpbb_request_request_interface::REQUEST);
|
||||
|
||||
/**
|
||||
* Shortcut method to retrieve SERVER variables.
|
||||
*
|
||||
* @param string|array $var_name See phpbb_request_interface::variable
|
||||
* @param mixed $default See phpbb_request_interface::variable
|
||||
* @param string|array $var_name See phpbb_request_request_interface::variable
|
||||
* @param mixed $default See phpbb_request_request_interface::variable
|
||||
*
|
||||
* @return mixed The server variable value.
|
||||
*/
|
||||
@@ -82,7 +82,7 @@ interface phpbb_request_request_interface
|
||||
* Shortcut method to retrieve the value of client HTTP headers.
|
||||
*
|
||||
* @param string|array $header_name The name of the header to retrieve.
|
||||
* @param mixed $default See phpbb_request_interface::variable
|
||||
* @param mixed $default See phpbb_request_request_interface::variable
|
||||
*
|
||||
* @return mixed The header value.
|
||||
*/
|
||||
@@ -105,12 +105,12 @@ interface phpbb_request_request_interface
|
||||
* arrays.
|
||||
*
|
||||
* @param string $var Name of the variable
|
||||
* @param phpbb_request_interface::POST|GET|REQUEST|COOKIE $super_global
|
||||
* @param phpbb_request_request_interface::POST|GET|REQUEST|COOKIE $super_global
|
||||
* Specifies the super global which shall be checked
|
||||
*
|
||||
* @return bool True if the variable was sent as input
|
||||
*/
|
||||
public function is_set($var, $super_global = phpbb_request_interface::REQUEST);
|
||||
public function is_set($var, $super_global = phpbb_request_request_interface::REQUEST);
|
||||
|
||||
/**
|
||||
* Checks whether the current request is an AJAX request (XMLHttpRequest)
|
||||
@@ -129,11 +129,11 @@ interface phpbb_request_request_interface
|
||||
/**
|
||||
* Returns all variable names for a given super global
|
||||
*
|
||||
* @param phpbb_request_interface::POST|GET|REQUEST|COOKIE $super_global
|
||||
* @param phpbb_request_request_interface::POST|GET|REQUEST|COOKIE $super_global
|
||||
* The super global from which names shall be taken
|
||||
*
|
||||
* @return array All variable names that are set for the super global.
|
||||
* Pay attention when using these, they are unsanitised!
|
||||
*/
|
||||
public function variable_names($super_global = phpbb_request_interface::REQUEST);
|
||||
public function variable_names($super_global = phpbb_request_request_interface::REQUEST);
|
||||
}
|
||||
|
Reference in New Issue
Block a user