If the uploaded file is HTML, then put it through the filters

This commit is contained in:
moodler 2004-03-09 06:28:01 +00:00
parent e359234d0f
commit f05070115c

View File

@ -49,7 +49,12 @@
header("Content-disposition: inline; filename=$filename"); header("Content-disposition: inline; filename=$filename");
header("Content-length: ".filesize($pathname)); header("Content-length: ".filesize($pathname));
header("Content-type: $mimetype"); header("Content-type: $mimetype");
if ($mimetype == "text/html") {
echo format_text(implode('', file($pathname)), FORMAT_HTML); // Filter HTML files
} else {
readfile("$pathname"); readfile("$pathname");
}
} else { } else {
error("Sorry, but the file you are looking for was not found ($pathname)", "course/view.php?id=$courseid"); error("Sorry, but the file you are looking for was not found ($pathname)", "course/view.php?id=$courseid");
} }