Fixes to tz/get.

This commit is contained in:
Andrew McMillan 2011-09-19 11:25:13 +12:00
parent eaeec0bc02
commit b569f93858
4 changed files with 49 additions and 6 deletions

View File

@ -11,6 +11,10 @@
require_once('vCalendar.php');
if ( empty($format) ) $format = 'text/calendar';
if ( $format != 'text/calendar' ) {
$request->PreconditionFailed(403, $precondition);
}
$sql = 'SELECT our_tzno, tzid, active, olson_name, vtimezone, etag, ';
$sql .= 'to_char(last_modified AT TIME ZONE \'UTC\',\'Dy, DD Mon IYYY HH24:MI:SS "GMT"\') AS last_modified ';
@ -29,7 +33,7 @@ if ( $qry->rows() < 1 ) {
$tz = $qry->Fetch();
$vtz = new vCalendar($tz->vtimezone);
$vtz->AddProperty('TZ-URL', ConstructURL($_SERVER['REQUEST_URI']));
$vtz->AddProperty('TZ-URL', $c->protocol_server_port . $_SERVER['REQUEST_URI']);
$vtz->AddProperty('TZNAME', $tz->olson_name );
if ( $qry->QDo('SELECT * FROM tz_localnames WHERE our_tzno = :our_tzno', array(':our_tzno'=>$tz->our_tzno)) && $qry->rows() ) {
while( $name = $qry->Fetch() ) {
@ -39,8 +43,7 @@ if ( $qry->QDo('SELECT * FROM tz_localnames WHERE our_tzno = :our_tzno', array('
}
}
header( 'Etag: "'.$tz->dav_etag.'"' );
header( 'Etag: "'.$tz->etag.'"' );
header( 'Last-Modified', $tz->last_modified );
$request->DoResponse(200, $vtz->Render(), 'text/calendar');

View File

@ -1,7 +1,7 @@
HTTP/1.1 200 OK
Date: Dow, 01 Jan 2000 00:00:00 GMT
Etag: ""
Content-Length: 605
Etag: "b6098dd509534c18b8bb8a979afa7df4"
Content-Length: 601
Content-Type: text/calendar
BEGIN:VCALENDAR
@ -9,7 +9,7 @@ PRODID:-//Morphoss Ltd//NONSGML aCal//EN
VERSION:2.0
LAST-MODIFIED:all good
TZ-URL:
/tz.php/tz.php%3Faction%3Dget%26tzid%3DPacific/Auckland%26lang%3Den_US
http://mycaldav/tz.php?action=get&tzid=Pacific/Auckland&lang=en_US
TZNAME:Pacific/Auckland
BEGIN:VTIMEZONE
TZID:Pacific/Auckland

View File

@ -0,0 +1,32 @@
HTTP/1.1 200 OK
Date: Dow, 01 Jan 2000 00:00:00 GMT
Etag: "0db80e352e12f15a4cceab465c77671b"
Content-Length: 611
Content-Type: text/calendar
BEGIN:VCALENDAR
PRODID:-//Morphoss Ltd//NONSGML aCal//EN
VERSION:2.0
LAST-MODIFIED:all good
TZ-URL:http://mycaldav/tz.php?action=get&tzid=Europe/Madrid&lang=es_ES&f
ormat=text/calendar
TZNAME:Europe/Madrid
BEGIN:VTIMEZONE
TZID:Europe/Madrid
X-LIC-LOCATION:Europe/Madrid
BEGIN:DAYLIGHT
TZOFFSETFROM:+0100
TZOFFSETTO:+0200
TZNAME:CEST
DTSTART:19700329T020000
RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU
END:DAYLIGHT
BEGIN:STANDARD
TZOFFSETFROM:+0200
TZOFFSETTO:+0100
TZNAME:CET
DTSTART:19701025T030000
RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU
END:STANDARD
END:VTIMEZONE
END:VCALENDAR

View File

@ -0,0 +1,8 @@
#
# List timezone server timezones
#
TYPE=GET
URL=http://regression.host/tz.php?action=get&tzid=Europe/Madrid&lang=es_ES&format=text/calendar
HEAD
REPLACE=/LAST-MODIFIED:[0-9TZ]{16}/LAST-MODIFIED:all good/