aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB
diff options
context:
space:
mode:
authorMarc Alexander <admin@m-a-styles.de>2015-06-02 15:24:38 +0200
committerMarc Alexander <admin@m-a-styles.de>2015-09-09 08:27:53 +0200
commit47f8f2cc88bdcd40087c8e391be1d33d36a2d308 (patch)
treefe55b0eaadda185cc8b3517b9669f7c849ac7d35 /phpBB
parent697ac5f4aa151b06ed65f8352652443bf297682a (diff)
downloadforums-47f8f2cc88bdcd40087c8e391be1d33d36a2d308.tar
forums-47f8f2cc88bdcd40087c8e391be1d33d36a2d308.tar.gz
forums-47f8f2cc88bdcd40087c8e391be1d33d36a2d308.tar.bz2
forums-47f8f2cc88bdcd40087c8e391be1d33d36a2d308.tar.xz
forums-47f8f2cc88bdcd40087c8e391be1d33d36a2d308.zip
[ticket/13904] Pass request service to upload instead of using global
PHPBB3-13904
Diffstat (limited to 'phpBB')
-rw-r--r--phpBB/config/default/container/services_files.yml1
-rw-r--r--phpBB/phpbb/files/upload.php23
2 files changed, 14 insertions, 10 deletions
diff --git a/phpBB/config/default/container/services_files.yml b/phpBB/config/default/container/services_files.yml
index aabb5583d1..f780441b65 100644
--- a/phpBB/config/default/container/services_files.yml
+++ b/phpBB/config/default/container/services_files.yml
@@ -23,3 +23,4 @@ services:
- @filesystem
- @files.factory
- @language
+ - @request
diff --git a/phpBB/phpbb/files/upload.php b/phpBB/phpbb/files/upload.php
index e37f90e820..e62c29883a 100644
--- a/phpBB/phpbb/files/upload.php
+++ b/phpBB/phpbb/files/upload.php
@@ -13,7 +13,10 @@
namespace phpbb\files;
+use \phpbb\filesystem\filesystem_interface;
use \phpbb\language\language;
+use \phpbb\plupload\plupload;
+use \phpbb\request\request_interface;
/**
* File upload class
@@ -57,18 +60,23 @@ class upload
/** @var \phpbb\language\language Language class */
protected $language;
+ /** @var \phpbb\request\request_interface Request class */
+ protected $request;
+
/**
* Init file upload class.
*
* @param \phpbb\filesystem\filesystem_interface $filesystem
* @param \phpbb\files\factory $factory Files factory
* @param \phpbb\language\language $language Language class
+ * @param \phpbb\request\request_interface $request Request class
*/
- public function __construct(\phpbb\filesystem\filesystem_interface $filesystem, factory $factory, language $language)
+ public function __construct(filesystem_interface $filesystem, factory $factory, language $language, request_interface $request)
{
$this->filesystem = $filesystem;
$this->factory = $factory;
$this->language = $language;
+ $this->request = $request;
}
/**
@@ -178,11 +186,9 @@ class upload
* @return filespec $file Object "filespec" is returned, all further operations can be done with this object
* @access public
*/
- function form_upload($form_name, \phpbb\plupload\plupload $plupload = null)
+ function form_upload($form_name, plupload $plupload = null)
{
- global $request;
-
- $upload = $request->file($form_name);
+ $upload = $this->request->file($form_name);
unset($upload['local_mode']);
if ($plupload)
@@ -264,8 +270,6 @@ class upload
*/
function local_upload($source_file, $filedata = false)
{
- global $request;
-
$upload = array();
$upload['local_mode'] = true;
@@ -331,7 +335,7 @@ class upload
}
$this->common_checks($file);
- $request->overwrite('local', $upload, \phpbb\request\request_interface::FILES);
+ $this->request->overwrite('local', $upload, request_interface::FILES);
return $file;
}
@@ -657,8 +661,7 @@ class upload
*/
function is_valid($form_name)
{
- global $request;
- $upload = $request->file($form_name);
+ $upload = $this->request->file($form_name);
return (!empty($upload) && $upload['name'] !== 'none');
}