Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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

…y tags etc
  • Loading branch information...
commit b7a3cf49f8175dc51b745c9891092f99baab9643 1 parent a69023c
martin authored
Showing with 10 additions and 2 deletions.
  1. +10 −2 lib/weblib.php
View
12 lib/weblib.php
@@ -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);
Please sign in to comment.
Something went wrong with that request. Please try again.