Some mods
[moodle.git] / files / mimetypes.php
CommitLineData
542a6914 1<? // $Id$\r
2\r
3function mimeinfo($element, $filename) {\r
4 $mimeinfo = array (\r
5 "xxx" => array ("type"=>"document/unknown", "icon"=>"unknown.gif"),\r
6 "ai" => array ("type"=>"application/postscript", "icon"=>"image.gif"),\r
7 "aif" => array ("type"=>"audio/x-aiff", "icon"=>"audio.gif"),\r
8 "aiff" => array ("type"=>"audio/x-aiff", "icon"=>"audio.gif"),\r
9 "aifc" => array ("type"=>"audio/x-aiff", "icon"=>"audio.gif"),\r
10 "applescript" => array ("type"=>"text/plain", "icon"=>"text.gif"),\r
11 "asc" => array ("type"=>"text/plain", "icon"=>"text.gif"),\r
12 "au" => array ("type"=>"audio/au", "icon"=>"audio.gif"),\r
13 "avi" => array ("type"=>"video/x-ms-wm", "icon"=>"avi.gif"),\r
14 "bmp" => array ("type"=>"image/bmp", "icon"=>"image.gif"),\r
15 "cs" => array ("type"=>"application/x-csh", "icon"=>"text.gif"),\r
16 "css" => array ("type"=>"text/css", "icon"=>"text.gif"),\r
17 "dv" => array ("type"=>"video/x-dv", "icon"=>"video.gif"),\r
18 "doc" => array ("type"=>"application/msword", "icon"=>"word.gif"),\r
19 "dif" => array ("type"=>"video/x-dv", "icon"=>"video.gif"),\r
20 "eps" => array ("type"=>"application/postscript", "icon"=>"image.gif"),\r
21 "gif" => array ("type"=>"image/gif", "icon"=>"image.gif"),\r
22 "gtar" => array ("type"=>"application/x-gtar", "icon"=>"zip.gif"),\r
23 "gzip" => array ("type"=>"application/g-zip", "icon"=>"zip.gif"),\r
24 "h" => array ("type"=>"text/plain", "icon"=>"text.gif"),\r
25 "hqx" => array ("type"=>"application/mac-binhex40", "icon"=>"zip.gif"),\r
26 "html" => array ("type"=>"text/html", "icon"=>"html.gif"),\r
27 "htm" => array ("type"=>"text/html", "icon"=>"html.gif"),\r
28 "jpe" => array ("type"=>"image/jpeg", "icon"=>"image.gif"),\r
29 "jpeg" => array ("type"=>"image/jpeg", "icon"=>"image.gif"),\r
30 "jpg" => array ("type"=>"image/jpeg", "icon"=>"image.gif"),\r
31 "js" => array ("type"=>"application/x-javascript", "icon"=>"text.gif"),\r
32 "latex"=> array ("type"=>"application/x-latex", "icon"=>"text.gif"),\r
33 "m" => array ("type"=>"text/plain", "icon"=>"text.gif"),\r
34 "mov" => array ("type"=>"video/quicktime", "icon"=>"video.gif"),\r
35 "movie"=> array ("type"=>"video/x-sgi-movie", "icon"=>"video.gif"),\r
36 "m3u" => array ("type"=>"audio/x-mpegurl", "icon"=>"audio.gif"),\r
37 "mp3" => array ("type"=>"audio/mp3", "icon"=>"audio.gif"),\r
38 "mp4" => array ("type"=>"video/mp4", "icon"=>"video.gif"),\r
39 "mpeg" => array ("type"=>"video/mpeg", "icon"=>"video.gif"),\r
40 "mpe" => array ("type"=>"video/mpeg", "icon"=>"video.gif"),\r
41 "mpg" => array ("type"=>"video/mpeg", "icon"=>"video.gif"),\r
42 "pct" => array ("type"=>"image/pict", "icon"=>"image.gif"),\r
43 "pdf" => array ("type"=>"application/pdf", "icon"=>"pdf.gif"),\r
44 "php" => array ("type"=>"text/plain", "icon"=>"text.gif"),\r
45 "pic" => array ("type"=>"image/pict", "icon"=>"image.gif"),\r
46 "pict" => array ("type"=>"image/pict", "icon"=>"image.gif"),\r
47 "png" => array ("type"=>"image/png", "icon"=>"image.gif"),\r
48 "ppt" => array ("type"=>"application/vnd.ms-powerpoint", "icon"=>"powerpoint.gif"),\r
49 "ps" => array ("type"=>"application/postscript", "icon"=>"image.gif"),\r
50 "qt" => array ("type"=>"video/quicktime", "icon"=>"video.gif"),\r
51 "ra" => array ("type"=>"audio/x-realaudio", "icon"=>"audio.gif"),\r
52 "ram" => array ("type"=>"audio/x-pn-realaudio", "icon"=>"audio.gif"),\r
53 "rm" => array ("type"=>"audio/x-pn-realaudio", "icon"=>"audio.gif"),\r
54 "rtf" => array ("type"=>"text/rtf", "icon"=>"text.gif"),\r
55 "rtx" => array ("type"=>"text/richtext", "icon"=>"text.gif"),\r
56 "sh" => array ("type"=>"application/x-sh", "icon"=>"text.gif"),\r
57 "sit" => array ("type"=>"application/x-stuffit", "icon"=>"zip.gif"),\r
58 "smi" => array ("type"=>"application/smil", "icon"=>"text.gif"),\r
59 "smil" => array ("type"=>"application/smil", "icon"=>"text.gif"),\r
60 "swf" => array ("type"=>"application/x-shockwave-flash", "icon"=>"flash.gif"),\r
61 "tar" => array ("type"=>"application/x-tar", "icon"=>"zip.gif"),\r
62 "tif" => array ("type"=>"image/tiff", "icon"=>"image.gif"),\r
63 "tiff" => array ("type"=>"image/tiff", "icon"=>"image.gif"),\r
64 "tex" => array ("type"=>"application/x-tex", "icon"=>"text.gif"),\r
65 "texi" => array ("type"=>"application/x-texinfo", "icon"=>"text.gif"),\r
66 "texinfo" => array ("type"=>"application/x-texinfo", "icon"=>"text.gif"),\r
67 "tsv" => array ("type"=>"text/tab-separated-values", "icon"=>"text.gif"),\r
68 "txt" => array ("type"=>"text/plain", "icon"=>"text.gif"),\r
69 "wav" => array ("type"=>"audio/wav", "icon"=>"audio.gif"),\r
70 "xls" => array ("type"=>"application/vnd.ms-excel", "icon"=>"excel.gif"),\r
71 "xml" => array ("type"=>"text/xml", "icon"=>"xml.gif"),\r
72 "xsl" => array ("type"=>"text/xml", "icon"=>"xml.gif"),\r
73 "zip" => array ("type"=>"application/zip", "icon"=>"zip.gif")\r
74 );\r
75\r
76 if (eregi("\.([a-z0-9]+)$", $filename, $match)) {\r
77 $result = $mimeinfo[strtolower($match[1])][$element];\r
78 }\r
79\r
80 if (!empty($result)) {\r
81 return $result;\r
82 } else {\r
83 return $mimeinfo["xxx"][$element]; // By default\r
84 }\r
85}\r
86\r
87?>\r