예제 #1
0
 function uncompress($src)
 {
     $header = unpack("LcSize/LuSize/Lmagic/Lcrc32", byte_substr($src, 0, 16));
     $in = 16;
     if ($header['cSize'] != byte_strlen($src) - 4) {
         debugLog("Stream too short");
         return false;
     }
     if ($header['crc32'] != $this->LZRTFCalcCRC32($src, 16, $header['cSize'] + 4 - 16)) {
         debugLog("CRC MISMATCH");
         return false;
     }
     if ($header['magic'] == 0x414c454d) {
         // uncompressed RTF - return as is.
         $dest = byte_substr($src, $in, $header['uSize']);
     } else {
         if ($header['magic'] == 0x75465a4c) {
             // compressed RTF - uncompress.
             $dst = $this->LZRTF_HDR_DATA;
             $out = $this->LZRTF_HDR_LEN;
             $oblen = $this->LZRTF_HDR_LEN + $header['uSize'];
             $flagCount = 0;
             $flags = 0;
             while ($out < $oblen) {
                 $flags = $flagCount++ % 8 == 0 ? ord($src[$in++]) : $flags >> 1;
                 if (($flags & 1) == 1) {
                     $offset = ord($src[$in++]);
                     $length = ord($src[$in++]);
                     $offset = $offset << 4 | $length >> 4;
                     $length = ($length & 0xf) + 2;
                     $offset = (int) ($out / 4096) * 4096 + $offset;
                     if ($offset >= $out) {
                         $offset -= 4096;
                     }
                     $end = $offset + $length;
                     while ($offset < $end) {
                         $dst .= $dst[$offset++];
                         $out++;
                     }
                 } else {
                     $dst .= $src[$in++];
                     $out++;
                 }
             }
             $src = $dst;
             $dest = byte_substr($src, $this->LZRTF_HDR_LEN, $header['uSize']);
         } else {
             // unknown magic - returfn false (please report if this ever happens)
             debugLog("Unknown Magic");
             return false;
         }
     }
     return $dest;
 }
