[ Index ]

PHP Cross Reference of phpBB-3.3.14-deutsch

title

Body

[close]

/phpbb/mimetype/ -> extension_guesser.php (source)

   1  <?php
   2  /**
   3  *
   4  * This file is part of the phpBB Forum Software package.
   5  *
   6  * @copyright (c) phpBB Limited <https://www.phpbb.com>
   7  * @license GNU General Public License, version 2 (GPL-2.0)
   8  *
   9  * For full copyright and license information, please see
  10  * the docs/CREDITS.txt file.
  11  *
  12  */
  13  
  14  namespace phpbb\mimetype;
  15  
  16  class extension_guesser extends guesser_base
  17  {
  18      /**
  19      * @var file extension map
  20      */
  21      protected $extension_map = array(
  22          '3dm'        => 'x-world/x-3dmf',
  23          '3dmf'        => 'x-world/x-3dmf',
  24          'a'        => 'application/octet-stream',
  25          'aab'        => 'application/x-authorware-bin',
  26          'aam'        => 'application/x-authorware-map',
  27          'aas'        => 'application/x-authorware-seg',
  28          'abc'        => 'text/vnd.abc',
  29          'acgi'        => 'text/html',
  30          'afl'        => 'video/animaflex',
  31          'ai'        => 'application/postscript',
  32          'aif'        => 'audio/aiff',
  33          'aifc'        => 'audio/aiff',
  34          'aiff'        => 'audio/aiff',
  35          'aim'        => 'application/x-aim',
  36          'aip'        => 'text/x-audiosoft-intra',
  37          'ani'        => 'application/x-navi-animation',
  38          'aos'        => 'application/x-nokia-9000-communicator-add-on-software',
  39          'aps'        => 'application/mime',
  40          'arc'        => 'application/octet-stream',
  41          'arj'        => 'application/arj',
  42          'art'        => 'image/x-jg',
  43          'asf'        => 'video/x-ms-asf',
  44          'asm'        => 'text/x-asm',
  45          'asp'        => 'text/asp',
  46          'asx'        => 'video/x-ms-asf',
  47          'au'        => 'audio/x-au',
  48          'avi'        => 'video/avi',
  49          'avs'        => 'video/avs-video',
  50          'bcpio'        => 'application/x-bcpio',
  51          'bin'        => 'application/x-binary',
  52          'bm'        => 'image/bmp',
  53          'bmp'        => 'image/bmp',
  54          'boo'        => 'application/book',
  55          'book'        => 'application/book',
  56          'boz'        => 'application/x-bzip2',
  57          'bsh'        => 'application/x-bsh',
  58          'bz'        => 'application/x-bzip',
  59          'bz2'        => 'application/x-bzip2',
  60          'c'        => 'text/x-c',
  61          'c++'        => 'text/x-c',
  62          'cat'        => 'application/vnd.ms-pki.seccat',
  63          'cc'        => 'text/plain',
  64          'ccad'        => 'application/clariscad',
  65          'cco'        => 'application/x-cocoa',
  66          'cdf'        => 'application/cdf',
  67          'cer'        => 'application/x-x509-ca-cert',
  68          'cha'        => 'application/x-chat',
  69          'chat'        => 'application/x-chat',
  70          'class'        => 'application/java',
  71          'com'        => 'application/octet-stream',
  72          'conf'        => 'text/plain',
  73          'cpio'        => 'application/x-cpio',
  74          'cpp'        => 'text/x-c',
  75          'cpt'        => 'application/x-cpt',
  76          'crl'        => 'application/pkix-crl',
  77          'crt'        => 'application/x-x509-ca-cert',
  78          'csh'        => 'application/x-csh',
  79          'css'        => 'text/css',
  80          'cxx'        => 'text/plain',
  81          'dcr'        => 'application/x-director',
  82          'deepv'        => 'application/x-deepv',
  83          'def'        => 'text/plain',
  84          'der'        => 'application/x-x509-ca-cert',
  85          'dif'        => 'video/x-dv',
  86          'dir'        => 'application/x-director',
  87          'dl'        => 'video/dl',
  88          'doc'        => 'application/msword',
  89          'dot'        => 'application/msword',
  90          'dp'        => 'application/commonground',
  91          'drw'        => 'application/drafting',
  92          'dump'        => 'application/octet-stream',
  93          'dv'        => 'video/x-dv',
  94          'dvi'        => 'application/x-dvi',
  95          'dwf'        => 'model/vnd.dwf',
  96          'dwg'        => 'image/x-dwg',
  97          'dxf'        => 'image/x-dwg',
  98          'dxr'        => 'application/x-director',
  99          'el'        => 'text/x-script.elisp',
 100          'elc'        => 'application/x-elc',
 101          'env'        => 'application/x-envoy',
 102          'eps'        => 'application/postscript',
 103          'es'        => 'application/x-esrehber',
 104          'etx'        => 'text/x-setext',
 105          'evy'        => 'application/x-envoy',
 106          'exe'        => 'application/octet-stream',
 107          'f'        => 'text/x-fortran',
 108          'f77'        => 'text/x-fortran',
 109          'f90'        => 'text/x-fortran',
 110          'fdf'        => 'application/vnd.fdf',
 111          'fif'        => 'image/fif',
 112          'fli'        => 'video/x-fli',
 113          'flo'        => 'image/florian',
 114          'flx'        => 'text/vnd.fmi.flexstor',
 115          'fmf'        => 'video/x-atomic3d-feature',
 116          'for'        => 'text/x-fortran',
 117          'fpx'        => 'image/vnd.fpx',
 118          'frl'        => 'application/freeloader',
 119          'funk'        => 'audio/make',
 120          'g'        => 'text/plain',
 121          'g3'        => 'image/g3fax',
 122          'gif'        => 'image/gif',
 123          'gl'        => 'video/x-gl',
 124          'gsd'        => 'audio/x-gsm',
 125          'gsm'        => 'audio/x-gsm',
 126          'gsp'        => 'application/x-gsp',
 127          'gss'        => 'application/x-gss',
 128          'gtar'        => 'application/x-gtar',
 129          'gz'        => 'application/x-gzip',
 130          'gzip'        => 'application/x-gzip',
 131          'h'        => 'text/x-h',
 132          'hdf'        => 'application/x-hdf',
 133          'help'        => 'application/x-helpfile',
 134          'hgl'        => 'application/vnd.hp-hpgl',
 135          'hh'        => 'text/x-h',
 136          'hlb'        => 'text/x-script',
 137          'hlp'        => 'application/hlp',
 138          'hpg'        => 'application/vnd.hp-hpgl',
 139          'hpgl'        => 'application/vnd.hp-hpgl',
 140          'hqx'        => 'application/x-binhex40',
 141          'hta'        => 'application/hta',
 142          'htc'        => 'text/x-component',
 143          'htm'        => 'text/html',
 144          'html'        => 'text/html',
 145          'htmls'        => 'text/html',
 146          'htt'        => 'text/webviewhtml',
 147          'htx'        => 'text/html',
 148          'ice'        => 'x-conference/x-cooltalk',
 149          'ico'        => 'image/x-icon',
 150          'idc'        => 'text/plain',
 151          'ief'        => 'image/ief',
 152          'iefs'        => 'image/ief',
 153          'iges'        => 'application/iges',
 154          'igs'        => 'application/iges',
 155          'ima'        => 'application/x-ima',
 156          'imap'        => 'application/x-httpd-imap',
 157          'inf'        => 'application/inf',
 158          'ins'        => 'application/x-internett-signup',
 159          'ip'        => 'application/x-ip2',
 160          'isu'        => 'video/x-isvideo',
 161          'it'        => 'audio/it',
 162          'iv'        => 'application/x-inventor',
 163          'ivr'        => 'i-world/i-vrml',
 164          'ivy'        => 'application/x-livescreen',
 165          'jam'        => 'audio/x-jam',
 166          'jav'        => 'text/x-java-source',
 167          'java'        => 'text/x-java-source',
 168          'jcm'        => 'application/x-java-commerce',
 169          'jfif'        => 'image/jpeg',
 170          'jfif-tbnl'    => 'image/jpeg',
 171          'jpe'        => 'image/jpeg',
 172          'jpeg'        => 'image/jpeg',
 173          'jpg'        => 'image/jpeg',
 174          'jps'        => 'image/x-jps',
 175          'js'        => 'application/x-javascript',
 176          'jut'        => 'image/jutvision',
 177          'kar'        => 'audio/midi',
 178          'ksh'        => 'text/x-script.ksh',
 179          'la'        => 'audio/x-nspaudio',
 180          'lam'        => 'audio/x-liveaudio',
 181          'latex'        => 'application/x-latex',
 182          'lha'        => 'application/x-lha',
 183          'lhx'        => 'application/octet-stream',
 184          'list'        => 'text/plain',
 185          'lma'        => 'audio/x-nspaudio',
 186          'log'        => 'text/plain',
 187          'lsp'        => 'text/x-script.lisp',
 188          'lst'        => 'text/plain',
 189          'lsx'        => 'text/x-la-asf',
 190          'ltx'        => 'application/x-latex',
 191          'lzh'        => 'application/x-lzh',
 192          'lzx'        => 'application/x-lzx',
 193          'm'        => 'text/x-m',
 194          'm1v'        => 'video/mpeg',
 195          'm2a'        => 'audio/mpeg',
 196          'm2v'        => 'video/mpeg',
 197          'm3u'        => 'audio/x-mpequrl',
 198          'man'        => 'application/x-troff-man',
 199          'map'        => 'application/x-navimap',
 200          'mar'        => 'text/plain',
 201          'mbd'        => 'application/mbedlet',
 202          'mc$'        => 'application/x-magic-cap-package-1.0',
 203          'mcd'        => 'application/x-mathcad',
 204          'mcf'        => 'text/mcf',
 205          'mcp'        => 'application/netmc',
 206          'me'        => 'application/x-troff-me',
 207          'mht'        => 'message/rfc822',
 208          'mhtml'        => 'message/rfc822',
 209          'mid'        => 'audio/x-midi',
 210          'midi'        => 'audio/x-midi',
 211          'mif'        => 'application/x-mif',
 212          'mime'        => 'www/mime',
 213          'mjf'        => 'audio/x-vnd.audioexplosion.mjuicemediafile',
 214          'mjpg'        => 'video/x-motion-jpeg',
 215          'mm'        => 'application/x-meme',
 216          'mme'        => 'application/base64',
 217          'mod'        => 'audio/x-mod',
 218          'moov'        => 'video/quicktime',
 219          'mov'        => 'video/quicktime',
 220          'movie'        => 'video/x-sgi-movie',
 221          'mp2'        => 'audio/x-mpeg',
 222          'mp3'        => 'audio/x-mpeg-3',
 223          'mpa'        => 'audio/mpeg',
 224          'mpc'        => 'application/x-project',
 225          'mpe'        => 'video/mpeg',
 226          'mpeg'        => 'video/mpeg',
 227          'mpg'        => 'video/mpeg',
 228          'mpga'        => 'audio/mpeg',
 229          'mpp'        => 'application/vnd.ms-project',
 230          'mpt'        => 'application/x-project',
 231          'mpv'        => 'application/x-project',
 232          'mpx'        => 'application/x-project',
 233          'mrc'        => 'application/marc',
 234          'ms'        => 'application/x-troff-ms',
 235          'mv'        => 'video/x-sgi-movie',
 236          'my'        => 'audio/make',
 237          'mzz'        => 'application/x-vnd.audioexplosion.mzz',
 238          'nap'        => 'image/naplps',
 239          'naplps'    => 'image/naplps',
 240          'nc'        => 'application/x-netcdf',
 241          'ncm'        => 'application/vnd.nokia.configuration-message',
 242          'nif'        => 'image/x-niff',
 243          'niff'        => 'image/x-niff',
 244          'nix'        => 'application/x-mix-transfer',
 245          'nsc'        => 'application/x-conference',
 246          'nvd'        => 'application/x-navidoc',
 247          'o'        => 'application/octet-stream',
 248          'oda'        => 'application/oda',
 249          'omc'        => 'application/x-omc',
 250          'omcd'        => 'application/x-omcdatamaker',
 251          'omcr'        => 'application/x-omcregerator',
 252          'p'        => 'text/x-pascal',
 253          'p10'        => 'application/x-pkcs10',
 254          'p12'        => 'application/x-pkcs12',
 255          'p7a'        => 'application/x-pkcs7-signature',
 256          'p7c'        => 'application/x-pkcs7-mime',
 257          'p7m'        => 'application/x-pkcs7-mime',
 258          'p7r'        => 'application/x-pkcs7-certreqresp',
 259          'p7s'        => 'application/pkcs7-signature',
 260          'part'        => 'application/pro_eng',
 261          'pas'        => 'text/pascal',
 262          'pbm'        => 'image/x-portable-bitmap',
 263          'pcl'        => 'application/x-pcl',
 264          'pct'        => 'image/x-pict',
 265          'pcx'        => 'image/x-pcx',
 266          'pdb'        => 'chemical/x-pdb',
 267          'pdf'        => 'application/pdf',
 268          'pfunk'        => 'audio/make.my.funk',
 269          'pgm'        => 'image/x-portable-greymap',
 270          'pic'        => 'image/pict',
 271          'pict'        => 'image/pict',
 272          'pkg'        => 'application/x-newton-compatible-pkg',
 273          'pko'        => 'application/vnd.ms-pki.pko',
 274          'pl'        => 'text/x-script.perl',
 275          'plx'        => 'application/x-pixclscript',
 276          'pm'        => 'text/x-script.perl-module',
 277          'pm4'        => 'application/x-pagemaker',
 278          'pm5'        => 'application/x-pagemaker',
 279          'png'        => 'image/png',
 280          'pnm'        => 'image/x-portable-anymap',
 281          'pot'        => 'application/mspowerpoint',
 282          'pov'        => 'model/x-pov',
 283          'ppa'        => 'application/vnd.ms-powerpoint',
 284          'ppm'        => 'image/x-portable-pixmap',
 285          'pps'        => 'application/mspowerpoint',
 286          'ppt'        => 'application/mspowerpoint',
 287          'ppz'        => 'application/mspowerpoint',
 288          'pre'        => 'application/x-freelance',
 289          'prt'        => 'application/pro_eng',
 290          'ps'        => 'application/postscript',
 291          'psd'        => 'application/octet-stream',
 292          'pvu'        => 'paleovu/x-pv',
 293          'pwz'        => 'application/vnd.ms-powerpoint',
 294          'py'        => 'text/x-script.phyton',
 295          'pyc'        => 'applicaiton/x-bytecode.python',
 296          'qcp'        => 'audio/vnd.qcelp',
 297          'qd3'        => 'x-world/x-3dmf',
 298          'qd3d'        => 'x-world/x-3dmf',
 299          'qif'        => 'image/x-quicktime',
 300          'qt'        => 'video/quicktime',
 301          'qtc'        => 'video/x-qtc',
 302          'qti'        => 'image/x-quicktime',
 303          'qtif'        => 'image/x-quicktime',
 304          'ra'        => 'audio/x-realaudio',
 305          'ram'        => 'audio/x-pn-realaudio',
 306          'ras'        => 'image/x-cmu-raster',
 307          'rast'        => 'image/cmu-raster',
 308          'rexx'        => 'text/x-script.rexx',
 309          'rf'        => 'image/vnd.rn-realflash',
 310          'rgb'        => 'image/x-rgb',
 311          'rm'        => 'audio/x-pn-realaudio',
 312          'rmi'        => 'audio/mid',
 313          'rmm'        => 'audio/x-pn-realaudio',
 314          'rmp'        => 'audio/x-pn-realaudio',
 315          'rng'        => 'application/vnd.nokia.ringing-tone',
 316          'rnx'        => 'application/vnd.rn-realplayer',
 317          'roff'        => 'application/x-troff',
 318          'rp'        => 'image/vnd.rn-realpix',
 319          'rpm'        => 'audio/x-pn-realaudio-plugin',
 320          'rt'        => 'text/richtext',
 321          'rtf'        => 'text/richtext',
 322          'rtx'        => 'text/richtext',
 323          'rv'        => 'video/vnd.rn-realvideo',
 324          's'        => 'text/x-asm',
 325          's3m'        => 'audio/s3m',
 326          'saveme'    => 'application/octet-stream',
 327          'sbk'        => 'application/x-tbook',
 328          'scm'        => 'video/x-scm',
 329          'sdml'        => 'text/plain',
 330          'sdp'        => 'application/x-sdp',
 331          'sdr'        => 'application/sounder',
 332          'sea'        => 'application/x-sea',
 333          'set'        => 'application/set',
 334          'sgm'        => 'text/x-sgml',
 335          'sgml'        => 'text/x-sgml',
 336          'sh'        => 'text/x-script.sh',
 337          'shar'        => 'application/x-shar',
 338          'shtml'        => 'text/x-server-parsed-html',
 339          'sid'        => 'audio/x-psid',
 340          'sit'        => 'application/x-stuffit',
 341          'skd'        => 'application/x-koan',
 342          'skm'        => 'application/x-koan',
 343          'skp'        => 'application/x-koan',
 344          'skt'        => 'application/x-koan',
 345          'sl'        => 'application/x-seelogo',
 346          'smi'        => 'application/smil',
 347          'smil'        => 'application/smil',
 348          'snd'        => 'audio/x-adpcm',
 349          'sol'        => 'application/solids',
 350          'spc'        => 'text/x-speech',
 351          'spl'        => 'application/futuresplash',
 352          'spr'        => 'application/x-sprite',
 353          'sprite'    => 'application/x-sprite',
 354          'src'        => 'application/x-wais-source',
 355          'ssi'        => 'text/x-server-parsed-html',
 356          'ssm'        => 'application/streamingmedia',
 357          'sst'        => 'application/vnd.ms-pki.certstore',
 358          'step'        => 'application/step',
 359          'stl'        => 'application/vnd.ms-pki.stl',
 360          'stp'        => 'application/step',
 361          'sv4cpio'    => 'application/x-sv4cpio',
 362          'sv4crc'    => 'application/x-sv4crc',
 363          'svf'        => 'image/x-dwg',
 364          'svr'        => 'application/x-world',
 365          'swf'        => 'application/x-shockwave-flash',
 366          't'        => 'application/x-troff',
 367          'talk'        => 'text/x-speech',
 368          'tar'        => 'application/x-tar',
 369          'tbk'        => 'application/x-tbook',
 370          'tcl'        => 'text/x-script.tcl',
 371          'tcsh'        => 'text/x-script.tcsh',
 372          'tex'        => 'application/x-tex',
 373          'texi'        => 'application/x-texinfo',
 374          'texinfo'    => 'application/x-texinfo',
 375          'text'        => 'text/plain',
 376          'tgz'        => 'application/x-compressed',
 377          'tif'        => 'image/tiff',
 378          'tiff'        => 'image/tiff',
 379          'tr'        => 'application/x-troff',
 380          'tsi'        => 'audio/tsp-audio',
 381          'tsp'        => 'audio/tsplayer',
 382          'tsv'        => 'text/tab-separated-values',
 383          'turbot'    => 'image/florian',
 384          'txt'        => 'text/plain',
 385          'uil'        => 'text/x-uil',
 386          'uni'        => 'text/uri-list',
 387          'unis'        => 'text/uri-list',
 388          'unv'        => 'application/i-deas',
 389          'uri'        => 'text/uri-list',
 390          'uris'        => 'text/uri-list',
 391          'ustar'        => 'multipart/x-ustar',
 392          'uu'        => 'text/x-uuencode',
 393          'uue'        => 'text/x-uuencode',
 394          'vcd'        => 'application/x-cdlink',
 395          'vcs'        => 'text/x-vcalendar',
 396          'vda'        => 'application/vda',
 397          'vdo'        => 'video/vdo',
 398          'vew'        => 'application/groupwise',
 399          'viv'        => 'video/vivo',
 400          'vivo'        => 'video/vivo',
 401          'vmd'        => 'application/vocaltec-media-desc',
 402          'vmf'        => 'application/vocaltec-media-file',
 403          'voc'        => 'audio/voc',
 404          'vos'        => 'video/vosaic',
 405          'vox'        => 'audio/voxware',
 406          'vqe'        => 'audio/x-twinvq-plugin',
 407          'vqf'        => 'audio/x-twinvq',
 408          'vql'        => 'audio/x-twinvq-plugin',
 409          'vrml'        => 'application/x-vrml',
 410          'vrt'        => 'x-world/x-vrt',
 411          'vsd'        => 'application/x-visio',
 412          'vst'        => 'application/x-visio',
 413          'vsw'        => 'application/x-visio',
 414          'w60'        => 'application/wordperfect6.0',
 415          'w61'        => 'application/wordperfect6.1',
 416          'w6w'        => 'application/msword',
 417          'wav'        => 'audio/wav',
 418          'wb1'        => 'application/x-qpro',
 419          'wbmp'        => 'image/vnd.wap.wbmp',
 420          'web'        => 'application/vnd.xara',
 421          'wiz'        => 'application/msword',
 422          'wk1'        => 'application/x-123',
 423          'wmf'        => 'windows/metafile',
 424          'wml'        => 'text/vnd.wap.wml',
 425          'wmlc'        => 'application/vnd.wap.wmlc',
 426          'wmls'        => 'text/vnd.wap.wmlscript',
 427          'wmlsc'        => 'application/vnd.wap.wmlscriptc',
 428          'word'        => 'application/msword',
 429          'wp'        => 'application/wordperfect',
 430          'wp5'        => 'application/wordperfect',
 431          'wp6'        => 'application/wordperfect',
 432          'wpd'        => 'application/wordperfect',
 433          'wq1'        => 'application/x-lotus',
 434          'wri'        => 'application/mswrite',
 435          'wrl'        => 'model/vrml',
 436          'wrz'        => 'model/vrml',
 437          'wsc'        => 'text/scriplet',
 438          'wsrc'        => 'application/x-wais-source',
 439          'wtk'        => 'application/x-wintalk',
 440          'xbm'        => 'image/xbm',
 441          'xdr'        => 'video/x-amt-demorun',
 442          'xgz'        => 'xgl/drawing',
 443          'xif'        => 'image/vnd.xiff',
 444          'xl'        => 'application/excel',
 445          'xla'        => 'application/excel',
 446          'xlb'        => 'application/excel',
 447          'xlc'        => 'application/excel',
 448          'xld'        => 'application/excel',
 449          'xlk'        => 'application/excel',
 450          'xll'        => 'application/excel',
 451          'xlm'        => 'application/excel',
 452          'xls'        => 'application/excel',
 453          'xlt'        => 'application/excel',
 454          'xlv'        => 'application/excel',
 455          'xlw'        => 'application/excel',
 456          'xm'        => 'audio/xm',
 457          'xml'        => 'text/xml',
 458          'xmz'        => 'xgl/movie',
 459          'xpix'        => 'application/x-vnd.ls-xpix',
 460          'xpm'        => 'image/xpm',
 461          'x-png'        => 'image/png',
 462          'xsr'        => 'video/x-amt-showrun',
 463          'xwd'        => 'image/x-xwindowdump',
 464          'xyz'        => 'chemical/x-pdb',
 465          'z'        => 'application/x-compressed',
 466          'zip'        => 'application/x-zip-compressed',
 467          'zoo'        => 'application/octet-stream',
 468          'zsh'        => 'text/x-script.zsh',
 469      );
 470  
 471      /**
 472      * {@inheritdoc}
 473      */
 474  	public function is_supported()
 475      {
 476          return true;
 477      }
 478  
 479      /**
 480      * {@inheritdoc}
 481      */
 482  	public function guess($file, $file_name = '')
 483      {
 484          $file_name = (empty($file_name)) ? $file : $file_name;
 485          return $this->map_extension_to_type($file_name);
 486      }
 487  
 488      /**
 489      * Map extension of supplied file_name to mime type
 490      *
 491      * @param string $file_name Path to file or filename
 492      *
 493      * @return string|null Mimetype if known or null if not
 494      */
 495  	protected function map_extension_to_type($file_name)
 496      {
 497          $extension = pathinfo($file_name, PATHINFO_EXTENSION);
 498  
 499          if (isset($this->extension_map[$extension]))
 500          {
 501              return $this->extension_map[$extension];
 502          }
 503          else
 504          {
 505              return null;
 506          }
 507      }
 508  }


Generated: Mon Nov 25 19:05:08 2024 Cross-referenced by PHPXref 0.7.1