From cecb985bee3bdd252e1b8dc0bd500b37cd52be01 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Wed, 16 May 2007 20:58:53 +0000 Subject: Aktualisierung auf MediaWiki 1.10.0 Plugins angepasst und verbessert kleine Korrekturen am Design --- includes/MimeMagic.php | 39 +++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-) (limited to 'includes/MimeMagic.php') diff --git a/includes/MimeMagic.php b/includes/MimeMagic.php index ca05dbb3..db35535d 100644 --- a/includes/MimeMagic.php +++ b/includes/MimeMagic.php @@ -1,7 +1,6 @@ mMimeToExt[$mime]) $this->mMimeToExt[$mime] .= ' '.$ext; + if ( !empty($this->mMimeToExt[$mime])) $this->mMimeToExt[$mime] .= ' '.$ext; else $this->mMimeToExt[$mime]= $ext; $extensions= explode(' ',$ext); @@ -158,7 +159,7 @@ class MimeMagic { $e= trim($e); if (empty($e)) continue; - if (@$this->mExtToMime[$e]) $this->mExtToMime[$e] .= ' '.$mime; + if ( !empty($this->mExtToMime[$e])) $this->mExtToMime[$e] .= ' '.$mime; else $this->mExtToMime[$e]= $mime; } } @@ -262,7 +263,7 @@ class MimeMagic { function getTypesForExtension($ext) { $ext= strtolower($ext); - $r= @$this->mExtToMime[$ext]; + $r= isset( $this->mExtToMime[$ext] ) ? $this->mExtToMime[$ext] : null; return $r; } @@ -341,7 +342,7 @@ class MimeMagic { } - /** mime type detection. This uses detectMimeType to detect the mim type of the file, + /** mime type detection. This uses detectMimeType to detect the mime type of the file, * but applies additional checks to determine some well known file formats that may be missed * or misinterpreter by the default mime detection (namely xml based formats like XHTML or SVG). * @@ -399,8 +400,8 @@ class MimeMagic { #print "
ANALYSING $file ($mime): doctype= $doctype; tag= $tag
"; - if (strpos($doctype,"-//W3C//DTD SVG")===0) $mime= "image/svg"; - elseif ($tag==="svg") $mime= "image/svg"; + if (strpos($doctype,"-//W3C//DTD SVG")===0) $mime= "image/svg+xml"; + elseif ($tag==="svg") $mime= "image/svg+xml"; elseif (strpos($doctype,"-//W3C//DTD XHTML")===0) $mime= "text/html"; elseif ($tag==="html") $mime= "text/html"; } @@ -424,7 +425,9 @@ class MimeMagic { $match= array(); $prog= ""; - if (preg_match('%/?([^\s]+/)(w+)%sim',$head,$match)) $script= $match[2]; + if (preg_match('%/?([^\s]+/)(w+)%sim',$head,$match)) { + $script= $match[2]; // FIXME: $script variable not used; should this be "$prog = $match[2];" instead? + } $mime= "application/x-$prog"; } -- cgit v1.2.2