diff --git a/groupdav.php b/groupdav.php index fb76f619c8..2d123f4c0d 100644 --- a/groupdav.php +++ b/groupdav.php @@ -44,4 +44,4 @@ $headertime = microtime(true); $groupdav = new groupdav(); $groupdav->ServeRequest(); -//error_log(sprintf("GroupDAV %s request took %5.3f s (header include took %5.3f s)",$_SERVER['REQUEST_METHOD'],microtime(true)-$starttime,$headertime-$starttime)); +error_log(sprintf('GroupDAV %s request: status "%s", took %5.3f s'.($headertime?' (header include took %5.3f s)':''),$_SERVER['REQUEST_METHOD'].($_SERVER['REQUEST_METHOD']=='REPORT'?' '.$groupdav->propfind_options['root']['name']:'').' '.$_SERVER['PATH_INFO'],$groupdav->_http_status,microtime(true)-$starttime,$headertime-$starttime)); diff --git a/phpgwapi/inc/class.groupdav.inc.php b/phpgwapi/inc/class.groupdav.inc.php index 6cc3858edd..93abe779fb 100644 --- a/phpgwapi/inc/class.groupdav.inc.php +++ b/phpgwapi/inc/class.groupdav.inc.php @@ -277,32 +277,40 @@ class groupdav extends HTTP_WebDAV_Server */ function OPTIONS($path, &$dav, &$allow) { - list(,$app) = explode('/',$path); - switch($app) + if (preg_match('#/(calendar|inbox|outbox)/#', $path)) { - case 'calendar': - if (!in_array(2,$dav)) $dav[] = 2; - $dav[] = 'access-control'; - $dav[] = 'calendar-access'; - $dav[] = 'calendar-auto-schedule'; - $dav[] = 'calendar-proxy'; - //$dav[] = 'calendar-availibility'; - //$dav[] = 'calendarserver-private-events'; - break; - case 'addressbook': - if (!in_array(2,$dav)) $dav[] = 2; - //$dav[] = 3; // revision aka versioning support not implemented - $dav[] = 'access-control'; - $dav[] = 'addressbook'; // CardDAV uses "addressbook" NOT "addressbook-access" - break; - default: // used eg. for root, and needs all above settings, as some clients only use these! - if (!in_array(2,$dav)) $dav[] = 2; - $dav[] = 'access-control'; - $dav[] = 'calendar-access'; - $dav[] = 'calendar-auto-schedule'; - $dav[] = 'calendar-proxy'; - $dav[] = 'addressbook'; + $app = 'calendar'; } + elseif (strpos($path, '/addressbook/') !== false) + { + $app = 'addressbook'; + } + // CalDAV and CardDAV + if (!in_array(2,$dav)) $dav[] = 2; + $dav[] = 'access-control'; + + if ($app !== 'addressbook') // CalDAV + { + $dav[] = 'calendar-access'; + $dav[] = 'calendar-auto-schedule'; + $dav[] = 'calendar-proxy'; + // required by iOS iCal to use principal-property-search to autocomplete participants (and locations) + $dav[] = 'calendarserver-principal-property-search'; + // other capabilities calendarserver announces + //$dav[] = 'calendar-schedule'; + //$dav[] = 'calendar-availability'; + //$dav[] = 'inbox-availability'; + //$dav[] = 'calendarserver-private-events'; + //$dav[] = 'calendarserver-private-comments'; + //$dav[] = 'calendarserver-sharing'; + //$dav[] = 'calendarserver-sharing-no-scheduling'; + + } + elseif ($app !== 'calendar') // CardDAV + { + $dav[] = 'addressbook'; // CardDAV uses "addressbook" NOT "addressbook-access" + } + //error_log(__METHOD__."('$path') --> app='$app' --> DAV: ".implode(', ', $dav)); } /** @@ -502,7 +510,7 @@ class groupdav extends HTTP_WebDAV_Server $ret = false; foreach($this->propfind_options['props'] as $prop) { - if ($prop['name'] == $name && (is_null($ns) || $prop['ns'] == $ns)) + if ($prop['name'] == $name && (is_null($ns) || $prop['xmlns'] == $ns)) { $ret = true; break; @@ -858,6 +866,11 @@ class groupdav extends HTTP_WebDAV_Server } echo "\n"; + $dav = array(1); + $allow = false; + $this->OPTIONS($options['path'], $dav, $allow); + echo "
DAV: ".implode(', ', $dav)."
\n"; + echo "