From b591115b724ee692674775d4ddd52d333fc9265b Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Mon, 27 Nov 2006 00:16:01 +1300 Subject: [PATCH] New class to handle requests, so we can extract permissions in a better way. Of course this breaks all of the existing code, so don't use this until I have all the regression tests passing again :-) --- dba/caldav_functions.sql | 2 +- htdocs/caldav.php | 118 ++------------------ inc/CalDAVRequest.php | 227 +++++++++++++++++++++++++++++++++++++++ rscds.webprj | 5 +- 4 files changed, 237 insertions(+), 115 deletions(-) create mode 100644 inc/CalDAVRequest.php diff --git a/dba/caldav_functions.sql b/dba/caldav_functions.sql index fe7535e1..717e5f73 100644 --- a/dba/caldav_functions.sql +++ b/dba/caldav_functions.sql @@ -207,7 +207,7 @@ DECLARE BEGIN -- Self can always have full access IF in_from = in_to THEN - RETURN ''RW''; + RETURN ''A''; END IF; -- dbg := ''S-''; diff --git a/htdocs/caldav.php b/htdocs/caldav.php index 50e6e8f7..d3d0943b 100644 --- a/htdocs/caldav.php +++ b/htdocs/caldav.php @@ -12,115 +12,10 @@ require_once("always.php"); dbg_error_log( "caldav", " User agent: %s", ((isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : "Unfortunately Mulberry and Chandler don't send a 'User-agent' header with their requests :-(")) ); require_once("BasicAuthSession.php"); -$raw_headers = apache_request_headers(); -$raw_post = file_get_contents ( 'php://input'); +require_once("CalDAVRequest.php"); +$request = new CalDAVRequest(); -if ( isset($debugging) && isset($_GET['method']) ) { - $_SERVER['REQUEST_METHOD'] = $_GET['method']; -} - -/** -* A variety of requests may set the "Depth" header to control recursion -*/ -$query_depth = ( isset($_SERVER['HTTP_DEPTH']) ? $_SERVER['HTTP_DEPTH'] : 0 ); -if ( $query_depth == 'infinite' ) $query_depth = 99; -$query_depth = intval($query_depth); - -/** -* Our path is /