$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) { $sResult = mysql_get_server_info(); $fVersion = substr($sResult, 0, 3); /* This differs between MySQL versions, newer ones are in the form yyyy-mm-dd hh:mm:ss */ if($fVersion >= 4.1) { $iDay = substr($sTimestamp, 8, 2); $iMonth = substr($sTimestamp, 5, 2); $iYear = substr($sTimestamp, 0, 4); $iHours = substr($sTimestamp, 11, 2); $iMinutes = substr($sTimestamp, 14, 2); $iSeconds = substr($sTimestamp, 17, 2); } else /* The old ones are in the form yyyymmddhhmmss */ { $iDay = substr($sTimestamp,6,2); $iMonth = substr($sTimestamp,4,2); $iYear = substr($sTimestamp,0,4); $iHours = substr($sTimestamp,8,2); $iMinutes = substr($sTimestamp,10,2); $iSeconds = substr($sTimestamp,12,2); } return mktime($iHours, $iMinutes, $iSeconds, $iMonth, $iDay, $iYear); } 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, ",,,