Implement support for 'Brief' header.

Also add VPOLL and VAVAILABILITY to list of supported components.
This commit is contained in:
Andrew McMillan 2012-01-31 09:23:59 -08:00
parent 016dbefcfa
commit e9e5073eb5
3 changed files with 11 additions and 4 deletions

View File

@ -105,6 +105,11 @@ class CalDAVRequest
*/
public $ticket;
/**
* Whether this request included the 'Brief: T' header.
*/
public $brief_response;
/**
* Create a new CalDAVRequest object.
*/
@ -113,6 +118,8 @@ class CalDAVRequest
$this->options = $options;
if ( !isset($this->options['allow_by_email']) ) $this->options['allow_by_email'] = false;
$this->brief_response = (isset($_SERVER['HTTP_BRIEF']) && (strtoupper($_SERVER['HTTP_BRIEF']) == 'T'));
/**
* Our path is /<script name>/<user name>/<user controlled> if it ends in

View File

@ -1636,13 +1636,13 @@ EOQRY;
if ( isset($this->dead_properties[$tag]) ) {
$set_of_components = explode('"', $this->dead_properties[$tag]);
foreach( $set_of_components AS $k => $v ) {
if ( !preg_match('{(VEVENT|VTODO|VJOURNAL|VTIMEZONE|VFREEBUSY)}', $v) ) {
if ( !preg_match('{(VEVENT|VTODO|VJOURNAL|VTIMEZONE|VFREEBUSY|VPOLL|VAVAILABILITY)}', $v) ) {
unset( $set_of_components[$k] );
}
}
}
else {
$set_of_components = array( 'VEVENT', 'VTODO', 'VJOURNAL', 'VTIMEZONE', 'VFREEBUSY' );
$set_of_components = array( 'VEVENT', 'VTODO', 'VJOURNAL', 'VTIMEZONE', 'VFREEBUSY', 'VPOLL', 'VAVAILABILITY' );
}
}
else if ( $this->IsSchedulingCollection() )
@ -1800,7 +1800,7 @@ EOQRY;
$elements[] = new XMLElement( 'propstat', array( $noprop, $status) );
}
if ( count($not_found) > 0 ) {
if ( !(isset($request->brief_response) && $request->brief_response) && count($not_found) > 0 ) {
$status = new XMLElement('status', 'HTTP/1.1 404 Not Found' );
$noprop = new XMLElement('prop');
foreach( $not_found AS $k => $v ) {

View File

@ -200,7 +200,7 @@ function component_to_xml( $properties, $item ) {
$elements[] = new XMLElement( "propstat", array( $noprop, $status) );
}
if ( count($unsupported) > 0 ) {
if ( !(isset($request->brief_response) && $request->brief_response) && count($unsupported) > 0 ) {
$status = new XMLElement("status", "HTTP/1.1 404 Not Found" );
$noprop = new XMLElement("prop");
foreach( $unsupported AS $k => $v ) {