From f37daa4ed7acca93065d617e9660aa28848feeb3 Mon Sep 17 00:00:00 2001 From: Florian Schlichting Date: Sun, 7 Jan 2018 00:35:16 +0100 Subject: [PATCH] clean up obsolete code: supported_methods and supported_reports was moved to DAVResource --- htdocs/caldav.php | 7 ++-- inc/CalDAVRequest.php | 83 ------------------------------------------- 2 files changed, 2 insertions(+), 88 deletions(-) diff --git a/htdocs/caldav.php b/htdocs/caldav.php index a1763b82..865d6d2f 100644 --- a/htdocs/caldav.php +++ b/htdocs/caldav.php @@ -89,15 +89,12 @@ register_shutdown_function('late_catch_fatal_error'); //if ( $request->method == 'OPTIONS' || $c->always_send_dav_header ) send_dav_header(); // Avoid polluting global namespace -$allowed = implode( ', ', array_keys($request->supported_methods) ); -// header( 'Allow: '.$allowed); - if ( ! ($request->IsPrincipal() || isset($request->collection) || $request->method == 'PUT' || $request->method == 'MKCALENDAR' || $request->method == 'MKCOL' ) ) { if ( preg_match( '#^/principals/users(/.*/)$#', $request->path, $matches ) ) { // Although this doesn't work with the iPhone, perhaps it will with iCal... - /** @todo integrate handling this URL into CalDAVRequest.php */ + // This is better handled by a RewriteRule, see config/apache-davical.conf $redirect_url = ConstructURL('/caldav.php'.$matches[1]); - dbg_error_log( 'LOG WARNING', 'Redirecting %s for "%s" to "%s"', $request->method, $request->path, $redirect_url ); + dbg_error_log( 'LOG WARNING', 'Redirecting %s for "%s" to "%s", consider using rewrites in the webserver instead!', $request->method, $request->path, $redirect_url ); header('Location: '.$redirect_url ); @ob_flush(); exit(0); } diff --git a/inc/CalDAVRequest.php b/inc/CalDAVRequest.php index 067c57da..c3e7ed89 100644 --- a/inc/CalDAVRequest.php +++ b/inc/CalDAVRequest.php @@ -466,89 +466,6 @@ EOSQL; */ $this->setPermissions(); - $this->supported_methods = array( - 'OPTIONS' => '', - 'PROPFIND' => '', - 'REPORT' => '', - 'DELETE' => '', - 'LOCK' => '', - 'UNLOCK' => '', - 'MOVE' => '', - 'ACL' => '' - ); - if ( $this->IsCollection() ) { - switch ( $this->collection_type ) { - case 'root': - case 'email': - // We just override the list completely here. - $this->supported_methods = array( - 'OPTIONS' => '', - 'PROPFIND' => '', - 'REPORT' => '' - ); - break; - case 'schedule-inbox': - case 'schedule-outbox': - $this->supported_methods = array_merge( - $this->supported_methods, - array( - 'POST' => '', 'GET' => '', 'PUT' => '', 'HEAD' => '', 'PROPPATCH' => '' - ) - ); - break; - case 'calendar': - $this->supported_methods['GET'] = ''; - $this->supported_methods['PUT'] = ''; - $this->supported_methods['HEAD'] = ''; - break; - case 'collection': - case 'principal': - $this->supported_methods['GET'] = ''; - $this->supported_methods['PUT'] = ''; - $this->supported_methods['HEAD'] = ''; - $this->supported_methods['MKCOL'] = ''; - $this->supported_methods['MKCALENDAR'] = ''; - $this->supported_methods['PROPPATCH'] = ''; - $this->supported_methods['BIND'] = ''; - break; - } - } - else { - $this->supported_methods = array_merge( - $this->supported_methods, - array( - 'GET' => '', - 'HEAD' => '', - 'PUT' => '' - ) - ); - } - - $this->supported_reports = array( - 'DAV::principal-property-search' => '', - 'DAV::expand-property' => '', - 'DAV::sync-collection' => '' - ); - if ( isset($this->collection) && $this->collection->is_calendar ) { - $this->supported_reports = array_merge( - $this->supported_reports, - array( - 'urn:ietf:params:xml:ns:caldav:calendar-query' => '', - 'urn:ietf:params:xml:ns:caldav:calendar-multiget' => '', - 'urn:ietf:params:xml:ns:caldav:free-busy-query' => '' - ) - ); - } - if ( isset($this->collection) && $this->collection->is_addressbook ) { - $this->supported_reports = array_merge( - $this->supported_reports, - array( - 'urn:ietf:params:xml:ns:carddav:addressbook-query' => '', - 'urn:ietf:params:xml:ns:carddav:addressbook-multiget' => '' - ) - ); - } - /** * If the content we are receiving is XML then we parse it here. RFC2518 says we