function s($var) {
/// returns $var with HTML characters (like "<", ">", etc.) properly quoted,
-/// or if $var is empty, will return an empty string.
- return empty($var) ? "" : htmlSpecialChars(stripslashes($var));
+ return htmlSpecialChars(stripslashes($var));
}
function p($var) {
/// prints $var with HTML characters (like "<", ">", etc.) properly quoted,
-/// or if $var is empty, will print an empty string.
- echo empty($var) ? "" : htmlSpecialChars(stripslashes($var));
+ echo htmlSpecialChars(stripslashes($var));
}
function nvl(&$var, $default="") {
function strip_querystring($url) {
/// takes a URL and returns it without the querystring portion
- if ($commapos = strpos($url, '?')) {
- return substr($url, 0, $commapos);
- } else {
- return $url;
- }
+ if ($commapos = strpos($url, '?')) {
+ return substr($url, 0, $commapos);
+ } else {
+ return $url;
+ }
}
function get_referer() {
global $REQUEST_URI, $PATH_INFO, $PHP_SELF;
- if ($REQUEST_URI) {
- return $REQUEST_URI;
+ if ($REQUEST_URI) {
+ return $REQUEST_URI;
- } else if ($PATH_INFO) {
- return $PATH_INFO;
+ } else if ($PATH_INFO) {
+ return $PATH_INFO;
- } else if ($PHP_SELF) {
- return $PHP_SELF;
+ } else if ($PHP_SELF) {
+ return $PHP_SELF;
- } else {
+ } else {
notify("Error: Could not find any of these web server variables: \$REQUEST_URI, \$PATH_INFO or \$PHP_SELF");
}
}
notify("Error: could not find web server variable: \$HTTP_HOST");
}
- $protocol = (isset($HTTPS) && $HTTPS == "on") ? "https://" : "http://";
- $url_prefix = "$protocol$HTTP_HOST";
- return $url_prefix . me();
+ $protocol = (isset($HTTPS) && $HTTPS == "on") ? "https://" : "http://";
+ $url_prefix = "$protocol$HTTP_HOST";
+ return $url_prefix . me();
}
return true;
}
- if ($good_referer == "") {
+ if ($good_referer == "") {
$good_referer = qualified_me();
}
- return $good_referer == get_referer();
+ return $good_referer == get_referer();
}
///
/// WARNING: do not use this on big files!!
- $temp = str_replace("\\", "\\\\", implode(file($filename), ""));
- $temp = str_replace('"', '\"', $temp);
- eval("\$template = \"$temp\";");
- return $template;
+ $temp = str_replace("\\", "\\\\", implode(file($filename), ""));
+ $temp = str_replace('"', '\"', $temp);
+ eval("\$template = \"$temp\";");
+ return $template;
}
function checked(&$var, $set_value = 1, $unset_value = 0) {
/// unset_value. used to handle checkboxes when you are expecting them from
/// a form
- if (empty($var)) {
- $var = $unset_value;
- } else {
- $var = $set_value;
- }
+ if (empty($var)) {
+ $var = $unset_value;
+ } else {
+ $var = $set_value;
+ }
}
function frmchecked(&$var, $true_value = "checked", $false_value = "") {
/// prints the word "checked" if a variable is true, otherwise prints nothing,
/// used for printing the word "checked" in a checkbox form input
- if ($var) {
- echo $true_value;
- } else {
- echo $false_value;
- }
+ if ($var) {
+ echo $true_value;
+ } else {
+ echo $false_value;
+ }
}
global $CFG;
- echo "\n<SCRIPT language=\"Javascript\">";
+ echo "\n<SCRIPT language=\"Javascript\">";
echo "\n<!--";
- echo "\ndocument.write('<A TITLE=\"$title\" HREF=javascript:openpopup(\"$url\",\"$name\",\"$height\",\"$width\") >$linkname</A>');";
+ echo "\ndocument.write('<A TITLE=\"$title\" HREF=javascript:openpopup(\"$url\",\"$name\",\"$height\",\"$width\") >$linkname</A>');";
echo "\n//-->";
- echo "\n</SCRIPT>";
- echo "\n<NOSCRIPT>\n<A TARGET=\"$name\" TITLE=\"$title\" HREF=\"$CFG->wwwroot/$url\">$linkname</A>\n</NOSCRIPT>\n";
+ echo "\n</SCRIPT>";
+ echo "\n<NOSCRIPT>\n<A TARGET=\"$name\" TITLE=\"$title\" HREF=\"$CFG->wwwroot/$url\">$linkname</A>\n</NOSCRIPT>\n";
}