]> git.mjollnir.org Git - moodle.git/commitdiff
"REPOSITORY/MDL-13766, use default icon for unknow file type"
authordongsheng <dongsheng>
Thu, 15 Jan 2009 06:53:40 +0000 (06:53 +0000)
committerdongsheng <dongsheng>
Thu, 15 Jan 2009 06:53:40 +0000 (06:53 +0000)
lib/filelib.php

index 24e01d9a592576a5df4de7e33123bb15db4cb912..51fabe4c85973bbc165acf54d4cfdc3fe6ca4d85 100644 (file)
@@ -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;