]> git.mjollnir.org Git - moodle.git/commitdiff
A few tweaks for robustness.
authormoodler <moodler>
Mon, 26 May 2003 14:43:19 +0000 (14:43 +0000)
committermoodler <moodler>
Mon, 26 May 2003 14:43:19 +0000 (14:43 +0000)
lib/weblib.php

index ac2130b9f8446c109f0ecdc2c36efb69174dbcb1..068356ef69108e5a7068c7d66f7e9f4b9223a5a5 100644 (file)
@@ -46,15 +46,21 @@ $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,
 
+    if (empty($var)) {
+        return "";
+    }
     return htmlSpecialChars(stripslashes_safe($var));
 }
 
-function p($var="") {
+function p($var) {
 /// prints $var with HTML characters (like "<", ">", etc.) properly quoted,
 
+    if (empty($var)) {
+        echo "";
+    }
     echo htmlSpecialChars(stripslashes_safe($var));
 }
 
@@ -679,7 +685,7 @@ function print_header ($title="", $heading="", $navigation="", $focus="", $meta=
         $meta = "<meta http-equiv=\"content-type\" content=\"text/html; charset=".get_string("thischarset")."\">\n$meta\n";
     }
 
-    if ($CFG->langdir == "RTL") {
+    if (!empty($CFG->langdir) and $CFG->langdir == "RTL") {
         $direction = " dir=\"rtl\"";
     } else {
         $direction = " dir=\"ltr\"";