From 0e1df68878848e3cd51f6e8d9b912d89ae0f2815 Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Sun, 28 Feb 2010 22:39:02 +1300 Subject: [PATCH] Correct allprop/include processing. --- inc/DAVResource.php | 16 +++++++++------- inc/always.php | 4 ++-- inc/always.php.in | 2 +- inc/caldav-REPORT-calquery.php | 7 +++---- 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/inc/DAVResource.php b/inc/DAVResource.php index 5a2bb558..46c8aeb4 100644 --- a/inc/DAVResource.php +++ b/inc/DAVResource.php @@ -955,13 +955,15 @@ EOQRY; */ function DAV_AllProperties() { if ( isset($this->dead_properties) ) $this->FetchDeadProperties(); - $allprop = array_merge( (isset($this->dead_properties)?$this->dead_properties:array()), array( - 'DAV::getcontenttype', 'DAV::resourcetype', 'DAV::getcontentlength', 'DAV::displayname', 'DAV::getlastmodified', - 'DAV::creationdate', 'DAV::getetag', 'DAV::getcontentlanguage', 'DAV::supportedlock', 'DAV::lockdiscovery', - 'DAV::owner', 'DAV::principal-URL', 'DAV::current-user-principal', - 'urn:ietf:params:xml:ns:carddav:max-resource-size', 'urn:ietf:params:xml:ns:carddav:supported-address-data', - 'urn:ietf:params:xml:ns:carddav:addressbook-description', 'urn:ietf:params:xml:ns:carddav:addressbook-home-set' - ) ); + $allprop = array_merge( (isset($this->dead_properties)?$this->dead_properties:array()), + (isset($include_properties)?$include_properties:array()), + array( + 'DAV::getcontenttype', 'DAV::resourcetype', 'DAV::getcontentlength', 'DAV::displayname', 'DAV::getlastmodified', + 'DAV::creationdate', 'DAV::getetag', 'DAV::getcontentlanguage', 'DAV::supportedlock', 'DAV::lockdiscovery', + 'DAV::owner', 'DAV::principal-URL', 'DAV::current-user-principal', + 'urn:ietf:params:xml:ns:carddav:max-resource-size', 'urn:ietf:params:xml:ns:carddav:supported-address-data', + 'urn:ietf:params:xml:ns:carddav:addressbook-description', 'urn:ietf:params:xml:ns:carddav:addressbook-home-set' + ) ); return $allprop; } diff --git a/inc/always.php b/inc/always.php index 560e04bc..0c7c00f5 100644 --- a/inc/always.php +++ b/inc/always.php @@ -10,7 +10,7 @@ $c = (object) array(); // Ditto for a few other global things -unset($session); unset($request); unset($dbconn); unset($_awl_dbconn); +unset($session); unset($request); unset($dbconn); unset($_awl_dbconn); unset($include_properties); // An ultra-simple exception handler to catch errors that occur // before we get a more functional exception handler in place... @@ -148,7 +148,7 @@ $_SERVER['SERVER_NAME'] = $c->domain_name; require_once('PgQuery.php'); -$c->want_dbversion = array(1,2,7); +$c->want_dbversion = array(1,2,8); $c->schema_version = 0; $qry = new PgQuery( 'SELECT schema_major, schema_minor, schema_patch FROM awl_db_revision ORDER BY schema_id DESC LIMIT 1;' ); if ( $qry->Exec('always') && $row = $qry->Fetch() ) { diff --git a/inc/always.php.in b/inc/always.php.in index df1e1475..8e3ee9d8 100644 --- a/inc/always.php.in +++ b/inc/always.php.in @@ -10,7 +10,7 @@ $c = (object) array(); // Ditto for a few other global things -unset($session); unset($request); unset($dbconn); unset($_awl_dbconn); +unset($session); unset($request); unset($dbconn); unset($_awl_dbconn); unset($include_properties); // An ultra-simple exception handler to catch errors that occur // before we get a more functional exception handler in place... diff --git a/inc/caldav-REPORT-calquery.php b/inc/caldav-REPORT-calquery.php index 5b3c202b..a77f7e72 100644 --- a/inc/caldav-REPORT-calquery.php +++ b/inc/caldav-REPORT-calquery.php @@ -6,7 +6,7 @@ function check_for_expansion( $calendar_data_node ) { if ( !class_exists('DateTime') ) return; /** We don't support expansion on PHP5.1 */ - $expansion = $v->GetElements('urn:ietf:params:xml:ns:caldav:expand'); + $expansion = $calendar_data_node->GetElements('urn:ietf:params:xml:ns:caldav:expand'); if ( isset($expansion[0]) ) { $need_expansion = true; $expand_range_start = $expansion[0]->GetAttribute('start'); @@ -28,7 +28,7 @@ switch( $proptype ) { foreach( $qry_content[0]->GetElements() AS $k => $v ) { $propertyname = preg_replace( '/^.*:/', '', $v->GetTag() ); $properties[$propertyname] = 1; - if ( $v->GetTag() == 'calendar-data' ) check_for_expansion($v); + if ( $v->GetTag() == 'urn:ietf:params:xml:ns:caldav:calendar-data' ) check_for_expansion($v); } break; @@ -36,8 +36,7 @@ switch( $proptype ) { $properties['allprop'] = 1; if ( $qry_content[1]->GetTag() == 'DAV::include' ) { foreach( $qry_content[1]->GetElements() AS $k => $v ) { - $propertyname = preg_replace( '/^.*:/', '', $v->GetTag() ); - $properties[$propertyname] = 1; + $include_properties[] = $v->GetTag(); /** $include_properties is referenced in DAVResource where allprop is expanded */ if ( $v->GetTag() == 'urn:ietf:params:xml:ns:caldav:calendar-data' ) check_for_expansion($v); } }