mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-21 18:44:37 +02:00
[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
This commit is contained in:
@ -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))
|
||||
{
|
||||
|
Reference in New Issue
Block a user