Followup to r64962: Fixed watchlist parameter in API. User options watchdeletions...
[lhc/web/wiklou.git] / includes / IEContentAnalyzer.php
index 59abc6a..a2ef1a0 100644 (file)
@@ -323,11 +323,11 @@ class IEContentAnalyzer {
         * Get the MIME types from getMimesFromData(), but convert the result from IE's 
         * idiosyncratic private types into something other apps will understand.
         *
-        * @param string $fileName The file name (unused at present)
-        * @param string $chunk The first 256 bytes of the file
-        * @param string $proposed The MIME type proposed by the server
+        * @param $fileName String: the file name (unused at present)
+        * @param $chunk String: the first 256 bytes of the file
+        * @param $proposed String: the MIME type proposed by the server
         *
-        * @return array Map of IE version to detected mime type
+        * @return Array: map of IE version to detected mime type
         */
        public function getRealMimesFromData( $fileName, $chunk, $proposed ) {
                $types = $this->getMimesFromData( $fileName, $chunk, $proposed );
@@ -359,11 +359,11 @@ class IEContentAnalyzer {
        /**
         * Get the untranslated MIME types for all known versions
         *
-        * @param string $fileName The file name (unused at present)
-        * @param string $chunk The first 256 bytes of the file
-        * @param string $proposed The MIME type proposed by the server
+        * @param $fileName String: the file name (unused at present)
+        * @param $chunk String: the first 256 bytes of the file
+        * @param $proposed String: the MIME type proposed by the server
         *
-        * @return array Map of IE version to detected mime type
+        * @return Array: map of IE version to detected mime type
         */
        public function getMimesFromData( $fileName, $chunk, $proposed ) {
                $types = array();
@@ -569,8 +569,9 @@ class IEContentAnalyzer {
                $chunk3 = substr( $chunk, 0, 3 );
                $chunk4 = substr( $chunk, 0, 4 );
                $chunk5 = substr( $chunk, 0, 5 );
+               $chunk5uc = strtoupper( $chunk5 );
                $chunk8 = substr( $chunk, 0, 8 );
-               if ( $chunk5 == 'GIF87' || $chunk5 == 'GIF89' ) {
+               if ( $chunk5uc == 'GIF87' || $chunk5uc == 'GIF89' ) {
                        return 'image/gif';
                }
                if ( $chunk2 == "\xff\xd8" ) {
@@ -579,7 +580,7 @@ class IEContentAnalyzer {
 
                if ( $chunk2 == 'BM' 
                        && substr( $chunk, 6, 2 ) == "\000\000"
-                       && substr( $chunk, 8, 2 ) != "\000\000" )
+                       && substr( $chunk, 8, 2 ) == "\000\000" )
                {
                        return 'image/bmp'; // another non-standard MIME
                }
@@ -800,7 +801,7 @@ class IEContentAnalyzer {
                        }
 
                        // BinHex
-                       if ( !strncasecmp( $remainder, $binhexMagic, strlen( $binhexMagic ) ) ) {
+                       if ( !strncmp( $remainder, $binhexMagic, strlen( $binhexMagic ) ) ) {
                                $found['binhex'] = true;
                        }
                }