]> git.mjollnir.org Git - moodle.git/commitdiff
Added cleantext function, used for cleaning user-entered text of nasty tags etc
authormartin <martin>
Tue, 26 Mar 2002 12:58:54 +0000 (12:58 +0000)
committermartin <martin>
Tue, 26 Mar 2002 12:58:54 +0000 (12:58 +0000)
lib/weblib.php

index 10e1d7ce3e94efe2d74f72af2009ab78c01bf233..56590eb25b4af427f50e7cef7fdbc7f26b76590d 100644 (file)
@@ -256,11 +256,19 @@ function get_slash_arguments($i=0) {
 }
 
 
-function text_to_html($text) {
-    global $CFG;
+function cleantext($text) {
+// Given raw text (eg typed in by a user), this function cleans it up 
+// and removes any nasty tags that could mess up Moodle pages.
+
+    return strip_tags($text, '<b><i><u><font>');
+}
 
+
+function text_to_html($text) {
 // Given plain text, makes it into HTML as nicely as possible.
 
+    global $CFG;
+
     // Make URLs into links.   eg http://moodle.com/
     $text = eregi_replace("([[:alnum:]]+)://([^[:space:]]*)([[:alnum:]#?/&=])", 
                           "<A HREF=\"\\1://\\2\\3\" TARGET=\"newpage\">\\1://\\2\\3</A>", $text);