MediaFile loses dependency on PEAR::MIME
At the same time we remove the "filecommand" setting, since we will likely not have use of it thanks to PECL fileinfo. Also the "supported" list for attachment mime types has changed format, so we can keep track of at least some known file extensions.
This commit is contained in:
25
lib/util.php
25
lib/util.php
@@ -1797,6 +1797,31 @@ function common_accept_to_prefs($accept, $def = '*/*')
|
||||
return $prefs;
|
||||
}
|
||||
|
||||
// Match by our supported file extensions
|
||||
function common_supported_ext_to_mime($fileext)
|
||||
{
|
||||
// Accept a filename and take out the extension
|
||||
if (strpos($fileext, '.') !== false) {
|
||||
$fileext = substr(strrchr($fileext, '.'), 1);
|
||||
}
|
||||
|
||||
$supported = common_config('attachments', 'supported');
|
||||
foreach($supported as $type => $ext) {
|
||||
if ($ext === $fileext) {
|
||||
return $type;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// The MIME "media" is the part before the slash (video in video/webm)
|
||||
function common_get_mime_media($type)
|
||||
{
|
||||
$tmp = explode('/', $type);
|
||||
return strtolower($tmp[0]);
|
||||
}
|
||||
|
||||
function common_mime_type_match($type, $avail)
|
||||
{
|
||||
if(array_key_exists($type, $avail)) {
|
||||
|
Reference in New Issue
Block a user