diff --git a/inc/tz/get.php b/inc/tz/get.php index f014e2ca..029a6b9b 100644 --- a/inc/tz/get.php +++ b/inc/tz/get.php @@ -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'); diff --git a/testing/tests/timezone/5030-get.result b/testing/tests/timezone/5030-get.result index f2c0e737..d7a1b64a 100644 --- a/testing/tests/timezone/5030-get.result +++ b/testing/tests/timezone/5030-get.result @@ -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 diff --git a/testing/tests/timezone/5031-get.result b/testing/tests/timezone/5031-get.result new file mode 100644 index 00000000..c3adb161 --- /dev/null +++ b/testing/tests/timezone/5031-get.result @@ -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 diff --git a/testing/tests/timezone/5031-get.test b/testing/tests/timezone/5031-get.test new file mode 100644 index 00000000..874e4bc7 --- /dev/null +++ b/testing/tests/timezone/5031-get.test @@ -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/