aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFyorl <gaelreth@gmail.com>2012-07-04 13:27:55 +0100
committerFyorl <gaelreth@gmail.com>2012-07-04 13:27:55 +0100
commit4fbcf4eaadea0425c7f8bf0ff02a60bd2165136b (patch)
tree6b3266348a405bd8f739b57bc4ad9da5f8605d9c
parentf208b59c5984e686a3589eb83d5edb0b69bc020b (diff)
downloadforums-4fbcf4eaadea0425c7f8bf0ff02a60bd2165136b.tar
forums-4fbcf4eaadea0425c7f8bf0ff02a60bd2165136b.tar.gz
forums-4fbcf4eaadea0425c7f8bf0ff02a60bd2165136b.tar.bz2
forums-4fbcf4eaadea0425c7f8bf0ff02a60bd2165136b.tar.xz
forums-4fbcf4eaadea0425c7f8bf0ff02a60bd2165136b.zip
[ticket/10963] filespec::get_mimetype now used
filespec::get_mimetype now uses the finfo class in order to detect the mimetype of a given filename. filespec::is_image() now uses this method. PHPBB3-10963
-rw-r--r--phpBB/includes/functions_upload.php15
1 files changed, 4 insertions, 11 deletions
diff --git a/phpBB/includes/functions_upload.php b/phpBB/includes/functions_upload.php
index aedf361000..33cb585b19 100644
--- a/phpBB/includes/functions_upload.php
+++ b/phpBB/includes/functions_upload.php
@@ -151,9 +151,7 @@ class filespec
*/
function is_image()
{
- $finfo = new finfo(FILEINFO_MIME_TYPE);
- $mimetype = $finfo->file($this->filename);
-
+ $mimetype = $this->get_mimetype($this->filename);
return (strpos($mimetype, 'image/') === 0);
}
@@ -203,17 +201,12 @@ class filespec
}
/**
- * Get mimetype. Utilize mime_content_type if the function exist.
- * Not used at the moment...
+ * Get mimetype. Utilises the finfo class.
*/
function get_mimetype($filename)
{
- $mimetype = '';
-
- if (function_exists('mime_content_type'))
- {
- $mimetype = mime_content_type($filename);
- }
+ $finfo = new finfo(FILEINFO_MIME_TYPE);
+ $mimetype = $finfo->file($filename);
// Some browsers choke on a mimetype of application/octet-stream
if (!$mimetype || $mimetype == 'application/octet-stream')