1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-30 21:40:43 +02:00

[ticket/11912] Integrate mimetype guesser with plupload

PHPBB3-11912
This commit is contained in:
Marc Alexander
2013-10-23 18:34:06 +02:00
parent d612041cd1
commit 789d493595
3 changed files with 33 additions and 2 deletions

View File

@@ -49,6 +49,11 @@ class plupload
*/
protected $php_ini;
/**
* @var \phpbb\mimetype\guesser
*/
protected $mimetype_guesser;
/**
* Final destination for uploaded files, i.e. the "files" directory.
* @var string
@@ -69,16 +74,18 @@ class plupload
* @param \phpbb\request\request_interface $request
* @param \phpbb\user $user
* @param \phpbb\php\ini $php_ini
* @param \phpbb\mimetype\guesser $mimetype_guesser
*
* @return null
*/
public function __construct($phpbb_root_path, \phpbb\config\config $config, \phpbb\request\request_interface $request, \phpbb\user $user, \phpbb\php\ini $php_ini)
public function __construct($phpbb_root_path, \phpbb\config\config $config, \phpbb\request\request_interface $request, \phpbb\user $user, \phpbb\php\ini $php_ini, \phpbb\mimetype\guesser $mimetype_guesser)
{
$this->phpbb_root_path = $phpbb_root_path;
$this->config = $config;
$this->request = $request;
$this->user = $user;
$this->php_ini = $php_ini;
$this->mimetype_guesser = $mimetype_guesser;
$this->upload_directory = $this->phpbb_root_path . $this->config['upload_path'];
$this->temporary_directory = $this->upload_directory . '/plupload';
@@ -128,7 +135,7 @@ class plupload
'tmp_name' => $file_path,
'name' => $this->request->variable('real_filename', ''),
'size' => filesize($file_path),
'type' => $file_info->getMimeType($file_path),
'type' => $this->mimetype_guesser->guess($file_path),
);
}
else