aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/functions_upload.php
diff options
context:
space:
mode:
authorFyorl <gaelreth@gmail.com>2012-07-17 17:36:09 +0100
committerFyorl <gaelreth@gmail.com>2012-07-17 17:39:00 +0100
commit6aea4db6c7adbcee4fffa7cbc39564481fa6e211 (patch)
treed8ca872a51d62fb4c64f1ff7dc79af0d34af78fb /phpBB/includes/functions_upload.php
parentb45bc27339d03016d47c0247aede8da5ce38a4ee (diff)
downloadforums-6aea4db6c7adbcee4fffa7cbc39564481fa6e211.tar
forums-6aea4db6c7adbcee4fffa7cbc39564481fa6e211.tar.gz
forums-6aea4db6c7adbcee4fffa7cbc39564481fa6e211.tar.bz2
forums-6aea4db6c7adbcee4fffa7cbc39564481fa6e211.tar.xz
forums-6aea4db6c7adbcee4fffa7cbc39564481fa6e211.zip
[ticket/10944] Reverted changes in PHPBB3-10963
is_image now just checks the mimetype reported by the browser and get_mimetype goes back to being unused. PHPBB3-10944
Diffstat (limited to 'phpBB/includes/functions_upload.php')
-rw-r--r--phpBB/includes/functions_upload.php15
1 files changed, 9 insertions, 6 deletions
diff --git a/phpBB/includes/functions_upload.php b/phpBB/includes/functions_upload.php
index 33cb585b19..f70e20e616 100644
--- a/phpBB/includes/functions_upload.php
+++ b/phpBB/includes/functions_upload.php
@@ -151,8 +151,7 @@ class filespec
*/
function is_image()
{
- $mimetype = $this->get_mimetype($this->filename);
- return (strpos($mimetype, 'image/') === 0);
+ return (strpos($this->mimetype, 'image/') !== false) ? true : false;
}
/**
@@ -201,12 +200,17 @@ class filespec
}
/**
- * Get mimetype. Utilises the finfo class.
+ * Get mimetype. Utilize mime_content_type if the function exist.
+ * Not used at the moment...
*/
function get_mimetype($filename)
{
- $finfo = new finfo(FILEINFO_MIME_TYPE);
- $mimetype = $finfo->file($filename);
+ $mimetype = '';
+
+ if (function_exists('mime_content_type'))
+ {
+ $mimetype = mime_content_type($filename);
+ }
// Some browsers choke on a mimetype of application/octet-stream
if (!$mimetype || $mimetype == 'application/octet-stream')
@@ -338,7 +342,6 @@ class filespec
// Remove temporary filename
@unlink($this->filename);
- $this->filename = $this->destination_file;
if (sizeof($this->error))
{