From 61b5bae4f79c43fc1e2ceae445a61a162f1cff92 Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Wed, 11 Oct 2006 14:13:43 +1300 Subject: [PATCH] Use new global config for server/port/script value. Ensure we quote the ETag, and also that we return "501 not implemented" when we don't do stuff, rather than Infernal Server Error. --- inc/caldav-REPORT.php | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/inc/caldav-REPORT.php b/inc/caldav-REPORT.php index 5fab1035..378de6a6 100644 --- a/inc/caldav-REPORT.php +++ b/inc/caldav-REPORT.php @@ -154,7 +154,7 @@ function calendar_to_xml( $properties, $item ) { dbg_error_log("REPORT","Building XML Response for item '%s'", $item->dav_name ); - $url = sprintf( "%s://%s:%d%s%s", 'http', $_SERVER['SERVER_NAME'], $_SERVER['SERVER_PORT'], $_SERVER['SCRIPT_NAME'], $item->dav_name ); + $url = $c->protocol_server_port_script . $item->dav_name; $prop = new XMLElement("prop"); if ( isset($properties['GETCONTENTLENGTH']) ) { $contentlength = strlen($item->caldav_data); @@ -176,19 +176,7 @@ function calendar_to_xml( $properties, $item ) { $prop->NewElement("getetag", '"'.$item->dav_etag.'"' ); } if ( isset($properties['CURRENT-USER-PRIVILEGE-SET']) ) { - /** - * FIXME: Fairly basic set of privileges at present. - */ - if ( $session->AllowedTo("Admin") && preg_match("#/.+/.#", $item->dav_name) ) { - $privs = array("all"); - } - else { - $privs = array("read"); - if ( $session->user_no == $item->user_no || $session->AllowedTo("Admin") ) { - $privs[] = "write"; - } - } - $prop->NewElement("current-user-privilege-set", privileges($privs) ); + $prop->NewElement("current-user-privilege-set", privileges($GLOBALS['permissions']) ); } $status = new XMLElement("status", "HTTP/1.1 200 OK" ); @@ -208,7 +196,7 @@ if ( isset($unsupported) && count($unsupported) > 0 ) { * That's a *BAD* request! */ - header('HTTP/1.1 403 Forbidden'); + header('HTTP/1.1 501 Not Implemented'); header('Content-Type: application/xml; charset="utf-8"'); $badprops = new XMLElement( "prop" );