38 "application/vnd.ms-excel",
40 "application/ms-excel",
43 "application/vnd.ms-powerpoint",
44 "application/ms-powerpoint",
45 "application/mspowerpoint",
58 ".doc" =>
"Microsoft Word Document",
59 ".xls" =>
"Microsoft Excel Spreadsheet",
60 ".ppt" =>
"Microsoft Powerpoint Presentation",
61 ".pdf" =>
"Adobe Acrobat PDF",
62 ".rtf" =>
"Rich Text Format",
63 ".htm" =>
"HTML File",
64 ".zip" =>
"ZIP Archive",
65 ".jpg" =>
"JPEG Image File",
66 ".gif" =>
"GIF Image File",
67 ".png" =>
"PNG Image File",
68 ".xlsx" =>
"Microsoft Excel Spreadsheet",
69 ".pptx" =>
"Microsoft Powerpoint Presentation",
70 ".docx" =>
"Microsoft Word Document",
71 ".mp3" =>
"MP3 Audio File",
72 ".flv" =>
"Flash Video",
74 ".csv" =>
"Comma-Separated Values"
78 ".doc" =>
"application/msword",
79 ".xls" =>
"application/vnd.ms-excel",
80 ".ppt" =>
"application/vnd.ms-powerpoint",
81 ".pdf" =>
"application/pdf",
83 ".htm" =>
"text/html",
84 ".zip" =>
"application/zip",
85 ".jpg" =>
"image/jpeg",
86 ".gif" =>
"image/gif",
87 ".png" =>
"image/x-png",
88 ".xlsx" =>
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
89 ".pptx" =>
"application/vnd.openxmlformats-officedocument.presentationml.presentation",
90 ".docx" =>
"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
91 ".mp3" =>
"audio/mpeg",
92 ".m4a" =>
"audio/mpeg",
93 ".flv" =>
"video/x-flv",
94 ".wav" =>
"audio/wav",
98 $doc_icons = array(
".doc" =>
"/fakoli/images/msword_icon.png",
99 ".docx" =>
"/fakoli/images/msword_icon.png",
100 ".xls" =>
"/fakoli/images/msexcel_icon.png",
101 ".xlsx" =>
"/fakoli/images/msexcel_icon.png",
102 ".pdf" =>
"/fakoli/images/pdf_icon.png",
103 ".ppt" =>
"/fakoli/images/ppt_icon.png",
104 ".pptx" =>
"/fakoli/images/ppt_icon.png",
105 ".mp3" =>
"/fakoli/images/mp3.png",
106 ".flv" =>
"/fakoli/images/icon_video.png",
107 ".jpg" =>
"/fakoli/images/jpeg_icon.png",
108 ".jpeg" =>
"/fakoli/images/jpeg_icon.png",
109 ".png" =>
"/fakoli/images/image_icon.png",
110 "default" =>
"/fakoli/images/file_icon.png");
130 $d = strtolower($doc);
132 $ext = substr($d, strrpos($d,
"."));
136 if (!$doc_type) $doc_type =
"Unknown";
155 $doc_file = str_replace($config[
"uploadurl"], $config[
"uploaddir"], $doc_file);
159 if (file_exists($doc_file))
161 $doc_size = (int)(filesize($doc_file)/1024);
182 $n = strtolower($name);
183 $extension = substr($n, strrpos($n,
"."));
185 if (!$type) $type=
"application/octet-stream";
192 $n = strtolower($doc);
193 $extension = substr($n, strrpos($n,
"."));
195 if (!$icon) $icon =
"/fakoli/images/file_icon.png";
207 global $auto_form_defaults;
209 $ext = substr($file, strrpos($file,
"."));
211 trace(
"getIcon($file) $ext $icon", 3);
218 return $auto_form_defaults[
"componentPath"].$icon;
225 'txt' =>
'text/plain',
226 'htm' =>
'text/html',
227 'html' =>
'text/html',
229 'js' =>
'application/javascript',
230 'json' =>
'application/json',
231 'xml' =>
'application/xml',
232 'swf' =>
'application/x-shockwave-flash',
233 'flv' =>
'video/x-flv',
236 'png' =>
'image/png',
237 'jpe' =>
'image/jpeg',
238 'jpeg' =>
'image/jpeg',
239 'jpg' =>
'image/jpeg',
240 'gif' =>
'image/gif',
241 'bmp' =>
'image/bmp',
242 'ico' =>
'image/vnd.microsoft.icon',
243 'tiff' =>
'image/tiff',
244 'tif' =>
'image/tiff',
245 'svg' =>
'image/svg+xml',
246 'svgz' =>
'image/svg+xml',
249 'zip' =>
'application/zip',
250 'rar' =>
'application/x-rar-compressed',
251 'exe' =>
'application/x-msdownload',
252 'msi' =>
'application/x-msdownload',
253 'cab' =>
'application/vnd.ms-cab-compressed',
256 'mp3' =>
'audio/mpeg',
257 'qt' =>
'video/quicktime',
258 'mov' =>
'video/quicktime',
259 'mp4' =>
'video/mp4',
260 'm4a' =>
'audio/m4a',
263 'pdf' =>
'application/pdf',
264 'psd' =>
'image/vnd.adobe.photoshop',
265 'ai' =>
'application/postscript',
266 'eps' =>
'application/postscript',
267 'ps' =>
'application/postscript',
270 'doc' =>
'application/msword',
271 'rtf' =>
'application/rtf',
272 'xls' =>
'application/vnd.ms-excel',
273 'ppt' =>
'application/vnd.ms-powerpoint',
276 'odt' =>
'application/vnd.oasis.opendocument.text',
277 'ods' =>
'application/vnd.oasis.opendocument.spreadsheet',
280 $ext = strtolower(array_pop(explode(
'.',$filename)));
282 if (array_key_exists($ext, $mime_types))
284 return $mime_types[$ext];
286 elseif (function_exists(
'finfo_open'))
288 $finfo = finfo_open(FILEINFO_MIME);
289 $mimetype = finfo_file($finfo, $filename);
static getMIMEType($filename)
static getDocSize($doc)
Returns the file size in Kb for a document.
static getDocType($doc)
Returns a human-readable type name for a document, based on the file extension of the supplied file n...
getDocMimeType($name)
Replaces getMimeType because name conflicts with getMIMEType.
static getIcon($file)
Retrieves a graphic icon appropriate for the given file.
$doc_extensions
Mapping of common file extensions to human-readable document type.
$doc_types
MIME types allowable for document uploads.
trace($msg, $lvl=3, $callStack=null)
Send output to the trace log.