diff --git a/inc/WritableCollection.php b/inc/WritableCollection.php index e9545057..e3bc05d9 100644 --- a/inc/WritableCollection.php +++ b/inc/WritableCollection.php @@ -4,6 +4,20 @@ include_once('DAVResource.php'); class WritableCollection extends DAVResource { /** + * Get a TZID string from this VEVENT/VTODO/... component if we can + * @param vComponent $comp + * @return The TZID value we found, or null + */ + private static function GetTZID( vComponent $comp ) { + $p = $comp->GetProperty('DTSTART'); + if ( !isset($p) && $comp->GetType() == 'VTODO' ) { + $p = $comp->GetProperty('DUE'); + } + if ( !isset($p) ) return null; + return $p->GetParameterValue('TZID'); + } + + /** * Writes the data to a member in the collection and returns the segment_name of the * resource in our internal namespace. * @@ -167,41 +181,21 @@ class WritableCollection extends DAVResource { } $calitem_params[':class'] = $class; - /** Calculate what timezone to set, first, if possible */ $last_tz_locn = 'Turkmenikikamukau'; // I really hope this location doesn't exist! - $dtstart_prop = $first->GetProperty('DTSTART'); - $tzid = $dtstart_prop->GetParameterValue('TZID'); - if ( empty($tzid) && $first->GetType() == 'VTODO' ) { - $due_prop = $first->GetProperty('DUE'); - $tzid = $due_prop->GetParameterValue('TZID'); - } - $timezones = $vcal->GetComponents('VTIMEZONE'); - foreach( $timezones AS $k => $tz ) { - if ( $tz->GetPValue('TZID') != $tzid ) { - /** - * We'll skip any tz definitions that are for a TZID other than the DTSTART/DUE on the first VEVENT/VTODO - */ - dbg_error_log( 'ERROR', ' Event uses TZID[%s], skipping included TZID[%s]!', $tz->GetPValue('TZID'), $tzid ); - continue; - } - // This is the one - $tz_locn = $tz->GetPValue('X-LIC-LOCATION'); - if ( ! isset($tz_locn) ) { - if ( preg_match( '#([^/]+/[^/]+)$#', $tzid, $matches ) ) - $tz_locn = $matches[1]; - else if ( isset($tzid) && $tzid != '' ) { - dbg_error_log( 'ERROR', ' Couldn\'t guess Olsen TZ from TZID[%s]. This may end in tears...', $tzid ); + $tzid = self::GetTZID($first); + if ( !empty($tzid) ) { + $tz = $vcal->GetTimeZone($tzid); + $tz_locn = olson_from_tzstring($tzid); + if ( empty($tz_locn) ) { + $tz_locn = $tz->GetPValue('X-LIC-LOCATION'); + if ( !empty($tz_locn) ) { + $tz_locn = olson_from_tzstring($tz_locn); } } - else { - if ( ! preg_match( $tz_regex, $tz_locn ) ) { - if ( preg_match( '#([^/]+/[^/]+)$#', $tzid, $matches ) ) $tz_locn = $matches[1]; - } - } - + dbg_error_log( 'PUT', ' Using TZID[%s] and location of [%s]', $tzid, (isset($tz_locn) ? $tz_locn : '') ); - if ( isset($tz_locn) && ($tz_locn != $last_tz_locn) && preg_match( $tz_regex, $tz_locn ) ) { + if ( !empty($tz_locn) && ($tz_locn != $last_tz_locn) && preg_match( $tz_regex, $tz_locn ) ) { dbg_error_log( 'PUT', ' Setting timezone to %s', $tz_locn ); if ( $tz_locn != '' ) { $qry->QDo('SET TIMEZONE TO \''.$tz_locn."'" ); @@ -216,9 +210,9 @@ class WritableCollection extends DAVResource { $qry->QDo('INSERT INTO time_zone (tz_id, tz_locn, tz_spec) VALUES(:tzid,:tzlocn,:tzspec)', $params ); } if ( !isset($tz_locn) || $tz_locn == '' ) $tz_locn = $tzid; - + } - + $created = $first->GetPValue('CREATED'); if ( $created == '00001231T000000Z' ) $created = '20001231T000000Z'; $calitem_params[':created'] = $created; diff --git a/inc/caldav-PUT-functions.php b/inc/caldav-PUT-functions.php index ed0ebfe3..8c71342e 100644 --- a/inc/caldav-PUT-functions.php +++ b/inc/caldav-PUT-functions.php @@ -316,7 +316,9 @@ function handle_schedule_reply ( vCalendar $ical ) { * @param boolean $create true if the scheduling requests are being created. */ function do_scheduling_requests( vCalendar $resource, $create ) { - global $request; + global $request, $c; + if ( isset($c->enable_auto_schedule) && !$c->enable_auto_schedule ) return; + if ( ! is_object($resource) ) { dbg_error_log( 'PUT', 'do_scheduling_requests called with non-object parameter (%s)', gettype($resource) ); return; @@ -465,7 +467,6 @@ EOSQL; /** Construct the VCALENDAR data */ $vcal = new vCalendar(); $vcal->SetComponents($resource); - do_scheduling_requests($vcal,true); $icalendar = $vcal->Render(); /** As ever, we mostly deal with the first resource component */ @@ -719,24 +720,25 @@ function write_attendees( $dav_id, vCalendar $ical ) { /** * Actually write the resource to the database. All checking of whether this is reasonable * should be done before this is called. -* @param int $user_no The user_no owning this resource on the server -* @param string $path The path to the resource being written -* @param string $caldav_data The actual resource to be written -* @param int $collection_id The ID of the collection containing the resource being written +* +* @param DAVResource $resource The resource being written +* @param string $caldav_data The actual data to be written +* @param DAVResource $collection The collection containing the resource being written * @param int $author The user_no who wants to put this resource on the server * @param string $etag An etag unique for this event -* @param vComponent $ic The parsed iCalendar object * @param string $put_action_type INSERT or UPDATE depending on what we are to do * @param boolean $caldav_context True, if we are responding via CalDAV, false for other ways of calling this * @param string Either 'INSERT' or 'UPDATE': the type of action we are doing * @param boolean $log_action Whether to log the fact that we are writing this into an action log (if configured) * @param string $weak_etag An etag that is NOT modified on ATTENDEE changes for this event +* * @return boolean True for success, false for failure. */ function write_resource( DAVResource $resource, $caldav_data, DAVResource $collection, $author, $etag, $put_action_type, $caldav_context, $log_action=true, $weak_etag=null ) { - global $tz_regex; + global $tz_regex, $session; $path = $resource->bound_from(); + $user_no = $collection->user_no(); $ic = new vCalendar( $caldav_data ); $resources = $ic->GetComponents('VTIMEZONE',false); // Not matching VTIMEZONE if ( !isset($resources[0]) ) { @@ -754,7 +756,6 @@ function write_resource( DAVResource $resource, $caldav_data, DAVResource $colle $resource_type = $first->GetType(); } - $user_no = $collection->user_no(); $collection_id = $collection->collection_id(); $qry = new AwlQuery(); @@ -868,32 +869,27 @@ function write_resource( DAVResource $resource, $caldav_data, DAVResource $colle /** Calculate what timezone to set, first, if possible */ $last_tz_locn = 'Turkmenikikamukau'; // I really hope this location doesn't exist! $tzid = GetTZID($first); - $timezones = $ic->GetComponents('VTIMEZONE'); - foreach( $timezones AS $k => $tz ) { - if ( $tz->GetPValue('TZID') != $tzid ) { - /** - * We'll skip any tz definitions that are for a TZID other than the DTSTART/DUE on the first VEVENT/VTODO - */ - dbg_error_log( 'ERROR', ' Event uses TZID[%s], skipping included TZID[%s]!', $tz->GetPValue('TZID'), $tzid ); - continue; - } - // This is the one - $tz_locn = $tz->GetPValue('X-LIC-LOCATION'); - if ( ! isset($tz_locn) ) { - if ( preg_match( '#([^/]+/[^/]+)$#', $tzid, $matches ) ) - $tz_locn = $matches[1]; - else if ( isset($tzid) && $tzid != '' ) { - dbg_error_log( 'ERROR', ' Couldn\'t guess Olsen TZ from TZID[%s]. This may end in tears...', $tzid ); + if ( !empty($tzid) ) { + $timezones = $ic->GetComponents('VTIMEZONE'); + foreach( $timezones AS $k => $tz ) { + if ( $tz->GetPValue('TZID') != $tzid ) { + /** + * We'll skip any tz definitions that are for a TZID other than the DTSTART/DUE on the first VEVENT/VTODO + */ + dbg_error_log( 'ERROR', ' Event uses TZID[%s], skipping included TZID[%s]!', $tz->GetPValue('TZID'), $tzid ); + continue; } - } - else { - if ( ! preg_match( $tz_regex, $tz_locn ) ) { - if ( preg_match( '#([^/]+/[^/]+)$#', $tzid, $matches ) ) $tz_locn = $matches[1]; + $tz_locn = olson_from_tzstring($tzid); + if ( empty($tz_locn) ) { + $tz_locn = $tz->GetPValue('X-LIC-LOCATION'); + if ( !empty($tz_locn) ) { + $tz_locn = olson_from_tzstring($tz_locn); + } } } dbg_error_log( 'PUT', ' Using TZID[%s] and location of [%s]', $tzid, (isset($tz_locn) ? $tz_locn : '') ); - if ( isset($tz_locn) && ($tz_locn != $last_tz_locn) && preg_match( $tz_regex, $tz_locn ) ) { + if ( !empty($tz_locn) && ($tz_locn != $last_tz_locn) && preg_match( $tz_regex, $tz_locn ) ) { dbg_error_log( 'PUT', ' Setting timezone to %s', $tz_locn ); if ( $tz_locn != '' ) { $qry->QDo('SET TIMEZONE TO \''.$tz_locn."'" ); diff --git a/testing/rrule-performance.test b/testing/rrule-performance.test new file mode 100755 index 00000000..65eb5be7 --- /dev/null +++ b/testing/rrule-performance.test @@ -0,0 +1,28 @@ +#!/usr/bin/perl +# +# +use strict; +use autodie; + +my ($dtstart, $rrule, $limit ); + +$limit = 100; +$dtstart = '19270311T040000Z'; + +while( <> ) { + m{\s* TZ \s* [:=] \s* (\S+.*) $}xi && do { + printf( "SET timezone TO '%s';\n", $1); + }; + m{\s* LIMIT \s* [:=] \s* (\d+) $}xi && do { + $limit = $1; + }; + m{\s* DTSTART \s* [:=] \s* (\S+.*) $}ix && do { + $dtstart = $1; + }; + m{\s* RRULE \s* [:=] \s* (\S+.*) $}ix && do { + $rrule = $1; + printf( "SELECT * FROM event_instances('%s', '%s' ) LIMIT %d;\n", $dtstart, $rrule, $limit); + $limit = 100; + }; +} + diff --git a/testing/rrule_test_data b/testing/rrule_test_data new file mode 100644 index 00000000..59a85a6b --- /dev/null +++ b/testing/rrule_test_data @@ -0,0 +1,215 @@ +# +# Tests taken from the iCalendar standard +# +TZ=US/Eastern +DTSTART=19970902T090000 +RRULE=FREQ=DAILY;COUNT=10 + +DTSTART=19970902T090000 +RRULE=FREQ=DAILY;UNTIL=19971224T000000 + +DTSTART=19970902T090000 +LIMIT=50 +RRULE=FREQ=DAILY;INTERVAL=2 + +DTSTART=19970902T090000 +RRULE=FREQ=DAILY;INTERVAL=10;COUNT=5 + +DTSTART=19970902T090000 +RRULE=FREQ=WEEKLY;COUNT=10 + +DTSTART=19970902T090000 +RRULE=FREQ=WEEKLY;UNTIL=19971224T000000Z + +DTSTART=19970902T090000 +LIMIT=13 +RRULE=FREQ=WEEKLY;INTERVAL=2;WKST=SU + +DTSTART=19970902T090000 +RRULE=FREQ=WEEKLY;UNTIL=19971007T000000Z;WKST=SU;BYDAY=TU,TH + +DTSTART=19970902T090000 +RRULE=FREQ=WEEKLY;COUNT=10;WKST=SU;BYDAY=TU,TH + +DTSTART=19970902T090000 +RRULE=FREQ=WEEKLY;INTERVAL=2;COUNT=8;WKST=SU;BYDAY=TU,TH + +DTSTART=19970905T090000 +RRULE=FREQ=MONTHLY;COUNT=10;BYDAY=1FR + +DTSTART=19970905T090000 +RRULE=FREQ=MONTHLY;UNTIL=19971224T000000Z;BYDAY=1FR + +DTSTART=19970907T090000 +RRULE=FREQ=MONTHLY;INTERVAL=2;COUNT=10;BYDAY=1SU,-1SU + +DTSTART=19970902T090000 +RRULE=FREQ=MONTHLY;COUNT=6;BYDAY=-2MO + +DTSTART=19970902T090000 +LIMIT=6 +RRULE=FREQ=MONTHLY;BYMONTHDAY=-3 + +DTSTART=19970902T090000 +RRULE=FREQ=MONTHLY;COUNT=10;BYMONTHDAY=2,15 + +DTSTART=19970930T090000 +RRULE=FREQ=MONTHLY;COUNT=10;BYMONTHDAY=1,-1 + +DTSTART=19970910T090000 +RRULE=FREQ=MONTHLY;INTERVAL=18;COUNT=10;BYMONTHDAY=10,11,12,13,14,15 + +DTSTART=19970902T090000 +LIMIT=18 +RRULE=FREQ=MONTHLY;INTERVAL=2;BYDAY=TU + +DTSTART=19970313T090000 +LIMIT=11 +RRULE=FREQ=YEARLY;BYMONTH=3;BYDAY=TH + +DTSTART=19970605T090000 +LIMIT=39 +RRULE=FREQ=YEARLY;BYDAY=TH;BYMONTH=6,7,8 + +DTSTART=19970902T090000 +LIMIT=35 +RRULE=FREQ=MONTHLY;BYDAY=FR;BYMONTHDAY=13 + +DTSTART=19970913T090000 +LIMIT=10 +RRULE=FREQ=MONTHLY;BYDAY=SA;BYMONTHDAY=7,8,9,10,11,12,13 + +DTSTART=19961105T090000 +LIMIT=6 +RRULE=FREQ=YEARLY;INTERVAL=4;BYMONTH=11;BYDAY=TU;BYMONTHDAY=2,3,4,5,6,7,8 + +DTSTART=19970904T090000 +RRULE=FREQ=MONTHLY;COUNT=3;BYDAY=TU,WE,TH;BYSETPOS=3 + +DTSTART=19970929T090000 +LIMIT=8 +RRULE=FREQ=MONTHLY;BYDAY=MO,TU,WE,TH,FR;BYSETPOS=-2 + +# +# A number of RRULE we have accumulated in real life from a variety of sources +# +TZ=Pacific/Auckland +DTSTART=20081020T110000 +RRULE=FREQ=DAILY;INTERVAL=1;BYDAY=MO,TU,WE,TH,FR +DTSTART=20081020T090000 +RRULE=FREQ=WEEKLY;INTERVAL=1 +DTSTART=20081024T140000 +RRULE=FREQ=WEEKLY;INTERVAL=1 +DTSTART=20061102T100000 +RRULE=FREQ=WEEKLY;COUNT=26;INTERVAL=1;BYDAY=TH +DTSTART=20081025T233000 +RRULE=FREQ=MONTHLY;INTERVAL=1;BYDAY=1TU,2WE,3TH,4FR;BYMONTH=3,6,9,10,12 +DTSTART=20081024T184500 +RRULE=FREQ=MONTHLY;INTERVAL=1;BYDAY=TU,FR +DTSTART=20081025T233000 +RRULE=FREQ=MONTHLY;INTERVAL=1;BYDAY=1TU,2WE,3TH,4FR;BYMONTH=3,6,9,10,12 +DTSTART=20081024T184500 +RRULE=FREQ=MONTHLY;INTERVAL=1;BYDAY=TU,FR +DTSTART=20021126T203000 +RRULE=FREQ=DAILY;UNTIL=20021128T230000Z +DTSTART=20071126T070000 +RRULE=FREQ=WEEKLY;INTERVAL=1;BYDAY=MO,TU,WE,TH,FR;WKST=SU +DTSTART=20050202T050000 +RRULE=FREQ=WEEKLY;UNTIL=20050322T160000Z;BYDAY=TU +DTSTART=20040803T000000 +RRULE=FREQ=DAILY;UNTIL=20040804 +DTSTART=20071211T074500 +RRULE=FREQ=WEEKLY;INTERVAL=1;BYDAY=TU,TH +DTSTART=20061103T160000 +RRULE=FREQ=WEEKLY;INTERVAL=2;UNTIL=20071222T235900 +DTSTART=20061103T073000 +RRULE=FREQ=MONTHLY +DTSTART=20071123T120000 +RRULE=FREQ=MONTHLY;INTERVAL=1;BYDAY=4FR +DTSTART=20081114T000000 +RRULE=FREQ=MONTHLY;INTERVAL=1;BYDAY=2FR +DTSTART=20081121T160000 +RRULE=FREQ=MONTHLY;INTERVAL=1;BYDAY=3FR +DTSTART=20020220T053000 +RRULE=FREQ=DAILY;UNTIL=20020528T153000Z;INTERVAL=14 +DTSTART=20060921T020000 +RRULE=FREQ=WEEKLY;UNTIL=20061004T140000Z;BYDAY=WE +DTSTART=20060801T090000 +RRULE=FREQ=YEARLY;INTERVAL=1 +DTSTART=20030301T050000 +RRULE=FREQ=DAILY;UNTIL=20030228T230000Z +DTSTART=20031013T200000 +RRULE=FREQ=DAILY;UNTIL=20031016T220000Z +DTSTART=20021022T193000 +RRULE=FREQ=DAILY;UNTIL=20021024T220000Z +DTSTART=20050224T220000 +RRULE=FREQ=DAILY;UNTIL=20050224T230000Z +DTSTART=20040916T000000 +RRULE=FREQ=DAILY;UNTIL=20040917 +DTSTART=20030530T200000 +RRULE=FREQ=DAILY;UNTIL=20030530T220000Z +DTSTART=20040616T180000 +RRULE=FREQ=DAILY;UNTIL=20040616T220000Z +DTSTART=20021030T203000 +RRULE=FREQ=WEEKLY;UNTIL=20021204T073000Z;BYDAY=WE +DTSTART=20050415T183000 +RRULE=FREQ=WEEKLY;UNTIL=20050513T063000Z;BYDAY=FR +DTSTART=20030711T180000 +RRULE=FREQ=DAILY;UNTIL=20030712T220000Z +DTSTART=20050128T200000 +RRULE=FREQ=DAILY;UNTIL=20050129T230000Z +DTSTART=20030326T193000 +RRULE=FREQ=WEEKLY;UNTIL=20030507T063000Z;BYDAY=WE +DTSTART=20060405T190000 +RRULE=FREQ=DAILY;UNTIL=20060406T070000Z +DTSTART=20051122T200000 +RRULE=FREQ=DAILY;COUNT=2 +DTSTART=20030212T203000 +RRULE=FREQ=WEEKLY;UNTIL=20030319T073000Z;BYDAY=WE +DTSTART=20030617T200000 +RRULE=FREQ=DAILY;UNTIL=20030618T220000Z +DTSTART=20050809T183000 +RRULE=FREQ=DAILY;COUNT=2 +DTSTART=20051124T200000 +RRULE=FREQ=DAILY;COUNT=2 +DTSTART=20020913T183000 +RRULE=FREQ=WEEKLY;UNTIL=20020920T063000Z;BYDAY=FR +DTSTART=20030827T183000 +RRULE=FREQ=WEEKLY;UNTIL=20031105T073000Z;BYDAY=WE +DTSTART=20030825T183000 +RRULE=FREQ=WEEKLY;UNTIL=20031103T073000Z;BYDAY=MO +DTSTART=20020912T183000 +RRULE=FREQ=WEEKLY;UNTIL=20020919T063000Z;BYDAY=TH +DTSTART=20021205T203000 +RRULE=FREQ=DAILY;UNTIL=20021205T230000Z +DTSTART=20031022T040000 +RRULE=FREQ=WEEKLY;UNTIL=20031216T160000Z;BYDAY=TU +DTSTART=20060511T180000 +RRULE=FREQ=DAILY;UNTIL=20060514T060000Z +DTSTART=20021203T203000 +RRULE=FREQ=DAILY;UNTIL=20021203T230000Z +DTSTART=20040602T180000 +RRULE=FREQ=DAILY;UNTIL=20040602T220000Z +DTSTART=20070307T203000 +RRULE=FREQ=WEEKLY;COUNT=2;BYDAY=WE +DTSTART=20030918T180000 +RRULE=FREQ=DAILY;UNTIL=20030918T220000Z +DTSTART=20050831T180000 +RRULE=FREQ=WEEKLY;UNTIL=20051109T070000Z;BYDAY=WE +DTSTART=20021028T203000 +RRULE=FREQ=WEEKLY;UNTIL=20021202T073000Z;BYDAY=MO +DTSTART=20030210T203000 +RRULE=FREQ=WEEKLY;UNTIL=20030317T073000Z;BYDAY=MO +DTSTART=20021212T203000 +RRULE=FREQ=DAILY;UNTIL=20021212T230000Z +DTSTART=20050131T203000 +RRULE=FREQ=WEEKLY;UNTIL=20050314T073000Z;BYDAY=MO +DTSTART=20030324T193000 +RRULE=FREQ=WEEKLY;UNTIL=20030512T063000Z;BYDAY=MO +DTSTART=20030414T180000 +RRULE=FREQ=DAILY;UNTIL=20030420T220000Z +DTSTART=20050105T220000 +RRULE=FREQ=DAILY;UNTIL=20050106T230000Z +DTSTART=20020919T180000 +RRULE=FREQ=DAILY;UNTIL=20020919T220000Z + diff --git a/testing/tests/binding/1000-BIND.result b/testing/tests/binding/1000-BIND.result index 2a4d85da..2cc207d0 100644 --- a/testing/tests/binding/1000-BIND.result +++ b/testing/tests/binding/1000-BIND.result @@ -7,7 +7,7 @@ Content-Length: 0 Content-Type: text/plain; charset="utf-8" - bind_id: >1598< + bind_id: >1599< bound_source_id: >11< dav_displayname: >User 2's Calendar, as uploaded by Admin< dav_name: >/user4/user2/< diff --git a/testing/tests/binding/1001-BIND.result b/testing/tests/binding/1001-BIND.result index 0d2806cf..7e800a33 100644 --- a/testing/tests/binding/1001-BIND.result +++ b/testing/tests/binding/1001-BIND.result @@ -9,7 +9,7 @@ Content-Type: text/xml; charset="utf-8" A resource already exists at the destination. - bind_id: >1598< + bind_id: >1599< bound_source_id: >11< dav_displayname: >User 2's Calendar, as uploaded by Admin< dav_name: >/user4/user2/< diff --git a/testing/tests/binding/1004-PROPFIND-bound.result b/testing/tests/binding/1004-PROPFIND-bound.result index 08bc56be..eb1bf1f8 100644 --- a/testing/tests/binding/1004-PROPFIND-bound.result +++ b/testing/tests/binding/1004-PROPFIND-bound.result @@ -100,7 +100,7 @@ User 4 Outbox - /caldav.php/.resources/1596 + /caldav.php/.resources/1597 diff --git a/testing/tests/binding/1012-BIND.result b/testing/tests/binding/1012-BIND.result index 323c56bb..ee7dc4d2 100644 --- a/testing/tests/binding/1012-BIND.result +++ b/testing/tests/binding/1012-BIND.result @@ -7,14 +7,14 @@ Content-Length: 0 Content-Type: text/plain; charset="utf-8" - bind_id: >1598< + bind_id: >1599< bound_source_id: >11< dav_displayname: >Updated Displayname with PROPPATCH< dav_name: >/user4/user2/< parent_container: >/user4/< ticket_id_length: >8< - bind_id: >1599< + bind_id: >1600< bound_source_id: >10< dav_displayname: >User 1's Calendaranza< dav_name: >/user4/user1/< diff --git a/testing/tests/binding/1022-BIND.result b/testing/tests/binding/1022-BIND.result index 0caf5720..362d0921 100644 --- a/testing/tests/binding/1022-BIND.result +++ b/testing/tests/binding/1022-BIND.result @@ -7,21 +7,21 @@ Content-Length: 0 Content-Type: text/plain; charset="utf-8" - bind_id: >1598< + bind_id: >1599< bound_source_id: >11< dav_displayname: >Updated Displayname with PROPPATCH< dav_name: >/user4/user2/< length: >8< parent_container: >/user4/< - bind_id: >1599< + bind_id: >1600< bound_source_id: >10< dav_displayname: >User 1's Calendaranza< dav_name: >/user4/user1/< length: >8< parent_container: >/user4/< - bind_id: >1603< + bind_id: >1604< bound_source_id: >10< dav_displayname: >User 1's Calendaranza< dav_name: >/user4/base/user1/< diff --git a/testing/tests/binding/1023-BIND.result b/testing/tests/binding/1023-BIND.result index 7e828954..10e55d4a 100644 --- a/testing/tests/binding/1023-BIND.result +++ b/testing/tests/binding/1023-BIND.result @@ -7,28 +7,28 @@ Content-Length: 0 Content-Type: text/plain; charset="utf-8" - bind_id: >1598< + bind_id: >1599< bound_source_id: >11< dav_displayname: >Updated Displayname with PROPPATCH< dav_name: >/user4/user2/< length: >8< parent_container: >/user4/< - bind_id: >1599< + bind_id: >1600< bound_source_id: >10< dav_displayname: >User 1's Calendaranza< dav_name: >/user4/user1/< length: >8< parent_container: >/user4/< - bind_id: >1603< + bind_id: >1604< bound_source_id: >10< dav_displayname: >User 1's Calendaranza< dav_name: >/user4/base/user1/< length: >8< parent_container: >/user4/base/< - bind_id: >1604< + bind_id: >1605< bound_source_id: >11< dav_displayname: >User 2's Calendar, as uploaded by Admin< dav_name: >/user4/base/user2/< diff --git a/testing/tests/binding/1024-BIND.result b/testing/tests/binding/1024-BIND.result index 9849e45f..5804f0b2 100644 --- a/testing/tests/binding/1024-BIND.result +++ b/testing/tests/binding/1024-BIND.result @@ -9,28 +9,28 @@ Content-Type: text/xml; charset="utf-8" A resource already exists at the destination. - bind_id: >1598< + bind_id: >1599< bound_source_id: >11< dav_displayname: >Updated Displayname with PROPPATCH< dav_name: >/user4/user2/< length: >8< parent_container: >/user4/< - bind_id: >1599< + bind_id: >1600< bound_source_id: >10< dav_displayname: >User 1's Calendaranza< dav_name: >/user4/user1/< length: >8< parent_container: >/user4/< - bind_id: >1603< + bind_id: >1604< bound_source_id: >10< dav_displayname: >User 1's Calendaranza< dav_name: >/user4/base/user1/< length: >8< parent_container: >/user4/base/< - bind_id: >1604< + bind_id: >1605< bound_source_id: >11< dav_displayname: >User 2's Calendar, as uploaded by Admin< dav_name: >/user4/base/user2/< diff --git a/testing/tests/binding/1025-PROPFIND.result b/testing/tests/binding/1025-PROPFIND.result index 31a77a7b..9d72baa8 100644 --- a/testing/tests/binding/1025-PROPFIND.result +++ b/testing/tests/binding/1025-PROPFIND.result @@ -6,7 +6,7 @@ A normal collection - /caldav.php/.resources/1601 + /caldav.php/.resources/1602 @@ -90,7 +90,7 @@ A sub collection - /caldav.php/.resources/1602 + /caldav.php/.resources/1603 diff --git a/testing/tests/binding/1027-PROPFIND.result b/testing/tests/binding/1027-PROPFIND.result index ca3cb38d..8a5cb22b 100644 --- a/testing/tests/binding/1027-PROPFIND.result +++ b/testing/tests/binding/1027-PROPFIND.result @@ -6,7 +6,7 @@ A normal collection - /caldav.php/.resources/1601 + /caldav.php/.resources/1602 diff --git a/testing/tests/binding/1030-PUT-whole-subcalendar.result b/testing/tests/binding/1030-PUT-whole-subcalendar.result index 312a74d6..0a9f8622 100644 --- a/testing/tests/binding/1030-PUT-whole-subcalendar.result +++ b/testing/tests/binding/1030-PUT-whole-subcalendar.result @@ -8,11 +8,6 @@ Content-Length: 0 Content-Type: text/plain; charset="utf-8" - dav_etag: >0e091d7cf1ea4f613199a2a60090a7e1< - dav_name: >/user4/base/newcalendar/4887b3b0-0f91-012d-1259-002421a2359e.ics< - dtstart: >2010-07-17 10:00:00+12< - summary: >New Event< - dav_etag: >228540edb5690f6e8adb855aaa98ee98< dav_name: >/user4/base/newcalendar/73d1f980-ec28-012c-11f9-002421a2359e.ics< dtstart: >2010-01-06 11:00:00+13< @@ -38,6 +33,11 @@ Content-Type: text/plain; charset="utf-8" dtstart: >2010-05-03 13:00:00+12< summary: >Youngberg Hill Winemaker Dinner @ The Stephanie Inn< + dav_etag: >0e091d7cf1ea4f613199a2a60090a7e1< + dav_name: >/user4/base/newcalendar/4887b3b0-0f91-012d-1259-002421a2359e.ics< + dtstart: >2010-07-17 10:00:00+12< + summary: >New Event< + dav_etag: >a5972f272523b97d6cade1486a8b1c40< dav_name: >/user4/base/newcalendar/ed3beb90-0f8a-012d-1259-002421a2359e.ics< dtstart: >2010-07-18 05:00:00+12< diff --git a/testing/tests/binding/1032-BIND-admin.result b/testing/tests/binding/1032-BIND-admin.result index 9cc8db69..dc99c10e 100644 --- a/testing/tests/binding/1032-BIND-admin.result +++ b/testing/tests/binding/1032-BIND-admin.result @@ -7,7 +7,7 @@ Content-Length: 0 Content-Type: text/plain; charset="utf-8" - bind_id: >1598< + bind_id: >1599< bind_owner: >1005< bound_source_id: >11< dav_displayname: >Updated Displayname with PROPPATCH< @@ -19,7 +19,7 @@ target_collection: >11< target_resource_i: >NULL< ticket_owner: >1003< - bind_id: >1599< + bind_id: >1600< bind_owner: >1005< bound_source_id: >10< dav_displayname: >User 1's Calendaranza< @@ -31,7 +31,7 @@ target_collection: >10< target_resource_i: >NULL< ticket_owner: >1002< - bind_id: >1603< + bind_id: >1604< bind_owner: >1005< bound_source_id: >10< dav_displayname: >User 1's Calendaranza< @@ -43,7 +43,7 @@ target_collection: >10< target_resource_i: >NULL< ticket_owner: >1002< - bind_id: >1604< + bind_id: >1605< bind_owner: >1005< bound_source_id: >11< dav_displayname: >User 2's Calendar, as uploaded by Admin< @@ -55,7 +55,7 @@ target_collection: >11< target_resource_i: >NULL< ticket_owner: >1003< - bind_id: >1625< + bind_id: >1626< bind_owner: >1< bound_source_id: >12< dav_displayname: >user3 home< diff --git a/testing/tests/binding/1034-DELETE-admin-bind.result b/testing/tests/binding/1034-DELETE-admin-bind.result index 50196156..9da37dd6 100644 --- a/testing/tests/binding/1034-DELETE-admin-bind.result +++ b/testing/tests/binding/1034-DELETE-admin-bind.result @@ -6,14 +6,14 @@ Content-Length: 0 Content-Type: text/plain; charset="utf-8" - bind_id: >1603< + bind_id: >1604< bound_source_id: >10< dav_displayname: >User 1's Calendaranza< dav_name: >/user4/base/user1/< dav_owner_id: >1005< parent_container: >/user4/base/< - bind_id: >1604< + bind_id: >1605< bound_source_id: >11< dav_displayname: >User 2's Calendar, as uploaded by Admin< dav_name: >/user4/base/user2/< diff --git a/testing/tests/binding/1035-GET-mashup.result b/testing/tests/binding/1035-GET-mashup.result index 708d7b7b..f463204b 100644 --- a/testing/tests/binding/1035-GET-mashup.result +++ b/testing/tests/binding/1035-GET-mashup.result @@ -2,7 +2,7 @@ HTTP/1.1 200 OK Date: Dow, 01 Jan 2000 00:00:00 GMT DAV: 1, 2, 3, access-control, calendar-access, calendar-schedule DAV: extended-mkcol, calendar-proxy, bind, addressbook, calendar-auto-schedule -Content-Length: 21247 +Content-Length: 21609 Etag: "ae93907cb03bc025b8e733eb61f3a09e" Content-Type: text/calendar; charset="utf-8" @@ -332,6 +332,16 @@ DURATION:PT3H RRULE:FREQ=MONTHLY;INTERVAL=1;BYDAY=3FR END:VEVENT BEGIN:VEVENT +UID:PUT-eastern-time +DTSTAMP:20101009T214524Z +SUMMARY;LANGUAGE=en-US:Psychic's Anonymous Meeting +DTSTART;TZID="(UTC-05:00) Eastern Time (US & Canada)":20110912T110000 +DTEND;TZID="(UTC-05:00) Eastern Time (US & Canada)":20110912T113000 +LOCATION:You will know when you arrive +CREATED:20101010T014639 +LAST-MODIFIED:20101010T014639 +END:VEVENT +BEGIN:VEVENT CREATED:20100318T044409Z LAST-MODIFIED:20100318T044451Z DTSTAMP:20100318T044451Z diff --git a/testing/tests/binding/1100-BIND.result b/testing/tests/binding/1100-BIND.result index 431e14bf..59bac120 100644 --- a/testing/tests/binding/1100-BIND.result +++ b/testing/tests/binding/1100-BIND.result @@ -7,36 +7,36 @@ Content-Length: 0 Content-Type: text/plain; charset="utf-8" - bind_id: >1598< + bind_id: >1599< bound_source_id: >11< dav_displayname: >Updated Displayname with PROPPATCH< dav_name: >/user4/user2/< length: >8< parent_container: >/user4/< - bind_id: >1599< + bind_id: >1600< bound_source_id: >10< dav_displayname: >User 1's Calendaranza< dav_name: >/user4/user1/< length: >8< parent_container: >/user4/< - bind_id: >1603< + bind_id: >1604< bound_source_id: >10< dav_displayname: >User 1's Calendaranza< dav_name: >/user4/base/user1/< length: >8< parent_container: >/user4/base/< - bind_id: >1604< + bind_id: >1605< bound_source_id: >11< dav_displayname: >User 2's Calendar, as uploaded by Admin< dav_name: >/user4/base/user2/< length: >8< parent_container: >/user4/base/< - bind_id: >1626< - bound_source_id: >1601< + bind_id: >1627< + bound_source_id: >1602< dav_displayname: >A normal collection< dav_name: >/user4/boundbase/< length: >NULL< diff --git a/testing/tests/binding/1101-PROPFIND-normal.result b/testing/tests/binding/1101-PROPFIND-normal.result index 59b09b60..de7df0fc 100644 --- a/testing/tests/binding/1101-PROPFIND-normal.result +++ b/testing/tests/binding/1101-PROPFIND-normal.result @@ -6,7 +6,7 @@ A normal collection - /caldav.php/.resources/1601 + /caldav.php/.resources/1602 @@ -90,7 +90,7 @@ A sub collection - /caldav.php/.resources/1602 + /caldav.php/.resources/1603 @@ -112,7 +112,7 @@ newcalendar - /caldav.php/.resources/1615 + /caldav.php/.resources/1616 diff --git a/testing/tests/binding/1102-PROPFIND-bound.result b/testing/tests/binding/1102-PROPFIND-bound.result index 1dbe5ca9..a94f8c2b 100644 --- a/testing/tests/binding/1102-PROPFIND-bound.result +++ b/testing/tests/binding/1102-PROPFIND-bound.result @@ -6,7 +6,7 @@ A normal collection - /caldav.php/.resources/1601 + /caldav.php/.resources/1602 @@ -99,7 +99,7 @@ A sub collection - /caldav.php/.resources/1602 + /caldav.php/.resources/1603 @@ -125,7 +125,7 @@ newcalendar - /caldav.php/.resources/1615 + /caldav.php/.resources/1616 diff --git a/testing/tests/binding/Restore-Database.result b/testing/tests/binding/Restore-Database.result index 34698c1a..c13664c9 100644 --- a/testing/tests/binding/Restore-Database.result +++ b/testing/tests/binding/Restore-Database.result @@ -1,6 +1,6 @@ setval -------- - 1597 + 1598 (1 row) setval diff --git a/testing/tests/carddav/Restore-Database.result b/testing/tests/carddav/Restore-Database.result index a389687f..52a952e1 100644 --- a/testing/tests/carddav/Restore-Database.result +++ b/testing/tests/carddav/Restore-Database.result @@ -1,6 +1,6 @@ setval -------- - 1626 + 1627 (1 row) setval diff --git a/testing/tests/regression-suite/0904-PUT-bad-timezone.result b/testing/tests/regression-suite/0904-PUT-bad-timezone.result new file mode 100644 index 00000000..a1a8e707 --- /dev/null +++ b/testing/tests/regression-suite/0904-PUT-bad-timezone.result @@ -0,0 +1,62 @@ +HTTP/1.1 201 Created +Date: Dow, 01 Jan 2000 00:00:00 GMT +DAV: 1, 2, 3, access-control, calendar-access, calendar-schedule +DAV: extended-mkcol, calendar-proxy, bind, addressbook, calendar-auto-schedule +ETag: "0b17d5f4102e63037d2ae732e4ca563d" +Content-Length: 0 +Content-Type: text/plain; charset="utf-8" + + + CalDAV Data: >BEGIN:VCALENDAR +CALSCALE:GREGORIAN +PRODID:-//Ximian//NONSGML Evolution Calendar//EN +VERSION:2.0 +BEGIN:VTIMEZONE +TZID:(UTC-05:00) Eastern Time (US & Canada) +BEGIN:STANDARD +DTSTART:16010101T020000 +TZOFFSETFROM:-0400 +TZOFFSETTO:-0500 +RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=11 +END:STANDARD +BEGIN:DAYLIGHT +DTSTART:16010101T020000 +TZOFFSETFROM:-0500 +TZOFFSETTO:-0400 +RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2SU;BYMONTH=3 +END:DAYLIGHT +END:VTIMEZONE +BEGIN:VEVENT +UID:PUT-eastern-time +DTSTAMP:20101009T214524Z +SUMMARY;LANGUAGE=en-US:Psychic's Anonymous Meeting +DTSTART;TZID="(UTC-05:00) Eastern Time (US & Canada)":20110912T110000 +DTEND;TZID="(UTC-05:00) Eastern Time (US & Canada)":20110912T113000 +LOCATION:You will know when you arrive +CREATED:20101010T014639 +LAST-MODIFIED:20101010T014639 +END:VEVENT +END:VCALENDAR +< + caldav_type: >VEVENT< + class: >PUBLIC< + dav_etag: >0b17d5f4102e63037d2ae732e4ca563d< + description: >NULL< + dtend: >2011-09-12 11:30:00< + dtstamp: >2010-10-09 21:45:24< + dtstart: >2011-09-12 11:00:00< + due: >NULL< + last_modified: >2010-10-10 01:46:39< + location: >You will know when you arrive< + logged_user: >10< + percent_complete: >NULL< + priority: >NULL< + rrule: >NULL< + status: >NULL< + summary: >Psychic's Anonymous Meeting< + transp: >NULL< + tz_id: >(UTC-05:00) Eastern Time (US & Canada)< + uid: >PUT-eastern-time< + url: >NULL< + user_no: >10< + diff --git a/testing/tests/regression-suite/0904-PUT-bad-timezone.test b/testing/tests/regression-suite/0904-PUT-bad-timezone.test new file mode 100644 index 00000000..05c07506 --- /dev/null +++ b/testing/tests/regression-suite/0904-PUT-bad-timezone.test @@ -0,0 +1,55 @@ +# +# PUT an event with a non-standard timezone +# +# There is no CalDAV defined behaviour for this. +# +TYPE=PUT +URL=http://mycaldav/caldav.php/user1/home/PUT-eastern-time.ics +HEADER=User-Agent: DAViCal Testing/0.9.x +HEADER=Content-Type: text/calendar; charset=utf-8 + +HEAD + +BEGINDATA +BEGIN:VCALENDAR +CALSCALE:GREGORIAN +PRODID:-//Ximian//NONSGML Evolution Calendar//EN +VERSION:2.0 +BEGIN:VTIMEZONE +TZID:(UTC-05:00) Eastern Time (US & Canada) +BEGIN:STANDARD +DTSTART:16010101T020000 +TZOFFSETFROM:-0400 +TZOFFSETTO:-0500 +RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=11 +END:STANDARD +BEGIN:DAYLIGHT +DTSTART:16010101T020000 +TZOFFSETFROM:-0500 +TZOFFSETTO:-0400 +RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2SU;BYMONTH=3 +END:DAYLIGHT +END:VTIMEZONE +BEGIN:VEVENT +UID:PUT-eastern-time +DTSTAMP:20101009T214524Z +SUMMARY;LANGUAGE=en-US:Psychic's Anonymous Meeting +DTSTART;TZID="(UTC-05:00) Eastern Time (US & Canada)":20110912T110000 +DTEND;TZID="(UTC-05:00) Eastern Time (US & Canada)":20110912T113000 +LOCATION:You will know when you arrive +CREATED:20101010T014639 +LAST-MODIFIED:20101010T014639 +END:VEVENT +END:VCALENDAR +ENDDATA + +QUERY +SELECT caldav_data.user_no, caldav_data.dav_etag, caldav_type, logged_user, + uid, dtstamp, dtstart at time zone tz_locn as dtstart, dtend at time zone tz_locn as dtend, due, summary, location, + description, priority, class, transp, rrule, url, + percent_complete, tz_id, status, + caldav_data AS " CalDAV Data", last_modified +FROM caldav_data JOIN calendar_item USING(dav_name) JOIN time_zone USING (tz_id) +WHERE caldav_data.dav_name = +'/user1/home/PUT-eastern-time.ics' +ENDQUERY diff --git a/testing/tests/regression-suite/1100-REPORT-sync-changed.result b/testing/tests/regression-suite/1100-REPORT-sync-changed.result index 1eb19210..3e559563 100644 --- a/testing/tests/regression-suite/1100-REPORT-sync-changed.result +++ b/testing/tests/regression-suite/1100-REPORT-sync-changed.result @@ -2,8 +2,8 @@ HTTP/1.1 207 Multi-Status Date: Dow, 01 Jan 2000 00:00:00 GMT DAV: 1, 2, 3, access-control, calendar-access, calendar-schedule DAV: extended-mkcol, calendar-proxy, bind, addressbook, calendar-auto-schedule -ETag: "097fa2801462b0c0267d02f9ec7c6c74" -Content-Length: 5578 +ETag: "f1d7fb1befbea4830cd1afc134974fc4" +Content-Length: 5873 Content-Type: text/xml; charset="utf-8" @@ -182,5 +182,15 @@ Content-Type: text/xml; charset="utf-8" HTTP/1.1 200 OK + + /caldav.php/user1/home/PUT-eastern-time.ics + + + "0b17d5f4102e63037d2ae732e4ca563d" + Dow, 01 Jan 2000 00:00:00 GMT + + HTTP/1.1 200 OK + + 4 diff --git a/testing/tests/scheduling/Restore-Database.result b/testing/tests/scheduling/Restore-Database.result index 685b8c70..d61c254c 100644 --- a/testing/tests/scheduling/Restore-Database.result +++ b/testing/tests/scheduling/Restore-Database.result @@ -1,6 +1,6 @@ setval -------- - 1638 + 1639 (1 row) setval