FIX Picto for mime

This commit is contained in:
Laurent Destailleur
2024-02-18 22:39:31 +01:00
parent fe7f94e1d9
commit 685cdecca5

View File

@@ -11007,229 +11007,229 @@ function dol_mimetype($file, $default = 'application/octet-stream', $mode = 0)
if (preg_match('/\.txt$/i', $tmpfile)) { if (preg_match('/\.txt$/i', $tmpfile)) {
$mime = 'text/plain'; $mime = 'text/plain';
$imgmime = 'text.png'; $imgmime = 'text.png';
$famime = 'file-text-o'; $famime = 'file-alt';
} elseif (preg_match('/\.rtx$/i', $tmpfile)) { } elseif (preg_match('/\.rtx$/i', $tmpfile)) {
$mime = 'text/richtext'; $mime = 'text/richtext';
$imgmime = 'text.png'; $imgmime = 'text.png';
$famime = 'file-text-o'; $famime = 'file-alt';
} elseif (preg_match('/\.csv$/i', $tmpfile)) { } elseif (preg_match('/\.csv$/i', $tmpfile)) {
$mime = 'text/csv'; $mime = 'text/csv';
$imgmime = 'text.png'; $imgmime = 'text.png';
$famime = 'file-text-o'; $famime = 'file-csv';
} elseif (preg_match('/\.tsv$/i', $tmpfile)) { } elseif (preg_match('/\.tsv$/i', $tmpfile)) {
$mime = 'text/tab-separated-values'; $mime = 'text/tab-separated-values';
$imgmime = 'text.png'; $imgmime = 'text.png';
$famime = 'file-text-o'; $famime = 'file-alt';
} elseif (preg_match('/\.(cf|conf|log)$/i', $tmpfile)) { } elseif (preg_match('/\.(cf|conf|log)$/i', $tmpfile)) {
$mime = 'text/plain'; $mime = 'text/plain';
$imgmime = 'text.png'; $imgmime = 'text.png';
$famime = 'file-text-o'; $famime = 'file-alt';
} elseif (preg_match('/\.ini$/i', $tmpfile)) { } elseif (preg_match('/\.ini$/i', $tmpfile)) {
$mime = 'text/plain'; $mime = 'text/plain';
$imgmime = 'text.png'; $imgmime = 'text.png';
$srclang = 'ini'; $srclang = 'ini';
$famime = 'file-text-o'; $famime = 'file-alt';
} elseif (preg_match('/\.md$/i', $tmpfile)) { } elseif (preg_match('/\.md$/i', $tmpfile)) {
$mime = 'text/plain'; $mime = 'text/plain';
$imgmime = 'text.png'; $imgmime = 'text.png';
$srclang = 'md'; $srclang = 'md';
$famime = 'file-text-o'; $famime = 'file-alt';
} elseif (preg_match('/\.css$/i', $tmpfile)) { } elseif (preg_match('/\.css$/i', $tmpfile)) {
$mime = 'text/css'; $mime = 'text/css';
$imgmime = 'css.png'; $imgmime = 'css.png';
$srclang = 'css'; $srclang = 'css';
$famime = 'file-text-o'; $famime = 'file-alt';
} elseif (preg_match('/\.lang$/i', $tmpfile)) { } elseif (preg_match('/\.lang$/i', $tmpfile)) {
$mime = 'text/plain'; $mime = 'text/plain';
$imgmime = 'text.png'; $imgmime = 'text.png';
$srclang = 'lang'; $srclang = 'lang';
$famime = 'file-text-o'; $famime = 'file-alt';
} elseif (preg_match('/\.(crt|cer|key|pub)$/i', $tmpfile)) { // Certificate files } elseif (preg_match('/\.(crt|cer|key|pub)$/i', $tmpfile)) { // Certificate files
$mime = 'text/plain'; $mime = 'text/plain';
$imgmime = 'text.png'; $imgmime = 'text.png';
$famime = 'file-text-o'; $famime = 'file-alt';
} elseif (preg_match('/\.(html|htm|shtml)$/i', $tmpfile)) { // XML based (HTML/XML/XAML) } elseif (preg_match('/\.(html|htm|shtml)$/i', $tmpfile)) { // XML based (HTML/XML/XAML)
$mime = 'text/html'; $mime = 'text/html';
$imgmime = 'html.png'; $imgmime = 'html.png';
$srclang = 'html'; $srclang = 'html';
$famime = 'file-text-o'; $famime = 'file-alt';
} elseif (preg_match('/\.(xml|xhtml)$/i', $tmpfile)) { } elseif (preg_match('/\.(xml|xhtml)$/i', $tmpfile)) {
$mime = 'text/xml'; $mime = 'text/xml';
$imgmime = 'other.png'; $imgmime = 'other.png';
$srclang = 'xml'; $srclang = 'xml';
$famime = 'file-text-o'; $famime = 'file-alt';
} elseif (preg_match('/\.xaml$/i', $tmpfile)) { } elseif (preg_match('/\.xaml$/i', $tmpfile)) {
$mime = 'text/xml'; $mime = 'text/xml';
$imgmime = 'other.png'; $imgmime = 'other.png';
$srclang = 'xaml'; $srclang = 'xaml';
$famime = 'file-text-o'; $famime = 'file-alt';
} elseif (preg_match('/\.bas$/i', $tmpfile)) { // Languages } elseif (preg_match('/\.bas$/i', $tmpfile)) { // Languages
$mime = 'text/plain'; $mime = 'text/plain';
$imgmime = 'text.png'; $imgmime = 'text.png';
$srclang = 'bas'; $srclang = 'bas';
$famime = 'file-code-o'; $famime = 'file-code';
} elseif (preg_match('/\.(c)$/i', $tmpfile)) { } elseif (preg_match('/\.(c)$/i', $tmpfile)) {
$mime = 'text/plain'; $mime = 'text/plain';
$imgmime = 'text.png'; $imgmime = 'text.png';
$srclang = 'c'; $srclang = 'c';
$famime = 'file-code-o'; $famime = 'file-code';
} elseif (preg_match('/\.(cpp)$/i', $tmpfile)) { } elseif (preg_match('/\.(cpp)$/i', $tmpfile)) {
$mime = 'text/plain'; $mime = 'text/plain';
$imgmime = 'text.png'; $imgmime = 'text.png';
$srclang = 'cpp'; $srclang = 'cpp';
$famime = 'file-code-o'; $famime = 'file-code';
} elseif (preg_match('/\.cs$/i', $tmpfile)) { } elseif (preg_match('/\.cs$/i', $tmpfile)) {
$mime = 'text/plain'; $mime = 'text/plain';
$imgmime = 'text.png'; $imgmime = 'text.png';
$srclang = 'cs'; $srclang = 'cs';
$famime = 'file-code-o'; $famime = 'file-code';
} elseif (preg_match('/\.(h)$/i', $tmpfile)) { } elseif (preg_match('/\.(h)$/i', $tmpfile)) {
$mime = 'text/plain'; $mime = 'text/plain';
$imgmime = 'text.png'; $imgmime = 'text.png';
$srclang = 'h'; $srclang = 'h';
$famime = 'file-code-o'; $famime = 'file-code';
} elseif (preg_match('/\.(java|jsp)$/i', $tmpfile)) { } elseif (preg_match('/\.(java|jsp)$/i', $tmpfile)) {
$mime = 'text/plain'; $mime = 'text/plain';
$imgmime = 'text.png'; $imgmime = 'text.png';
$srclang = 'java'; $srclang = 'java';
$famime = 'file-code-o'; $famime = 'file-code';
} elseif (preg_match('/\.php([0-9]{1})?$/i', $tmpfile)) { } elseif (preg_match('/\.php([0-9]{1})?$/i', $tmpfile)) {
$mime = 'text/plain'; $mime = 'text/plain';
$imgmime = 'php.png'; $imgmime = 'php.png';
$srclang = 'php'; $srclang = 'php';
$famime = 'file-code-o'; $famime = 'file-code';
} elseif (preg_match('/\.phtml$/i', $tmpfile)) { } elseif (preg_match('/\.phtml$/i', $tmpfile)) {
$mime = 'text/plain'; $mime = 'text/plain';
$imgmime = 'php.png'; $imgmime = 'php.png';
$srclang = 'php'; $srclang = 'php';
$famime = 'file-code-o'; $famime = 'file-code';
} elseif (preg_match('/\.(pl|pm)$/i', $tmpfile)) { } elseif (preg_match('/\.(pl|pm)$/i', $tmpfile)) {
$mime = 'text/plain'; $mime = 'text/plain';
$imgmime = 'pl.png'; $imgmime = 'pl.png';
$srclang = 'perl'; $srclang = 'perl';
$famime = 'file-code-o'; $famime = 'file-code';
} elseif (preg_match('/\.sql$/i', $tmpfile)) { } elseif (preg_match('/\.sql$/i', $tmpfile)) {
$mime = 'text/plain'; $mime = 'text/plain';
$imgmime = 'text.png'; $imgmime = 'text.png';
$srclang = 'sql'; $srclang = 'sql';
$famime = 'file-code-o'; $famime = 'file-code';
} elseif (preg_match('/\.js$/i', $tmpfile)) { } elseif (preg_match('/\.js$/i', $tmpfile)) {
$mime = 'text/x-javascript'; $mime = 'text/x-javascript';
$imgmime = 'jscript.png'; $imgmime = 'jscript.png';
$srclang = 'js'; $srclang = 'js';
$famime = 'file-code-o'; $famime = 'file-code';
} elseif (preg_match('/\.odp$/i', $tmpfile)) { // Open office } elseif (preg_match('/\.odp$/i', $tmpfile)) { // Open office
$mime = 'application/vnd.oasis.opendocument.presentation'; $mime = 'application/vnd.oasis.opendocument.presentation';
$imgmime = 'ooffice.png'; $imgmime = 'ooffice.png';
$famime = 'file-powerpoint-o'; $famime = 'file-powerpoint';
} elseif (preg_match('/\.ods$/i', $tmpfile)) { } elseif (preg_match('/\.ods$/i', $tmpfile)) {
$mime = 'application/vnd.oasis.opendocument.spreadsheet'; $mime = 'application/vnd.oasis.opendocument.spreadsheet';
$imgmime = 'ooffice.png'; $imgmime = 'ooffice.png';
$famime = 'file-excel-o'; $famime = 'file-excel';
} elseif (preg_match('/\.odt$/i', $tmpfile)) { } elseif (preg_match('/\.odt$/i', $tmpfile)) {
$mime = 'application/vnd.oasis.opendocument.text'; $mime = 'application/vnd.oasis.opendocument.text';
$imgmime = 'ooffice.png'; $imgmime = 'ooffice.png';
$famime = 'file-word-o'; $famime = 'file-word';
} elseif (preg_match('/\.mdb$/i', $tmpfile)) { // MS Office } elseif (preg_match('/\.mdb$/i', $tmpfile)) { // MS Office
$mime = 'application/msaccess'; $mime = 'application/msaccess';
$imgmime = 'mdb.png'; $imgmime = 'mdb.png';
$famime = 'file-o'; $famime = 'file';
} elseif (preg_match('/\.doc[xm]?$/i', $tmpfile)) { } elseif (preg_match('/\.doc[xm]?$/i', $tmpfile)) {
$mime = 'application/msword'; $mime = 'application/msword';
$imgmime = 'doc.png'; $imgmime = 'doc.png';
$famime = 'file-word-o'; $famime = 'file-word';
} elseif (preg_match('/\.dot[xm]?$/i', $tmpfile)) { } elseif (preg_match('/\.dot[xm]?$/i', $tmpfile)) {
$mime = 'application/msword'; $mime = 'application/msword';
$imgmime = 'doc.png'; $imgmime = 'doc.png';
$famime = 'file-word-o'; $famime = 'file-word';
} elseif (preg_match('/\.xlt(x)?$/i', $tmpfile)) { } elseif (preg_match('/\.xlt(x)?$/i', $tmpfile)) {
$mime = 'application/vnd.ms-excel'; $mime = 'application/vnd.ms-excel';
$imgmime = 'xls.png'; $imgmime = 'xls.png';
$famime = 'file-excel-o'; $famime = 'file-excel';
} elseif (preg_match('/\.xla(m)?$/i', $tmpfile)) { } elseif (preg_match('/\.xla(m)?$/i', $tmpfile)) {
$mime = 'application/vnd.ms-excel'; $mime = 'application/vnd.ms-excel';
$imgmime = 'xls.png'; $imgmime = 'xls.png';
$famime = 'file-excel-o'; $famime = 'file-excel';
} elseif (preg_match('/\.xls$/i', $tmpfile)) { } elseif (preg_match('/\.xls$/i', $tmpfile)) {
$mime = 'application/vnd.ms-excel'; $mime = 'application/vnd.ms-excel';
$imgmime = 'xls.png'; $imgmime = 'xls.png';
$famime = 'file-excel-o'; $famime = 'file-excel';
} elseif (preg_match('/\.xls[bmx]$/i', $tmpfile)) { } elseif (preg_match('/\.xls[bmx]$/i', $tmpfile)) {
$mime = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'; $mime = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
$imgmime = 'xls.png'; $imgmime = 'xls.png';
$famime = 'file-excel-o'; $famime = 'file-excel';
} elseif (preg_match('/\.pps[mx]?$/i', $tmpfile)) { } elseif (preg_match('/\.pps[mx]?$/i', $tmpfile)) {
$mime = 'application/vnd.ms-powerpoint'; $mime = 'application/vnd.ms-powerpoint';
$imgmime = 'ppt.png'; $imgmime = 'ppt.png';
$famime = 'file-powerpoint-o'; $famime = 'file-powerpoint';
} elseif (preg_match('/\.ppt[mx]?$/i', $tmpfile)) { } elseif (preg_match('/\.ppt[mx]?$/i', $tmpfile)) {
$mime = 'application/x-mspowerpoint'; $mime = 'application/x-mspowerpoint';
$imgmime = 'ppt.png'; $imgmime = 'ppt.png';
$famime = 'file-powerpoint-o'; $famime = 'file-powerpoint';
} elseif (preg_match('/\.pdf$/i', $tmpfile)) { // Other } elseif (preg_match('/\.pdf$/i', $tmpfile)) { // Other
$mime = 'application/pdf'; $mime = 'application/pdf';
$imgmime = 'pdf.png'; $imgmime = 'pdf.png';
$famime = 'file-pdf-o'; $famime = 'file-pdf';
} elseif (preg_match('/\.bat$/i', $tmpfile)) { // Scripts } elseif (preg_match('/\.bat$/i', $tmpfile)) { // Scripts
$mime = 'text/x-bat'; $mime = 'text/x-bat';
$imgmime = 'script.png'; $imgmime = 'script.png';
$srclang = 'dos'; $srclang = 'dos';
$famime = 'file-code-o'; $famime = 'file-code';
} elseif (preg_match('/\.sh$/i', $tmpfile)) { } elseif (preg_match('/\.sh$/i', $tmpfile)) {
$mime = 'text/x-sh'; $mime = 'text/x-sh';
$imgmime = 'script.png'; $imgmime = 'script.png';
$srclang = 'bash'; $srclang = 'bash';
$famime = 'file-code-o'; $famime = 'file-code';
} elseif (preg_match('/\.ksh$/i', $tmpfile)) { } elseif (preg_match('/\.ksh$/i', $tmpfile)) {
$mime = 'text/x-ksh'; $mime = 'text/x-ksh';
$imgmime = 'script.png'; $imgmime = 'script.png';
$srclang = 'bash'; $srclang = 'bash';
$famime = 'file-code-o'; $famime = 'file-code';
} elseif (preg_match('/\.bash$/i', $tmpfile)) { } elseif (preg_match('/\.bash$/i', $tmpfile)) {
$mime = 'text/x-bash'; $mime = 'text/x-bash';
$imgmime = 'script.png'; $imgmime = 'script.png';
$srclang = 'bash'; $srclang = 'bash';
$famime = 'file-code-o'; $famime = 'file-code';
} elseif (preg_match('/\.ico$/i', $tmpfile)) { // Images } elseif (preg_match('/\.ico$/i', $tmpfile)) { // Images
$mime = 'image/x-icon'; $mime = 'image/x-icon';
$imgmime = 'image.png'; $imgmime = 'image.png';
$famime = 'file-image-o'; $famime = 'file-image';
} elseif (preg_match('/\.(jpg|jpeg)$/i', $tmpfile)) { } elseif (preg_match('/\.(jpg|jpeg)$/i', $tmpfile)) {
$mime = 'image/jpeg'; $mime = 'image/jpeg';
$imgmime = 'image.png'; $imgmime = 'image.png';
$famime = 'file-image-o'; $famime = 'file-image';
} elseif (preg_match('/\.png$/i', $tmpfile)) { } elseif (preg_match('/\.png$/i', $tmpfile)) {
$mime = 'image/png'; $mime = 'image/png';
$imgmime = 'image.png'; $imgmime = 'image.png';
$famime = 'file-image-o'; $famime = 'file-image';
} elseif (preg_match('/\.gif$/i', $tmpfile)) { } elseif (preg_match('/\.gif$/i', $tmpfile)) {
$mime = 'image/gif'; $mime = 'image/gif';
$imgmime = 'image.png'; $imgmime = 'image.png';
$famime = 'file-image-o'; $famime = 'file-image';
} elseif (preg_match('/\.bmp$/i', $tmpfile)) { } elseif (preg_match('/\.bmp$/i', $tmpfile)) {
$mime = 'image/bmp'; $mime = 'image/bmp';
$imgmime = 'image.png'; $imgmime = 'image.png';
$famime = 'file-image-o'; $famime = 'file-image';
} elseif (preg_match('/\.(tif|tiff)$/i', $tmpfile)) { } elseif (preg_match('/\.(tif|tiff)$/i', $tmpfile)) {
$mime = 'image/tiff'; $mime = 'image/tiff';
$imgmime = 'image.png'; $imgmime = 'image.png';
$famime = 'file-image-o'; $famime = 'file-image';
} elseif (preg_match('/\.svg$/i', $tmpfile)) { } elseif (preg_match('/\.svg$/i', $tmpfile)) {
$mime = 'image/svg+xml'; $mime = 'image/svg+xml';
$imgmime = 'image.png'; $imgmime = 'image.png';
$famime = 'file-image-o'; $famime = 'file-image';
} elseif (preg_match('/\.webp$/i', $tmpfile)) { } elseif (preg_match('/\.webp$/i', $tmpfile)) {
$mime = 'image/webp'; $mime = 'image/webp';
$imgmime = 'image.png'; $imgmime = 'image.png';
$famime = 'file-image-o'; $famime = 'file-image';
} elseif (preg_match('/\.vcs$/i', $tmpfile)) { // Calendar } elseif (preg_match('/\.vcs$/i', $tmpfile)) { // Calendar
$mime = 'text/calendar'; $mime = 'text/calendar';
$imgmime = 'other.png'; $imgmime = 'other.png';
$famime = 'file-text-o'; $famime = 'file-alt';
} elseif (preg_match('/\.ics$/i', $tmpfile)) { } elseif (preg_match('/\.ics$/i', $tmpfile)) {
$mime = 'text/calendar'; $mime = 'text/calendar';
$imgmime = 'other.png'; $imgmime = 'other.png';
$famime = 'file-text-o'; $famime = 'file-alt';
} elseif (preg_match('/\.torrent$/i', $tmpfile)) { // Other } elseif (preg_match('/\.torrent$/i', $tmpfile)) { // Other
$mime = 'application/x-bittorrent'; $mime = 'application/x-bittorrent';
$imgmime = 'other.png'; $imgmime = 'other.png';
@@ -11237,40 +11237,40 @@ function dol_mimetype($file, $default = 'application/octet-stream', $mode = 0)
} elseif (preg_match('/\.(mp3|ogg|au|wav|wma|mid)$/i', $tmpfile)) { // Audio } elseif (preg_match('/\.(mp3|ogg|au|wav|wma|mid)$/i', $tmpfile)) { // Audio
$mime = 'audio'; $mime = 'audio';
$imgmime = 'audio.png'; $imgmime = 'audio.png';
$famime = 'file-audio-o'; $famime = 'file-audio';
} elseif (preg_match('/\.mp4$/i', $tmpfile)) { // Video } elseif (preg_match('/\.mp4$/i', $tmpfile)) { // Video
$mime = 'video/mp4'; $mime = 'video/mp4';
$imgmime = 'video.png'; $imgmime = 'video.png';
$famime = 'file-video-o'; $famime = 'file-video';
} elseif (preg_match('/\.ogv$/i', $tmpfile)) { } elseif (preg_match('/\.ogv$/i', $tmpfile)) {
$mime = 'video/ogg'; $mime = 'video/ogg';
$imgmime = 'video.png'; $imgmime = 'video.png';
$famime = 'file-video-o'; $famime = 'file-video';
} elseif (preg_match('/\.webm$/i', $tmpfile)) { } elseif (preg_match('/\.webm$/i', $tmpfile)) {
$mime = 'video/webm'; $mime = 'video/webm';
$imgmime = 'video.png'; $imgmime = 'video.png';
$famime = 'file-video-o'; $famime = 'file-video';
} elseif (preg_match('/\.avi$/i', $tmpfile)) { } elseif (preg_match('/\.avi$/i', $tmpfile)) {
$mime = 'video/x-msvideo'; $mime = 'video/x-msvideo';
$imgmime = 'video.png'; $imgmime = 'video.png';
$famime = 'file-video-o'; $famime = 'file-video';
} elseif (preg_match('/\.divx$/i', $tmpfile)) { } elseif (preg_match('/\.divx$/i', $tmpfile)) {
$mime = 'video/divx'; $mime = 'video/divx';
$imgmime = 'video.png'; $imgmime = 'video.png';
$famime = 'file-video-o'; $famime = 'file-video';
} elseif (preg_match('/\.xvid$/i', $tmpfile)) { } elseif (preg_match('/\.xvid$/i', $tmpfile)) {
$mime = 'video/xvid'; $mime = 'video/xvid';
$imgmime = 'video.png'; $imgmime = 'video.png';
$famime = 'file-video-o'; $famime = 'file-video';
} elseif (preg_match('/\.(wmv|mpg|mpeg)$/i', $tmpfile)) { } elseif (preg_match('/\.(wmv|mpg|mpeg)$/i', $tmpfile)) {
$mime = 'video'; $mime = 'video';
$imgmime = 'video.png'; $imgmime = 'video.png';
$famime = 'file-video-o'; $famime = 'file-video';
} elseif (preg_match('/\.(zip|rar|gz|tgz|z|cab|bz2|7z|tar|lzh|zst)$/i', $tmpfile)) { // Archive } elseif (preg_match('/\.(zip|rar|gz|tgz|z|cab|bz2|7z|tar|lzh|zst)$/i', $tmpfile)) { // Archive
// application/xxx where zzz is zip, ... // application/xxx where zzz is zip, ...
$mime = 'archive'; $mime = 'archive';
$imgmime = 'archive.png'; $imgmime = 'archive.png';
$famime = 'file-archive-o'; $famime = 'file-archive';
} elseif (preg_match('/\.(exe|com)$/i', $tmpfile)) { // Exe } elseif (preg_match('/\.(exe|com)$/i', $tmpfile)) { // Exe
$mime = 'application/octet-stream'; $mime = 'application/octet-stream';
$imgmime = 'other.png'; $imgmime = 'other.png';
@@ -11282,7 +11282,7 @@ function dol_mimetype($file, $default = 'application/octet-stream', $mode = 0)
} elseif (preg_match('/\.err$/i', $tmpfile)) { // phpcs:ignore } elseif (preg_match('/\.err$/i', $tmpfile)) { // phpcs:ignore
$mime = 'error'; $mime = 'error';
$imgmime = 'error.png'; $imgmime = 'error.png';
$famime = 'file-text-o'; $famime = 'file-alt';
} }
// Return mimetype string // Return mimetype string