예제 #2
0
function get_mime_type_from_content($filename, $content, $flags = 3)
{
    $mimemagic_data[0][30]["eval \"exec /usr/local/bin/perl"] = "application/x-perl";
    $mimemagic_data[0][26]["-----BEGIN PGP40SIGNATURE-"] = "application/pgp-signature";
    $mimemagic_data[0][24]["eval \"exec /usr/bin/perl"] = "application/x-perl";
    $mimemagic_data[0][24]["-----BEGIN PGP40MESSAGE-"] = "application/pgp";
    $mimemagic_data[0][22]["#! /usr/local/bin/bash"] = "application/x-shellscript";
    $mimemagic_data[0][22]["#! /usr/local/bin/gawk"] = "application/x-gawk";
    $mimemagic_data[0][22]["#! /usr/local/bin/nawk"] = "application/x-nawk";
    $mimemagic_data[0][22]["#! /usr/local/bin/perl"] = "application/x-perl";
    $mimemagic_data[0][22]["#! /usr/local/bin/tcsh"] = "application/x-shellscript";
    $mimemagic_data[0][21]["#! /usr/local/bin/ash"] = "application/x-shellscript";
    $mimemagic_data[0][21]["#! /usr/local/bin/zsh"] = "application/x-shellscript";
    $mimemagic_data[0][21]["#!/usr/local/bin/bash"] = "application/x-shellscript";
    $mimemagic_data[0][21]["#!/usr/local/bin/gawk"] = "application/x-gawk";
    $mimemagic_data[0][21]["#!/usr/local/bin/nawk"] = "application/x-nawk";
    $mimemagic_data[0][21]["#!/usr/local/bin/perl"] = "application/x-perl";
    $mimemagic_data[0][21]["#!/usr/local/bin/tcsh"] = "application/x-shellscript";
    $mimemagic_data[0][20]["eval \"exec /bin/perl"] = "application/x-perl";
    $mimemagic_data[0][20]["# PaCkAgE DaTaStReAm"] = "application/x-svr4-package";
    $mimemagic_data[0][20]["#!/usr/local/bin/ash"] = "application/x-shellscript";
    $mimemagic_data[0][20]["#!/usr/local/bin/zsh"] = "application/x-shellscript";
    $mimemagic_data[0][19]["Creative Voice File"] = "audio/x-unknown";
    $mimemagic_data[0][19]["[KDE Desktop Entry]"] = "application/x-kdelnk";
    $mimemagic_data[0][19]["#! /usr/bin/env lua"] = "application/x-lua";
    $mimemagic_data[0][18]["#! /usr/local/tcsh"] = "application/x-shellscript";
    $mimemagic_data[0][18]["#!/usr/bin/env lua"] = "application/x-lua";
    $mimemagic_data[0][17]["This is Info file"] = "text/x-info";
    $mimemagic_data[0][17]["# KDE Config File"] = "application/x-kdelnk";
    $mimemagic_data[0][17]["#!/usr/local/tcsh"] = "application/x-shellscript";
    $mimemagic_data[0][16]["Extended Module:"] = "audio/x-mod";
    $mimemagic_data[0][16]["#VRML V1.0 ascii"] = "model/vrml";
    $mimemagic_data[0][16]["#! /usr/bin/gawk"] = "application/x-gawk";
    $mimemagic_data[0][16]["#! /usr/bin/nawk"] = "application/x-nawk";
    $mimemagic_data[0][16]["#! /usr/bin/perl"] = "application/x-perl";
    $mimemagic_data[0][16]["<MakerDictionary"] = "application/x-mif";
    $mimemagic_data[0][15]["#VRML V2.0 utf8"] = "model/vrml";
    $mimemagic_data[0][15]["#! /usr/bin/awk"] = "application/x-awk";
    $mimemagic_data[0][15]["#!/usr/bin/gawk"] = "application/x-gawk";
    $mimemagic_data[0][15]["#!/usr/bin/nawk"] = "application/x-nawk";
    $mimemagic_data[0][15]["#!/usr/bin/perl"] = "application/x-perl";
    $mimemagic_data[0][15]["<MakerScreenFon"] = "application/x-mif";
    $mimemagic_data[0][14]["Relay-Version:"] = "message/rfc822";
    $mimemagic_data[0][14]["#!/usr/bin/awk"] = "application/x-awk";
    $mimemagic_data[0][14]["#!/usr/bin/zsh"] = "application/x-shellscript";
    $mimemagic_data[0][13]["input texinfo"] = "text/x-texinfo";
    $mimemagic_data[0][12]["Return-Path:"] = "message/rfc822";
    $mimemagic_data[0][12]["#! /bin/bash"] = "application/x-shellscript";
    $mimemagic_data[0][12]["#! /bin/gawk"] = "application/x-gawk";
    $mimemagic_data[0][12]["#! /bin/nawk"] = "application/x-nawk";
    $mimemagic_data[0][12]["#! /bin/perl"] = "application/x-perl";
    $mimemagic_data[0][12]["#! /bin/tcsh"] = "application/x-shellscript";
    $mimemagic_data[0][11]["d8:announce"] = "application/x-bittorrent";
    $mimemagic_data[0][11]["#! /bin/awk"] = "application/x-awk";
    $mimemagic_data[0][11]["#! /bin/csh"] = "application/x-shellscript";
    $mimemagic_data[0][11]["#! /bin/ksh"] = "application/x-shellscript";
    $mimemagic_data[0][11]["#!/bin/bash"] = "application/x-shellscript";
    $mimemagic_data[0][11]["#!/bin/gawk"] = "application/x-gawk";
    $mimemagic_data[0][11]["#!/bin/nawk"] = "application/x-nawk";
    $mimemagic_data[0][11]["#!/bin/perl"] = "application/x-perl";
    $mimemagic_data[0][11]["#!/bin/tcsh"] = "application/x-shellscript";
    $mimemagic_data[0][10]["Forward to"] = "message/rfc822";
    $mimemagic_data[0][10]["#! /bin/sh"] = "application/x-shellscript";
    $mimemagic_data[0][10]["#!/bin/awk"] = "application/x-awk";
    $mimemagic_data[0][10]["#!/bin/csh"] = "application/x-shellscript";
    $mimemagic_data[0][10]["#!/bin/ksh"] = "application/x-shellscript";
    $mimemagic_data[0][10]["#!/bin/zsh"] = "application/x-shellscript";
    $mimemagic_data[0][10]["<MakerFile"] = "application/x-mif";
    $mimemagic_data[0][9]["N#! rnews"] = "message/rfc822";
    $mimemagic_data[0][9]["Received:"] = "message/rfc822";
    $mimemagic_data[0][9]["WordProrû"] = "application/vnd.lotus-wordpro";
    $mimemagic_data[0][9]["#!/bin/sh"] = "application/x-shellscript";
    $mimemagic_data[0][9]["00MMXPR30"] = "application/x-quark-xpress-3";
    $mimemagic_data[0][8]["AT&TFORM"] = "image/vnd.djvu";
    $mimemagic_data[0][8]["WordPro0"] = "application/vnd.lotus-wordpro";
    $mimemagic_data[0][8]["ÐÏࡱá"] = "application/msword";
    $mimemagic_data[0][8]["#! rnews"] = "message/rfc822";
    $mimemagic_data[0][8][";ELC"] = "application/x-elc";
    $mimemagic_data[0][8]["<MIFFile"] = "application/x-mif";
    $mimemagic_data[0][7]["Article"] = "message/news";
    $mimemagic_data[0][7]["Pipe to"] = "message/rfc822";
    $mimemagic_data[0][7]["StuffIt"] = "application/x-stuffit";
    $mimemagic_data[0][7]["‰HDFrn"] = "application/x-hdf";
    $mimemagic_data[0][7]["!<arch>"] = "application/x-archive";
    $mimemagic_data[0][6]["FGF95a"] = "image/x-unknown";
    $mimemagic_data[0][6]["GIF94z"] = "image/x-unknown";
    $mimemagic_data[0][6]["Û¥-000"] = "application/msword";
    $mimemagic_data[0][6]["# xmcd"] = "text/x-xmcd";
    $mimemagic_data[0][6]["/* XPM"] = "image/x-xpmi";
    $mimemagic_data[0][6]["<Maker"] = "application/x-mif";
    $mimemagic_data[0][5]["From:"] = "message/rfc822";
    $mimemagic_data[0][5]["PO^Q`"] = "application/msword";
    $mimemagic_data[0][5]["Path:"] = "message/news";
    $mimemagic_data[0][5]["Xref:"] = "message/news";
    $mimemagic_data[0][5]["%PDF-"] = "application/pdf";
    $mimemagic_data[0][5]["<Book"] = "application/x-mif";
    $mimemagic_data[0][5]["<?xml"] = "text/xml";
    $mimemagic_data[0][5]["=<ar>"] = "application/x-archive";
    $mimemagic_data[0][4]["°"] = "video/mp4v-es";
    $mimemagic_data[0][4]["³"] = "video/mpv";
    $mimemagic_data[0][4]["µ"] = "video/mp4v-es";
    $mimemagic_data[0][4]["»"] = "video/mpeg";
    $mimemagic_data[0][4][""] = "application/x-123";
    $mimemagic_data[0][4][""] = "application/x-123";
    $mimemagic_data[0][4]["a"] = "application/x-dbm";
    $mimemagic_data[0][4]["ADIF"] = "audio/X-HX-AAC-ADIF";
    $mimemagic_data[0][4]["CPC²"] = "image/x-cpi";
    $mimemagic_data[0][4]["CTMF"] = "audio/x-unknown";
    $mimemagic_data[0][4]["GDBM"] = "application/x-gdbm";
    $mimemagic_data[0][4]["IIN1"] = "image/x-niff";
    $mimemagic_data[0][4]["IMPM"] = "audio/x-mod";
    $mimemagic_data[0][4]["MOVI"] = "video/x-sgi-movie";
    $mimemagic_data[0][4]["MThd"] = "audio/midi";
    $mimemagic_data[0][4]["OggS"] = "application/ogg";
    $mimemagic_data[0][4]["PE"] = "application/octet-stream";
    $mimemagic_data[0][4]["PK"] = "application/zip";
    $mimemagic_data[0][4]["Rar!"] = "application/x-rar";
    $mimemagic_data[0][4]["fLaC"] = "audio/x-flac";
    $mimemagic_data[0][4][""] = "application/x-hdf";
    $mimemagic_data[0][4]["{rtf"] = "text/rtf";
    $mimemagic_data[0][4][" z"] = "x-epoc/x-sisx-app";
    $mimemagic_data[0][4]["‰PNG"] = "image/png";
    $mimemagic_data[0][4]["ŠJNG"] = "video/x-jng";
    $mimemagic_data[0][4]["ŠMNG"] = "video/x-mng";
    $mimemagic_data[0][4]["WšÎ"] = "application/x-gdbm";
    $mimemagic_data[0][4]["ÎÎÎÎ"] = "application/x-java-jce-keystore";
    $mimemagic_data[0][4]["çÿ"] = "application/x-eet";
    $mimemagic_data[0][4]["þíþí"] = "application/x-java-keystore";
    $mimemagic_data[0][4]["þ70#"] = "application/msword";
    $mimemagic_data[0][4]["ÿÿÿÿ"] = "application/octet-stream";
    $mimemagic_data[0][4]["\">Ÿx"] = "application/vnd.ms-tnef";
    $mimemagic_data[0][4][".RMF"] = "application/vnd.rn-realmedia";
    $mimemagic_data[0][4][".raý"] = "audio/x-pn-realaudio";
    $mimemagic_data[0][4]["1¾"] = "application/msword";
    $mimemagic_data[0][4]["8BPS"] = "image/vnd.adobe.photoshop";
    $mimemagic_data[0][4]["<MML"] = "application/x-mif";
    $mimemagic_data[0][4]["<!--"] = "text/html";
    $mimemagic_data[0][3]["BZh"] = "application/x-bzip2";
    $mimemagic_data[0][3]["CWS"] = "application/x-shockwave-flash";
    $mimemagic_data[0][3]["FLV"] = "video/x-flv";
    $mimemagic_data[0][3]["GIF"] = "image/gif";
    $mimemagic_data[0][3]["ID3"] = "audio/mpeg";
    $mimemagic_data[0][3]["PBF"] = "image/x-unknown";
    $mimemagic_data[0][3]["SBI"] = "audio/x-unknown";
    $mimemagic_data[0][3]["”¦."] = "application/msword";
    $mimemagic_data[0][3]["%!"] = "application/postscript";
    $mimemagic_data[0][2]["BM"] = "image/x-ms-bmp";
    $mimemagic_data[0][2]["II"] = "image/tiff";
    $mimemagic_data[0][2]["LZ"] = "application/octet-stream";
    $mimemagic_data[0][2]["MM"] = "image/tiff";
    $mimemagic_data[0][2]["MZ"] = "application/octet-stream";
    $mimemagic_data[0][2]["Má"] = "audio/MP4A-LATM";
    $mimemagic_data[0][2]["P1"] = "image/x-portable-bitmap";
    $mimemagic_data[0][2]["P2"] = "image/x-portable-greymap";
    $mimemagic_data[0][2]["P3"] = "image/x-portable-pixmap";
    $mimemagic_data[0][2]["P4"] = "image/x-portable-bitmap";
    $mimemagic_data[0][2]["P5"] = "image/x-portable-greymap";
    $mimemagic_data[0][2]["P6"] = "image/x-portable-pixmap";
    $mimemagic_data[0][2]["\n("] = "application/x-elc";
    $mimemagic_data[0][2]["qÇ"] = "application/x-cpio";
    $mimemagic_data[0][2]["…"] = "application/pgp-encrypted";
    $mimemagic_data[0][2]["•"] = "application/pgp";
    $mimemagic_data[0][2]["•"] = "application/pgp";
    $mimemagic_data[0][2]["™"] = "application/pgp";
    $mimemagic_data[0][2]["™"] = "application/pgp";
    $mimemagic_data[0][2]["¦"] = "application/pgp-encrypted";
    $mimemagic_data[0][2]["¯"] = "video/x-fli";
    $mimemagic_data[0][2]["¯"] = "video/x-flc";
    $mimemagic_data[0][2]["÷"] = "application/x-dvi";
    $mimemagic_data[0][2]["Ë"] = "application/octet-stream";
    $mimemagic_data[0][2]["ê`"] = "application/x-arj";
    $mimemagic_data[0][2]["÷"] = "application/x-dvi";
    $mimemagic_data[0][2]["ÿØ"] = "image/jpeg";
    $mimemagic_data[0][2]["ÿ"] = "application/octet-stream";
    $mimemagic_data[0][2]["‹"] = "application/x-gzip";
    $mimemagic_data[0][2][""] = "application/octet-stream";
    $mimemagic_data[0][2][""] = "application/octet-stream";
    $mimemagic_data[0][2]["ÿ"] = "application/octet-stream";
    $mimemagic_data[0][2]["%!"] = "application/postscript";
    $mimemagic_data[0][2][";;"] = "text/plain";
    $mimemagic_data[0][1][""] = "video/x-unknown";
    $mimemagic_data[0][1][""] = "video/x-unknown";
    $mimemagic_data[2][30]["---BEGIN PGP PUBLIC KEY BLOCK-"] = "application/pgp-keys";
    $mimemagic_data[2][2][""] = "application/x-tex-tfm";
    $mimemagic_data[2][2][""] = "application/x-tex-tfm";
    $mimemagic_data[4][15]["Standard Jet DB"] = "application/x-msaccess";
    $mimemagic_data[4][4]["free"] = "video/quicktime";
    $mimemagic_data[4][4]["idat"] = "image/x-quicktime";
    $mimemagic_data[4][4]["idsc"] = "image/x-quicktime";
    $mimemagic_data[4][4]["mdat"] = "video/quicktime";
    $mimemagic_data[4][4]["moov"] = "video/quicktime";
    $mimemagic_data[4][4]["pckg"] = "application/x-quicktime-player";
    $mimemagic_data[4][4]["skip"] = "video/quicktime";
    $mimemagic_data[4][4]["wide"] = "video/quicktime";
    $mimemagic_data[8][4]["AIFC"] = "audio/x-aiff";
    $mimemagic_data[8][4]["AIFF"] = "audio/x-aiff";
    $mimemagic_data[8][4][""] = "application/vnd.symbian.install";
    $mimemagic_data[8][4]["8SVX"] = "audio/x-aiff";
    $mimemagic_data[11][31]["must be converted with BinHex 4"] = "application/mac-binhex40";
    $mimemagic_data[20][4]["ýħÜ"] = "application/x-zoo";
    $mimemagic_data[21][8]["BMOD2STM"] = "audio/x-mod";
    $mimemagic_data[38][11]["Spreadsheet"] = "application/x-sc";
    $mimemagic_data[39][14]["=<gmr:Workbook"] = "application/x-gnumeric";
    $mimemagic_data[128][4]["DICM"] = "application/dicom";
    $mimemagic_data[128][4]["PE"] = "application/octet-stream";
    $mimemagic_data[512][19]["R0o0o0t0 0E0n0t0r0y"] = "application/msword";
    $mimemagic_data[512][8]["R0o0o0t0"] = "application/x-hwp";
    $mimemagic_data[512][3]["ì¥Á"] = "application/msword";
    $mimemagic_data[1080][4]["CD81"] = "audio/x-mod";
    $mimemagic_data[1080][4]["FLT4"] = "audio/x-mod";
    $mimemagic_data[1080][4]["FLT8"] = "audio/x-mod";
    $mimemagic_data[1080][4]["M!K!"] = "audio/x-mod";
    $mimemagic_data[1080][4]["M.K."] = "audio/x-mod";
    $mimemagic_data[1080][4]["OKTA"] = "audio/x-mod";
    $mimemagic_data[1080][4]["16CN"] = "audio/x-mod";
    $mimemagic_data[1080][4]["32CN"] = "audio/x-mod";
    $mimemagic_data[1080][4]["4CHN"] = "audio/x-mod";
    $mimemagic_data[1080][4]["6CHN"] = "audio/x-mod";
    $mimemagic_data[1080][4]["8CHN"] = "audio/x-mod";
    $mimemagic_data[2080][29]["Microsoft Excel 5.0 Worksheet"] = "application/vnd.ms-excel";
    $mimemagic_data[2080][27]["Microsoft Word 6.0 Document"] = "application/msword";
    $mimemagic_data[2080][26]["Documento Microsoft Word 6"] = "application/msword";
    $mimemagic_data[2112][9]["MSWordDoc"] = "application/msword";
    $mimemagic_data[2114][5]["Biff5"] = "application/vnd.ms-excel";
    $mimemagic_data[32769][5]["CD001"] = "application/x-iso9660-image";
    $mimetypes_data["ez"] = "application/andrew-inset";
    $mimetypes_data["anx"] = "application/annodex";
    $mimetypes_data["atom"] = "application/atom+xml";
    $mimetypes_data["atomcat"] = "application/atomcat+xml";
    $mimetypes_data["atomsrv"] = "application/atomserv+xml";
    $mimetypes_data["lin"] = "application/bbolin";
    $mimetypes_data["cap"] = "application/cap";
    $mimetypes_data["pcap"] = "application/cap";
    $mimetypes_data["cu"] = "application/cu-seeme";
    $mimetypes_data["davmount"] = "application/davmount+xml";
    $mimetypes_data["tsp"] = "application/dsptype";
    $mimetypes_data["es"] = "application/ecmascript";
    $mimetypes_data["spl"] = "application/futuresplash";
    $mimetypes_data["hta"] = "application/hta";
    $mimetypes_data["jar"] = "application/java-archive";
    $mimetypes_data["ser"] = "application/java-serialized-object";
    $mimetypes_data["class"] = "application/java-vm";
    $mimetypes_data["js"] = "application/javascript";
    $mimetypes_data["m3g"] = "application/m3g";
    $mimetypes_data["hqx"] = "application/mac-binhex40";
    $mimetypes_data["cpt"] = "application/mac-compactpro";
    $mimetypes_data["nb"] = "application/mathematica";
    $mimetypes_data["nbp"] = "application/mathematica";
    $mimetypes_data["mdb"] = "application/msaccess";
    $mimetypes_data["doc"] = "application/msword";
    $mimetypes_data["dot"] = "application/msword";
    $mimetypes_data["bin"] = "application/octet-stream";
    $mimetypes_data["oda"] = "application/oda";
    $mimetypes_data["ogx"] = "application/ogg";
    $mimetypes_data["pdf"] = "application/pdf";
    $mimetypes_data["key"] = "application/pgp-keys";
    $mimetypes_data["pgp"] = "application/pgp-signature";
    $mimetypes_data["prf"] = "application/pics-rules";
    $mimetypes_data["ps"] = "application/postscript";
    $mimetypes_data["ai"] = "application/postscript";
    $mimetypes_data["eps"] = "application/postscript";
    $mimetypes_data["espi"] = "application/postscript";
    $mimetypes_data["epsf"] = "application/postscript";
    $mimetypes_data["eps2"] = "application/postscript";
    $mimetypes_data["eps3"] = "application/postscript";
    $mimetypes_data["rar"] = "application/rar";
    $mimetypes_data["rdf"] = "application/rdf+xml";
    $mimetypes_data["rss"] = "application/rss+xml";
    $mimetypes_data["rtf"] = "application/rtf";
    $mimetypes_data["smi"] = "application/smil";
    $mimetypes_data["smil"] = "application/smil";
    $mimetypes_data["xhtml"] = "application/xhtml+xml";
    $mimetypes_data["xht"] = "application/xhtml+xml";
    $mimetypes_data["xml"] = "application/xml";
    $mimetypes_data["xsl"] = "application/xml";
    $mimetypes_data["xsd"] = "application/xml";
    $mimetypes_data["xspf"] = "application/xspf+xml";
    $mimetypes_data["zip"] = "application/zip";
    $mimetypes_data["cdy"] = "application/vnd.cinderella";
    $mimetypes_data["kml"] = "application/vnd.google-earth.kml+xml";
    $mimetypes_data["kmz"] = "application/vnd.google-earth.kmz";
    $mimetypes_data["xul"] = "application/vnd.mozilla.xul+xml";
    $mimetypes_data["xls"] = "application/vnd.ms-excel";
    $mimetypes_data["xlb"] = "application/vnd.ms-excel";
    $mimetypes_data["xlt"] = "application/vnd.ms-excel";
    $mimetypes_data["cat"] = "application/vnd.ms-pki.seccat";
    $mimetypes_data["stl"] = "application/vnd.ms-pki.stl";
    $mimetypes_data["ppt"] = "application/vnd.ms-powerpoint";
    $mimetypes_data["pps"] = "application/vnd.ms-powerpoint";
    $mimetypes_data["odc"] = "application/vnd.oasis.opendocument.chart";
    $mimetypes_data["odb"] = "application/vnd.oasis.opendocument.database";
    $mimetypes_data["odf"] = "application/vnd.oasis.opendocument.formula";
    $mimetypes_data["odg"] = "application/vnd.oasis.opendocument.graphics";
    $mimetypes_data["otg"] = "application/vnd.oasis.opendocument.graphics-template";
    $mimetypes_data["odi"] = "application/vnd.oasis.opendocument.image";
    $mimetypes_data["odp"] = "application/vnd.oasis.opendocument.presentation";
    $mimetypes_data["otp"] = "application/vnd.oasis.opendocument.presentation-template";
    $mimetypes_data["ods"] = "application/vnd.oasis.opendocument.spreadsheet";
    $mimetypes_data["ots"] = "application/vnd.oasis.opendocument.spreadsheet-template";
    $mimetypes_data["odt"] = "application/vnd.oasis.opendocument.text";
    $mimetypes_data["odm"] = "application/vnd.oasis.opendocument.text-master";
    $mimetypes_data["ott"] = "application/vnd.oasis.opendocument.text-template";
    $mimetypes_data["oth"] = "application/vnd.oasis.opendocument.text-web";
    $mimetypes_data["cod"] = "application/vnd.rim.cod";
    $mimetypes_data["mmf"] = "application/vnd.smaf";
    $mimetypes_data["sdc"] = "application/vnd.stardivision.calc";
    $mimetypes_data["sds"] = "application/vnd.stardivision.chart";
    $mimetypes_data["sda"] = "application/vnd.stardivision.draw";
    $mimetypes_data["sdd"] = "application/vnd.stardivision.impress";
    $mimetypes_data["sdf"] = "application/vnd.stardivision.math";
    $mimetypes_data["sdw"] = "application/vnd.stardivision.writer";
    $mimetypes_data["sgl"] = "application/vnd.stardivision.writer-global";
    $mimetypes_data["sxc"] = "application/vnd.sun.xml.calc";
    $mimetypes_data["stc"] = "application/vnd.sun.xml.calc.template";
    $mimetypes_data["sxd"] = "application/vnd.sun.xml.draw";
    $mimetypes_data["std"] = "application/vnd.sun.xml.draw.template";
    $mimetypes_data["sxi"] = "application/vnd.sun.xml.impress";
    $mimetypes_data["sti"] = "application/vnd.sun.xml.impress.template";
    $mimetypes_data["sxm"] = "application/vnd.sun.xml.math";
    $mimetypes_data["sxw"] = "application/vnd.sun.xml.writer";
    $mimetypes_data["sxg"] = "application/vnd.sun.xml.writer.global";
    $mimetypes_data["stw"] = "application/vnd.sun.xml.writer.template";
    $mimetypes_data["sis"] = "application/vnd.symbian.install";
    $mimetypes_data["vsd"] = "application/vnd.visio";
    $mimetypes_data["wbxml"] = "application/vnd.wap.wbxml";
    $mimetypes_data["wmlc"] = "application/vnd.wap.wmlc";
    $mimetypes_data["wmlsc"] = "application/vnd.wap.wmlscriptc";
    $mimetypes_data["wpd"] = "application/vnd.wordperfect";
    $mimetypes_data["wp5"] = "application/vnd.wordperfect5.1";
    $mimetypes_data["wk"] = "application/x-123";
    $mimetypes_data["7z"] = "application/x-7z-compressed";
    $mimetypes_data["abw"] = "application/x-abiword";
    $mimetypes_data["dmg"] = "application/x-apple-diskimage";
    $mimetypes_data["bcpio"] = "application/x-bcpio";
    $mimetypes_data["torrent"] = "application/x-bittorrent";
    $mimetypes_data["cab"] = "application/x-cab";
    $mimetypes_data["cbr"] = "application/x-cbr";
    $mimetypes_data["cbz"] = "application/x-cbz";
    $mimetypes_data["cdf"] = "application/x-cdf";
    $mimetypes_data["cda"] = "application/x-cdf";
    $mimetypes_data["vcd"] = "application/x-cdlink";
    $mimetypes_data["pgn"] = "application/x-chess-pgn";
    $mimetypes_data["cpio"] = "application/x-cpio";
    $mimetypes_data["csh"] = "application/x-csh";
    $mimetypes_data["deb"] = "application/x-debian-package";
    $mimetypes_data["udeb"] = "application/x-debian-package";
    $mimetypes_data["dcr"] = "application/x-director";
    $mimetypes_data["dir"] = "application/x-director";
    $mimetypes_data["dxr"] = "application/x-director";
    $mimetypes_data["dms"] = "application/x-dms";
    $mimetypes_data["wad"] = "application/x-doom";
    $mimetypes_data["dvi"] = "application/x-dvi";
    $mimetypes_data["rhtml"] = "application/x-httpd-eruby";
    $mimetypes_data["pfa"] = "application/x-font";
    $mimetypes_data["pfb"] = "application/x-font";
    $mimetypes_data["gsf"] = "application/x-font";
    $mimetypes_data["pcf"] = "application/x-font";
    $mimetypes_data["pcf.Z"] = "application/x-font";
    $mimetypes_data["mm"] = "application/x-freemind";
    $mimetypes_data["spl"] = "application/x-futuresplash";
    $mimetypes_data["gnumeric"] = "application/x-gnumeric";
    $mimetypes_data["sgf"] = "application/x-go-sgf";
    $mimetypes_data["gcf"] = "application/x-graphing-calculator";
    $mimetypes_data["gtar"] = "application/x-gtar";
    $mimetypes_data["tgz"] = "application/x-gtar";
    $mimetypes_data["taz"] = "application/x-gtar";
    $mimetypes_data["hdf"] = "application/x-hdf";
    $mimetypes_data["phtml"] = "application/x-httpd-php";
    $mimetypes_data["pht"] = "application/x-httpd-php";
    $mimetypes_data["php"] = "application/x-httpd-php";
    $mimetypes_data["phps"] = "application/x-httpd-php-source";
    $mimetypes_data["php3"] = "application/x-httpd-php3";
    $mimetypes_data["php3p"] = "application/x-httpd-php3-preprocessed";
    $mimetypes_data["php4"] = "application/x-httpd-php4";
    $mimetypes_data["ica"] = "application/x-ica";
    $mimetypes_data["info"] = "application/x-info";
    $mimetypes_data["ins"] = "application/x-internet-signup";
    $mimetypes_data["isp"] = "application/x-internet-signup";
    $mimetypes_data["iii"] = "application/x-iphone";
    $mimetypes_data["iso"] = "application/x-iso9660-image";
    $mimetypes_data["jam"] = "application/x-jam";
    $mimetypes_data["jnlp"] = "application/x-java-jnlp-file";
    $mimetypes_data["jmz"] = "application/x-jmol";
    $mimetypes_data["chrt"] = "application/x-kchart";
    $mimetypes_data["kil"] = "application/x-killustrator";
    $mimetypes_data["skp"] = "application/x-koan";
    $mimetypes_data["skd"] = "application/x-koan";
    $mimetypes_data["skt"] = "application/x-koan";
    $mimetypes_data["skm"] = "application/x-koan";
    $mimetypes_data["kpr"] = "application/x-kpresenter";
    $mimetypes_data["kpt"] = "application/x-kpresenter";
    $mimetypes_data["ksp"] = "application/x-kspread";
    $mimetypes_data["kwd"] = "application/x-kword";
    $mimetypes_data["kwt"] = "application/x-kword";
    $mimetypes_data["latex"] = "application/x-latex";
    $mimetypes_data["lha"] = "application/x-lha";
    $mimetypes_data["lyx"] = "application/x-lyx";
    $mimetypes_data["lzh"] = "application/x-lzh";
    $mimetypes_data["lzx"] = "application/x-lzx";
    $mimetypes_data["frm"] = "application/x-maker";
    $mimetypes_data["maker"] = "application/x-maker";
    $mimetypes_data["frame"] = "application/x-maker";
    $mimetypes_data["fm"] = "application/x-maker";
    $mimetypes_data["fb"] = "application/x-maker";
    $mimetypes_data["book"] = "application/x-maker";
    $mimetypes_data["fbdoc"] = "application/x-maker";
    $mimetypes_data["mif"] = "application/x-mif";
    $mimetypes_data["wmd"] = "application/x-ms-wmd";
    $mimetypes_data["wmz"] = "application/x-ms-wmz";
    $mimetypes_data["com"] = "application/x-msdos-program";
    $mimetypes_data["exe"] = "application/x-msdos-program";
    $mimetypes_data["bat"] = "application/x-msdos-program";
    $mimetypes_data["dll"] = "application/x-msdos-program";
    $mimetypes_data["msi"] = "application/x-msi";
    $mimetypes_data["nc"] = "application/x-netcdf";
    $mimetypes_data["pac"] = "application/x-ns-proxy-autoconfig";
    $mimetypes_data["dat"] = "application/x-ns-proxy-autoconfig";
    $mimetypes_data["nwc"] = "application/x-nwc";
    $mimetypes_data["o"] = "application/x-object";
    $mimetypes_data["oza"] = "application/x-oz-application";
    $mimetypes_data["p7r"] = "application/x-pkcs7-certreqresp";
    $mimetypes_data["crl"] = "application/x-pkcs7-crl";
    $mimetypes_data["pyc"] = "application/x-python-code";
    $mimetypes_data["pyo"] = "application/x-python-code";
    $mimetypes_data["qgs"] = "application/x-qgis";
    $mimetypes_data["shp"] = "application/x-qgis";
    $mimetypes_data["shx"] = "application/x-qgis";
    $mimetypes_data["qtl"] = "application/x-quicktimeplayer";
    $mimetypes_data["rpm"] = "application/x-redhat-package-manager";
    $mimetypes_data["rb"] = "application/x-ruby";
    $mimetypes_data["sh"] = "application/x-sh";
    $mimetypes_data["shar"] = "application/x-shar";
    $mimetypes_data["swf"] = "application/x-shockwave-flash";
    $mimetypes_data["swfl"] = "application/x-shockwave-flash";
    $mimetypes_data["sit"] = "application/x-stuffit";
    $mimetypes_data["sitx"] = "application/x-stuffit";
    $mimetypes_data["sv4cpio"] = "application/x-sv4cpio";
    $mimetypes_data["sv4crc"] = "application/x-sv4crc";
    $mimetypes_data["tar"] = "application/x-tar";
    $mimetypes_data["tcl"] = "application/x-tcl";
    $mimetypes_data["gf"] = "application/x-tex-gf";
    $mimetypes_data["pk"] = "application/x-tex-pk";
    $mimetypes_data["texinfo"] = "application/x-texinfo";
    $mimetypes_data["texi"] = "application/x-texinfo";
    $mimetypes_data["~"] = "application/x-trash";
    $mimetypes_data["%"] = "application/x-trash";
    $mimetypes_data["bak"] = "application/x-trash";
    $mimetypes_data["old"] = "application/x-trash";
    $mimetypes_data["sik"] = "application/x-trash";
    $mimetypes_data["t"] = "application/x-troff";
    $mimetypes_data["tr"] = "application/x-troff";
    $mimetypes_data["roff"] = "application/x-troff";
    $mimetypes_data["man"] = "application/x-troff-man";
    $mimetypes_data["me"] = "application/x-troff-me";
    $mimetypes_data["ms"] = "application/x-troff-ms";
    $mimetypes_data["ustar"] = "application/x-ustar";
    $mimetypes_data["src"] = "application/x-wais-source";
    $mimetypes_data["wz"] = "application/x-wingz";
    $mimetypes_data["crt"] = "application/x-x509-ca-cert";
    $mimetypes_data["xcf"] = "application/x-xcf";
    $mimetypes_data["fig"] = "application/x-xfig";
    $mimetypes_data["xpi"] = "application/x-xpinstall";
    $mimetypes_data["amr"] = "audio/amr";
    $mimetypes_data["awb"] = "audio/amr-wb";
    $mimetypes_data["amr"] = "audio/amr";
    $mimetypes_data["awb"] = "audio/amr-wb";
    $mimetypes_data["axa"] = "audio/annodex";
    $mimetypes_data["au"] = "audio/basic";
    $mimetypes_data["snd"] = "audio/basic";
    $mimetypes_data["flac"] = "audio/flac";
    $mimetypes_data["mid"] = "audio/midi";
    $mimetypes_data["midi"] = "audio/midi";
    $mimetypes_data["kar"] = "audio/midi";
    $mimetypes_data["mpga"] = "audio/mpeg";
    $mimetypes_data["mpega"] = "audio/mpeg";
    $mimetypes_data["mp2"] = "audio/mpeg";
    $mimetypes_data["mp3"] = "audio/mpeg";
    $mimetypes_data["m4a"] = "audio/mpeg";
    $mimetypes_data["m3u"] = "audio/mpegurl";
    $mimetypes_data["oga"] = "audio/ogg";
    $mimetypes_data["ogg"] = "audio/ogg";
    $mimetypes_data["spx"] = "audio/ogg";
    $mimetypes_data["sid"] = "audio/prs.sid";
    $mimetypes_data["aif"] = "audio/x-aiff";
    $mimetypes_data["aiff"] = "audio/x-aiff";
    $mimetypes_data["aifc"] = "audio/x-aiff";
    $mimetypes_data["gsm"] = "audio/x-gsm";
    $mimetypes_data["m3u"] = "audio/x-mpegurl";
    $mimetypes_data["wma"] = "audio/x-ms-wma";
    $mimetypes_data["wax"] = "audio/x-ms-wax";
    $mimetypes_data["ra"] = "audio/x-pn-realaudio";
    $mimetypes_data["rm"] = "audio/x-pn-realaudio";
    $mimetypes_data["ram"] = "audio/x-pn-realaudio";
    $mimetypes_data["ra"] = "audio/x-realaudio";
    $mimetypes_data["pls"] = "audio/x-scpls";
    $mimetypes_data["sd2"] = "audio/x-sd2";
    $mimetypes_data["wav"] = "audio/x-wav";
    $mimetypes_data["alc"] = "chemical/x-alchemy";
    $mimetypes_data["cac"] = "chemical/x-cache";
    $mimetypes_data["cache"] = "chemical/x-cache";
    $mimetypes_data["csf"] = "chemical/x-cache-csf";
    $mimetypes_data["cbin"] = "chemical/x-cactvs-binary";
    $mimetypes_data["cascii"] = "chemical/x-cactvs-binary";
    $mimetypes_data["ctab"] = "chemical/x-cactvs-binary";
    $mimetypes_data["cdx"] = "chemical/x-cdx";
    $mimetypes_data["cer"] = "chemical/x-cerius";
    $mimetypes_data["c3d"] = "chemical/x-chem3d";
    $mimetypes_data["chm"] = "chemical/x-chemdraw";
    $mimetypes_data["cif"] = "chemical/x-cif";
    $mimetypes_data["cmdf"] = "chemical/x-cmdf";
    $mimetypes_data["cml"] = "chemical/x-cml";
    $mimetypes_data["cpa"] = "chemical/x-compass";
    $mimetypes_data["bsd"] = "chemical/x-crossfire";
    $mimetypes_data["csml"] = "chemical/x-csml";
    $mimetypes_data["csm"] = "chemical/x-csml";
    $mimetypes_data["ctx"] = "chemical/x-ctx";
    $mimetypes_data["cxf"] = "chemical/x-cxf";
    $mimetypes_data["cef"] = "chemical/x-cxf";
    $mimetypes_data["emb"] = "chemical/x-embl-dl-nucleotide";
    $mimetypes_data["embl"] = "chemical/x-embl-dl-nucleotide";
    $mimetypes_data["spc"] = "chemical/x-galactic-spc";
    $mimetypes_data["inp"] = "chemical/x-gamess-input";
    $mimetypes_data["gam"] = "chemical/x-gamess-input";
    $mimetypes_data["gamin"] = "chemical/x-gamess-input";
    $mimetypes_data["fch"] = "chemical/x-gaussian-checkpoint";
    $mimetypes_data["fchk"] = "chemical/x-gaussian-checkpoint";
    $mimetypes_data["cub"] = "chemical/x-gaussian-cube";
    $mimetypes_data["gau"] = "chemical/x-gaussian-input";
    $mimetypes_data["gjc"] = "chemical/x-gaussian-input";
    $mimetypes_data["gjf"] = "chemical/x-gaussian-input";
    $mimetypes_data["gal"] = "chemical/x-gaussian-log";
    $mimetypes_data["gcg"] = "chemical/x-gcg8-sequence";
    $mimetypes_data["gen"] = "chemical/x-genbank";
    $mimetypes_data["hin"] = "chemical/x-hin";
    $mimetypes_data["istr"] = "chemical/x-isostar";
    $mimetypes_data["ist"] = "chemical/x-isostar";
    $mimetypes_data["jdx"] = "chemical/x-jcamp-dx";
    $mimetypes_data["dx"] = "chemical/x-jcamp-dx";
    $mimetypes_data["kin"] = "chemical/x-kinemage";
    $mimetypes_data["mcm"] = "chemical/x-macmolecule";
    $mimetypes_data["mmd"] = "chemical/x-macromodel-input";
    $mimetypes_data["mmod"] = "chemical/x-macromodel-input";
    $mimetypes_data["mol"] = "chemical/x-mdl-molfile";
    $mimetypes_data["rd"] = "chemical/x-mdl-rdfile";
    $mimetypes_data["rxn"] = "chemical/x-mdl-rxnfile";
    $mimetypes_data["sd"] = "chemical/x-mdl-sdfile";
    $mimetypes_data["sdf"] = "chemical/x-mdl-sdfile";
    $mimetypes_data["tgf"] = "chemical/x-mdl-tgf";
    $mimetypes_data["mcif"] = "chemical/x-mmcif";
    $mimetypes_data["mol2"] = "chemical/x-mol2";
    $mimetypes_data["b"] = "chemical/x-molconn-Z";
    $mimetypes_data["gpt"] = "chemical/x-mopac-graph";
    $mimetypes_data["mop"] = "chemical/x-mopac-input";
    $mimetypes_data["mopcrt"] = "chemical/x-mopac-input";
    $mimetypes_data["mpc"] = "chemical/x-mopac-input";
    $mimetypes_data["zmt"] = "chemical/x-mopac-input";
    $mimetypes_data["moo"] = "chemical/x-mopac-out";
    $mimetypes_data["mvb"] = "chemical/x-mopac-vib";
    $mimetypes_data["asn"] = "chemical/x-ncbi-asn1";
    $mimetypes_data["prt"] = "chemical/x-ncbi-asn1-ascii";
    $mimetypes_data["ent"] = "chemical/x-ncbi-asn1-ascii";
    $mimetypes_data["val"] = "chemical/x-ncbi-asn1-binary";
    $mimetypes_data["aso"] = "chemical/x-ncbi-asn1-binary";
    $mimetypes_data["asn"] = "chemical/x-ncbi-asn1-spec";
    $mimetypes_data["pdb"] = "chemical/x-pdb";
    $mimetypes_data["ent"] = "chemical/x-pdb";
    $mimetypes_data["ros"] = "chemical/x-rosdal";
    $mimetypes_data["sw"] = "chemical/x-swissprot";
    $mimetypes_data["vms"] = "chemical/x-vamas-iso14976";
    $mimetypes_data["vmd"] = "chemical/x-vmd";
    $mimetypes_data["xtel"] = "chemical/x-xtel";
    $mimetypes_data["xyz"] = "chemical/x-xyz";
    $mimetypes_data["gif"] = "image/gif";
    $mimetypes_data["ief"] = "image/ief";
    $mimetypes_data["jpeg"] = "image/jpeg";
    $mimetypes_data["jpg"] = "image/jpeg";
    $mimetypes_data["jpe"] = "image/jpeg";
    $mimetypes_data["pcx"] = "image/pcx";
    $mimetypes_data["png"] = "image/png";
    $mimetypes_data["svg"] = "image/svg+xml";
    $mimetypes_data["svgz"] = "image/svg+xml";
    $mimetypes_data["tiff"] = "image/tiff";
    $mimetypes_data["tif"] = "image/tiff";
    $mimetypes_data["djvu"] = "image/vnd.djvu";
    $mimetypes_data["djv"] = "image/vnd.djvu";
    $mimetypes_data["wbmp"] = "image/vnd.wap.wbmp";
    $mimetypes_data["ras"] = "image/x-cmu-raster";
    $mimetypes_data["cdr"] = "image/x-coreldraw";
    $mimetypes_data["pat"] = "image/x-coreldrawpattern";
    $mimetypes_data["cdt"] = "image/x-coreldrawtemplate";
    $mimetypes_data["cpt"] = "image/x-corelphotopaint";
    $mimetypes_data["ico"] = "image/x-icon";
    $mimetypes_data["art"] = "image/x-jg";
    $mimetypes_data["jng"] = "image/x-jng";
    $mimetypes_data["bmp"] = "image/x-ms-bmp";
    $mimetypes_data["psd"] = "image/x-photoshop";
    $mimetypes_data["pnm"] = "image/x-portable-anymap";
    $mimetypes_data["pbm"] = "image/x-portable-bitmap";
    $mimetypes_data["pgm"] = "image/x-portable-graymap";
    $mimetypes_data["ppm"] = "image/x-portable-pixmap";
    $mimetypes_data["rgb"] = "image/x-rgb";
    $mimetypes_data["xbm"] = "image/x-xbitmap";
    $mimetypes_data["xpm"] = "image/x-xpixmap";
    $mimetypes_data["xwd"] = "image/x-xwindowdump";
    $mimetypes_data["eml"] = "message/rfc822";
    $mimetypes_data["igs"] = "model/iges";
    $mimetypes_data["iges"] = "model/iges";
    $mimetypes_data["msh"] = "model/mesh";
    $mimetypes_data["mesh"] = "model/mesh";
    $mimetypes_data["silo"] = "model/mesh";
    $mimetypes_data["wrl"] = "model/vrml";
    $mimetypes_data["vrml"] = "model/vrml";
    $mimetypes_data["ics"] = "text/calendar";
    $mimetypes_data["icz"] = "text/calendar";
    $mimetypes_data["css"] = "text/css";
    $mimetypes_data["csv"] = "text/csv";
    $mimetypes_data["323"] = "text/h323";
    $mimetypes_data["html"] = "text/html";
    $mimetypes_data["htm"] = "text/html";
    $mimetypes_data["shtml"] = "text/html";
    $mimetypes_data["uls"] = "text/iuls";
    $mimetypes_data["mml"] = "text/mathml";
    $mimetypes_data["asc"] = "text/plain";
    $mimetypes_data["txt"] = "text/plain";
    $mimetypes_data["text"] = "text/plain";
    $mimetypes_data["pot"] = "text/plain";
    $mimetypes_data["brf"] = "text/plain";
    $mimetypes_data["rtx"] = "text/richtext";
    $mimetypes_data["sct"] = "text/scriptlet";
    $mimetypes_data["wsc"] = "text/scriptlet";
    $mimetypes_data["tm"] = "text/texmacs";
    $mimetypes_data["ts"] = "text/texmacs";
    $mimetypes_data["tsv"] = "text/tab-separated-values";
    $mimetypes_data["jad"] = "text/vnd.sun.j2me.app-descriptor";
    $mimetypes_data["wml"] = "text/vnd.wap.wml";
    $mimetypes_data["wmls"] = "text/vnd.wap.wmlscript";
    $mimetypes_data["bib"] = "text/x-bibtex";
    $mimetypes_data["boo"] = "text/x-boo";
    $mimetypes_data["h++"] = "text/x-c++hdr";
    $mimetypes_data["hpp"] = "text/x-c++hdr";
    $mimetypes_data["hxx"] = "text/x-c++hdr";
    $mimetypes_data["hh"] = "text/x-c++hdr";
    $mimetypes_data["c++"] = "text/x-c++src";
    $mimetypes_data["cpp"] = "text/x-c++src";
    $mimetypes_data["cxx"] = "text/x-c++src";
    $mimetypes_data["cc"] = "text/x-c++src";
    $mimetypes_data["h"] = "text/x-chdr";
    $mimetypes_data["htc"] = "text/x-component";
    $mimetypes_data["csh"] = "text/x-csh";
    $mimetypes_data["c"] = "text/x-csrc";
    $mimetypes_data["d"] = "text/x-dsrc";
    $mimetypes_data["diff"] = "text/x-diff";
    $mimetypes_data["patch"] = "text/x-diff";
    $mimetypes_data["hs"] = "text/x-haskell";
    $mimetypes_data["java"] = "text/x-java";
    $mimetypes_data["lhs"] = "text/x-literate-haskell";
    $mimetypes_data["moc"] = "text/x-moc";
    $mimetypes_data["p"] = "text/x-pascal";
    $mimetypes_data["pas"] = "******";
    $mimetypes_data["gcd"] = "text/x-pcs-gcd";
    $mimetypes_data["pl"] = "text/x-perl";
    $mimetypes_data["pm"] = "text/x-perl";
    $mimetypes_data["py"] = "text/x-python";
    $mimetypes_data["scala"] = "text/x-scala";
    $mimetypes_data["etx"] = "text/x-setext";
    $mimetypes_data["sh"] = "text/x-sh";
    $mimetypes_data["tcl"] = "text/x-tcl";
    $mimetypes_data["tk"] = "text/x-tcl";
    $mimetypes_data["tex"] = "text/x-tex";
    $mimetypes_data["ltx"] = "text/x-tex";
    $mimetypes_data["sty"] = "text/x-tex";
    $mimetypes_data["cls"] = "text/x-tex";
    $mimetypes_data["vcs"] = "text/x-vcalendar";
    $mimetypes_data["vcf"] = "text/x-vcard";
    $mimetypes_data["3gp"] = "video/3gpp";
    $mimetypes_data["axv"] = "video/annodex";
    $mimetypes_data["dl"] = "video/dl";
    $mimetypes_data["dif"] = "video/dv";
    $mimetypes_data["dv"] = "video/dv";
    $mimetypes_data["fli"] = "video/fli";
    $mimetypes_data["gl"] = "video/gl";
    $mimetypes_data["mpeg"] = "video/mpeg";
    $mimetypes_data["mpg"] = "video/mpeg";
    $mimetypes_data["mpe"] = "video/mpeg";
    $mimetypes_data["mp4"] = "video/mp4";
    $mimetypes_data["qt"] = "video/quicktime";
    $mimetypes_data["mov"] = "video/quicktime";
    $mimetypes_data["ogv"] = "video/ogg";
    $mimetypes_data["mxu"] = "video/vnd.mpegurl";
    $mimetypes_data["flv"] = "video/x-flv";
    $mimetypes_data["lsf"] = "video/x-la-asf";
    $mimetypes_data["lsx"] = "video/x-la-asf";
    $mimetypes_data["mng"] = "video/x-mng";
    $mimetypes_data["asf"] = "video/x-ms-asf";
    $mimetypes_data["asx"] = "video/x-ms-asf";
    $mimetypes_data["wm"] = "video/x-ms-wm";
    $mimetypes_data["wmv"] = "video/x-ms-wmv";
    $mimetypes_data["wmx"] = "video/x-ms-wmx";
    $mimetypes_data["wvx"] = "video/x-ms-wvx";
    $mimetypes_data["avi"] = "video/x-msvideo";
    $mimetypes_data["movie"] = "video/x-sgi-movie";
    $mimetypes_data["mpv"] = "video/x-matroska";
    $mimetypes_data["ice"] = "x-conference/x-cooltalk";
    $mimetypes_data["sisx"] = "x-epoc/x-sisx-app";
    $mimetypes_data["vrm"] = "x-world/x-vrml";
    $mimetypes_data["vrml"] = "x-world/x-vrml";
    $mimetypes_data["wrl"] = "x-world/x-vrml";
    $mimetypes_data["p7s"] = "application/pkcs7-signature";
    $mimetypes_data["p7m"] = "application/pkcs7-mime";
    $mimetypes_data["p7c"] = "application/pkcs7-mime";
    $MIME_EXT = 0x1;
    $MIME_DATA = 0x2;
    $result = false;
    if ($flags & $MIME_DATA) {
        reset($mimemagic_data);
        if ($content) {
            $content_length = byte_strlen($content);
            while (!$result && (list($offset, $odata) = each($mimemagic_data))) {
                while (!$result && (list($length, $ldata) = each($odata))) {
                    if ($content_length >= $offset + $length) {
                        $lookup = byte_substr($content, $offset, $length);
                        if (isset($ldata[$lookup])) {
                            $result = $ldata[$lookup];
                        }
                    }
                }
            }
        }
    }
    if ($flags & $MIME_EXT && ($flags & $MIME_DATA && !$result || !($flags & $MIME_DATA))) {
        if (eregi('.*[.]([^.]*)', $filename, $regs)) {
            if (isset($mimetypes_data[strtolower($regs[1])])) {
                $result = $mimetypes_data[strtolower($regs[1])];
            }
        }
    }
    return $result;
}
예제 #3
0
/**
 * Extracts the basedate of the GlobalObjectID and the RecurStartTime 
 *
 * @param string $goid - OL compatible GlobalObjectID
 * @param long $recurStartTime - RecurStartTime 
 * @return long basedate 
 *
 */
function extractBaseDate($goid, $recurStartTime)
{
    $hexbase = byte_substr(bin2hex($goid), 32, 8);
    $day = hexdec(byte_substr($hexbase, 6, 2));
    $month = hexdec(byte_substr($hexbase, 4, 2));
    $year = hexdec(byte_substr($hexbase, 0, 4));
    if ($day && $month && $year) {
        $h = $recurStartTime >> 12;
        $m = $recurStartTime - $h * 4096 >> 6;
        $s = $recurStartTime - $h * 4096 - $m * 64;
        return gmmktime($h, $m, $s, $month, $day, $year);
    } else {
        return false;
    }
}
예제 #4
0
 function splitTag($fulltag)
 {
     $ns = false;
     $pos = strpos($fulltag, chr(58));
     // chr(58) == ':'
     if ($pos) {
         $ns = byte_substr($fulltag, 0, $pos);
         $tag = byte_substr($fulltag, $pos + 1);
     } else {
         $tag = $fulltag;
     }
     $ret = array();
     if ($ns) {
         $ret["ns"] = $ns;
     }
     $ret["tag"] = $tag;
     return $ret;
 }