1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-10 02:36:38 +02:00

Merge remote-tracking branch 'github-marc1706/ticket/11148' into develop-ascraeus

* github-marc1706/ticket/11148:
  [ticket/11148] Remove unneeded variable mimetype and use type octet-stream
  [ticket/11148] Change expected output with disallowed content in test
  [ticket/11148] Always use the output of the mimetype guesser in get_mimetype
  [ticket/11148] Get rid of extra line in mimetype guesser setter doc block
  [ticket/11148] Add missing parts to docblock of get_mimetype() method
  [ticket/11148] Default to application/octet-stream if no mimetype given
  [ticket/11148] Use mimetype guesser for uploaded avatars
  [ticket/11148] Pass mimetype guesser to upload_attachment() function
  [ticket/11148] Add mimetype guesser to filespec and fileupload class
This commit is contained in:
Nils Adermann
2014-08-07 12:06:33 +02:00
9 changed files with 134 additions and 44 deletions

View File

@@ -18,6 +18,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}
*/
@@ -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
{