phpBB API Documentation
Interface

phpbb\request\request_interface

interface request_interface

An interface through which all application input can be accessed.

Constants

POST

GET

REQUEST

COOKIE

SERVER

FILES

Methods

overwrite($var_name, $value, $super_global = \phpbb\request\request_interface::REQUEST)

This function allows overwriting or setting a value in one of the super global arrays.

variable($var_name, $default, $multibyte = false, $super_global = \phpbb\request\request_interface::REQUEST)

Central type safe input handling function.

raw_variable($var_name, $default, $super_global = \phpbb\request\request_interface::REQUEST)

Get a variable without trimming strings and without escaping.

server($var_name, $default = '')

Shortcut method to retrieve SERVER variables.

header($var_name, $default = '')

Shortcut method to retrieve the value of client HTTP headers.

is_set_post($name)

Checks whether a certain variable was sent via POST.

is_set($var, $super_global = \phpbb\request\request_interface::REQUEST)

Checks whether a certain variable is set in one of the super global arrays.

is_ajax()

Checks whether the current request is an AJAX request (XMLHttpRequest)

is_secure()

Checks if the current request is happening over HTTPS.

variable_names($super_global = \phpbb\request\request_interface::REQUEST)

Returns all variable names for a given super global

get_super_global($super_global = \phpbb\request\request_interface::REQUEST)

Returns the original array of the requested super global

string|array escape(mixed $value, bool $multibyte)

Escape a string variable.

Details

at line 45
public overwrite($var_name, $value, $super_global = \phpbb\request\request_interface::REQUEST)

This function allows overwriting or setting a value in one of the super global arrays.

Changes which are performed on the super globals directly will not have any effect on the results of other methods this class provides. Using this function should be avoided if possible! It will consume twice the the amount of memory of the value

Parameters

$var_name
$value
$super_global

at line 65
public variable($var_name, $default, $multibyte = false, $super_global = \phpbb\request\request_interface::REQUEST)

Central type safe input handling function.

All variables in GET or POST requests should be retrieved through this function to maximise security.

Parameters

$var_name
$default
$multibyte
$super_global

at line 87
public raw_variable($var_name, $default, $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.

Parameters

$var_name
$default
$super_global

at line 97
public server($var_name, $default = '')

Shortcut method to retrieve SERVER variables.

Parameters

$var_name
$default

at line 107
public header($var_name, $default = '')

Shortcut method to retrieve the value of client HTTP headers.

Parameters

$var_name
$default

at line 119
public is_set_post($name)

Checks whether a certain variable was sent via POST.

To make sure that a request was sent using POST you should call this function on at least one variable.

Parameters

$name

at line 131
public is_set($var, $super_global = \phpbb\request\request_interface::REQUEST)

Checks whether a certain variable is set in one of the super global arrays.

Parameters

$var
$super_global

at line 138
public is_ajax()

Checks whether the current request is an AJAX request (XMLHttpRequest)

at line 145
public is_secure()

Checks if the current request is happening over HTTPS.

at line 156
public variable_names($super_global = \phpbb\request\request_interface::REQUEST)

Returns all variable names for a given super global

Parameters

$super_global

at line 166
public get_super_global($super_global = \phpbb\request\request_interface::REQUEST)

Returns the original array of the requested super global

Parameters

$super_global

at line 176
public string|array escape(mixed $value, bool $multibyte)

Escape a string variable.

Parameters

mixed $value The contents to fill with
bool $multibyte Indicates whether string values may contain UTF-8 characters. Default is false, causing all bytes outside the ASCII range (0-127) to be replaced with question marks.

Return Value

string|array