mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-05-11 20:21:16 +00:00
fix getMimetype()
This commit is contained in:
parent
08d10d2cc0
commit
83770f7521
|
@ -407,20 +407,20 @@ function getFilenameByDocname($content) { /* {{{ */
|
|||
* @return string mimetype
|
||||
*/
|
||||
function getMimeType($filename) { /* {{{ */
|
||||
$finfo = finfo_open(FILEINFO_MIME_TYPE);
|
||||
$mimetype = finfo_file($finfo, $filename);
|
||||
$finfo = finfo_open(FILEINFO_MIME_TYPE);
|
||||
$mimetype = finfo_file($finfo, $filename);
|
||||
|
||||
switch($mimetype) {
|
||||
case 'application/octet-stream':
|
||||
case 'text/plain':
|
||||
$lastDotIndex = strrpos($filename, ".");
|
||||
if($lastDotIndex === false) $fileType = ".";
|
||||
else $fileType = substr($name, $lastDotIndex);
|
||||
if($fileType == '.md')
|
||||
$mimetype = 'text/markdown';
|
||||
break;
|
||||
}
|
||||
return $mimetype;
|
||||
switch($mimetype) {
|
||||
case 'application/octet-stream':
|
||||
case 'text/plain':
|
||||
$lastDotIndex = strrpos($filename, ".");
|
||||
if($lastDotIndex === false) $fileType = ".";
|
||||
else $fileType = substr($filename, $lastDotIndex);
|
||||
if($fileType == '.md')
|
||||
$mimetype = 'text/markdown';
|
||||
break;
|
||||
}
|
||||
return $mimetype;
|
||||
} /* }}} */
|
||||
|
||||
function getLogger($prefix='', $mask=PEAR_LOG_INFO) { /* {{{ */
|
||||
|
|
Loading…
Reference in New Issue
Block a user