diff options
author | Matt Friedman <maf675@gmail.com> | 2013-12-12 10:28:10 -0800 |
---|---|---|
committer | Matt Friedman <maf675@gmail.com> | 2013-12-12 10:28:10 -0800 |
commit | a59bbeed2dd82b316f1e2f9ad484b978ef2a541c (patch) | |
tree | f3d667b7711b44fa56f6d575b8ae2bc072682d23 /phpBB/phpbb/plupload/plupload.php | |
parent | 2ae6f216f66466a1851f52cbc9839e3405525981 (diff) | |
parent | da6ced59d9632fec5103ce4bea86eb6bcceb5d1e (diff) | |
download | forums-a59bbeed2dd82b316f1e2f9ad484b978ef2a541c.tar forums-a59bbeed2dd82b316f1e2f9ad484b978ef2a541c.tar.gz forums-a59bbeed2dd82b316f1e2f9ad484b978ef2a541c.tar.bz2 forums-a59bbeed2dd82b316f1e2f9ad484b978ef2a541c.tar.xz forums-a59bbeed2dd82b316f1e2f9ad484b978ef2a541c.zip |
[ticket/11966] Merge branch 'develop' into ticket/11966
PHPBB3-11966
Diffstat (limited to 'phpBB/phpbb/plupload/plupload.php')
-rw-r--r-- | phpBB/phpbb/plupload/plupload.php | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/phpBB/phpbb/plupload/plupload.php b/phpBB/phpbb/plupload/plupload.php index 6eb5adf864..6bff2b8a7e 100644 --- a/phpBB/phpbb/plupload/plupload.php +++ b/phpBB/phpbb/plupload/plupload.php @@ -10,14 +10,6 @@ namespace phpbb\plupload; /** - * @ignore - */ -if (!defined('IN_PHPBB')) -{ - exit; -} - -/** * This class handles all server-side plupload functions * * @package \phpbb\plupload\plupload @@ -50,6 +42,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 +66,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'; @@ -121,14 +120,12 @@ class plupload { rename("{$file_path}.part", $file_path); - $file_info = new \Symfony\Component\HttpFoundation\File\File($file_path); - // Need to modify some of the $_FILES values to reflect the new file return array( '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, $file_name), ); } else |