wrote this file. * As long as you retain this notice you can do whatever you want with this * software. If we meet some day, and you think this stuff is worth it, you can * buy me a beer in return. * Sandino Araico Sánchez * --END LICENSE--------------------------------------------------------------- * --LICENCIA EN ESPAÑOL MEXICANO---------------------------------------------- * "LA LICENCIA BEER-WARE" (traducción al español de la revisión 42-sandino-3): * Sandino Araico Sánchez escribió éste archivo. * Siempre y cuando usted retenga éste aviso (en español y en inglés) usted * puede hacer cualquier cosa con éste software. Si algún día nos encontramos y * usted piensa que éste software vale la pena, usted puede invitarme una * cerveza en recompensa. * Sandino Araico Sánchez * --FIN DE LICENCIA----------------------------------------------------------- */ # Changelog: # 2002-01-05 Sandino Araico Sánchez - Functions for mime types # 2002-01-29 Sandino Araico Sánchez - Corrected file name notice # 2002-02-06 Sandino Araico Sánchez - application/msword # 2002-02-08 Sandino Araico Sánchez - h_mime_set_doc_name_headers() if(!defined("__HOPP_MIME")) { define ("__HOPP_MIME",1); #--------------------------------------------------------------------- function h_mime_get_mime_headers($doc) { h_mime_set_mime_headers($doc); } function h_mime_set_mime_headers($doc) { //$doc=strtolower($doc); if(eregi('\.([a-z0-9_]+)$', $doc, $regs)) { s_log("EXT: $regs[0]"); $content_type=h_mime_get_mime_content_type($regs[1]); } else $content_type='text/plain'; s_log("content_type: $content_type"); header("Content-Type: $content_type"); } function h_mime_set_doc_name_headers($doc) { $doc=basename($doc); s_log("Content-Disposition: attachment; filename=$doc"); header("Content-Disposition: attachment; filename=$doc"); } function h_mime_get_mime_content_type($ext) { $ext=strtolower($ext); switch ($ext) { case 'pdf': return 'application/pdf'; case 'ppt': return 'application/vnd.ms-powerpoint'; case 'doc': return 'application/msword'; case 'html': case 'htm': return 'text/html'; } return 'text/plain'; } #--------------------------------------------------------------------- } //__HOPP_MIME ?>