Permalink
Browse files

Added cleantext function, used for cleaning user-entered text of nast…

…y tags etc
  • Loading branch information...
martin
martin committed Mar 26, 2002
1 parent a69023c commit b7a3cf49f8175dc51b745c9891092f99baab9643
Showing with 10 additions and 2 deletions.
  1. +10 −2 lib/weblib.php
View
@@ -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);

0 comments on commit b7a3cf4

Please sign in to comment.