mirror of
https://github.com/moodle/moodle.git
synced 2025-07-16 03:46:30 +02:00
If the uploaded file is HTML, then put it through the filters
This commit is contained in:
5
file.php
5
file.php
@ -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");
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user