[ticket/14875] Move raw_variable() method to request_interface

PHPBB3-14875
This commit is contained in:
Marc Alexander 2016-12-02 11:36:07 +01:00
parent 08bf8812d3
commit 9bdd002f58
No known key found for this signature in database
GPG key ID: 50E0D2423696F995
4 changed files with 28 additions and 23 deletions

View file

@ -27,7 +27,7 @@ class ajax_iohandler extends iohandler_base
protected $path_helper;
/**
* @var \phpbb\request\request
* @var \phpbb\request\request_interface
*/
protected $request;
@ -90,12 +90,12 @@ class ajax_iohandler extends iohandler_base
* Constructor
*
* @param path_helper $path_helper
* @param \phpbb\request\request $request HTTP request interface
* @param \phpbb\request\request_interface $request HTTP request interface
* @param \phpbb\template\template $template Template engine
* @param router $router Router
* @param string $root_path Path to phpBB's root
*/
public function __construct(path_helper $path_helper, \phpbb\request\request $request, \phpbb\template\template $template, router $router, $root_path)
public function __construct(path_helper $path_helper, \phpbb\request\request_interface $request, \phpbb\template\template $template, router $router, $root_path)
{
$this->path_helper = $path_helper;
$this->request = $request;

View file

@ -52,7 +52,7 @@ interface iohandler_interface
/**
* Returns server variable
*
* This function should work the same as request_interterface::server().
* This function should work the same as request_interface::server().
*
* @param string $name Name of the server variable
* @param mixed $default Default value to return when the requested variable does not exist
@ -62,7 +62,7 @@ interface iohandler_interface
public function get_server_variable($name, $default = '');
/**
* Wrapper function for request_interterface::header()
* Wrapper function for request_interface::header()
*
* @param string $name Name of the request header variable
* @param mixed $default Default value to return when the requested variable does not exist

View file

@ -225,24 +225,7 @@ class request implements \phpbb\request\request_interface
}
/**
* Get a variable without trimming strings and without escaping.
* This method MUST NOT be used with queries.
* Same functionality as variable(), except does not run trim() on strings
* and does not escape input.
* This method should only be used when the raw input is needed without
* any escaping, i.e. for database password during the installation.
*
* @param string|array $var_name The form variable's name from which data shall be retrieved.
* If the value is an array this may be an array of indizes which will give
* direct access to a value at any depth. E.g. if the value of "var" is array(1 => "a")
* then specifying array("var", 1) as the name will return "a".
* @param mixed $default A default value that is returned if the variable was not set.
* This function will always return a value of the same type as the default.
* @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.
* {@inheritdoc}
*/
public function raw_variable($var_name, $default, $super_global = \phpbb\request\request_interface::REQUEST)
{

View file

@ -64,6 +64,28 @@ interface request_interface
*/
public function variable($var_name, $default, $multibyte = false, $super_global = \phpbb\request\request_interface::REQUEST);
/**
* Get a variable without trimming strings and without escaping.
* This method MUST NOT be used with queries.
* Same functionality as variable(), except does not run trim() on strings
* and does not escape input.
* This method should only be used when the raw input is needed without
* any escaping, i.e. for database password during the installation.
*
* @param string|array $var_name The form variable's name from which data shall be retrieved.
* If the value is an array this may be an array of indizes which will give
* direct access to a value at any depth. E.g. if the value of "var" is array(1 => "a")
* then specifying array("var", 1) as the name will return "a".
* @param mixed $default A default value that is returned if the variable was not set.
* This function will always return a value of the same type as the default.
* @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 raw_variable($var_name, $default, $super_global = \phpbb\request\request_interface::REQUEST);
/**
* Shortcut method to retrieve SERVER variables.
*