logged in to perform that operation."; } header("HTTP/1.0 404 Object not found or user is not logged in"); apidb_header("Oops"); echo "
$text
\n"; echo "

$message

\n"; apidb_footer(); exit; } /** * redirect to $url */ function util_redirect_and_exit($url) { header("Location: ".html_entity_decode($url)); exit; } 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; } /* Display a login form */ function login_form($bShowHeader = true) { global $aClean; $aClean['sReturnTo'] = urlencode($_SERVER['REQUEST_URI']); if($bShowHeader) apidb_header("Login"); include(BASE."include/"."form_login.php"); if($bShowHeader) apidb_footer(); } // 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) { return strtotime($sDatetime); } function htmlify_urls($text) { //FIXME: wonder what the syntax is, this doesn't seem to work // $text = strip_tags($text, ",,,