From 0e6be2613ee1917c2fd9e91daad07ed595d3d3c6 Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Sun, 8 Nov 2009 20:32:11 +1300 Subject: [PATCH] Slightly improved initialisation from row. --- inc/DAVResource.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/inc/DAVResource.php b/inc/DAVResource.php index 73feaed6..006342e5 100644 --- a/inc/DAVResource.php +++ b/inc/DAVResource.php @@ -230,15 +230,19 @@ class DAVResource if ( $row == null ) return; $this->exists = true; + $this->_is_collection = preg_match( '{/$}', $row->dav_name ); + foreach( $row AS $k => $v ) { dbg_error_log( 'DAVResource', 'Processing resource property "%s" has "%s".', $row->dav_name, $k ); + $this->resource->{$k} = $v; switch ( $k ) { case 'dav_etag': $this->unique_tag = '"'.$v.'"'; break; - default: - $this->{$k} = $v; + case 'is_calendar': if ( $this->_is_collection) $this->_is_calendar = ($v == 't'); break; + case 'is_addressbook': if ( $this->_is_collection) $this->_is_addressbook = ($v == 't'); break; + case 'is_principal': if ( $this->_is_collection) $this->_is_principal = ($v == 't'); break; } } }