phpBB

Code Changes

File: phpbb/request/request.php

  Unmodified   Added   Modified   Removed
Line 222Line 222
	public function untrimmed_variable($var_name, $default, $multibyte = false, $super_global = \phpbb\request\request_interface::REQUEST)
{
return $this->_variable($var_name, $default, $multibyte, $super_global, false);

	public function untrimmed_variable($var_name, $default, $multibyte = false, $super_global = \phpbb\request\request_interface::REQUEST)
{
return $this->_variable($var_name, $default, $multibyte, $super_global, false);

 
	}

/**
* {@inheritdoc}
*/
public function raw_variable($var_name, $default, $super_global = \phpbb\request\request_interface::REQUEST)
{
$path = false;

// deep direct access to multi dimensional arrays
if (is_array($var_name))
{
$path = $var_name;
// make sure at least the variable name is specified
if (empty($path))
{
return (is_array($default)) ? array() : $default;
}
// the variable name is the first element on the path
$var_name = array_shift($path);
}

if (!isset($this->input[$super_global][$var_name]))
{
return (is_array($default)) ? array() : $default;
}
$var = $this->input[$super_global][$var_name];

if ($path)
{
// walk through the array structure and find the element we are looking for
foreach ($path as $key)
{
if (is_array($var) && isset($var[$key]))
{
$var = $var[$key];
}
else
{
return (is_array($default)) ? array() : $default;
}
}
}

return $var;

	}

/**

	}

/**

Line 275Line 320
	*/
public function file($form_name)
{

	*/
public function file($form_name)
{

		return $this->variable($form_name, array('name' => 'none'), false, \phpbb\request\request_interface::FILES);

		return $this->variable($form_name, array('name' => 'none'), true, \phpbb\request\request_interface::FILES);

	}

/**

	}

/**

Line 325Line 370
	*/
public function is_secure()
{

	*/
public function is_secure()
{

		return $this->server('HTTPS') == 'on';



		$https = $this->server('HTTPS');
$https = $this->server('HTTP_X_FORWARDED_PROTO') === 'https' ? 'on' : $https;
return !empty($https) && $https !== 'off';

	}

/**

	}

/**

Line 367Line 414
	*/
protected function _variable($var_name, $default, $multibyte = false, $super_global = \phpbb\request\request_interface::REQUEST, $trim = true)
{

	*/
protected function _variable($var_name, $default, $multibyte = false, $super_global = \phpbb\request\request_interface::REQUEST, $trim = true)
{

		$path = false;

		$var = $this->raw_variable($var_name, $default, $super_global);





		// deep direct access to multi dimensional arrays
if (is_array($var_name))



		// Return prematurely if raw variable is empty array or the same as
// the default. Using strict comparison to ensure that one can't
// prevent proper type checking on any input variable
if ($var === array() || $var === $default)

		{

		{

			$path = $var_name;
// make sure at least the variable name is specified
if (empty($path))
{
return (is_array($default)) ? array() : $default;

			return $var;





			}

			}

			// the variable name is the first element on the path
$var_name = array_shift($path);




$this->type_cast_helper->recursive_set_var($var, $default, $multibyte, $trim);

return $var;

		}


		}


		if (!isset($this->input[$super_global][$var_name]))




	/**
* {@inheritdoc}
*/
public function get_super_global($super_global = \phpbb\request\request_interface::REQUEST)

		{

		{

			return (is_array($default)) ? array() : $default;

		return $this->input[$super_global];

		}

		}

		$var = $this->input[$super_global][$var_name];

 




		if ($path)




	/**
* {@inheritdoc}
*/
public function escape($var, $multibyte)

		{

		{

			// walk through the array structure and find the element we are looking for
foreach ($path as $key)

		if (is_array($var))


			{

			{

				if (is_array($var) && isset($var[$key]))


			$result = array();
foreach ($var as $key => $value)

				{

				{

					$var = $var[$key];




				$this->type_cast_helper->set_var($key, $key, gettype($key), $multibyte);
$result[$key] = $this->escape($value, $multibyte);
}
$var = $result;

				}
else
{

				}
else
{

					return (is_array($default)) ? array() : $default;
}
}

			$this->type_cast_helper->set_var($var, $var, 'string', $multibyte);



		}

		}


$this->type_cast_helper->recursive_set_var($var, $default, $multibyte, $trim);

 

return $var;


return $var;

	}

/**
* {@inheritdoc}
*/
public function get_super_global($super_global = \phpbb\request\request_interface::REQUEST)
{
return $this->input[$super_global];

 
	}
}


	}
}