From 4f885d055c6dbba3536ea055e887b7e54aaf52e3 Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Wed, 28 Oct 2009 18:42:21 +1300 Subject: [PATCH] Implementations of supported-report-set and supported-method-set. --- inc/CalDAVRequest.php | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/inc/CalDAVRequest.php b/inc/CalDAVRequest.php index 81282d3b..20d26ece 100644 --- a/inc/CalDAVRequest.php +++ b/inc/CalDAVRequest.php @@ -891,17 +891,30 @@ EOSQL; */ function RenderSupportedMethods( ) { global $reply; - $methods = array(); + $methods = new XMLElement('supported-method-set'); foreach( $this->supported_methods AS $k => $v ) { dbg_error_log( 'caldav', 'Adding method "%s" which is "%s".', $k, $v ); - $method = new XMLElement('method'); - $reply->NSElement($method,$k); - $methods[] = new XMLElement('supported-method',$method); + $reply->NSElement( $methods, 'DAV::supported-method', null, array('name' => $k) ); } return $methods; } + /** + * Returns the array of supported methods converted into XMLElements + */ + function RenderSupportedReports( ) { + global $reply; + $reports = array(); + foreach( $this->supported_reports AS $k => $v ) { + dbg_error_log( 'caldav', 'Adding supported report "%s" which is "%s".', $k, $v ); + $report = new XMLElement('supported-report'); + $reply->NSElement($report, $k ); + } + return new XMLElement('supported-report-set', $reports); + } + + /** * Return general server-related properties for this URL */ @@ -1100,7 +1113,8 @@ EOSQL; } } - echo translate($message); + header( "Content-Length: ".strlen($message) ); + echo $message; if ( strlen($message) > 100 || strstr($message, "\n") ) { $message = substr( preg_replace("#\s+#m", ' ', $message ), 0, 100) . (strlen($message) > 100 ? "..." : "");