fixed s() p() for values false, number 0, and string '0'; '' from s() caused troubles in PostgreSQL; merged from MOODLE_15_STABLE

This commit is contained in:
skodak 2005-07-09 07:20:52 +00:00
parent 020b4efdd2
commit 63e554d0f3

View File

@ -98,9 +98,8 @@ $ALLOWED_PROTOCOLS = array('http', 'https', 'ftp', 'news', 'mailto', 'rtsp', 'te
* @return string
*/
function s($var) {
if (empty($var)) {
return '';
if ($var == '0') { // for integer 0, boolean false, string '0'
return '0';
}
return htmlSpecialChars(stripslashes_safe($var));
}
@ -115,11 +114,11 @@ function s($var) {
* @return string
*/
function p($var) {
if (empty($var)) {
echo '';
if ($var == '0') { // for integer 0, boolean false, string '0'
echo '0';
} else {
echo htmlSpecialChars(stripslashes_safe($var));
}
echo htmlSpecialChars(stripslashes_safe($var));
}
@ -4284,7 +4283,7 @@ class tabobject {
$cstr = '';
/// The text and anchor for this tab
if ($inactive || $activetwo) {
if ($inactive || $activetwo || $selected) {
$astr .= $this->text;
} else {
$astr .= '<a href="'.$this->link.'" title="'.$this->text.'">'.$this->text.'</a>';