From: moodler <moodler>
Date: Tue, 9 Mar 2004 06:28:01 +0000 (+0000)
Subject: If the uploaded file is HTML, then put it through the filters
X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=f05070115cfbd0ee59d4f7b43c8b4d2e96b75265;p=moodle.git

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

diff --git a/file.php b/file.php
index 97052b04e1..6319b44075 100644
--- a/file.php
+++ b/file.php
@@ -49,7 +49,12 @@
         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");
     }