Fix the last_modified and dtstamp? Nearly?

This commit is contained in:
Andrew McMillan 2011-10-05 11:20:58 +02:00
parent e6ddf79f3e
commit 3559f6e932
3 changed files with 13 additions and 6 deletions

View File

@ -21,14 +21,14 @@ if ( empty($start) ) $start = sprintf( '%04d-01-01', date('Y'));
if ( empty($end) ) $end = sprintf( '%04d-12-31', date('Y') + 10);
$sql = 'SELECT our_tzno, tzid, active, olson_name, vtimezone, etag, ';
$sql .= 'to_char((last_modified::timestamp WITH TIME ZONE) AT TIME ZONE \'UTC\',\'Dy, DD Mon IYYY HH24:MI:SS "GMT"\') AS last_modified ';
$sql .= 'to_char(last_modified,\'Dy, DD Mon IYYY HH24:MI:SS "GMT"\') AS last_modified ';
$sql .= 'FROM timezones WHERE tzid=:tzid';
$params = array( ':tzid' => $tzid );
$qry = new AwlQuery($sql,$params);
if ( !$qry->Exec() ) exit(1);
if ( $qry->rows() < 1 ) {
$sql = 'SELECT our_tzno, tzid, active, olson_name, vtimezone, etag, ';
$sql .= 'to_char((last_modified::timestamp WITH TIME ZONE) AT TIME ZONE \'UTC\',\'Dy, DD Mon IYYY HH24:MI:SS "GMT"\') AS last_modified ';
$sql .= 'to_char(last_modified,\'Dy, DD Mon IYYY HH24:MI:SS "GMT"\') AS last_modified ';
$sql .= 'FROM timezones JOIN tz_aliases USING(our_tzno) WHERE tzalias=:tzid';
if ( !$qry->Exec() ) exit(1);
if ( $qry->rows() < 1 ) $request->DoResponse(404);

View File

@ -17,14 +17,14 @@ if ( $format != 'text/calendar' ) {
}
$sql = 'SELECT our_tzno, tzid, active, olson_name, vtimezone, etag, ';
$sql .= 'to_char((last_modified::timestamp WITH TIME ZONE) AT TIME ZONE \'UTC\',\'Dy, DD Mon IYYY HH24:MI:SS "GMT"\') AS last_modified ';
$sql .= 'to_char(last_modified,\'Dy, DD Mon IYYY HH24:MI:SS "GMT"\') AS last_modified ';
$sql .= 'FROM timezones WHERE tzid=:tzid';
$params = array( ':tzid' => $tzid );
$qry = new AwlQuery($sql,$params);
if ( !$qry->Exec() ) exit(1);
if ( $qry->rows() < 1 ) {
$sql = 'SELECT our_tzno, tzid, active, olson_name, vtimezone, etag, ';
$sql .= 'to_char((last_modified::timestamp WITH TIME ZONE) AT TIME ZONE \'UTC\',\'Dy, DD Mon IYYY HH24:MI:SS "GMT"\') AS last_modified ';
$sql .= 'to_char(last_modified,\'Dy, DD Mon IYYY HH24:MI:SS "GMT"\') AS last_modified ';
$sql .= 'FROM timezones JOIN tz_aliases USING(our_tzno) WHERE tzalias=:tzid';
if ( !$qry->Exec() ) exit(1);
if ( $qry->rows() < 1 ) $request->DoResponse(404);

View File

@ -13,9 +13,16 @@ require_once('vComponent.php');
$response = new XMLDocument( array("urn:ietf:params:xml:ns:timezone-service" => "") );
$tzlist = $response->NewXMLElement('timezone-list');
$tzlist->NewElement('dtstamp', gmdate('Y-m-d\TH:i:s\Z'));
$qry = new AwlQuery('SELECT to_char(max(last_modified),\'YYYY-MM-DD\"T\"HH24:MI:SS"Z"\') AS dtstamp FROM timezones');
if ( $qry->Exec('tz/list',__LINE__,__FILE__) && $qry->rows() > 0 ) {
$row = $qry->Fetch();
$tzlist->NewElement('dtstamp', $row->dtstamp);
}
else {
$tzlist->NewElement('dtstamp', gmdate('Y-m-d\TH:i:s\Z'));
}
$sql = 'SELECT our_tzno, tzid, active, to_char((last_modified::timestamp WITH TIME ZONE) AT TIME ZONE \'UTC\',\'YYYY-MM-DD\"T\"HH24:MI:SS"Z"\') AS last_modified, olson_name, vtimezone FROM timezones';
$sql = 'SELECT our_tzno, tzid, active, to_char(last_modified,\'YYYY-MM-DD\"T\"HH24:MI:SS"Z"\') AS last_modified, olson_name, vtimezone FROM timezones';
$params = array();
$where = '';
if ( $returnall !== true ) {