diff --git a/dba/patches/1.1.9.sql b/dba/patches/1.1.9.sql index 056cd100..e3d49113 100644 --- a/dba/patches/1.1.9.sql +++ b/dba/patches/1.1.9.sql @@ -1,13 +1,13 @@ --- Adding a primary key to the calendar_item table +-- Make sure that class is set to something, by default PUBLIC. +-- According to RFC2445, 4.8.1.3. BEGIN; SELECT check_db_revision(1,1,8); -ALTER TABLE calendar_item ADD PRIMARY KEY (user_no, dav_name ); +UPDATE calendar_item SET class = 'PUBLIC' WHERE class IS NULL; -SELECT new_db_revision(1,1,9, 'September' ); +SELECT new_db_revision(1,1,9, 'October' ); COMMIT; ROLLBACK; -VACUUM FULL ANALYZE; \ No newline at end of file diff --git a/inc/caldav-PUT-functions.php b/inc/caldav-PUT-functions.php index 7deee23b..7b2ae3d5 100644 --- a/inc/caldav-PUT-functions.php +++ b/inc/caldav-PUT-functions.php @@ -185,6 +185,16 @@ function import_collection( $ics_content, $user_no, $path, $caldav_context ) { $dtstamp = $last_modified; } + /* + * It seems that some calendar clients don't set a class... + * RFC2445, 4.8.1.3: + * Default is PUBLIC + */ + $class = $ic->Get("class"); + if ( !isset($class) || $class == '' ) { + $class = 'PUBLIC' + } + $sql .= <<Get('uid'), $dtstamp, $ic->Get('dtstart'), $ic->Get('summary'), $ic->Get('location'), - $ic->Get('class'), $ic->Get('transp'), $ic->Get('description'), $ic->Get('rrule'), $ic->Get('tz_id'), + $class, $ic->Get('transp'), $ic->Get('description'), $ic->Get('rrule'), $ic->Get('tz_id'), $last_modified, $ic->Get('url'), $ic->Get('priority'), $ic->Get('created'), $ic->Get('due'), $ic->Get('percent-complete') ); @@ -315,6 +325,17 @@ function putCalendarResource( &$request, $author, $caldav_context ) { $dtstamp = $last_modified; } + /* + * It seems that some calendar clients don't set a class... + * RFC2445, 4.8.1.3: + * Default is PUBLIC + */ + $class = $ic->Get("class"); + if ( !isset($class) || $class == '' ) { + $class = 'PUBLIC' + } + + if ( $put_action_type != 'INSERT' ) { $sql .= "DELETE FROM calendar_item WHERE user_no=$request->user_no AND dav_name=".qpg($request->path).";"; } @@ -327,7 +348,7 @@ EOSQL; $qry = new PgQuery( $sql, $request->user_no, $request->path, $etag, $ic->Get('UID'), $dtstamp, $ic->Get('DTSTART'), $ic->Get('SUMMARY'), $ic->Get('LOCATION'), - $ic->Get('CLASS'), $ic->Get('TRANSP'), $ic->Get('DESCRIPTION'), $ic->Get('RRULE'), $ic->Get('TZ_ID'), + $class, $ic->Get('TRANSP'), $ic->Get('DESCRIPTION'), $ic->Get('RRULE'), $ic->Get('TZ_ID'), $last_modified, $ic->Get('URL'), $ic->Get('PRIORITY'), $ic->Get('CREATED'), $ic->Get('DUE'), $ic->Get('PERCENT-COMPLETE'), $ic->Get('STATUS') );