diff options
| author | Fyorl <gaelreth@gmail.com> | 2012-06-15 14:10:20 +0100 | 
|---|---|---|
| committer | Fyorl <gaelreth@gmail.com> | 2012-07-02 23:30:47 +0100 | 
| commit | 03ddfbbaf1ba078df16638c642f8a3a9d8ca8c1c (patch) | |
| tree | f88043e88d7713aea9bb060679aea2037b7fceee /phpBB/includes/functions_upload.php | |
| parent | a0771b8814adb504e37749b7c9e4fdc3e21b5ce5 (diff) | |
| download | forums-03ddfbbaf1ba078df16638c642f8a3a9d8ca8c1c.tar forums-03ddfbbaf1ba078df16638c642f8a3a9d8ca8c1c.tar.gz forums-03ddfbbaf1ba078df16638c642f8a3a9d8ca8c1c.tar.bz2 forums-03ddfbbaf1ba078df16638c642f8a3a9d8ca8c1c.tar.xz forums-03ddfbbaf1ba078df16638c642f8a3a9d8ca8c1c.zip | |
[ticket/10963] Modified filespec::is_image() to check actual mimetype
Modified filespec::is_image() to check the Fileinfo mimetype rather than
trusting the browser.
PHPBB3-10963
Diffstat (limited to 'phpBB/includes/functions_upload.php')
| -rw-r--r-- | phpBB/includes/functions_upload.php | 6 | 
1 files changed, 5 insertions, 1 deletions
| diff --git a/phpBB/includes/functions_upload.php b/phpBB/includes/functions_upload.php index f70e20e616..f3ae9d6cc4 100644 --- a/phpBB/includes/functions_upload.php +++ b/phpBB/includes/functions_upload.php @@ -151,7 +151,10 @@ class filespec  	*/  	function is_image()  	{ -		return (strpos($this->mimetype, 'image/') !== false) ? true : false; +		$finfo = new finfo(FILEINFO_MIME_TYPE); +		$mimetype = $finfo->file($this->filename); + +		return (strpos($mimetype, 'image/') !== false) ? true : false;  	}  	/** @@ -342,6 +345,7 @@ class filespec  			// Remove temporary filename  			@unlink($this->filename); +			$this->filename = $this->destination_file;  			if (sizeof($this->error))  			{ | 
