FileStorage.php 58 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121
  1. <?php
  2. // @requires $_SERVER['SERVER_NAME']
  3. Lib::loadClass('Http');
  4. /*
  5. # FileStorage:
  6. - [x] create CRM_FILES - sql at the end of file
  7. - [x] only meta fields, perms? - no perms in relation based on record which is connected
  8. - [x] add file to storage - API POST/PUT action
  9. - [ ] base storage folder - from config - default /Library/Server/Web/Data/p5-pliki, chmod - add to instalator, upgrade
  10. - [x] subfolders like postfix, but [0-9],[A-Z] - substr(strrev(base_convert($id, 10, 10 + 26)), 0, 1) - 36 folderów
  11. - [x] file connected to user - A_RECORD_CREATE_AUTHOR
  12. - [ ] ? file connected to user - A_OWNER (L_APP_USER)?
  13. - [ ] connect file to record - generate {tbl_name}__#REF__FILES
  14. - [ ] ? add A_HAS_REF field to struct - cache to check if file is connected to any record
  15. - [-] add sync state - remote file name, mtime to check if file has changed in Storage or remote record folder
  16. - [-] sync - conflict - file connected with 2 objects and both changed and try to store changes to FileStorage
  17. - [ ] add version to REF table
  18. - [x] use streams for upload - better memory usage
  19. - [ ] use streams for upload progress in form - http://www.webiny.com/blog/2012/05/07/webiny-file-upload-with-html5-and-ajax-using-php-streams/
  20. - [x] add IP to table struct
  21. - [ ] WebDav - use only files from this table @see WebDav on Mac OS X https://www.qnap.com/pl-pl/tutorial/con_show.php?op=showone&cid=75
  22. - [ ] Update file - add {tblName}__#VERSIONS table (work like _HIST, but only on update file content)
  23. */
  24. class FileStorage {
  25. public static function isProduction() {// TODO: mv to Config
  26. // return V::get('P5_ENV', '/Library/Server/Web/Data/p5-file-storage', $_SERVER);
  27. // $env = getenv('P5_ENV');
  28. // if (empty($env)) $env = 'production';
  29. return ('production' == V::get('P5_ENV', 'production', $_SERVER));
  30. }
  31. public static function getRootStoragePath() {
  32. return (self::isProduction()) ? '/Library/Server/Web/Data/p5-file-storage' : '/tmp/test-upload-file-storage';
  33. }
  34. public static function getTableName() {
  35. return (self::isProduction()) ? 'CRM_FILES' : 'CRM_FILES__#DEV';
  36. }
  37. public static function getFileById($idFile, $forceVersion = null) {
  38. $fileObject = array();// @returns array
  39. $fileObject['_raw'] = null;// raw object from database
  40. $fileObject['id'] = (int)$idFile;
  41. $fileObject['name'] = '';
  42. $fileObject['relativePath'] = null;
  43. $fileObject['absolutePath'] = null;
  44. $fileObject['exists'] = null;
  45. $fileObject['size'] = 0;
  46. $fileObject['mimeType'] = null;
  47. $fileObject['version'] = 0;
  48. $rowFile = self::_getRowFile($idFile, $forceVersion);
  49. $fileObject['_raw'] = $rowFile;
  50. // TODO: check perms
  51. $fileObject['name'] = V::get('FILE_LABEL', $id, $rowFile);
  52. $fileObject['version'] = ($forceVersion) ? $forceVersion : V::get('FILE_VERSION', 0, $rowFile);
  53. $fileObject['relativePath'] = self::generateFilePathHashFromId($rowFile['ID'], $version);
  54. $fileObject['absolutePath'] = self::getRootStoragePath() . "/" . $fileObject['relativePath'];
  55. $fileObject['exists'] = file_exists($fileObject['absolutePath']);
  56. if ($fileObject['exists']) {
  57. $fileObject['size'] = ($rowFile['FILE_SIZE']) ? $rowFile['FILE_SIZE'] : filesize($absFilePath);
  58. $fileObject['mimeType'] = ($rowFile['FILE_MIME_TYPE']) ? $rowFile['FILE_MIME_TYPE'] : mime_content_type($absFilePath);
  59. }
  60. return $fileObject;
  61. }
  62. public static function addFileStream($inputHandler, $name = '') {
  63. $sqlLogin = User::getLogin();
  64. $sqlIP = Request::getUserIp();
  65. $sqlLabel = DB::getPDO()->quote($name, PDO::PARAM_STR);
  66. $idFile = self::_createRowFile($name);
  67. DBG::_('DBG', '>1', "idFile", $idFile, __CLASS__, __FUNCTION__, __LINE__);
  68. $fileObject = self::getFileById($idFile);
  69. $absFilePath = $fileObject['absolutePath'];
  70. $dirPath = dirname($absFilePath);
  71. @mkdir($dirPath, $mode = 0775, $recursive = true);
  72. if (!file_exists($dirPath)) throw new HttpException("#L" . __LINE__ . ": Cannot create path", 500);
  73. @chmod($dirPath, $mode = 0775);
  74. // create a temp file where to save data from the input stream
  75. $fileHandler = fopen($absFilePath, "w+");
  76. DBG::_('DBG', '>1', "absFilePath", $absFilePath, __CLASS__, __FUNCTION__, __LINE__);
  77. // save data from the input stream
  78. while (true) {
  79. $buffer = fgets($inputHandler, 4096);
  80. if (strlen($buffer) == 0) {
  81. fclose($inputHandler);
  82. fclose($fileHandler);
  83. break;
  84. }
  85. fwrite($fileHandler, $buffer);
  86. }
  87. if (!file_exists($absFilePath)) throw new Exception("Cannot save file");
  88. self::_uploadUpdateMimeType($idFile, $absFilePath);
  89. self::_uploadUpdateStat($idFile, $absFilePath);
  90. return $idFile;
  91. }
  92. public static function addFile($content, $name = '') {
  93. $rootFileStoragePath = self::getRootStoragePath();
  94. $idFile = self::_createRowFile($name);
  95. DBG::_('DBG', '>1', "idFile", $idFile, __CLASS__, __FUNCTION__, __LINE__);
  96. $fileObject = self::getFileById($idFile);
  97. $absFilePath = $fileObject['absolutePath'];
  98. $dirPath = dirname($absFilePath);
  99. @mkdir($dirPath, $mode = 0777, $recursive = true);
  100. if (!file_exists($dirPath)) throw new Exception("Cannot create path");
  101. @chmod($dirPath, $mode = 0777);
  102. $fp = fopen($absFilePath, 'w');
  103. fwrite($fp, $fileContent);
  104. fclose($fp);
  105. if (!file_exists($absFilePath)) throw new Exception("Cannot save file");
  106. self::_uploadUpdateMimeType($idFile, $absFilePath);
  107. self::_uploadUpdateStat($idFile, $absFilePath);
  108. return $idFile;
  109. }
  110. public static function updateFileStream($idFile, $inputHandler, $name = '') {
  111. throw new Exception("TODO: insert into `\{\$tblName\}__#VERSIONS` for file `{$idFile}`");
  112. $fileObject = self::getFileById($idFile);
  113. if (!$fileObject['exists']) throw new Exception("Oryginalny plik nie istnieje");
  114. // TODO: check perms
  115. $fileVersion = self::_createUpdateRowFile($idFile, $name);// insert into `{$tblName}__#VERSIONS` ( `FILE_VERSION` = 1 + (select MAX(`FILE_VERSION`) from #VER) )
  116. {// upload by stream
  117. }
  118. self::_updateRowFileFromVersion($fileVersion);// update `{$tblName}` values from `{$tblName}__#VERSIONS`
  119. }
  120. public static function _createRowFile($name = '') {
  121. $sqlLogin = User::getLogin();
  122. $sqlLabel = DB::getPDO()->quote($name, PDO::PARAM_STR);
  123. $sqlIP = DB::getPDO()->quote(Request::getUserIp(), PDO::PARAM_STR);
  124. $sqlTblName = self::getTableName();
  125. $sql = "
  126. insert into `{$sqlTblName}` (`A_RECORD_CREATE_AUTHOR`,`A_RECORD_CREATE_DATE`,`FILE_LABEL`,`A_USER_IP`)
  127. values ('{$sqlLogin}', NOW(), {$sqlLabel}, INET_ATON({$sqlIP}))
  128. ";
  129. DBG::_('DBG', '>2', "sql", $sql, __CLASS__, __FUNCTION__, __LINE__);
  130. DB::getPDO()->exec($sql);
  131. return DB::getPDO()->lastInsertId();
  132. }
  133. public static function _getRowFile($idFile, $version = null) {
  134. $idFile = intval($idFile);
  135. if ($idFile <= 0) throw new HttpException("#L" . __LINE__ . ": Wrong file id", 500);
  136. $sqlId = DB::getPDO()->quote($idFile, PDO::PARAM_INT);
  137. $sqlTblName = self::getTableName();
  138. $rows = DB::getPDO()->fetchAll("
  139. select f.*
  140. from `{$sqlTblName}` f
  141. where f.ID = {$sqlId}
  142. ");
  143. DBG::_('DBG', '>2', "rows", $rows, __CLASS__, __FUNCTION__, __LINE__);
  144. if (empty($rows)) throw new HttpException("Plik nie istnieje w bazie", 404);
  145. $rowFile = $rows[0];
  146. // TODO: fetch info by $version
  147. return $rowFile;
  148. }
  149. public static function _uploadUpdateMimeType($idFile, $absPath) {
  150. $mimeType = mime_content_type($absPath);
  151. $mtime = filemtime($absPath);
  152. DBG::_('DBG', '>1', "mimeType", $mimeType, __CLASS__, __FUNCTION__, __LINE__);
  153. if (!self::isAllowedMimeType($mimeType)) {
  154. $sqlTblName = self::getTableName();
  155. if ('inode/x-empty' == $mimeType) {// empty file
  156. DB::getPDO()->exec("
  157. update `{$sqlTblName}`
  158. set `A_STATUS` = 'WARNING'
  159. -- , `A_STATUS_INFO` = ''
  160. , `FILE_MIME_TYPE` = '{$mimeType}'
  161. , `FILE_MTIME` = '{$mtime}'
  162. , `FILE_SIZE` = 0
  163. where `ID` = '{$idFile}'
  164. ");
  165. throw new AlertWarningException("Wgrano pusty plik");
  166. } else {// non empty, not allowed mime type
  167. $size = filesize($absPath);
  168. DB::getPDO()->exec("
  169. update `{$sqlTblName}`
  170. set `A_STATUS` = 'DELETED'
  171. -- , `A_STATUS_INFO` = ''
  172. , `FILE_MIME_TYPE` = '{$mimeType}'
  173. , `FILE_MTIME` = '{$mtime}'
  174. , `FILE_SIZE` = '{$size}'
  175. where `ID` = '{$idFile}'
  176. ");
  177. rename($absPath, "{$absPath}-not-allowed-mime-type");
  178. throw new Exception("Niedozwolony typ pliku '{$mimeType}'");
  179. }
  180. }
  181. }
  182. public static function _uploadUpdateStat($idFile, $absPath) {
  183. $mimeType = mime_content_type($absPath);
  184. $mtime = filemtime($absPath);
  185. $size = filesize($absPath);
  186. DBG::_('DBG', '>1', "mtime", $mtime, __CLASS__, __FUNCTION__, __LINE__);
  187. DBG::_('DBG', '>1', "size", $size, __CLASS__, __FUNCTION__, __LINE__);
  188. $sqlTblName = self::getTableName();
  189. DB::getPDO()->exec("
  190. update `{$sqlTblName}`
  191. set `A_STATUS` = 'NORMAL'
  192. , `FILE_MIME_TYPE` = '{$mimeType}'
  193. , `FILE_MTIME` = '{$mtime}'
  194. , `FILE_SIZE` = '{$size}'
  195. where `ID` = '{$idFile}'
  196. ");
  197. }
  198. public static function generateFilePathHashFromId($intId, $version = null) {
  199. // $base36Id = base_convert($intId, 10, 10 + 26);// 0-9 + A-Z
  200. $base36Id = base_convert($intId, 10, 10 + 6);// 0-9 + A-F
  201. $base36Str = str_pad($base36Id, 10, "0", STR_PAD_LEFT);
  202. $base36Str = strrev($base36Str);
  203. $pathParts = array();
  204. $pathParts[] = substr($base36Str, 0, 2);
  205. $pathParts[] = substr($base36Str, 2, 2);
  206. $pathParts[] = substr($base36Str, 4);
  207. $hashPath = implode("/", $pathParts);
  208. // echo "ID($intId) converted to ({$base36Id})\t to ({$base36Str})\t to path ({$hashPath})\n";
  209. // TODO: add $version to file name: .= "-v{$version}"
  210. return $hashPath;
  211. }
  212. public static function reinstall() {
  213. try {
  214. DB::getPDO()->exec("
  215. CREATE TABLE IF NOT EXISTS `CRM_FILES` (
  216. `ID` int(11) NOT NULL AUTO_INCREMENT,
  217. `FILE_HASH` varchar(255) NOT NULL, -- generated from ID by hash function - only for cache
  218. `FILE_LABEL` varchar(255) NOT NULL, -- original file name or system name
  219. `FILE_TYPE` varchar(32) NOT NULL DEFAULT '', -- $TRG_FILE -> config/.cnf--folders...
  220. `FILE_MIME_TYPE` varchar(64) NOT NULL DEFAULT '',
  221. `FILE_MTIME` datetime NOT NULL,
  222. `FILE_SIZE` bigint NOT NULL DEFAULT 0,
  223. `FILE_VERSION` int(11) NOT NULL DEFAULT 0, -- used for update
  224. `A_STATUS` enum('WAITING','NORMAL','MONITOR','OFF_HARD','OFF_SOFT','DELETED','WARNING') NOT NULL DEFAULT 'WAITING',
  225. `A_RECORD_CREATE_DATE` datetime DEFAULT NULL,
  226. `A_RECORD_CREATE_AUTHOR` varchar(20) NOT NULL DEFAULT '',
  227. `A_RECORD_UPDATE_DATE` datetime DEFAULT NULL,
  228. `A_RECORD_UPDATE_AUTHOR` varchar(20) NOT NULL DEFAULT '',
  229. `A_ADM_COMPANY` varchar(100) NOT NULL DEFAULT '',
  230. `A_CLASSIFIED` varchar(100) NOT NULL DEFAULT '',
  231. `A_USER_IP` bigint NOT NULL DEFAULT '0',
  232. PRIMARY KEY (`ID`),
  233. KEY `FILE_TYPE` (`FILE_TYPE`)
  234. ) ENGINE=MyISAM DEFAULT CHARSET=latin2;
  235. ");
  236. DB::getPDO()->exec("
  237. CREATE TABLE IF NOT EXISTS `CRM_FILES__#DEV` (
  238. `ID` int(11) NOT NULL AUTO_INCREMENT,
  239. `FILE_HASH` varchar(255) NOT NULL, -- generated from ID by hash function - only for cache
  240. `FILE_LABEL` varchar(255) NOT NULL, -- original file name or system name
  241. `FILE_TYPE` varchar(32) NOT NULL DEFAULT '', -- $TRG_FILE -> config/.cnf--folders...
  242. `FILE_MIME_TYPE` varchar(64) NOT NULL DEFAULT '',
  243. `FILE_MTIME` datetime NOT NULL,
  244. `FILE_SIZE` bigint NOT NULL DEFAULT 0,
  245. `FILE_VERSION` int(11) NOT NULL DEFAULT 0, -- used for update
  246. `A_STATUS` enum('WAITING','NORMAL','MONITOR','OFF_HARD','OFF_SOFT','DELETED','WARNING') NOT NULL DEFAULT 'WAITING',
  247. `A_RECORD_CREATE_DATE` datetime DEFAULT NULL,
  248. `A_RECORD_CREATE_AUTHOR` varchar(20) NOT NULL DEFAULT '',
  249. `A_RECORD_UPDATE_DATE` datetime DEFAULT NULL,
  250. `A_RECORD_UPDATE_AUTHOR` varchar(20) NOT NULL DEFAULT '',
  251. `A_ADM_COMPANY` varchar(100) NOT NULL DEFAULT '',
  252. `A_CLASSIFIED` varchar(100) NOT NULL DEFAULT '',
  253. `A_USER_IP` bigint NOT NULL DEFAULT '0',
  254. PRIMARY KEY (`ID`),
  255. KEY `FILE_TYPE` (`FILE_TYPE`)
  256. ) ENGINE=MyISAM DEFAULT CHARSET=latin2;
  257. ");
  258. DB::getPDO()->exec("
  259. CREATE TABLE IF NOT EXISTS `CRM_FILES__#VERSIONS` (
  260. `ID_FILE` int(11) NOT NULL,
  261. `FILE_HASH` varchar(255) NOT NULL, -- generated from ID by hash function - only for cache
  262. `FILE_LABEL` varchar(255) NOT NULL, -- original file name or system name
  263. `FILE_TYPE` varchar(32) NOT NULL DEFAULT '', -- $TRG_FILE -> config/.cnf--folders...
  264. `FILE_MIME_TYPE` varchar(64) NOT NULL DEFAULT '',
  265. `FILE_MTIME` datetime NOT NULL,
  266. `FILE_SIZE` bigint NOT NULL DEFAULT 0,
  267. `FILE_VERSION` int(11) NOT NULL DEFAULT 0, -- used for update
  268. `A_RECORD_CREATE_DATE` datetime DEFAULT NULL,
  269. `A_RECORD_CREATE_AUTHOR` varchar(20) NOT NULL DEFAULT '',
  270. `A_USER_IP` bigint NOT NULL DEFAULT '0',
  271. KEY `ID_FILE` (`ID_FILE`)
  272. ) ENGINE=MyISAM DEFAULT CHARSET=latin2;
  273. ");
  274. DB::getPDO()->exec("
  275. CREATE TABLE IF NOT EXISTS `CRM_FILES__#DEV__#VERSIONS` (
  276. `ID_FILE` int(11) NOT NULL,
  277. `FILE_HASH` varchar(255) NOT NULL, -- generated from ID by hash function - only for cache
  278. `FILE_LABEL` varchar(255) NOT NULL, -- original file name or system name
  279. `FILE_TYPE` varchar(32) NOT NULL DEFAULT '', -- $TRG_FILE -> config/.cnf--folders...
  280. `FILE_MIME_TYPE` varchar(64) NOT NULL DEFAULT '',
  281. `FILE_MTIME` datetime NOT NULL,
  282. `FILE_SIZE` bigint NOT NULL DEFAULT 0,
  283. `FILE_VERSION` int(11) NOT NULL DEFAULT 0, -- used for update
  284. `A_RECORD_CREATE_DATE` datetime DEFAULT NULL,
  285. `A_RECORD_CREATE_AUTHOR` varchar(20) NOT NULL DEFAULT '',
  286. `A_USER_IP` bigint NOT NULL DEFAULT '0',
  287. KEY `ID_FILE` (`ID_FILE`)
  288. ) ENGINE=MyISAM DEFAULT CHARSET=latin2;
  289. ");
  290. {// TODO: only in cli mode - require root perms
  291. $devRootPath = '/tmp/test-upload-file-storage';
  292. if (!file_exists($devRootPath)) {
  293. @mkdir($devRootPath, $mode = 0777, $recursive = true);
  294. if (!file_exists($devRootPath)) throw new Exception("Cannot create FileStorage root path for dev");
  295. @chmod($devRootPath, $mode = 0777);
  296. @chown($devRootPath, $user = '_www');
  297. }
  298. $productionRootPath = '/Library/Server/Web/Data/p5-file-storage';
  299. if (!file_exists($productionRootPath)) {
  300. @mkdir($productionRootPath, $mode = 0775, $recursive = true);
  301. if (!file_exists($productionRootPath)) throw new Exception("Cannot create FileStorage root path");
  302. @chmod($productionRootPath, $mode = 0775);
  303. @chown($productionRootPath, $user = '_www');
  304. }
  305. }
  306. } catch (Exception $e) {
  307. UI::alert('danger', $e->getMessage());
  308. }
  309. }
  310. public static function isAllowedMimeType($mimeType) {
  311. // http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types
  312. switch ($mimeType) {
  313. case 'image/png': return true;
  314. case 'application/atom+xml': return true;// atom
  315. case 'application/atomcat+xml': return true;// atomcat
  316. case 'application/atomsvc+xml': return true;// atomsvc
  317. case 'application/ccxml+xml': return true;// ccxml
  318. case 'application/cdmi-capability': return true;// cdmia
  319. case 'application/cdmi-container': return true;// cdmic
  320. case 'application/cdmi-domain': return true;// cdmid
  321. case 'application/cdmi-object': return true;// cdmio
  322. case 'application/cdmi-queue': return true;// cdmiq
  323. case 'application/cu-seeme': return true;// cu
  324. case 'application/davmount+xml': return true;// davmount
  325. case 'application/docbook+xml': return true;// dbk
  326. case 'application/dssc+der': return true;// dssc
  327. case 'application/dssc+xml': return true;// xdssc
  328. case 'application/ecmascript': return true;// ecma
  329. case 'application/emma+xml': return true;// emma
  330. case 'application/epub+zip': return true;// epub
  331. case 'application/exi': return true;// exi
  332. case 'application/font-tdpfr': return true;// pfr
  333. case 'application/font-woff': return true;// woff
  334. case 'application/gml+xml': return true;// gml
  335. case 'application/gpx+xml': return true;// gpx
  336. case 'application/gxf': return true;// gxf
  337. case 'application/hyperstudio': return true;// stk
  338. case 'application/inkml+xml': return true;// ink inkml
  339. case 'application/ipfix': return true;// ipfix
  340. case 'application/java-archive': return true;// jar
  341. case 'application/java-serialized-object': return true;// ser
  342. case 'application/java-vm': return true;// class
  343. case 'application/javascript': return true;// js
  344. case 'application/json': return true;// json
  345. case 'application/jsonml+json': return true;// jsonml
  346. case 'application/lost+xml': return true;// lostxml
  347. case 'application/mac-binhex40': return true;// hqx
  348. case 'application/mac-compactpro': return true;// cpt
  349. case 'application/mads+xml': return true;// mads
  350. case 'application/marc': return true;// mrc
  351. case 'application/marcxml+xml': return true;// mrcx
  352. case 'application/mathematica': return true;// ma nb mb
  353. case 'application/mathml+xml': return true;// mathml
  354. case 'application/mbox': return true;// mbox
  355. case 'application/mediaservercontrol+xml': return true;// mscml
  356. case 'application/metalink+xml': return true;// metalink
  357. case 'application/metalink4+xml': return true;// meta4
  358. case 'application/mets+xml': return true;// mets
  359. case 'application/mods+xml': return true;// mods
  360. case 'application/mp21': return true;// m21 mp21
  361. case 'application/mp4': return true;// mp4s
  362. case 'application/msword': return true;// doc dot
  363. case 'application/mxf': return true;// mxf
  364. case 'application/octet-stream': return true;// bin dms lrf mar so dist distz pkg bpk dump elc deploy
  365. case 'application/oda': return true;// oda
  366. case 'application/oebps-package+xml': return true;// opf
  367. case 'application/ogg': return true;// ogx
  368. case 'application/omdoc+xml': return true;// omdoc
  369. case 'application/onenote': return true;// onetoc2 onetmp onetoc onepkg
  370. case 'application/oxps': return true;// oxps
  371. case 'application/patch-ops-error+xml': return true;// xer
  372. case 'application/pdf': return true;// pdf
  373. case 'application/pgp-encrypted': return true;// pgp
  374. case 'application/pgp-signature': return true;// asc sig
  375. case 'application/pics-rules': return true;// prf
  376. case 'application/pkcs10': return true;// p10
  377. case 'application/pkcs7-mime': return true;// p7m p7c
  378. case 'application/pkcs7-signature': return true;// p7s
  379. case 'application/pkcs8': return true;// p8
  380. case 'application/pkix-attr-cert': return true;// ac
  381. case 'application/pkix-cert': return true;// cer
  382. case 'application/pkix-crl': return true;// crl
  383. case 'application/pkix-pkipath': return true;// pkipath
  384. case 'application/pkixcmp': return true;// pki
  385. case 'application/pls+xml': return true;// pls
  386. case 'application/postscript': return true;// ai eps ps
  387. case 'application/prs.cww': return true;// cww
  388. case 'application/pskc+xml': return true;// pskcxml
  389. case 'application/rdf+xml': return true;// rdf
  390. case 'application/reginfo+xml': return true;// rif
  391. case 'application/relax-ng-compact-syntax': return true;// rnc
  392. case 'application/resource-lists+xml': return true;// rl
  393. case 'application/resource-lists-diff+xml': return true;// rld
  394. case 'application/rls-services+xml': return true;// rs
  395. case 'application/rpki-ghostbusters': return true;// gbr
  396. case 'application/rpki-manifest': return true;// mft
  397. case 'application/rpki-roa': return true;// roa
  398. case 'application/rsd+xml': return true;// rsd
  399. case 'application/rss+xml': return true;// rss
  400. case 'application/rtf': return true;// rtf
  401. case 'application/sbml+xml': return true;// sbml
  402. case 'application/scvp-cv-request': return true;// scq
  403. case 'application/scvp-cv-response': return true;// scs
  404. case 'application/scvp-vp-request': return true;// spq
  405. case 'application/scvp-vp-response': return true;// spp
  406. case 'application/sdp': return true;// sdp
  407. case 'application/set-payment-initiation': return true;// setpay
  408. case 'application/set-registration-initiation': return true;// setreg
  409. case 'application/shf+xml': return true;// shf
  410. case 'application/smil+xml': return true;// smi smil
  411. case 'application/sparql-query': return true;// rq
  412. case 'application/sparql-results+xml': return true;// srx
  413. case 'application/srgs': return true;// gram
  414. case 'application/srgs+xml': return true;// grxml
  415. case 'application/sru+xml': return true;// sru
  416. case 'application/ssdl+xml': return true;// ssdl
  417. case 'application/ssml+xml': return true;// ssml
  418. case 'application/tei+xml': return true;// tei teicorpus
  419. case 'application/thraud+xml': return true;// tfi
  420. case 'application/timestamped-data': return true;// tsd
  421. case 'application/vnd.3gpp.pic-bw-large': return true;// plb
  422. case 'application/vnd.3gpp.pic-bw-small': return true;// psb
  423. case 'application/vnd.3gpp.pic-bw-var': return true;// pvb
  424. case 'application/vnd.3gpp2.tcap': return true;// tcap
  425. case 'application/vnd.3m.post-it-notes': return true;// pwn
  426. case 'application/vnd.accpac.simply.aso': return true;// aso
  427. case 'application/vnd.accpac.simply.imp': return true;// imp
  428. case 'application/vnd.acucobol': return true;// acu
  429. case 'application/vnd.acucorp': return true;// atc acutc
  430. case 'application/vnd.adobe.air-application-installer-package+zip': return true;// air
  431. case 'application/vnd.adobe.formscentral.fcdt': return true;// fcdt
  432. case 'application/vnd.adobe.fxp': return true;// fxp fxpl
  433. case 'application/vnd.adobe.xdp+xml': return true;// xdp
  434. case 'application/vnd.adobe.xfdf': return true;// xfdf
  435. case 'application/vnd.ahead.space': return true;// ahead
  436. case 'application/vnd.airzip.filesecure.azf': return true;// azf
  437. case 'application/vnd.airzip.filesecure.azs': return true;// azs
  438. case 'application/vnd.amazon.ebook': return true;// azw
  439. case 'application/vnd.americandynamics.acc': return true;// acc
  440. case 'application/vnd.amiga.ami': return true;// ami
  441. case 'application/vnd.android.package-archive': return true;// apk
  442. case 'application/vnd.anser-web-certificate-issue-initiation': return true;// cii
  443. case 'application/vnd.anser-web-funds-transfer-initiation': return true;// fti
  444. case 'application/vnd.antix.game-component': return true;// atx
  445. case 'application/vnd.apple.installer+xml': return true;// mpkg
  446. case 'application/vnd.apple.mpegurl': return true;// m3u8
  447. case 'application/vnd.aristanetworks.swi': return true;// swi
  448. case 'application/vnd.astraea-software.iota': return true;// iota
  449. case 'application/vnd.audiograph': return true;// aep
  450. case 'application/vnd.blueice.multipass': return true;// mpm
  451. case 'application/vnd.bmi': return true;// bmi
  452. case 'application/vnd.businessobjects': return true;// rep
  453. case 'application/vnd.chemdraw+xml': return true;// cdxml
  454. case 'application/vnd.chipnuts.karaoke-mmd': return true;// mmd
  455. case 'application/vnd.cinderella': return true;// cdy
  456. case 'application/vnd.claymore': return true;// cla
  457. case 'application/vnd.cloanto.rp9': return true;// rp9
  458. case 'application/vnd.clonk.c4group': return true;// c4g c4d c4f c4p c4u
  459. case 'application/vnd.cluetrust.cartomobile-config': return true;// c11amc
  460. case 'application/vnd.cluetrust.cartomobile-config-pkg': return true;// c11amz
  461. case 'application/vnd.commonspace': return true;// csp
  462. case 'application/vnd.contact.cmsg': return true;// cdbcmsg
  463. case 'application/vnd.cosmocaller': return true;// cmc
  464. case 'application/vnd.crick.clicker': return true;// clkx
  465. case 'application/vnd.crick.clicker.keyboard': return true;// clkk
  466. case 'application/vnd.crick.clicker.palette': return true;// clkp
  467. case 'application/vnd.crick.clicker.template': return true;// clkt
  468. case 'application/vnd.crick.clicker.wordbank': return true;// clkw
  469. case 'application/vnd.criticaltools.wbs+xml': return true;// wbs
  470. case 'application/vnd.ctc-posml': return true;// pml
  471. case 'application/vnd.cups-ppd': return true;// ppd
  472. case 'application/vnd.curl.car': return true;// car
  473. case 'application/vnd.curl.pcurl': return true;// pcurl
  474. case 'application/vnd.dart': return true;// dart
  475. case 'application/vnd.data-vision.rdz': return true;// rdz
  476. case 'application/vnd.dece.data': return true;// uvf uvvf uvd uvvd
  477. case 'application/vnd.dece.ttml+xml': return true;// uvt uvvt
  478. case 'application/vnd.dece.unspecified': return true;// uvx uvvx
  479. case 'application/vnd.dece.zip': return true;// uvz uvvz
  480. case 'application/vnd.denovo.fcselayout-link': return true;// fe_launch
  481. case 'application/vnd.dna': return true;// dna
  482. case 'application/vnd.dolby.mlp': return true;// mlp
  483. case 'application/vnd.dpgraph': return true;// dpg
  484. case 'application/vnd.dreamfactory': return true;// dfac
  485. case 'application/vnd.ds-keypoint': return true;// kpxx
  486. case 'application/vnd.dvb.ait': return true;// ait
  487. case 'application/vnd.dvb.service': return true;// svc
  488. case 'application/vnd.dynageo': return true;// geo
  489. case 'application/vnd.ecowin.chart': return true;// mag
  490. case 'application/vnd.enliven': return true;// nml
  491. case 'application/vnd.epson.esf': return true;// esf
  492. case 'application/vnd.epson.msf': return true;// msf
  493. case 'application/vnd.epson.quickanime': return true;// qam
  494. case 'application/vnd.epson.salt': return true;// slt
  495. case 'application/vnd.epson.ssf': return true;// ssf
  496. case 'application/vnd.eszigno3+xml es3': return true;// et3
  497. case 'application/vnd.ezpix-album': return true;// ez2
  498. case 'application/vnd.ezpix-package': return true;// ez3
  499. case 'application/vnd.fdf': return true;// fdf
  500. case 'application/vnd.fdsn.mseed': return true;// mseed
  501. case 'application/vnd.fdsn.seed': return true;// seed dataless
  502. case 'application/vnd.flographit': return true;// gph
  503. case 'application/vnd.fluxtime.clip': return true;// ftc
  504. case 'application/vnd.framemaker': return true;// fm frame maker book
  505. case 'application/vnd.frogans.fnc': return true;// fnc
  506. case 'application/vnd.frogans.ltf': return true;// ltf
  507. case 'application/vnd.fsc.weblaunch': return true;// fsc
  508. case 'application/vnd.fujitsu.oasys': return true;// oas
  509. case 'application/vnd.fujitsu.oasys2': return true;// oa2
  510. case 'application/vnd.fujitsu.oasys3': return true;// oa3
  511. case 'application/vnd.fujitsu.oasysgp': return true;// fg5
  512. case 'application/vnd.fujitsu.oasysprs': return true;// bh2
  513. case 'application/vnd.fujixerox.ddd': return true;// ddd
  514. case 'application/vnd.fujixerox.docuworks': return true;// xdw
  515. case 'application/vnd.fujixerox.docuworks.binder': return true;// xbd
  516. case 'application/vnd.fuzzysheet': return true;// fzs
  517. case 'application/vnd.genomatix.tuxedo': return true;// txd
  518. case 'application/vnd.geogebra.file': return true;// ggb
  519. case 'application/vnd.geogebra.tool': return true;// ggt
  520. case 'application/vnd.geometry-explorer': return true;// gex gre
  521. case 'application/vnd.geonext': return true;// gxt
  522. case 'application/vnd.geoplan': return true;// g2w
  523. case 'application/vnd.geospace': return true;// g3w
  524. case 'application/vnd.gmx': return true;// gmx
  525. case 'application/vnd.google-earth.kml+xml': return true;// kml
  526. case 'application/vnd.google-earth.kmz': return true;// kmz
  527. case 'application/vnd.grafeq': return true;// gqf gqs
  528. case 'application/vnd.groove-account': return true;// gac
  529. case 'application/vnd.groove-help': return true;// ghf
  530. case 'application/vnd.groove-identity-message': return true;// gim
  531. case 'application/vnd.groove-injector': return true;// grv
  532. case 'application/vnd.groove-tool-message': return true;// gtm
  533. case 'application/vnd.groove-tool-template': return true;// tpl
  534. case 'application/vnd.groove-vcard': return true;// vcg
  535. case 'application/vnd.hal+xml': return true;// hal
  536. case 'application/vnd.handheld-entertainment+xml': return true;// zmm
  537. case 'application/vnd.hbci': return true;// hbci
  538. case 'application/vnd.hhe.lesson-player': return true;// les
  539. case 'application/vnd.hp-hpgl': return true;// hpgl
  540. case 'application/vnd.hp-hpid': return true;// hpid
  541. case 'application/vnd.hp-hps': return true;// hps
  542. case 'application/vnd.hp-jlyt': return true;// jlt
  543. case 'application/vnd.hp-pcl': return true;// pcl
  544. case 'application/vnd.hp-pclxl': return true;// pclxl
  545. case 'application/vnd.hydrostatix.sof-data': return true;// sfd- hdstx
  546. case 'application/vnd.ibm.minipay': return true;// mpy
  547. case 'application/vnd.ibm.modcap': return true;// afp listafp list3820
  548. case 'application/vnd.ibm.rights-management': return true;// irm
  549. case 'application/vnd.ibm.secure-container': return true;// sc
  550. case 'application/vnd.iccprofile': return true;// icc icm
  551. case 'application/vnd.igloader': return true;// igl
  552. case 'application/vnd.immervision-ivp': return true;// ivp
  553. case 'application/vnd.immervision-ivu': return true;// ivu
  554. case 'application/vnd.insors.igm': return true;// igm
  555. case 'application/vnd.intercon.formnet': return true;// xpw xpx
  556. case 'application/vnd.intergeo': return true;// i2g
  557. case 'application/vnd.intu.qbo': return true;// qbo
  558. case 'application/vnd.intu.qfx': return true;// qfx
  559. case 'application/vnd.ipunplugged.rcprofile': return true;// rcprofile
  560. case 'application/vnd.irepository.package+xml': return true;// irp
  561. case 'application/vnd.is-xpr': return true;// xpr
  562. case 'application/vnd.isac.fcs': return true;// fcs
  563. case 'application/vnd.jam': return true;// jam
  564. case 'application/vnd.jcp.javame.midlet-rms': return true;// rms
  565. case 'application/vnd.jisp': return true;// jisp
  566. case 'application/vnd.joost.joda-archive': return true;// joda
  567. case 'application/vnd.kahootz': return true;// ktz ktr
  568. case 'application/vnd.kde.karbon': return true;// karbon
  569. case 'application/vnd.kde.kchart': return true;// chrt
  570. case 'application/vnd.kde.kformula': return true;// kfo
  571. case 'application/vnd.kde.kivio': return true;// flw
  572. case 'application/vnd.kde.kontour': return true;// kon
  573. case 'application/vnd.kde.kpresenter': return true;// kpr kpt
  574. case 'application/vnd.kde.kspread': return true;// ksp
  575. case 'application/vnd.kde.kword': return true;// kwd kwt
  576. case 'application/vnd.kenameaapp': return true;// htke
  577. case 'application/vnd.kidspiration': return true;// kia
  578. case 'application/vnd.kinar': return true;// kne knp
  579. case 'application/vnd.koan': return true;// skp skd skt skm
  580. case 'application/vnd.kodak-descriptor': return true;// sse
  581. case 'application/vnd.las.las+xml': return true;// lasxml
  582. case 'application/vnd.llamagraphics.life-balance.desktop': return true;// lbd
  583. case 'application/vnd.llamagraphics.life-balance.exchange+xml': return true;// lbe
  584. case 'application/vnd.lotus-1-2-3': return true;// 123
  585. case 'application/vnd.lotus-approach': return true;// apr
  586. case 'application/vnd.lotus-freelance': return true;// pre
  587. case 'application/vnd.lotus-notes': return true;// nsf
  588. case 'application/vnd.lotus-organizer': return true;// org
  589. case 'application/vnd.lotus-screencam': return true;// scm
  590. case 'application/vnd.lotus-wordpro': return true;// lwp
  591. case 'application/vnd.macports.portpkg': return true;// portpkg
  592. case 'application/vnd.mcd': return true;// mcd
  593. case 'application/vnd.medcalcdata': return true;// mc1
  594. case 'application/vnd.mediastation.cdkey': return true;// cdkey
  595. case 'application/vnd.mfer': return true;// mwf
  596. case 'application/vnd.mfmp': return true;// mfm
  597. case 'application/vnd.micrografx.flo': return true;// flo
  598. case 'application/vnd.micrografx.igx': return true;// igx
  599. case 'application/vnd.mif': return true;// mif
  600. case 'application/vnd.mobius.daf': return true;// daf
  601. case 'application/vnd.mobius.dis': return true;// dis
  602. case 'application/vnd.mobius.mbk': return true;// mbk
  603. case 'application/vnd.mobius.mqy': return true;// mqy
  604. case 'application/vnd.mobius.msl': return true;// msl
  605. case 'application/vnd.mobius.plc': return true;// plc
  606. case 'application/vnd.mobius.txf': return true;// txf
  607. case 'application/vnd.mophun.application': return true;// mpn
  608. case 'application/vnd.mophun.certificate': return true;// mpc
  609. case 'application/vnd.mozilla.xul+xml': return true;// xul
  610. case 'application/vnd.ms-artgalry': return true;// cil
  611. case 'application/vnd.ms-cab-compressed': return true;// cab
  612. case 'application/vnd.ms-excel': return true;// xls xlm xla xlc xlt xlw
  613. case 'application/vnd.ms-excel.addin.macroenabled.12': return true;// xlam
  614. case 'application/vnd.ms-excel.sheet.binary.macroenabled.12': return true;// xlsb
  615. case 'application/vnd.ms-excel.sheet.macroenabled.12': return true;// xlsm
  616. case 'application/vnd.ms-excel.template.macroenabled.12': return true;// xltm
  617. case 'application/vnd.ms-fontobject': return true;// eot
  618. case 'application/vnd.ms-htmlhelp': return true;// chm
  619. case 'application/vnd.ms-ims': return true;// ims
  620. case 'application/vnd.ms-lrm': return true;// lrm
  621. case 'application/vnd.ms-office': return true;// theme thmx
  622. case 'application/vnd.ms-pki.seccat': return true;// cat
  623. case 'application/vnd.ms-pki.stl': return true;// stl
  624. case 'application/vnd.ms-powerpoint': return true;// ppt pps pot
  625. case 'application/vnd.ms-powerpoint.addin.macroenabled.12': return true;// ppam
  626. case 'application/vnd.ms-powerpoint.presentation.macroenabled.12': return true;// pptm
  627. case 'application/vnd.ms-powerpoint.slide.macroenabled.12': return true;// sldm
  628. case 'application/vnd.ms-powerpoint.slideshow.macroenabled.12': return true;// ppsm
  629. case 'application/vnd.ms-powerpoint.template.macroenabled.12': return true;// potm
  630. case 'application/vnd.ms-project': return true;// mpp mpt
  631. case 'application/vnd.ms-word.document.macroenabled.12': return true;// docm
  632. case 'application/vnd.ms-word.template.macroenabled.12': return true;// dotm
  633. case 'application/vnd.ms-works': return true;// wps wks wcm wdb
  634. case 'application/vnd.ms-wpl': return true;// wpl
  635. case 'application/vnd.ms-xpsdocument': return true;// xps
  636. case 'application/vnd.mseq': return true;// mseq
  637. case 'application/vnd.musician': return true;// mus
  638. case 'application/vnd.muvee.style': return true;// msty
  639. case 'application/vnd.mynfc': return true;// taglet
  640. case 'application/vnd.neurolanguage.nlu': return true;// nlu
  641. case 'application/vnd.nitf': return true;// ntf nitf
  642. case 'application/vnd.noblenet-directory': return true;// nnd
  643. case 'application/vnd.noblenet-sealer': return true;// nns
  644. case 'application/vnd.noblenet-web': return true;// nnw
  645. case 'application/vnd.nokia.n-gage.data': return true;// ngdat
  646. case 'application/vnd.nokia.n-gage.symbian.install': return true;// n- gage
  647. case 'application/vnd.nokia.radio-preset': return true;// rpst
  648. case 'application/vnd.nokia.radio-presets': return true;// rpss
  649. case 'application/vnd.novadigm.edm': return true;// edm
  650. case 'application/vnd.novadigm.edx': return true;// edx
  651. case 'application/vnd.novadigm.ext': return true;// ext
  652. case 'application/vnd.oasis.opendocument.chart': return true;// odc
  653. case 'application/vnd.oasis.opendocument.chart-template': return true;// otc
  654. case 'application/vnd.oasis.opendocument.database': return true;// odb
  655. case 'application/vnd.oasis.opendocument.formula': return true;// odf
  656. case 'application/vnd.oasis.opendocument.formula-template': return true;// odft
  657. case 'application/vnd.oasis.opendocument.graphics': return true;// odg
  658. case 'application/vnd.oasis.opendocument.graphics-template': return true;// otg
  659. case 'application/vnd.oasis.opendocument.image': return true;// odi
  660. case 'application/vnd.oasis.opendocument.image-template': return true;// oti
  661. case 'application/vnd.oasis.opendocument.presentation': return true;// odp
  662. case 'application/vnd.oasis.opendocument.presentation-template': return true;// otp
  663. case 'application/vnd.oasis.opendocument.spreadsheet': return true;// ods
  664. case 'application/vnd.oasis.opendocument.spreadsheet-template': return true;// ots
  665. case 'application/vnd.oasis.opendocument.text': return true;// odt
  666. case 'application/vnd.oasis.opendocument.text-master': return true;// odm
  667. case 'application/vnd.oasis.opendocument.text-template': return true;// ott
  668. case 'application/vnd.oasis.opendocument.text-web': return true;// oth
  669. case 'application/vnd.olpc-sugar': return true;// xo
  670. case 'application/vnd.oma.dd2+xml': return true;// dd2
  671. case 'application/vnd.openofficeorg.extension': return true;// oxt
  672. case 'application/vnd.openxmlformats-officedocument.presentationml.presentation': return true;// pptx
  673. case 'application/vnd.openxmlformats-officedocument.presentationml.slide': return true;// sldx
  674. case 'application/vnd.openxmlformats-officedocument.presentationml.slideshow': return true;// ppsx
  675. case 'application/vnd.openxmlformats-officedocument.presentationml.template': return true;// potx
  676. case 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet': return true;// xlsx
  677. case 'application/vnd.openxmlformats-officedocument.spreadsheetml.template': return true;// xltx
  678. case 'application/vnd.openxmlformats-officedocument.wordprocessingml.document': return true;// docx
  679. case 'application/vnd.openxmlformats-officedocument.wordprocessingml.template': return true;// dotx
  680. case 'application/vnd.osgeo.mapguide.package': return true;// mgp
  681. case 'application/vnd.osgi.dp': return true;// dp
  682. case 'application/vnd.osgi.subsystem': return true;// esa
  683. case 'application/vnd.palm': return true;// pdb pqa oprc
  684. case 'application/vnd.pawaafile': return true;// paw
  685. case 'application/vnd.pg.format': return true;// str
  686. case 'application/vnd.pg.osasli': return true;// ei6
  687. case 'application/vnd.picsel': return true;// efif
  688. case 'application/vnd.pmi.widget': return true;// wg
  689. case 'application/vnd.pocketlearn': return true;// plf
  690. case 'application/vnd.powerbuilder6': return true;// pbd
  691. case 'application/vnd.previewsystems.box': return true;// box
  692. case 'application/vnd.proteus.magazine': return true;// mgz
  693. case 'application/vnd.publishare-delta-tree': return true;// qps
  694. case 'application/vnd.pvi.ptid1': return true;// ptid
  695. case 'application/vnd.quark.quarkxpress': return true;// qxd qxt qwd qwt qxl qxb
  696. case 'application/vnd.realvnc.bed': return true;// bed
  697. case 'application/vnd.recordare.musicxml': return true;// mxl
  698. case 'application/vnd.recordare.musicxml+xml': return true;// musicxml
  699. case 'application/vnd.rig.cryptonote': return true;// cryptonote
  700. case 'application/vnd.rim.cod': return true;// cod
  701. case 'application/vnd.rn-realmedia': return true;// rm
  702. case 'application/vnd.rn-realmedia-vbr': return true;// rmvb
  703. case 'application/vnd.route66.link66+xml': return true;// link66
  704. case 'application/vnd.sailingtracker.track': return true;// st
  705. case 'application/vnd.seemail': return true;// see
  706. case 'application/vnd.sema': return true;// sema
  707. case 'application/vnd.semd': return true;// semd
  708. case 'application/vnd.semf': return true;// semf
  709. case 'application/vnd.shana.informed.formdata': return true;// ifm
  710. case 'application/vnd.shana.informed.formtemplate': return true;// itp
  711. case 'application/vnd.shana.informed.interchange': return true;// iif
  712. case 'application/vnd.shana.informed.package': return true;// ipk
  713. case 'application/vnd.simtech-mindmapper': return true;// twd twds
  714. case 'application/vnd.smaf': return true;// mmf
  715. case 'application/vnd.smart.teacher': return true;// teacher
  716. case 'application/vnd.solent.sdkm+xml': return true;// sdkm sdkd
  717. case 'application/vnd.spotfire.dxp': return true;// dxp
  718. case 'application/vnd.spotfire.sfs': return true;// sfs
  719. case 'application/vnd.stardivision.calc': return true;// sdc
  720. case 'application/vnd.stardivision.draw': return true;// sda
  721. case 'application/vnd.stardivision.impress': return true;// sdd
  722. case 'application/vnd.stardivision.math': return true;// smf
  723. case 'application/vnd.stardivision.writer': return true;// sdw vor
  724. case 'application/vnd.stardivision.writer-global': return true;// sgl
  725. case 'application/vnd.stepmania.package': return true;// smzip
  726. case 'application/vnd.stepmania.stepchart': return true;// sm
  727. case 'application/vnd.sun.xml.calc': return true;// sxc
  728. case 'application/vnd.sun.xml.calc.template': return true;// stc
  729. case 'application/vnd.sun.xml.draw': return true;// sxd
  730. case 'application/vnd.sun.xml.draw.template': return true;// std
  731. case 'application/vnd.sun.xml.impress': return true;// sxi
  732. case 'application/vnd.sun.xml.impress.template': return true;// sti
  733. case 'application/vnd.sun.xml.math': return true;// sxm
  734. case 'application/vnd.sun.xml.writer': return true;// sxw
  735. case 'application/vnd.sun.xml.writer.global': return true;// sxg
  736. case 'application/vnd.sun.xml.writer.template': return true;// stw
  737. case 'application/vnd.sus-calendar': return true;// sus susp
  738. case 'application/vnd.svd': return true;// svd
  739. case 'application/vnd.symbian.install sis': return true;// sisx
  740. case 'application/vnd.syncml+xml': return true;// xsm
  741. case 'application/vnd.syncml.dm+wbxml': return true;// bdm
  742. case 'application/vnd.syncml.dm+xml': return true;// xdm
  743. case 'application/vnd.tao.intent-module-archive': return true;// tao
  744. case 'application/vnd.tcpdump.pcap': return true;// pcap cap dmp
  745. case 'application/vnd.tmobile-livetv': return true;// tmo
  746. case 'application/vnd.trid.tpt': return true;// tpt
  747. case 'application/vnd.triscape.mxs': return true;// mxs
  748. case 'application/vnd.trueapp': return true;// tra
  749. case 'application/vnd.ufdl': return true;// ufd ufdl
  750. case 'application/vnd.uiq.theme': return true;// utz
  751. case 'application/vnd.umajin': return true;// umj
  752. case 'application/vnd.unity': return true;// unityweb
  753. case 'application/vnd.uoml+xml': return true;// uoml
  754. case 'application/vnd.vcx': return true;// vcx
  755. case 'application/vnd.visio': return true;// vsd vst vss vsw
  756. case 'application/vnd.visionary': return true;// vis
  757. case 'application/vnd.vsf': return true;// vsf
  758. case 'application/vnd.wap.wbxml': return true;// wbxml
  759. case 'application/vnd.wap.wmlc': return true;// wmlc
  760. case 'application/vnd.wap.wmlscriptc': return true;// wmlsc
  761. case 'application/vnd.webturbo': return true;// wtb
  762. case 'application/vnd.wolfram.player': return true;// nbp
  763. case 'application/vnd.wordperfect': return true;// wpd
  764. case 'application/vnd.wqd': return true;// wqd
  765. case 'application/vnd.wt.stf': return true;// stf
  766. case 'application/vnd.xara': return true;// xar
  767. case 'application/vnd.xfdl': return true;// xfdl
  768. case 'application/vnd.yamaha.hv-dic': return true;// hvd
  769. case 'application/vnd.yamaha.hv-script': return true;// hvs
  770. case 'application/vnd.yamaha.hv-voice': return true;// hvp
  771. case 'application/vnd.yamaha.openscoreformat': return true;// osf
  772. case 'application/vnd.yamaha.openscoreformat.osfpvg+xml': return true;// osfpvg
  773. case 'application/vnd.yamaha.smaf-audio': return true;// saf
  774. case 'application/vnd.yamaha.smaf-phrase': return true;// spf
  775. case 'application/vnd.yellowriver-custom-menu': return true;// cmp
  776. case 'application/vnd.zul': return true;// zir zirz
  777. case 'application/vnd.zzazz.deck+xml': return true;// zaz
  778. case 'application/voicexml+xml': return true;// vxml
  779. case 'application/widget': return true;// wgt
  780. case 'application/winhlp': return true;// hlp
  781. case 'application/wsdl+xml': return true;// wsdl
  782. case 'application/wspolicy+xml': return true;// wspolicy
  783. case 'application/x-7z-compressed': return true;// 7z
  784. case 'application/x-abiword': return true;// abw
  785. case 'application/x-ace-compressed': return true;// ace
  786. case 'application/x-apple-diskimage': return true;// dmg
  787. case 'application/x-authorware-bin': return true;// aab x32 u32 vox
  788. case 'application/x-authorware-map': return true;// aam
  789. case 'application/x-authorware-seg': return true;// aas
  790. case 'application/x-archive': return true;// ADMIN_USERS//5027.Pawel_Kamola/projekty/grafy_projekt_python/grafy/numpy/core/lib/libnpymath.a
  791. case 'application/x-empty': return false;// empty files
  792. case 'application/x-bcpio': return true;// bcpio
  793. case 'application/x-bittorrent': return true;// torrent
  794. case 'application/x-blorb': return true;// blb blorb
  795. case 'application/x-bzip': return true;// bz
  796. case 'application/x-bzip2': return true;// bz2 boz
  797. case 'application/x-cbr': return true;// cbr cba cbt cbz cb7
  798. case 'application/x-cdlink': return true;// vcd
  799. case 'application/x-cfs-compressed': return true;// cfs
  800. case 'application/x-chat': return true;// chat
  801. case 'application/x-chess-pgn': return true;// pgn
  802. case 'application/x-conference': return true;// nsc
  803. case 'application/x-cpio': return true;// cpio
  804. case 'application/x-csh': return true;// csh
  805. case 'application/x-debian-package': return true;// deb udeb
  806. case 'application/x-dgc-compressed': return true;// dgc
  807. case 'application/x-director': return true;// dir dcr dxr cst cct cxt w3d fgd swa
  808. case 'application/x-doom': return true;// wad
  809. case 'application/x-dtbncx+xml': return true;// ncx
  810. case 'application/x-dtbook+xml': return true;// dtb
  811. case 'application/x-dtbresource+xml': return true;// res
  812. case 'application/x-dvi': return true;// dvi
  813. case 'application/x-envoy': return true;// evy
  814. case 'application/x-eva': return true;// eva
  815. case 'application/x-font-bdf': return true;// bdf
  816. case 'application/x-font-ghostscript': return true;// gsf
  817. case 'application/x-font-linux-psf': return true;// psf
  818. case 'application/x-font-otf': return true;// otf
  819. case 'application/x-font-pcf': return true;// pcf
  820. case 'application/x-font-snf': return true;// snf
  821. case 'application/x-font-ttf': return true;// ttc ttf
  822. case 'application/x-font-type1': return true;// afm pfa pfb pfm
  823. case 'application/x-freearc': return true;// arc
  824. case 'application/x-futuresplash': return true;// spl
  825. case 'application/x-executable': return true;//
  826. case 'application/x-gca-compressed': return true;// gca
  827. case 'application/x-glulx': return true;// ulx
  828. case 'application/x-gnumeric': return true;// gnumeric
  829. case 'application/x-gramps-xml': return true;// gramps
  830. case 'application/x-gtar': return true;// gtar
  831. case 'application/x-gzip': return true;// gz gzip
  832. case 'application/x-hdf': return true;// hdf
  833. case 'application/x-install-instructions': return true;// install
  834. case 'application/x-iso9660-image': return true;// iso
  835. case 'application/x-java-jnlp-file': return true;// jnlp
  836. case 'application/x-latex': return true;// latex
  837. case 'application/x-lzh-compressed': return true;// lha lzh
  838. case 'application/x-mie': return true;// mie
  839. case 'application/x-mobipocket-ebook': return true;// mobi prc
  840. case 'application/x-ms-application': return true;// application
  841. case 'application/x-ms-shortcut': return true;// lnk
  842. case 'application/x-ms-wmd': return true;// wmd
  843. case 'application/x-ms-wmz': return true;// wmz
  844. case 'application/x-ms-xbap': return true;// xbap
  845. case 'application/x-msaccess': return true;// mdb
  846. case 'application/x-msbinder': return true;// obd
  847. case 'application/x-mscardfile': return true;// crd
  848. case 'application/x-msclip': return true;// clp
  849. case 'application/x-msdownload': return true;// msi exe dll com bat
  850. case 'application/x-msmediaview': return true;// m14 mvb m13
  851. case 'application/x-msmetafile': return true;// emz wmf wmz emf
  852. case 'application/x-msmoney': return true;// mny
  853. case 'application/x-mspublisher': return true;// pub
  854. case 'application/x-msschedule': return true;// scd
  855. case 'application/x-msterminal': return true;// trm
  856. case 'application/x-mswrite': return true;// wri
  857. case 'application/x-netcdf': return true;// cdf nc
  858. case 'application/x-nzb': return true;// nzb
  859. case 'application/x-pkcs12': return true;// pfx p12
  860. case 'application/x-pkcs7-certificates': return true;// spc p7b
  861. case 'application/x-pkcs7-certreqresp': return true;// p7r
  862. case 'application/x-rar': return true;// rar
  863. case 'application/x-rar-compressed': return true;// rar
  864. case 'application/x-research-info-systems': return true;// ris
  865. case 'application/x-sh': return true;// sh
  866. case 'application/x-shar': return true;// shar
  867. case 'application/x-shockwave-flash': return true;// swf
  868. case 'application/x-silverlight-app': return true;// xap
  869. case 'application/x-sql': return true;// sql
  870. case 'application/x-stuffit': return true;// sit
  871. case 'application/x-stuffitx': return true;// sitx
  872. case 'application/x-subrip': return true;// srt
  873. case 'application/x-sv4cpio': return true;// sv4cpio
  874. case 'application/x-sv4crc': return true;// sv4crc
  875. case 'application/x-t3vm-image': return true;// t3
  876. case 'application/x-tads': return true;// gam
  877. case 'application/x-tar': return true;// tar
  878. case 'application/x-tcl': return true;// tcl
  879. case 'application/x-tex': return true;// tex
  880. case 'application/x-tex-tfm': return true;// tfm
  881. case 'application/x-texinfo': return true;// texi texinfo
  882. case 'application/x-tgif': return true;// obj
  883. case 'application/x-ustar': return true;// ustar
  884. case 'application/x-wais-source': return true;// src
  885. case 'application/x-x509-ca-cert': return true;// crt der
  886. case 'application/x-xfig': return true;// fig
  887. case 'application/x-xliff+xml': return true;// xlf
  888. case 'application/x-xpinstall': return true;// xpi
  889. case 'application/x-xz': return true;// xz
  890. case 'application/x-zmachine': return true;// z8 z1 z2 z3 z4 z5 z6 z7
  891. case 'application/xaml+xml': return true;// xaml
  892. case 'application/xcap-diff+xml': return true;// xdf
  893. case 'application/xenc+xml': return true;// xenc
  894. case 'application/xhtml+xml': return true;// xht xhtml
  895. case 'application/xml': return true;// xsl xml
  896. case 'application/xml-dtd': return true;// dtd
  897. case 'application/xop+xml': return true;// xop
  898. case 'application/xproc+xml': return true;// xpl
  899. case 'application/xslt+xml': return true;// xslt
  900. case 'application/xspf+xml': return true;// xspf
  901. case 'application/xv+xml': return true;// xvm mxml xhvml xvml
  902. case 'application/yang': return true;// yang
  903. case 'application/yin+xml': return true;// yin
  904. case 'application/zip': return true;// zip
  905. case 'audio/adpcm': return true;// adp
  906. case 'audio/basic': return true;// snd au
  907. case 'audio/midi': return true;// rmi mid midi kar
  908. case 'audio/mp4': return true;// mp4a m4a
  909. case 'audio/mpeg': return true;// m3a mpga mp2 mp2a mp3 m2a
  910. case 'audio/ogg': return true;// spx oga ogg
  911. case 'audio/s3m': return true;// s3m
  912. case 'audio/silk': return true;// sil
  913. case 'audio/vnd.dece.audio': return true;// uvva uva
  914. case 'audio/vnd.digital-winds': return true;// eol
  915. case 'audio/vnd.dra': return true;// dra
  916. case 'audio/vnd.dts': return true;// dts
  917. case 'audio/vnd.dts.hd': return true;// dtshd
  918. case 'audio/vnd.lucent.voice': return true;// lvp
  919. case 'audio/vnd.ms-playready.media.pya': return true;// pya
  920. case 'audio/vnd.nuera.ecelp4800': return true;// ecelp4800
  921. case 'audio/vnd.nuera.ecelp7470': return true;// ecelp7470
  922. case 'audio/vnd.nuera.ecelp9600': return true;// ecelp9600
  923. case 'audio/vnd.rip': return true;// rip
  924. case 'audio/webm': return true;// weba
  925. case 'audio/x-aac': return true;// aac
  926. case 'audio/x-aiff': return true;// aifc aif aiff
  927. case 'audio/x-caf': return true;// caf
  928. case 'audio/x-flac': return true;// flac
  929. case 'audio/x-matroska': return true;// mka
  930. case 'audio/x-mpegurl': return true;// m3u
  931. case 'audio/x-ms-wax': return true;// wax
  932. case 'audio/x-ms-wma': return true;// wma
  933. case 'audio/x-pn-realaudio': return true;// ra ram
  934. case 'audio/x-pn-realaudio-plugin': return true;// rmp
  935. case 'audio/x-wav': return true;// wav
  936. case 'audio/xm': return true;// xm
  937. case 'chemical/x-cdx': return true;// cdx
  938. case 'chemical/x-cif': return true;// cif
  939. case 'chemical/x-cmdf': return true;// cmdf
  940. case 'chemical/x-cml': return true;// cml
  941. case 'chemical/x-csml': return true;// csml
  942. case 'chemical/x-xyz': return true;// xyz
  943. case 'image/bmp': return true;// bmp
  944. case 'image/cgm': return true;// cgm
  945. case 'image/g3fax': return true;// g3
  946. case 'image/gif': return true;// gif
  947. case 'image/ief': return true;// ief
  948. case 'image/jpeg': return true;// jpe jpeg jpg
  949. case 'image/ktx': return true;// ktx
  950. case 'image/png': return true;// png
  951. case 'image/prs.btif': return true;// btif
  952. case 'image/sgi': return true;// sgi
  953. case 'image/svg+xml': return true;// svgz svg
  954. case 'image/tiff': return true;// tif tiff
  955. case 'image/vnd.adobe.photoshop': return true;// psd
  956. case 'image/vnd.dece.graphic': return true;// uvvg uvi uvvi uvg
  957. case 'image/vnd.djvu': return true;// djv djvu
  958. case 'image/vnd.dvb.subtitle': return true;// sub
  959. case 'image/vnd.dwg': return true;// dwg
  960. case 'image/vnd.dxf': return true;// dxf
  961. case 'image/vnd.fastbidsheet': return true;// fbs
  962. case 'image/vnd.fpx': return true;// fpx
  963. case 'image/vnd.fst': return true;// fst
  964. case 'image/vnd.fujixerox.edmics-mmr': return true;// mmr
  965. case 'image/vnd.fujixerox.edmics-rlc': return true;// rlc
  966. case 'image/vnd.ms-modi': return true;// mdi
  967. case 'image/vnd.ms-photo': return true;// wdp
  968. case 'image/vnd.net-fpx': return true;// npx
  969. case 'image/vnd.wap.wbmp': return true;// wbmp
  970. case 'image/vnd.xiff': return true;// xif
  971. case 'image/webp': return true;// webp
  972. case 'image/x-3ds': return true;// 3ds
  973. case 'image/x-cmu-raster': return true;// ras
  974. case 'image/x-cmx': return true;// cmx
  975. case 'image/x-freehand': return true;// fh7 fh fhc fh4 fh5
  976. case 'image/x-ico': return true;// ico
  977. case 'image/x-icon': return true;// ico
  978. case 'image/x-mrsid-image': return true;// sid
  979. case 'image/x-ms-bmp': return true;// bmp
  980. case 'image/x-pcx': return true;// pcx
  981. case 'image/x-pict': return true;// pct pic
  982. case 'image/x-portable-anymap': return true;// pnm
  983. case 'image/x-portable-bitmap': return true;// pbm
  984. case 'image/x-portable-graymap': return true;// pgm
  985. case 'image/x-portable-greymap': return true;// pgm
  986. case 'image/x-portable-pixmap': return true;// ppm
  987. case 'image/x-rgb': return true;// rgb
  988. case 'image/x-tga': return true;// tga
  989. case 'image/x-xbitmap': return true;// xbm
  990. case 'image/x-xpixmap': return true;// xpm
  991. case 'image/x-xwindowdump': return true;// xwd
  992. case 'inode/x-empty': return false;// empty file
  993. case 'message/rfc822': return true;// mime eml
  994. case 'model/iges': return true;// iges igs
  995. case 'model/mesh': return true;// silo msh mesh
  996. case 'model/vnd.collada+xml': return true;// dae
  997. case 'model/vnd.dwf': return true;// dwf
  998. case 'model/vnd.gdl': return true;// gdl
  999. case 'model/vnd.gtw': return true;// gtw
  1000. case 'model/vnd.mts': return true;// mts
  1001. case 'model/vnd.vtu': return true;// vtu
  1002. case 'model/vrml': return true;// vrml wrl
  1003. case 'model/x3d+binary': return true;// x3dbz x3db
  1004. case 'model/x3d+vrml': return true;// x3dvz x3dv
  1005. case 'model/x3d+xml': return true;// x3dz x3d
  1006. case 'text/cache-manifest': return true;// appcache
  1007. case 'text/calendar': return true;// ifb ics
  1008. case 'text/css': return true;// css
  1009. case 'text/csv': return true;// csv
  1010. case 'text/html': return true;// htm html
  1011. case 'text/n3': return true;// n3
  1012. case 'text/plain': return true;// in txt text conf def list log
  1013. case 'text/prs.lines.tag': return true;// dsc
  1014. case 'text/rtf': return true;// rtf
  1015. case 'text/richtext': return true;// rtx
  1016. case 'text/sgml': return true;// sgm sgml
  1017. case 'text/tab-separated-values': return true;// tsv
  1018. case 'text/troff': return true;// ms t tr roff man me
  1019. case 'text/turtle': return true;// ttl
  1020. case 'text/uri-list': return true;// urls uri uris
  1021. case 'text/vcard': return true;// vcard
  1022. case 'text/vnd.curl': return true;// curl
  1023. case 'text/vnd.curl.dcurl': return true;// dcurl
  1024. case 'text/vnd.curl.mcurl': return true;// mcurl
  1025. case 'text/vnd.curl.scurl': return true;// scurl
  1026. case 'text/vnd.dvb.subtitle': return true;// sub
  1027. case 'text/vnd.fly': return true;// fly
  1028. case 'text/vnd.fmi.flexstor': return true;// flx
  1029. case 'text/vnd.graphviz': return true;// gv
  1030. case 'text/vnd.in3d.3dml': return true;// 3dml
  1031. case 'text/vnd.in3d.spot': return true;// spot
  1032. case 'text/vnd.sun.j2me.app-descriptor': return true;// jad
  1033. case 'text/vnd.wap.wml': return true;// wml
  1034. case 'text/vnd.wap.wmlscript': return true;// wmls
  1035. case 'text/x-asm': return true;// s asm
  1036. case 'text/x-c': return true;// c cc cxx cpp h hh dic
  1037. case 'text/x-c++': return true;// c++
  1038. case 'text/x-fortran': return true;// f for f77 f90
  1039. case 'text/x-java': return true;// java
  1040. case 'text/x-java-source': return true;// java
  1041. case 'text/x-makefile': return true;// Makefile
  1042. case 'text/x-nfo': return true;// nfo
  1043. case 'text/x-opml': return true;// opml
  1044. case 'text/x-pascal': return true;// p pas
  1045. case 'text/x-php': return true;// php
  1046. case 'text/x-python': return true;// py
  1047. case 'text/x-setext': return true;// etx
  1048. case 'text/x-sfv': return true;// sfv
  1049. case 'text/x-shellscript': return true;// ...
  1050. case 'text/x-uuencode': return true;// uu
  1051. case 'text/x-vcalendar': return true;// vcs
  1052. case 'text/x-vcard': return true;// vcf
  1053. case 'video/3gpp': return true;// 3gp
  1054. case 'video/3gpp2': return true;// 3g2
  1055. case 'video/h261': return true;// h261
  1056. case 'video/h263': return true;// h263
  1057. case 'video/h264': return true;// h264
  1058. case 'video/jpeg': return true;// jpgv
  1059. case 'video/jpm': return true;// jpm jpgm
  1060. case 'video/mj2': return true;// mjp2 mj2
  1061. case 'video/mp4': return true;// mpg4 mp4 mp4v
  1062. case 'video/mpeg': return true;// m2v mpeg mpg mpe m1v
  1063. case 'video/ogg': return true;// ogv
  1064. case 'video/quicktime': return true;// mov qt
  1065. case 'video/vnd.dece.hd': return true;// uvvh uvh
  1066. case 'video/vnd.dece.mobile': return true;// uvvm uvm
  1067. case 'video/vnd.dece.pd': return true;// uvvp uvp
  1068. case 'video/vnd.dece.sd': return true;// uvvs uvs
  1069. case 'video/vnd.dece.video': return true;// uvvv uvv
  1070. case 'video/vnd.dvb.file': return true;// dvb
  1071. case 'video/vnd.fvt': return true;// fvt
  1072. case 'video/vnd.mpegurl': return true;// m4u mxu
  1073. case 'video/vnd.ms-playready.media.pyv': return true;// pyv
  1074. case 'video/vnd.uvvu.mp4': return true;// uvvu uvu
  1075. case 'video/vnd.vivo': return true;// viv
  1076. case 'video/webm': return true;// webm
  1077. case 'video/x-f4v': return true;// f4v
  1078. case 'video/x-fli': return true;// fli
  1079. case 'video/x-flv': return true;// flv
  1080. case 'video/x-m4v': return true;// m4v
  1081. case 'video/x-matroska': return true;// mks mkv mk3d
  1082. case 'video/x-mng': return true;// mng
  1083. case 'video/x-ms-asf': return true;// asx asf
  1084. case 'video/x-ms-vob': return true;// vob
  1085. case 'video/x-ms-wm': return true;// wm
  1086. case 'video/x-ms-wmv': return true;// wmv
  1087. case 'video/x-ms-wmx': return true;// wmx
  1088. case 'video/x-ms-wvx': return true;// wvx
  1089. case 'video/x-msvideo': return true;// avi
  1090. case 'video/x-sgi-movie': return true;// movie
  1091. case 'video/x-smv': return true;// smv
  1092. case 'x-conference/x-cooltalk': return true;// ice
  1093. }
  1094. return false;
  1095. }
  1096. }