]> git.mjollnir.org Git - moodle.git/commitdiff
Fixes for detect_munged_arguments() and default values for p() s() etc
authormoodler <moodler>
Mon, 12 May 2003 06:35:32 +0000 (06:35 +0000)
committermoodler <moodler>
Mon, 12 May 2003 06:35:32 +0000 (06:35 +0000)
lib/weblib.php

index 7ccc02108794c740f2273ed10165c049ec4153cc..7f46217f780f04772064fad40d9ce81174192c88 100644 (file)
@@ -46,13 +46,13 @@ $ALLOWED_TAGS = "<p><br><b><i><u><font><table><tbody><span><div><tr><td><ol><ul>
 
 /// Functions
 
-function s($var) {
+function s($var="") {
 /// returns $var with HTML characters (like "<", ">", etc.) properly quoted,
 
     return htmlSpecialChars(stripslashes_safe($var));
 }
 
-function p($var) {
+function p($var="") {
 /// prints $var with HTML characters (like "<", ">", etc.) properly quoted,
 
     echo htmlSpecialChars(stripslashes_safe($var));
@@ -379,13 +379,10 @@ function validate_email ($address) {
 }
 
 function detect_munged_arguments($string) {
-    if (ereg("\.\.", $string)) { // check for parent URLs
+    if (ereg('\.\.', $string)) { // check for parent URLs
         return true;
     }
-    if (ereg("\|", $string)) {  // check for pipes
-        return true;
-    }
-    if (ereg("\'", $string)) {  // check for backquotes
+    if (ereg('[\|\`]', $string)) {  // check for other bad characters
         return true;
     }
     return false;