diff options
author | Nathan Guse <nathaniel.guse@gmail.com> | 2013-09-13 09:52:02 -0500 |
---|---|---|
committer | Nathan Guse <nathaniel.guse@gmail.com> | 2013-09-13 09:52:02 -0500 |
commit | aa710df2db2512f6065f91dcf8b5fc7d100edf41 (patch) | |
tree | 89ae712128b68db41237e032315dcbf17dea1108 /phpBB/phpbb/symfony_request.php | |
parent | a194e6ce7afe373fcb89ab26b3d057f60d10fa3d (diff) | |
download | forums-aa710df2db2512f6065f91dcf8b5fc7d100edf41.tar forums-aa710df2db2512f6065f91dcf8b5fc7d100edf41.tar.gz forums-aa710df2db2512f6065f91dcf8b5fc7d100edf41.tar.bz2 forums-aa710df2db2512f6065f91dcf8b5fc7d100edf41.tar.xz forums-aa710df2db2512f6065f91dcf8b5fc7d100edf41.zip |
[ticket/11832] Create phpbb_symfony_request to handle initiating symfony_request
Now symfony_request is also a service (removed the function
phpbb_create_symfony_request).
Inject symfony request into filesystem
Cleanup for the tests
PHPBB3-11832
Diffstat (limited to 'phpBB/phpbb/symfony_request.php')
-rw-r--r-- | phpBB/phpbb/symfony_request.php | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/phpBB/phpbb/symfony_request.php b/phpBB/phpbb/symfony_request.php new file mode 100644 index 0000000000..29ab8c000e --- /dev/null +++ b/phpBB/phpbb/symfony_request.php @@ -0,0 +1,46 @@ +<?php +/** +* +* @package phpBB3 +* @copyright (c) 2013 phpBB Group +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* +*/ + +use Symfony\Component\HttpFoundation\Request; + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +class phpbb_symfony_request extends Request +{ + /** + * Constructor + * + * @param phpbb_request_interface $phpbb_request + */ + public function __construct(phpbb_request_interface $phpbb_request) + { + // This function is meant to sanitize the global input arrays + $sanitizer = function(&$value, $key) { + $type_cast_helper = new phpbb_request_type_cast_helper(); + $type_cast_helper->set_var($value, $value, gettype($value), true); + }; + + $get_parameters = $phpbb_request->get_super_global(phpbb_request_interface::GET); + $post_parameters = $phpbb_request->get_super_global(phpbb_request_interface::POST); + $server_parameters = $phpbb_request->get_super_global(phpbb_request_interface::SERVER); + $files_parameters = $phpbb_request->get_super_global(phpbb_request_interface::FILES); + $cookie_parameters = $phpbb_request->get_super_global(phpbb_request_interface::COOKIE); + + array_walk_recursive($get_parameters, $sanitizer); + array_walk_recursive($post_parameters, $sanitizer); + + parent::__construct($get_parameters, $post_parameters, array(), $cookie_parameters, $files_parameters, $server_parameters); + } +} |