From: dongsheng Date: Thu, 15 Jan 2009 06:53:40 +0000 (+0000) Subject: "REPOSITORY/MDL-13766, use default icon for unknow file type" X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=72aa74ce7cbff1048c9ecb00471d402977c6acbc;p=moodle.git "REPOSITORY/MDL-13766, use default icon for unknow file type" --- diff --git a/lib/filelib.php b/lib/filelib.php index 24e01d9a59..51fabe4c85 100644 --- a/lib/filelib.php +++ b/lib/filelib.php @@ -675,8 +675,12 @@ function mimeinfo($element, $filename) { if (isset($mimeinfo[strtolower($match[1])][$element])) { return $mimeinfo[strtolower($match[1])][$element]; } else { - if ($element == 'icon32' and isset($mimeinfo[strtolower($match[1])]['icon'])) { - $filename = substr($mimeinfo[strtolower($match[1])]['icon'], 0, -4); + if ($element == 'icon32') { + if (isset($mimeinfo[strtolower($match[1])]['icon'])) { + $filename = substr($mimeinfo[strtolower($match[1])]['icon'], 0, -4); + } else { + $filename = 'unknown'; + } $filename .= '-32.png'; if (file_exists($CFG->dirroot.'/pix/f/'.$filename)) { return $filename;