From 3662bce5b4785509410ac1c39d913c7604db8e87 Mon Sep 17 00:00:00 2001 From: moodler Date: Mon, 26 May 2003 14:43:19 +0000 Subject: [PATCH] A few tweaks for robustness. --- lib/weblib.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) 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 = "


      /// 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 = "\n$meta\n"; } - if ($CFG->langdir == "RTL") { + if (!empty($CFG->langdir) and $CFG->langdir == "RTL") { $direction = " dir=\"rtl\""; } else { $direction = " dir=\"ltr\""; -- 2.39.5