From: moodler <moodler>
Date: Mon, 26 May 2003 14:43:19 +0000 (+0000)
Subject: A few tweaks for robustness.
X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=3662bce5b4785509410ac1c39d913c7604db8e87;p=moodle.git

A few tweaks for robustness.
---

diff --git a/lib/weblib.php b/lib/weblib.php
index ac2130b9f8..068356ef69 100644
--- a/lib/weblib.php
+++ b/lib/weblib.php
@@ -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\"";