mirror of
https://gitlab.com/davical-project/davical.git
synced 2026-04-19 14:10:14 +00:00
Fixes to tz/get.
This commit is contained in:
parent
eaeec0bc02
commit
b569f93858
@ -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');
|
||||
|
||||
@ -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
|
||||
|
||||
32
testing/tests/timezone/5031-get.result
Normal file
32
testing/tests/timezone/5031-get.result
Normal 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
|
||||
8
testing/tests/timezone/5031-get.test
Normal file
8
testing/tests/timezone/5031-get.test
Normal 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/
|
||||
Loading…
x
Reference in New Issue
Block a user