I did try in phpBB something like this:
Code: Select all
$this->request->variable(['translate']['file'], '');
Code: Select all
$_POST['translate']['file']
Code: Select all
$this->request->variable(['translate']['file'], '');
Code: Select all
$_POST['translate']['file']
Code: Select all
$language = $this->request->variable('language', array('into' => 'en'));
print_r($language['into']);
Code: Select all
es
Code: Select all
$language_into = $_POST['language']['into'];
$this->request->is_set_post('some_variable')
Withorynider wrote: ↑Tue Mar 20, 2018 3:01 pmI get:Code: Select all
$language = $this->request->variable('language', array('into' => 'en')); print_r($language['into']);
Code: Select all
es
Code: Select all
$language = $this->request->variable('language', array('into' => 'en'));
language[into]=es
, then you'll get Code: Select all
var_dump($language);
/* result:
array(1) {
["into"]=>
string(2) "es"
}
*/
language
parameter was not set, you will get the default value: Code: Select all
var_dump($language);
/* result:
array(1) {
["into"]=>
string(2) "en"
}
*/
phpbb\request\request
:
Code: Select all
/**
* Central type safe input handling function.
* All variables in GET or POST requests should be retrieved through this function to maximise security.
*
* @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 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\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\request_interface::REQUEST)