From 43ea696c770d53023fb7c4fd4d89a8fc1ac4b99b Mon Sep 17 00:00:00 2001 From: stronk7 Date: Sat, 10 Sep 2005 10:59:19 +0000 Subject: [PATCH] Now both p() and s() respect html entities. --- lib/weblib.php | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/lib/weblib.php b/lib/weblib.php index 801d532e455f6..13f2beeae6452 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -101,7 +101,7 @@ function s($var) { if ($var == '0') { // for integer 0, boolean false, string '0' return '0'; } - return htmlSpecialChars(stripslashes_safe($var)); + return preg_replace("/&(\w+|#\d+);/i", "&$1;", htmlspecialchars(stripslashes_safe($var))); } /** @@ -114,11 +114,7 @@ function s($var) { * @return string */ function p($var) { - if ($var == '0') { // for integer 0, boolean false, string '0' - echo '0'; - } else { - echo htmlSpecialChars(stripslashes_safe($var)); - } + echo s($var); }