]> git.mxchange.org Git - friendica.git/blobdiff - include/attach.php
quattro: in post display page, scroll to and flash selected comment
[friendica.git] / include / attach.php
index ca53081d9347ea764909a9445f0632fa820a539e..6d611cec0418534ce50f80bae09c0c3d7189587f 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 
-if(!function_exists('mime_content_type')) {
-function mime_content_type($filename) {
+
+function z_mime_content_type($filename) {
 
        $mime_types = array(
 
@@ -38,6 +38,7 @@ function mime_content_type($filename) {
 
                // audio/video
                'mp3' => 'audio/mpeg',
+               'wav' => 'audio/wav',
                'qt' => 'video/quicktime',
                'mov' => 'video/quicktime',
                'ogg' => 'application/ogg',
@@ -61,20 +62,22 @@ function mime_content_type($filename) {
                'ods' => 'application/vnd.oasis.opendocument.spreadsheet',
        );
 
-       if(strpos($filename,'.') !== false) {
-               $ext = strtolower(array_pop(explode('.',$filename)));
+       $dot = strpos($filename,'.');
+       if($dot !== false) {
+               $ext = strtolower(substr($filename,$dot+1));
                if (array_key_exists($ext, $mime_types)) {
                        return $mime_types[$ext];
                }
        }
-       elseif (function_exists('finfo_open')) {
-               $finfo = finfo_open(FILEINFO_MIME);
-               $mimetype = finfo_file($finfo, $filename);
-               finfo_close($finfo);
-               return $mimetype;
-       }
+// can't use this because we're just passing a name, e.g. not a file that can be opened
+//     elseif (function_exists('finfo_open')) {
+//             $finfo = @finfo_open(FILEINFO_MIME);
+//             $mimetype = @finfo_file($finfo, $filename);
+//             @finfo_close($finfo);
+//             return $mimetype;
+//     }
        else {
                return 'application/octet-stream';
        }
-}}
+}