Browse files

Now both p() and s() respect html entities.

(and some unmerged silent headers)

Merged from MOODLE_15_STABLE
  • Loading branch information...
1 parent b4d6179 commit df8d3e66f48c57f25f0c53bbdb30bc6f91273502 stronk7 committed Sep 10, 2005
Showing with 3 additions and 7 deletions.
  1. +3 −7 lib/weblib.php
View
10 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);
}
@@ -3718,7 +3714,7 @@ function print_scale_menu_helpbutton($courseid, $scale) {
function error ($message, $link='') {
global $CFG, $SESSION;
- header('HTTP/1.0 404 Not Found');
+ @header('HTTP/1.0 404 Not Found');
print_header(get_string('error'));
echo '<br />';

0 comments on commit df8d3e6

Please sign in to comment.