]> git.mjollnir.org Git - moodle.git/commitdiff
If the uploaded file is HTML, then put it through the filters
authormoodler <moodler>
Tue, 9 Mar 2004 06:28:01 +0000 (06:28 +0000)
committermoodler <moodler>
Tue, 9 Mar 2004 06:28:01 +0000 (06:28 +0000)
file.php

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