$text\n"; echo "

$message

\n"; apidb_footer(); exit; } /** * redirect to $url */ function util_redirect_and_exit($url) { header("Location: ".$url); exit; } function makeSafe($var) { /* Disable addslashes() until we can use more finely grained filtering on user input */ /* $var = trim(addslashes($var)); */ return $var; } function build_urlarg($vars) { $arr = array(); while(list($key, $val) = each($vars)) { if(is_array($val)) { while(list($idx, $value) = each($val)) { //echo "Encoding $key / $value
"; $arr[] = rawurlencode($key."[]")."=".rawurlencode($value); } } else $arr[] = $key."=".rawurlencode($val); } return implode("&", $arr); } /* * return all values of a mapping as an array */ function values($arr) { $res = array(); while(list($k, $v) = each($arr)) $res[] = $v; return $res; } // print the month, day, year, hour, minute, second function print_date($sTimestamp) { return date("F d Y H:i:s", $sTimestamp); } // print the month, day and year function print_short_date($sTimestamp) { return date("F d Y", $sTimestamp); } function mysqltimestamp_to_unixtimestamp($sTimestamp) { $d = substr($sTimestamp,6,2); // day $m = substr($sTimestamp,4,2); // month $y = substr($sTimestamp,0,4); // year $hours = substr($sTimestamp,8,2); // year $minutes = substr($sTimestamp,10,2); // year $seconds = substr($sTimestamp,12,2); // year return mktime($hours,$minutes,$seconds,$m, $d, $y); } function mysqldatetime_to_unixtimestamp($sDatetime) { sscanf($sDatetime, "%4s-%2s-%2s %2s:%2s:%2s", &$y, &$m, &$d, &$hours, &$minutes, &$seconds); return mktime($hours,$minutes,$seconds,$m, $d, $y); } function get_remote() { global $REMOTE_HOST, $REMOTE_ADDR; if($REMOTE_HOST) $ip = $REMOTE_HOST; else $ip = $REMOTE_ADDR; return $ip; } function htmlify_urls($text) { //FIXME: wonder what the syntax is, this doesn't seem to work // $text = strip_tags($text, ",,,