From 4e5a22df7a66ee912bd3206963b9c20f4f9d3b47 Mon Sep 17 00:00:00 2001 From: Jonathon Fowler Date: Fri, 13 Jun 2014 10:58:55 +1000 Subject: [PATCH] MDL-39913 filetypes: mimetypes remediation Going by http://www.iana.org/assignments/media-types/media-types.xhtml. Disambiguated the Office 2007 types, Apple iWorks and other types changes by tonyjbutler. --- lang/en/mimetypes.php | 40 ++++++++++++++++++++++++++++++++++----- lib/classes/filetypes.php | 13 +++++++------ 2 files changed, 42 insertions(+), 11 deletions(-) diff --git a/lang/en/mimetypes.php b/lang/en/mimetypes.php index c2b48d7780c..bba3cd00b26 100644 --- a/lang/en/mimetypes.php +++ b/lang/en/mimetypes.php @@ -40,17 +40,47 @@ $string['application/msword'] = 'Word document'; $string['application/pdf'] = 'PDF document'; $string['application/vnd.moodle.backup'] = 'Moodle backup'; $string['application/vnd.ms-excel'] = 'Excel spreadsheet'; +$string['application/vnd.ms-excel.sheet.macroEnabled.12'] = 'Excel 2007 macro-enabled workbook'; $string['application/vnd.ms-powerpoint'] = 'Powerpoint presentation'; -$string['application/vnd.openxmlformats-officedocument.presentationml.presentation'] = 'Powerpoint presentation'; -$string['application/vnd.openxmlformats-officedocument.presentationml.slideshow'] = 'Powerpoint slideshow'; -$string['application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'] = 'Excel spreadsheet'; -$string['application/vnd.openxmlformats-officedocument.spreadsheetml.template'] = 'Excel template'; -$string['application/vnd.openxmlformats-officedocument.wordprocessingml.document'] = 'Word document'; +$string['application/vnd.oasis.opendocument.spreadsheet'] = 'OpenDocument Spreadsheet'; +$string['application/vnd.oasis.opendocument.spreadsheet-template'] = 'OpenDocument Spreadsheet template'; +$string['application/vnd.oasis.opendocument.text'] = 'OpenDocument Text document'; +$string['application/vnd.oasis.opendocument.text-template'] = 'OpenDocument Text template'; +$string['application/vnd.oasis.opendocument.text-web'] = 'OpenDocument Web page template'; +$string['application/vnd.openxmlformats-officedocument.presentationml.presentation'] = 'Powerpoint 2007 presentation'; +$string['application/vnd.openxmlformats-officedocument.presentationml.slideshow'] = 'Powerpoint 2007 slideshow'; +$string['application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'] = 'Excel 2007 spreadsheet'; +$string['application/vnd.openxmlformats-officedocument.spreadsheetml.template'] = 'Excel 2007 template'; +$string['application/vnd.openxmlformats-officedocument.wordprocessingml.document'] = 'Word 2007 document'; +$string['application/x-iwork-keynote-sffkey'] = 'iWork Keynote presentation'; +$string['application/x-iwork-numbers-sffnumbers'] = 'iWork Numbers spreadsheet'; +$string['application/x-iwork-pages-sffpages'] = 'iWork Pages document'; +$string['application/x-javascript'] = 'JavaScript source'; +$string['application/x-mspublisher'] = 'Publisher document'; +$string['application/x-shockwave-flash'] = 'Flash animation'; +$string['application/xhtml_xml'] = 'XHTML document'; $string['archive'] = 'Archive ({$a->EXT})'; $string['audio'] = 'Audio file ({$a->EXT})'; $string['default'] = '{$a->mimetype}'; $string['document/unknown'] = 'File'; +$string['group:archive'] = 'Archive files'; +$string['group:audio'] = 'Audio files'; +$string['group:document'] = 'Document files'; +$string['group:html_audio'] = 'Audio files natively supported by browsers'; +$string['group:html_video'] = 'Video files natively supported by browsers'; +$string['group:image'] = 'Image files'; +$string['group:presentation'] = 'Presentation files'; +$string['group:sourcecode'] = 'Source code'; +$string['group:spreadsheet'] = 'Spreadsheet files'; +$string['group:video'] = 'Video files'; +$string['group:web_audio'] = 'Audio files used on the web'; +$string['group:web_file'] = 'Web files'; +$string['group:web_image'] = 'Image files used on the web'; +$string['group:web_video'] = 'Video files used on the web'; $string['image'] = 'Image ({$a->MIMETYPE2})'; +$string['image/vnd.microsoft.icon'] = 'Windows icon'; +$string['text/css'] = 'Cascading Style-Sheet'; +$string['text/csv'] = 'Comma-separated values'; $string['text/html'] = 'HTML document'; $string['text/plain'] = 'Text file'; $string['text/rtf'] = 'RTF document'; diff --git a/lib/classes/filetypes.php b/lib/classes/filetypes.php index 97ff4568271..23c01913b0c 100644 --- a/lib/classes/filetypes.php +++ b/lib/classes/filetypes.php @@ -90,7 +90,7 @@ abstract class core_filetypes { 'dxr' => array('type' => 'application/x-director', 'icon' => 'flash'), 'eps' => array('type' => 'application/postscript', 'icon' => 'eps'), 'epub' => array('type' => 'application/epub+zip', 'icon' => 'epub', 'groups' => array('document')), - 'fdf' => array('type' => 'application/pdf', 'icon' => 'pdf'), + 'fdf' => array('type' => 'application/vnd.fdf', 'icon' => 'pdf'), 'flac' => array('type' => 'audio/flac', 'icon' => 'audio', 'groups' => array('audio', 'html_audio', 'web_audio'), 'string' => 'audio'), 'flv' => array('type' => 'video/x-flv', 'icon' => 'flash', @@ -197,7 +197,7 @@ abstract class core_filetypes { 'string' => 'video'), 'pct' => array('type' => 'image/pict', 'icon' => 'image', 'groups' => array('image'), 'string' => 'image'), - 'pdf' => array('type' => 'application/pdf', 'icon' => 'pdf'), + 'pdf' => array('type' => 'application/pdf', 'icon' => 'pdf', 'groups' => array('document')), 'php' => array('type' => 'text/plain', 'icon' => 'sourcecode'), 'pic' => array('type' => 'image/pict', 'icon' => 'image', 'groups' => array('image'), 'string' => 'image'), 'pict' => array('type' => 'image/pict', 'icon' => 'image', 'groups' => array('image'), 'string' => 'image'), @@ -283,12 +283,13 @@ abstract class core_filetypes { 'wma' => array('type' => 'audio/x-ms-wma', 'icon' => 'audio', 'groups' => array('audio'), 'string' => 'audio'), 'xbk' => array('type' => 'application/x-smarttech-notebook', 'icon' => 'archive'), - 'xdp' => array('type' => 'application/pdf', 'icon' => 'pdf'), - 'xfd' => array('type' => 'application/pdf', 'icon' => 'pdf'), - 'xfdf' => array('type' => 'application/pdf', 'icon' => 'pdf'), + 'xdp' => array('type' => 'application/vnd.adobe.xdp+xml', 'icon' => 'pdf'), + 'xfd' => array('type' => 'application/vnd.xfdl', 'icon' => 'pdf'), + 'xfdf' => array('type' => 'application/vnd.adobe.xfdf', 'icon' => 'pdf'), 'xls' => array('type' => 'application/vnd.ms-excel', 'icon' => 'spreadsheet', 'groups' => array('spreadsheet')), - 'xlsx' => array('type' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'icon' => 'spreadsheet'), + 'xlsx' => array('type' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'icon' => 'spreadsheet', + 'groups' => array('spreadsheet')), 'xlsm' => array('type' => 'application/vnd.ms-excel.sheet.macroEnabled.12', 'icon' => 'spreadsheet', 'groups' => array('spreadsheet')), 'xltx' => array('type' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.template',