From 95bfd2078b0cff1e6994d3da44ae10e7d17c402b Mon Sep 17 00:00:00 2001 From: skodak Date: Mon, 4 Jul 2005 20:23:53 +0000 Subject: [PATCH] merged from MOODLE_15_STABLE --- lib/moodlelib.php | 5 +++++ lib/weblib.php | 3 --- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/moodlelib.php b/lib/moodlelib.php index 339f4ce8d46..1933d7dd475 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -109,6 +109,7 @@ define('PARAM_ALPHANUM', 0x0400); //numbers or letters only define('PARAM_BOOL', 0x0800); //convert to value 1 or 0 using empty() define('PARAM_CLEANHTML',0x1000); //actual HTML code that you want cleaned and slashes removed define('PARAM_ALPHAEXT', 0x2000); // PARAM_ALPHA plus the chars in quotes: "/-_" allowed +define('PARAM_SAFEDIR', 0x4000); // safe directory name, suitable for include() and require() /** * Definition of page types @@ -237,6 +238,10 @@ function clean_param($param, $options) { $param = strip_tags($param); } + if ($options & PARAM_SAFEDIR) { // Remove everything not a-zA-Z0-9_- + $param = eregi_replace('[^a-zA-Z0-9_-]', '', $param); + } + if ($options & PARAM_CLEANFILE) { // allow only safe characters $param = clean_filename($param); } diff --git a/lib/weblib.php b/lib/weblib.php index 35f7627fa0a..801e0ce5fc5 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -2973,9 +2973,6 @@ function print_textarea($usehtmleditor, $rows, $cols, $width, $height, $name, $v if ($usehtmleditor) { - // cleanup bad html that may have made it to the db - $value = clean_text($value); - if (!empty($courseid) and isteacher($courseid)) { echo ($scriptcount < 1) ? ''."\n" : ''; } else {