aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB')
-rw-r--r--phpBB/config/avatars.yml1
-rw-r--r--phpBB/phpbb/avatar/driver/upload.php30
2 files changed, 29 insertions, 2 deletions
diff --git a/phpBB/config/avatars.yml b/phpBB/config/avatars.yml
index d22a5db2ae..8e5b1fdbfe 100644
--- a/phpBB/config/avatars.yml
+++ b/phpBB/config/avatars.yml
@@ -45,6 +45,7 @@ services:
- %core.root_path%
- %core.php_ext%
- @path_helper
+ - @mimetype.guesser
- @cache.driver
calls:
- [set_name, [avatar.driver.upload]]
diff --git a/phpBB/phpbb/avatar/driver/upload.php b/phpBB/phpbb/avatar/driver/upload.php
index c43004f340..edc5941602 100644
--- a/phpBB/phpbb/avatar/driver/upload.php
+++ b/phpBB/phpbb/avatar/driver/upload.php
@@ -19,6 +19,32 @@ namespace phpbb\avatar\driver;
class upload extends \phpbb\avatar\driver\driver
{
/**
+ * @var \phpbb\mimetype\guesser
+ */
+ protected $mimetype_guesser;
+
+ /**
+ * Construct a driver object
+ *
+ * @param \phpbb\config\config $config phpBB configuration
+ * @param \phpbb\request\request $request Request object
+ * @param string $phpbb_root_path Path to the phpBB root
+ * @param string $php_ext PHP file extension
+ * @param \phpbb_path_helper $path_helper phpBB path helper
+ * @param \phpbb\mimetype\guesser $mimetype_guesser Mimetype guesser
+ * @param \phpbb\cache\driver\driver_interface $cache Cache driver
+ */
+ public function __construct(\phpbb\config\config $config, $phpbb_root_path, $php_ext, \phpbb\path_helper $path_helper, \phpbb\mimetype\guesser $mimetype_guesser, \phpbb\cache\driver\driver_interface $cache = null)
+ {
+ $this->config = $config;
+ $this->phpbb_root_path = $phpbb_root_path;
+ $this->php_ext = $php_ext;
+ $this->path_helper = $path_helper;
+ $this->mimetype_guesser = $mimetype_guesser;
+ $this->cache = $cache;
+ }
+
+ /**
* {@inheritdoc}
*/
public function get_data($row, $ignore_config = false)
@@ -70,7 +96,7 @@ class upload extends \phpbb\avatar\driver\driver
if (!empty($upload_file['name']))
{
- $file = $upload->form_upload('avatar_upload_file');
+ $file = $upload->form_upload('avatar_upload_file', $this->mimetype_guesser);
}
else if (!empty($this->config['allow_avatar_remote_upload']) && !empty($url))
{
@@ -100,7 +126,7 @@ class upload extends \phpbb\avatar\driver\driver
return false;
}
- $file = $upload->remote_upload($url);
+ $file = $upload->remote_upload($url, $this->mimetype_guesser);
}
else
{