-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #152 from untrobotics/URW-170-AdminBot-Update-Send…
…Messages URW-170 Update Discord bot Send_Messages functionality
- Loading branch information
Showing
2 changed files
with
163 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,128 @@ | ||
<?php | ||
const MIMES = array( | ||
"png"=>array("image/png","image/x-png"), | ||
"bmp"=>array("image/bmp","image/x-bmp","image/x-bitmap","image/x-xbitmap","image/x-win-bitmap","image/x-windows-bmp","image/ms-bmp","image/x-ms-bmp","application/bmp","application/x-bmp","application/x-win-bitmap"), | ||
"gif"=>array("image/gif"), | ||
"jpeg"=>array("image/jpeg","image/pjpeg"), | ||
"jpg"=>array("image/jpg","image/pjpg"), | ||
"xspf"=>array("application/xspf+xml"), | ||
"vlc"=>array("application/videolan"), | ||
"wmv"=>array("video/x-ms-wmv","video/x-ms-asf"), | ||
"au"=>array("audio/x-au"), | ||
"ac3"=>array("audio/ac3"), | ||
"flac"=>array("audio/x-flac"), | ||
"ogg"=>array("audio/ogg","video/ogg","application/ogg"), | ||
"kmz"=>array("application/vnd.google-earth.kmz"), | ||
"kml"=>array("application/vnd.google-earth.kml+xml"), | ||
"rtx"=>array("text/richtext"), | ||
"rtf"=>array("text/rtf"), | ||
"jar"=>array("application/java-archive","application/x-java-application","application/x-jar"), | ||
"zip"=>array("application/x-zip","application/zip","application/x-zip-compressed","application/s-compressed","multipart/x-zip"), | ||
"7zip"=>array("application/x-compressed"), | ||
"xml"=>array("application/xml","text/xml"), | ||
"svg"=>array("image/svg+xml"), | ||
"3g2"=>array("video/3gpp2"), | ||
"3gp"=>array("video/3gp","video/3gpp"), | ||
"mp4"=>array("video/mp4"), | ||
"m4a"=>array("audio/x-m4a"), | ||
"f4v"=>array("video/x-f4v"), | ||
"flv"=>array("video/x-flv"), | ||
"webm"=>array("video/webm"), | ||
"aac"=>array("audio/x-acc"), | ||
"m4u"=>array("application/vnd.mpegurl"), | ||
"pdf"=>array("application/pdf","application/octet-stream"), | ||
"pptx"=>array("application/vnd.openxmlformats-officedocument.presentationml.presentation"), | ||
"ppt"=>array("application/powerpoint","application/vnd.ms-powerpoint","application/vnd.ms-office","application/msword"), | ||
"docx"=>array("application/vnd.openxmlformats-officedocument.wordprocessingml.document"), | ||
"xlsx"=>array("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.ms-excel"), | ||
"xl"=>array("application/excel"), | ||
"xls"=>array("application/msexcel","application/x-msexcel","application/x-ms-excel","application/x-excel","application/x-dos_ms_excel","application/xls","application/x-xls"), | ||
"xsl"=>array("text/xsl"), | ||
"mpeg"=>array("video/mpeg"), | ||
"mov"=>array("video/quicktime"), | ||
"avi"=>array("video/x-msvideo","video/msvideo","video/avi","application/x-troff-msvideo"), | ||
"movie"=>array("video/x-sgi-movie"), | ||
"log"=>array("text/x-log"), | ||
"txt"=>array("text/plain"), | ||
"css"=>array("text/css"), | ||
"html"=>array("text/html"), | ||
"wav"=>array("audio/x-wav","audio/wave","audio/wav"), | ||
"xhtml"=>array("application/xhtml+xml"), | ||
"tar"=>array("application/x-tar"), | ||
"tgz"=>array("application/x-gzip-compressed"), | ||
"psd"=>array("application/x-photoshop","image/vnd.adobe.photoshop"), | ||
"exe"=>array("application/x-msdownload"), | ||
"js"=>array("application/x-javascript"), | ||
"mp3"=>array("audio/mpeg","audio/mpg","audio/mpeg3","audio/mp3"), | ||
"rar"=>array("application/x-rar","application/rar","application/x-rar-compressed"), | ||
"gzip"=>array("application/x-gzip"), | ||
"hqx"=>array("application/mac-binhex40","application/mac-binhex","application/x-binhex40","application/x-mac-binhex40"), | ||
"cpt"=>array("application/mac-compactpro"), | ||
"bin"=>array("application/macbinary","application/mac-binary","application/x-binary","application/x-macbinary"), | ||
"oda"=>array("application/oda"), | ||
"ai"=>array("application/postscript"), | ||
"smil"=>array("application/smil"), | ||
"mif"=>array("application/vnd.mif"), | ||
"wbxml"=>array("application/wbxml"), | ||
"wmlc"=>array("application/wmlc"), | ||
"dcr"=>array("application/x-director"), | ||
"dvi"=>array("application/x-dvi"), | ||
"gtar"=>array("application/x-gtar"), | ||
"php"=>array("application/x-httpd-php","application/php","application/x-php","text/php","text/x-php","application/x-httpd-php-source"), | ||
"swf"=>array("application/x-shockwave-flash"), | ||
"sit"=>array("application/x-stuffit"), | ||
"z"=>array("application/x-compress"), | ||
"mid"=>array("audio/midi"), | ||
"aif"=>array("audio/x-aiff","audio/aiff"), | ||
"ram"=>array("audio/x-pn-realaudio"), | ||
"rpm"=>array("audio/x-pn-realaudio-plugin"), | ||
"ra"=>array("audio/x-realaudio"), | ||
"rv"=>array("video/vnd.rn-realvideo"), | ||
"jp2"=>array("image/jp2","video/mj2","image/jpx","image/jpm"), | ||
"tiff"=>array("image/tiff"), | ||
"eml"=>array("message/rfc822"), | ||
"pem"=>array("application/x-x509-user-cert","application/x-pem-file"), | ||
"p10"=>array("application/x-pkcs10","application/pkcs10"), | ||
"p12"=>array("application/x-pkcs12"), | ||
"p7a"=>array("application/x-pkcs7-signature"), | ||
"p7c"=>array("application/pkcs7-mime","application/x-pkcs7-mime"), | ||
"p7r"=>array("application/x-pkcs7-certreqresp"), | ||
"p7s"=>array("application/pkcs7-signature"), | ||
"crt"=>array("application/x-x509-ca-cert","application/pkix-cert"), | ||
"crl"=>array("application/pkix-crl","application/pkcs-crl"), | ||
"pgp"=>array("application/pgp"), | ||
"gpg"=>array("application/gpg-keys"), | ||
"rsa"=>array("application/x-pkcs7"), | ||
"ics"=>array("text/calendar"), | ||
"zsh"=>array("text/x-scriptzsh"), | ||
"cdr"=>array("application/cdr","application/coreldraw","application/x-cdr","application/x-coreldraw","image/cdr","image/x-cdr","zz-application/zz-winassoc-cdr"), | ||
"wma"=>array("audio/x-ms-wma"), | ||
"vcf"=>array("text/x-vcard"), | ||
"srt"=>array("text/srt"), | ||
"vtt"=>array("text/vtt"), | ||
"ico"=>array("image/x-icon","image/x-ico","image/vnd.microsoft.icon"), | ||
"csv"=>array("text/x-comma-separated-values","text/comma-separated-values","application/vnd.msexcel"), | ||
"json"=>array("application/json","text/json") | ||
); | ||
function mime2ext($mime){ | ||
$all_mimes = '{"png":["image\/png","image\/x-png"],"bmp":["image\/bmp","image\/x-bmp","image\/x-bitmap","image\/x-xbitmap","image\/x-win-bitmap","image\/x-windows-bmp","image\/ms-bmp","image\/x-ms-bmp","application\/bmp","application\/x-bmp","application\/x-win-bitmap"],"gif":["image\/gif"],"jpeg":["image\/jpeg","image\/pjpeg"],"xspf":["application\/xspf+xml"],"vlc":["application\/videolan"],"wmv":["video\/x-ms-wmv","video\/x-ms-asf"],"au":["audio\/x-au"],"ac3":["audio\/ac3"],"flac":["audio\/x-flac"],"ogg":["audio\/ogg","video\/ogg","application\/ogg"],"kmz":["application\/vnd.google-earth.kmz"],"kml":["application\/vnd.google-earth.kml+xml"],"rtx":["text\/richtext"],"rtf":["text\/rtf"],"jar":["application\/java-archive","application\/x-java-application","application\/x-jar"],"zip":["application\/x-zip","application\/zip","application\/x-zip-compressed","application\/s-compressed","multipart\/x-zip"],"7zip":["application\/x-compressed"],"xml":["application\/xml","text\/xml"],"svg":["image\/svg+xml"],"3g2":["video\/3gpp2"],"3gp":["video\/3gp","video\/3gpp"],"mp4":["video\/mp4"],"m4a":["audio\/x-m4a"],"f4v":["video\/x-f4v"],"flv":["video\/x-flv"],"webm":["video\/webm"],"aac":["audio\/x-acc"],"m4u":["application\/vnd.mpegurl"],"pdf":["application\/pdf","application\/octet-stream"],"pptx":["application\/vnd.openxmlformats-officedocument.presentationml.presentation"],"ppt":["application\/powerpoint","application\/vnd.ms-powerpoint","application\/vnd.ms-office","application\/msword"],"docx":["application\/vnd.openxmlformats-officedocument.wordprocessingml.document"],"xlsx":["application\/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application\/vnd.ms-excel"],"xl":["application\/excel"],"xls":["application\/msexcel","application\/x-msexcel","application\/x-ms-excel","application\/x-excel","application\/x-dos_ms_excel","application\/xls","application\/x-xls"],"xsl":["text\/xsl"],"mpeg":["video\/mpeg"],"mov":["video\/quicktime"],"avi":["video\/x-msvideo","video\/msvideo","video\/avi","application\/x-troff-msvideo"],"movie":["video\/x-sgi-movie"],"log":["text\/x-log"],"txt":["text\/plain"],"css":["text\/css"],"html":["text\/html"],"wav":["audio\/x-wav","audio\/wave","audio\/wav"],"xhtml":["application\/xhtml+xml"],"tar":["application\/x-tar"],"tgz":["application\/x-gzip-compressed"],"psd":["application\/x-photoshop","image\/vnd.adobe.photoshop"],"exe":["application\/x-msdownload"],"js":["application\/x-javascript"],"mp3":["audio\/mpeg","audio\/mpg","audio\/mpeg3","audio\/mp3"],"rar":["application\/x-rar","application\/rar","application\/x-rar-compressed"],"gzip":["application\/x-gzip"],"hqx":["application\/mac-binhex40","application\/mac-binhex","application\/x-binhex40","application\/x-mac-binhex40"],"cpt":["application\/mac-compactpro"],"bin":["application\/macbinary","application\/mac-binary","application\/x-binary","application\/x-macbinary"],"oda":["application\/oda"],"ai":["application\/postscript"],"smil":["application\/smil"],"mif":["application\/vnd.mif"],"wbxml":["application\/wbxml"],"wmlc":["application\/wmlc"],"dcr":["application\/x-director"],"dvi":["application\/x-dvi"],"gtar":["application\/x-gtar"],"php":["application\/x-httpd-php","application\/php","application\/x-php","text\/php","text\/x-php","application\/x-httpd-php-source"],"swf":["application\/x-shockwave-flash"],"sit":["application\/x-stuffit"],"z":["application\/x-compress"],"mid":["audio\/midi"],"aif":["audio\/x-aiff","audio\/aiff"],"ram":["audio\/x-pn-realaudio"],"rpm":["audio\/x-pn-realaudio-plugin"],"ra":["audio\/x-realaudio"],"rv":["video\/vnd.rn-realvideo"],"jp2":["image\/jp2","video\/mj2","image\/jpx","image\/jpm"],"tiff":["image\/tiff"],"eml":["message\/rfc822"],"pem":["application\/x-x509-user-cert","application\/x-pem-file"],"p10":["application\/x-pkcs10","application\/pkcs10"],"p12":["application\/x-pkcs12"],"p7a":["application\/x-pkcs7-signature"],"p7c":["application\/pkcs7-mime","application\/x-pkcs7-mime"],"p7r":["application\/x-pkcs7-certreqresp"],"p7s":["application\/pkcs7-signature"],"crt":["application\/x-x509-ca-cert","application\/pkix-cert"],"crl":["application\/pkix-crl","application\/pkcs-crl"],"pgp":["application\/pgp"],"gpg":["application\/gpg-keys"],"rsa":["application\/x-pkcs7"],"ics":["text\/calendar"],"zsh":["text\/x-scriptzsh"],"cdr":["application\/cdr","application\/coreldraw","application\/x-cdr","application\/x-coreldraw","image\/cdr","image\/x-cdr","zz-application\/zz-winassoc-cdr"],"wma":["audio\/x-ms-wma"],"vcf":["text\/x-vcard"],"srt":["text\/srt"],"vtt":["text\/vtt"],"ico":["image\/x-icon","image\/x-ico","image\/vnd.microsoft.icon"],"csv":["text\/x-comma-separated-values","text\/comma-separated-values","application\/vnd.msexcel"],"json":["application\/json","text\/json"]}'; | ||
$all_mimes = json_decode($all_mimes,true); | ||
foreach ($all_mimes as $key => $value) { | ||
foreach (MIMES as $key => $value) { | ||
if(array_search($mime,$value) !== false) { | ||
return $key; | ||
} | ||
} | ||
return false; | ||
} | ||
|
||
function ext2mime($ext) | ||
{ | ||
global $mimes; | ||
foreach(MIMES as $key=>$value) | ||
{ | ||
if($key===$ext) | ||
{ | ||
return $value[0]; | ||
} | ||
} | ||
return false; | ||
} | ||
?> |