\n"; $link = "$folder/$f"; $target = "_BLANK"; $isdir = false; $icon = "fas fa-file"; if (is_dir($fullpath . "/" . $f)) { $isdir = true; $link = "app.php?page=files&path=$folder/$f"; $icon = "fas fa-folder"; $target = ""; } else { $link = "public/file.php?file=$folder/$f"; $extension = pathinfo($fullpath . "/" . $f)['extension']; // If we don't have an extension, try using the whole filename if ($extension == "") { $extension = $f; } $mimetype = "application/octet-stream"; // Lookup mimetype from extension if (array_key_exists($extension, $EXT2MIME)) { $mimetype = $EXT2MIME[$extension]; } // Lookup icon from mimetype if (array_key_exists($mimetype, $MIMEICONS)) { $icon = $MIMEICONS[$mimetype]; } else { // Allow broad generic /other icons $mimefirst = explode("/", $mimetype, 2)[0]; if (array_key_exists($mimefirst . "/other", $MIMEICONS)) { $icon = $MIMEICONS[$mimetype]; } } } echo "\t"; echo " "; echo $f . "\n
\n"; } } ?>