Fix ordering of OpenDocument type detection so template files can actually be uploaded.
authorBrion Vibber <brion@users.mediawiki.org>
Thu, 22 Jan 2009 00:15:16 +0000 (00:15 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Thu, 22 Jan 2009 00:15:16 +0000 (00:15 +0000)
Previously, the shorter types like 'text' matched before the longer ones like 'text-template', causing an .ott file to be misdetected as an .odt... and thus rejected for being the wrong type.

includes/MimeMagic.php

index 4797752..d52de99 100644 (file)
@@ -579,22 +579,22 @@ class MimeMagic {
         */
        function detectZipType( $header ) {
                $opendocTypes = array(
-                       'chart',
                        'chart-template',
-                       'formula',
+                       'chart',
                        'formula-template',
-                       'graphics',
+                       'formula',
                        'graphics-template',
-                       'image',
+                       'graphics',
                        'image-template',
-                       'presentation',
+                       'image',
                        'presentation-template',
-                       'spreadsheet',
+                       'presentation',
                        'spreadsheet-template',
-                       'text',
+                       'spreadsheet',
                        'text-template',
                        'text-master',
-                       'text-web' );
+                       'text-web',
+                       'text' );
 
                // http://lists.oasis-open.org/archives/office/200505/msg00006.html
                $types = '(?:' . implode( '|', $opendocTypes ) . ')';