mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-08 10:38:15 +01:00
FIX Picto for mime
This commit is contained in:
@@ -11007,229 +11007,229 @@ function dol_mimetype($file, $default = 'application/octet-stream', $mode = 0)
|
||||
if (preg_match('/\.txt$/i', $tmpfile)) {
|
||||
$mime = 'text/plain';
|
||||
$imgmime = 'text.png';
|
||||
$famime = 'file-text-o';
|
||||
$famime = 'file-alt';
|
||||
} elseif (preg_match('/\.rtx$/i', $tmpfile)) {
|
||||
$mime = 'text/richtext';
|
||||
$imgmime = 'text.png';
|
||||
$famime = 'file-text-o';
|
||||
$famime = 'file-alt';
|
||||
} elseif (preg_match('/\.csv$/i', $tmpfile)) {
|
||||
$mime = 'text/csv';
|
||||
$imgmime = 'text.png';
|
||||
$famime = 'file-text-o';
|
||||
$famime = 'file-csv';
|
||||
} elseif (preg_match('/\.tsv$/i', $tmpfile)) {
|
||||
$mime = 'text/tab-separated-values';
|
||||
$imgmime = 'text.png';
|
||||
$famime = 'file-text-o';
|
||||
$famime = 'file-alt';
|
||||
} elseif (preg_match('/\.(cf|conf|log)$/i', $tmpfile)) {
|
||||
$mime = 'text/plain';
|
||||
$imgmime = 'text.png';
|
||||
$famime = 'file-text-o';
|
||||
$famime = 'file-alt';
|
||||
} elseif (preg_match('/\.ini$/i', $tmpfile)) {
|
||||
$mime = 'text/plain';
|
||||
$imgmime = 'text.png';
|
||||
$srclang = 'ini';
|
||||
$famime = 'file-text-o';
|
||||
$famime = 'file-alt';
|
||||
} elseif (preg_match('/\.md$/i', $tmpfile)) {
|
||||
$mime = 'text/plain';
|
||||
$imgmime = 'text.png';
|
||||
$srclang = 'md';
|
||||
$famime = 'file-text-o';
|
||||
$famime = 'file-alt';
|
||||
} elseif (preg_match('/\.css$/i', $tmpfile)) {
|
||||
$mime = 'text/css';
|
||||
$imgmime = 'css.png';
|
||||
$srclang = 'css';
|
||||
$famime = 'file-text-o';
|
||||
$famime = 'file-alt';
|
||||
} elseif (preg_match('/\.lang$/i', $tmpfile)) {
|
||||
$mime = 'text/plain';
|
||||
$imgmime = 'text.png';
|
||||
$srclang = 'lang';
|
||||
$famime = 'file-text-o';
|
||||
$famime = 'file-alt';
|
||||
} elseif (preg_match('/\.(crt|cer|key|pub)$/i', $tmpfile)) { // Certificate files
|
||||
$mime = 'text/plain';
|
||||
$imgmime = 'text.png';
|
||||
$famime = 'file-text-o';
|
||||
$famime = 'file-alt';
|
||||
} elseif (preg_match('/\.(html|htm|shtml)$/i', $tmpfile)) { // XML based (HTML/XML/XAML)
|
||||
$mime = 'text/html';
|
||||
$imgmime = 'html.png';
|
||||
$srclang = 'html';
|
||||
$famime = 'file-text-o';
|
||||
$famime = 'file-alt';
|
||||
} elseif (preg_match('/\.(xml|xhtml)$/i', $tmpfile)) {
|
||||
$mime = 'text/xml';
|
||||
$imgmime = 'other.png';
|
||||
$srclang = 'xml';
|
||||
$famime = 'file-text-o';
|
||||
$famime = 'file-alt';
|
||||
} elseif (preg_match('/\.xaml$/i', $tmpfile)) {
|
||||
$mime = 'text/xml';
|
||||
$imgmime = 'other.png';
|
||||
$srclang = 'xaml';
|
||||
$famime = 'file-text-o';
|
||||
$famime = 'file-alt';
|
||||
} elseif (preg_match('/\.bas$/i', $tmpfile)) { // Languages
|
||||
$mime = 'text/plain';
|
||||
$imgmime = 'text.png';
|
||||
$srclang = 'bas';
|
||||
$famime = 'file-code-o';
|
||||
$famime = 'file-code';
|
||||
} elseif (preg_match('/\.(c)$/i', $tmpfile)) {
|
||||
$mime = 'text/plain';
|
||||
$imgmime = 'text.png';
|
||||
$srclang = 'c';
|
||||
$famime = 'file-code-o';
|
||||
$famime = 'file-code';
|
||||
} elseif (preg_match('/\.(cpp)$/i', $tmpfile)) {
|
||||
$mime = 'text/plain';
|
||||
$imgmime = 'text.png';
|
||||
$srclang = 'cpp';
|
||||
$famime = 'file-code-o';
|
||||
$famime = 'file-code';
|
||||
} elseif (preg_match('/\.cs$/i', $tmpfile)) {
|
||||
$mime = 'text/plain';
|
||||
$imgmime = 'text.png';
|
||||
$srclang = 'cs';
|
||||
$famime = 'file-code-o';
|
||||
$famime = 'file-code';
|
||||
} elseif (preg_match('/\.(h)$/i', $tmpfile)) {
|
||||
$mime = 'text/plain';
|
||||
$imgmime = 'text.png';
|
||||
$srclang = 'h';
|
||||
$famime = 'file-code-o';
|
||||
$famime = 'file-code';
|
||||
} elseif (preg_match('/\.(java|jsp)$/i', $tmpfile)) {
|
||||
$mime = 'text/plain';
|
||||
$imgmime = 'text.png';
|
||||
$srclang = 'java';
|
||||
$famime = 'file-code-o';
|
||||
$famime = 'file-code';
|
||||
} elseif (preg_match('/\.php([0-9]{1})?$/i', $tmpfile)) {
|
||||
$mime = 'text/plain';
|
||||
$imgmime = 'php.png';
|
||||
$srclang = 'php';
|
||||
$famime = 'file-code-o';
|
||||
$famime = 'file-code';
|
||||
} elseif (preg_match('/\.phtml$/i', $tmpfile)) {
|
||||
$mime = 'text/plain';
|
||||
$imgmime = 'php.png';
|
||||
$srclang = 'php';
|
||||
$famime = 'file-code-o';
|
||||
$famime = 'file-code';
|
||||
} elseif (preg_match('/\.(pl|pm)$/i', $tmpfile)) {
|
||||
$mime = 'text/plain';
|
||||
$imgmime = 'pl.png';
|
||||
$srclang = 'perl';
|
||||
$famime = 'file-code-o';
|
||||
$famime = 'file-code';
|
||||
} elseif (preg_match('/\.sql$/i', $tmpfile)) {
|
||||
$mime = 'text/plain';
|
||||
$imgmime = 'text.png';
|
||||
$srclang = 'sql';
|
||||
$famime = 'file-code-o';
|
||||
$famime = 'file-code';
|
||||
} elseif (preg_match('/\.js$/i', $tmpfile)) {
|
||||
$mime = 'text/x-javascript';
|
||||
$imgmime = 'jscript.png';
|
||||
$srclang = 'js';
|
||||
$famime = 'file-code-o';
|
||||
$famime = 'file-code';
|
||||
} elseif (preg_match('/\.odp$/i', $tmpfile)) { // Open office
|
||||
$mime = 'application/vnd.oasis.opendocument.presentation';
|
||||
$imgmime = 'ooffice.png';
|
||||
$famime = 'file-powerpoint-o';
|
||||
$famime = 'file-powerpoint';
|
||||
} elseif (preg_match('/\.ods$/i', $tmpfile)) {
|
||||
$mime = 'application/vnd.oasis.opendocument.spreadsheet';
|
||||
$imgmime = 'ooffice.png';
|
||||
$famime = 'file-excel-o';
|
||||
$famime = 'file-excel';
|
||||
} elseif (preg_match('/\.odt$/i', $tmpfile)) {
|
||||
$mime = 'application/vnd.oasis.opendocument.text';
|
||||
$imgmime = 'ooffice.png';
|
||||
$famime = 'file-word-o';
|
||||
$famime = 'file-word';
|
||||
} elseif (preg_match('/\.mdb$/i', $tmpfile)) { // MS Office
|
||||
$mime = 'application/msaccess';
|
||||
$imgmime = 'mdb.png';
|
||||
$famime = 'file-o';
|
||||
$famime = 'file';
|
||||
} elseif (preg_match('/\.doc[xm]?$/i', $tmpfile)) {
|
||||
$mime = 'application/msword';
|
||||
$imgmime = 'doc.png';
|
||||
$famime = 'file-word-o';
|
||||
$famime = 'file-word';
|
||||
} elseif (preg_match('/\.dot[xm]?$/i', $tmpfile)) {
|
||||
$mime = 'application/msword';
|
||||
$imgmime = 'doc.png';
|
||||
$famime = 'file-word-o';
|
||||
$famime = 'file-word';
|
||||
} elseif (preg_match('/\.xlt(x)?$/i', $tmpfile)) {
|
||||
$mime = 'application/vnd.ms-excel';
|
||||
$imgmime = 'xls.png';
|
||||
$famime = 'file-excel-o';
|
||||
$famime = 'file-excel';
|
||||
} elseif (preg_match('/\.xla(m)?$/i', $tmpfile)) {
|
||||
$mime = 'application/vnd.ms-excel';
|
||||
$imgmime = 'xls.png';
|
||||
$famime = 'file-excel-o';
|
||||
$famime = 'file-excel';
|
||||
} elseif (preg_match('/\.xls$/i', $tmpfile)) {
|
||||
$mime = 'application/vnd.ms-excel';
|
||||
$imgmime = 'xls.png';
|
||||
$famime = 'file-excel-o';
|
||||
$famime = 'file-excel';
|
||||
} elseif (preg_match('/\.xls[bmx]$/i', $tmpfile)) {
|
||||
$mime = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
|
||||
$imgmime = 'xls.png';
|
||||
$famime = 'file-excel-o';
|
||||
$famime = 'file-excel';
|
||||
} elseif (preg_match('/\.pps[mx]?$/i', $tmpfile)) {
|
||||
$mime = 'application/vnd.ms-powerpoint';
|
||||
$imgmime = 'ppt.png';
|
||||
$famime = 'file-powerpoint-o';
|
||||
$famime = 'file-powerpoint';
|
||||
} elseif (preg_match('/\.ppt[mx]?$/i', $tmpfile)) {
|
||||
$mime = 'application/x-mspowerpoint';
|
||||
$imgmime = 'ppt.png';
|
||||
$famime = 'file-powerpoint-o';
|
||||
$famime = 'file-powerpoint';
|
||||
} elseif (preg_match('/\.pdf$/i', $tmpfile)) { // Other
|
||||
$mime = 'application/pdf';
|
||||
$imgmime = 'pdf.png';
|
||||
$famime = 'file-pdf-o';
|
||||
$famime = 'file-pdf';
|
||||
} elseif (preg_match('/\.bat$/i', $tmpfile)) { // Scripts
|
||||
$mime = 'text/x-bat';
|
||||
$imgmime = 'script.png';
|
||||
$srclang = 'dos';
|
||||
$famime = 'file-code-o';
|
||||
$famime = 'file-code';
|
||||
} elseif (preg_match('/\.sh$/i', $tmpfile)) {
|
||||
$mime = 'text/x-sh';
|
||||
$imgmime = 'script.png';
|
||||
$srclang = 'bash';
|
||||
$famime = 'file-code-o';
|
||||
$famime = 'file-code';
|
||||
} elseif (preg_match('/\.ksh$/i', $tmpfile)) {
|
||||
$mime = 'text/x-ksh';
|
||||
$imgmime = 'script.png';
|
||||
$srclang = 'bash';
|
||||
$famime = 'file-code-o';
|
||||
$famime = 'file-code';
|
||||
} elseif (preg_match('/\.bash$/i', $tmpfile)) {
|
||||
$mime = 'text/x-bash';
|
||||
$imgmime = 'script.png';
|
||||
$srclang = 'bash';
|
||||
$famime = 'file-code-o';
|
||||
$famime = 'file-code';
|
||||
} elseif (preg_match('/\.ico$/i', $tmpfile)) { // Images
|
||||
$mime = 'image/x-icon';
|
||||
$imgmime = 'image.png';
|
||||
$famime = 'file-image-o';
|
||||
$famime = 'file-image';
|
||||
} elseif (preg_match('/\.(jpg|jpeg)$/i', $tmpfile)) {
|
||||
$mime = 'image/jpeg';
|
||||
$imgmime = 'image.png';
|
||||
$famime = 'file-image-o';
|
||||
$famime = 'file-image';
|
||||
} elseif (preg_match('/\.png$/i', $tmpfile)) {
|
||||
$mime = 'image/png';
|
||||
$imgmime = 'image.png';
|
||||
$famime = 'file-image-o';
|
||||
$famime = 'file-image';
|
||||
} elseif (preg_match('/\.gif$/i', $tmpfile)) {
|
||||
$mime = 'image/gif';
|
||||
$imgmime = 'image.png';
|
||||
$famime = 'file-image-o';
|
||||
$famime = 'file-image';
|
||||
} elseif (preg_match('/\.bmp$/i', $tmpfile)) {
|
||||
$mime = 'image/bmp';
|
||||
$imgmime = 'image.png';
|
||||
$famime = 'file-image-o';
|
||||
$famime = 'file-image';
|
||||
} elseif (preg_match('/\.(tif|tiff)$/i', $tmpfile)) {
|
||||
$mime = 'image/tiff';
|
||||
$imgmime = 'image.png';
|
||||
$famime = 'file-image-o';
|
||||
$famime = 'file-image';
|
||||
} elseif (preg_match('/\.svg$/i', $tmpfile)) {
|
||||
$mime = 'image/svg+xml';
|
||||
$imgmime = 'image.png';
|
||||
$famime = 'file-image-o';
|
||||
$famime = 'file-image';
|
||||
} elseif (preg_match('/\.webp$/i', $tmpfile)) {
|
||||
$mime = 'image/webp';
|
||||
$imgmime = 'image.png';
|
||||
$famime = 'file-image-o';
|
||||
$famime = 'file-image';
|
||||
} elseif (preg_match('/\.vcs$/i', $tmpfile)) { // Calendar
|
||||
$mime = 'text/calendar';
|
||||
$imgmime = 'other.png';
|
||||
$famime = 'file-text-o';
|
||||
$famime = 'file-alt';
|
||||
} elseif (preg_match('/\.ics$/i', $tmpfile)) {
|
||||
$mime = 'text/calendar';
|
||||
$imgmime = 'other.png';
|
||||
$famime = 'file-text-o';
|
||||
$famime = 'file-alt';
|
||||
} elseif (preg_match('/\.torrent$/i', $tmpfile)) { // Other
|
||||
$mime = 'application/x-bittorrent';
|
||||
$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
|
||||
$mime = 'audio';
|
||||
$imgmime = 'audio.png';
|
||||
$famime = 'file-audio-o';
|
||||
$famime = 'file-audio';
|
||||
} elseif (preg_match('/\.mp4$/i', $tmpfile)) { // Video
|
||||
$mime = 'video/mp4';
|
||||
$imgmime = 'video.png';
|
||||
$famime = 'file-video-o';
|
||||
$famime = 'file-video';
|
||||
} elseif (preg_match('/\.ogv$/i', $tmpfile)) {
|
||||
$mime = 'video/ogg';
|
||||
$imgmime = 'video.png';
|
||||
$famime = 'file-video-o';
|
||||
$famime = 'file-video';
|
||||
} elseif (preg_match('/\.webm$/i', $tmpfile)) {
|
||||
$mime = 'video/webm';
|
||||
$imgmime = 'video.png';
|
||||
$famime = 'file-video-o';
|
||||
$famime = 'file-video';
|
||||
} elseif (preg_match('/\.avi$/i', $tmpfile)) {
|
||||
$mime = 'video/x-msvideo';
|
||||
$imgmime = 'video.png';
|
||||
$famime = 'file-video-o';
|
||||
$famime = 'file-video';
|
||||
} elseif (preg_match('/\.divx$/i', $tmpfile)) {
|
||||
$mime = 'video/divx';
|
||||
$imgmime = 'video.png';
|
||||
$famime = 'file-video-o';
|
||||
$famime = 'file-video';
|
||||
} elseif (preg_match('/\.xvid$/i', $tmpfile)) {
|
||||
$mime = 'video/xvid';
|
||||
$imgmime = 'video.png';
|
||||
$famime = 'file-video-o';
|
||||
$famime = 'file-video';
|
||||
} elseif (preg_match('/\.(wmv|mpg|mpeg)$/i', $tmpfile)) {
|
||||
$mime = 'video';
|
||||
$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
|
||||
// application/xxx where zzz is zip, ...
|
||||
$mime = 'archive';
|
||||
$imgmime = 'archive.png';
|
||||
$famime = 'file-archive-o';
|
||||
$famime = 'file-archive';
|
||||
} elseif (preg_match('/\.(exe|com)$/i', $tmpfile)) { // Exe
|
||||
$mime = 'application/octet-stream';
|
||||
$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
|
||||
$mime = 'error';
|
||||
$imgmime = 'error.png';
|
||||
$famime = 'file-text-o';
|
||||
$famime = 'file-alt';
|
||||
}
|
||||
|
||||
// Return mimetype string
|
||||
|
||||
Reference in New Issue
Block a user