From b7a3cf49f8175dc51b745c9891092f99baab9643 Mon Sep 17 00:00:00 2001 From: martin Date: Tue, 26 Mar 2002 12:58:54 +0000 Subject: [PATCH] Added cleantext function, used for cleaning user-entered text of nasty tags etc --- lib/weblib.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/weblib.php b/lib/weblib.php index 10e1d7ce3e..56590eb25b 100644 --- a/lib/weblib.php +++ b/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, ''); +} + +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:]#?/&=])", "\\1://\\2\\3", $text); -- 2.39.5