diff --git a/inc/CalDAVPrincipal.php b/inc/CalDAVPrincipal.php index 56c65eeb..d3b4b802 100644 --- a/inc/CalDAVPrincipal.php +++ b/inc/CalDAVPrincipal.php @@ -403,6 +403,7 @@ class CalDAVPrincipal * Return the privileges bits for the current session user to this resource */ function Privileges() { + if ( !isset($this->privileges) ) if ( is_string($this->privileges) ) $this->privileges = bindec( $this->privileges ); return $this->privileges; } diff --git a/inc/CalDAVRequest.php b/inc/CalDAVRequest.php index 2950c1df..5ce24998 100644 --- a/inc/CalDAVRequest.php +++ b/inc/CalDAVRequest.php @@ -310,20 +310,23 @@ class CalDAVRequest } $this->collection->type = $this->collection_type; } - else if ( preg_match( '#^((/[^/]+/)\.(in|out)/)[^/]*$#', $this->path, $matches ) ) { + else if ( preg_match( '{^( ( / ([^/]+) / ) \.(in|out)/ ) [^/]*$}x', $this->path, $matches ) ) { // The request is for a scheduling inbox or outbox (or something inside one) and we should auto-create it - $displayname = $session->fullname . ($matches[3] == 'in' ? ' Inbox' : ' Outbox'); - $this->collection_type = 'schedule-'. $matches[3]. 'box'; - $resourcetypes = sprintf('', $this->collection_type ); + $params = array( ':username' => $matches[3], ':parent_container' => $matches[2], ':dav_name' => $matches[1] ); + $params[':boxname'] = ($matches[4] == 'in' ? ' Inbox' : ' Outbox'); + $this->collection_type = 'schedule-'. $matches[4]. 'box'; + $params[':resourcetypes'] = sprintf('', $this->collection_type ); $sql = << $session->user_no, ':parent_path' => $matches[2], ':dav_name' => $matches[1], - ':displayname' => $displayname, ':resourcetypes' => $resourcetypes ); + $qry = new AwlQuery( $sql, $params ); $qry->Exec('caldav',__LINE__,__FILE__); - dbg_error_log( "caldav", "Created new collection as '$displayname'." ); + dbg_error_log( 'caldav', 'Created new collection as "%s".', trim($params[':boxname']) ); $qry = new AwlQuery( "SELECT * FROM collection WHERE dav_name = :dav_name", array( ':dav_name' => $matches[1] ) ); if ( $qry->Exec('caldav',__LINE__,__FILE__) && $qry->rows() == 1 && ($row = $qry->Fetch()) ) { diff --git a/inc/DAVResource.php b/inc/DAVResource.php index 94c0995b..ef56c720 100644 --- a/inc/DAVResource.php +++ b/inc/DAVResource.php @@ -324,19 +324,22 @@ class DAVResource else $this->collection->type = 'collection'; } - else if ( preg_match( '#^((/[^/]+/)\.(in|out)/)[^/]*$#', $this->dav_name, $matches ) ) { + else if ( preg_match( '{^( ( / ([^/]+) / ) \.(in|out)/ ) [^/]*$}x', $this->dav_name, $matches ) ) { // The request is for a scheduling inbox or outbox (or something inside one) and we should auto-create it - $params = array( ':user_no' => $session->user_no, ':parent_container' => $matches[2], ':dav_name' => $matches[1] ); - $params[':displayname'] = $session->fullname . ($matches[3] == 'in' ? ' Inbox' : ' Outbox'); - $this->collection_type = 'schedule-'. $matches[3]. 'box'; + $params = array( ':username' => $matches[3], ':parent_container' => $matches[2], ':dav_name' => $matches[1] ); + $params[':boxname'] = ($matches[4] == 'in' ? ' Inbox' : ' Outbox'); + $this->collection_type = 'schedule-'. $matches[4]. 'box'; $params[':resourcetypes'] = sprintf('', $this->collection_type ); $sql = <<Exec('DAVResource'); - dbg_error_log( 'DAVResource', 'Created new collection as "$displayname".' ); + dbg_error_log( 'DAVResource', 'Created new collection as "%s".', trim($params[':boxname']) ); $params = array( ':raw_path' => $this->dav_name, ':session_principal' => $session->principal_id, ':scan_depth' => $c->permission_scan_depth ); $qry = new AwlQuery( $base_sql . ' dav_name = :raw_path', $params ); @@ -449,7 +452,7 @@ EOSQL; */ function FetchPrincipal() { global $c, $session; - $this->principal = new CalDAVPrincipal( array( "path" => $this->dav_name ) ); + $this->principal = new CalDAVPrincipal( array( "path" => $this->bound_from() ) ); if ( $this->_is_principal && $this->principal->Exists() ) { // $this->contenttype = 'httpd/unix-directory'; $this->exists = true; @@ -540,6 +543,9 @@ EOQRY; if ( ! isset($this->collection) ) $this->FetchCollection(); $this->privileges = 0; if ( !isset($this->collection->path_privs) ) { + if ( !isset($this->collection->parent_container) ) { + $this->collection->parent_container = preg_replace('{/[^/]+/$}', '', $this->collection->dav_name); + } dbg_error_log( 'DAVResource', 'Checking privileges of "%s" - parent of "%s" (dav_name: %s)', $this->collection->parent_container, $this->collection->dav_name, $this->dav_name() ); $parent = new DAVResource( $this->collection->parent_container ); diff --git a/testing/test-RRULE-v2.php b/testing/test-RRULE-v2.php index 80d3bb48..b49dd54c 100755 --- a/testing/test-RRULE-v2.php +++ b/testing/test-RRULE-v2.php @@ -12,7 +12,7 @@ $c->dbg = array(); require_once("RRule-v2.php"); require_once('AwlQuery.php'); -header("Content-type: text/plain"); +@header("Content-type: text/plain"); echo << @@ -12,7 +12,7 @@ Content-Type: text/xml; charset="utf-8" "29a4f57ff8c8564c364d37fac0e18e34" - User 1 Inbox + User 2 Inbox @@ -32,4 +32,26 @@ Content-Type: text/xml; charset="utf-8" HTTP/1.1 404 Not Found + + /caldav.php/user2/.in/15f40cce00b378332164188cf779f0d6.ics + + + test meeting + + + /caldav.php/user2/home/ + + + HTTP/1.1 200 OK + + + + + + + + + HTTP/1.1 404 Not Found + + diff --git a/testing/tests/regression-suite/522-iCal-PROPFIND.result b/testing/tests/regression-suite/522-iCal-PROPFIND.result index cecbd9e9..51363538 100644 --- a/testing/tests/regression-suite/522-iCal-PROPFIND.result +++ b/testing/tests/regression-suite/522-iCal-PROPFIND.result @@ -1,8 +1,8 @@ HTTP/1.1 207 Multi-Status Date: Dow, 01 Jan 2000 00:00:00 GMT DAV: 1, 2, access-control, calendar-access, calendar-schedule, extended-mkcol, calendar-proxy -ETag: "c4f5aca6816fa9251ab0c662adadf0c9" -Content-Length: 3316 +ETag: "15c404c52f510728b184026a924e53e7" +Content-Length: 3930 Content-Type: text/xml; charset="utf-8" @@ -57,6 +57,31 @@ Content-Type: text/xml; charset="utf-8" HTTP/1.1 404 Not Found + + /caldav.php/user2/.in/ + + + "29a4f57ff8c8564c364d37fac0e18e34" + User 2 Inbox + + + + + + /caldav.php/user2/home/ + + + HTTP/1.1 200 OK + + + + + + + + HTTP/1.1 404 Not Found + + /caldav.php/user2/.out/ diff --git a/testing/tests/regression-suite/527-iCal-PROPFIND.result b/testing/tests/regression-suite/527-iCal-PROPFIND.result index 59fde3ed..c6116e39 100644 --- a/testing/tests/regression-suite/527-iCal-PROPFIND.result +++ b/testing/tests/regression-suite/527-iCal-PROPFIND.result @@ -1,46 +1,17 @@ -HTTP/1.1 207 Multi-Status +HTTP/1.1 403 Forbidden Date: Dow, 01 Jan 2000 00:00:00 GMT DAV: 1, 2, access-control, calendar-access, calendar-schedule, extended-mkcol, calendar-proxy -ETag: "1f0e016ecbd8566bc60b88a167178059" -Content-Length: 1071 +Content-Length: 216 Content-Type: text/xml; charset="utf-8" - - - /caldav.php/resmgr1/ - - - - /caldav.php/resource1/calendar-proxy-write/ - /caldav.php/resource2/calendar-proxy-write/ - - - HTTP/1.1 200 OK - - - - /caldav.php/resmgr1/calendar-proxy-read/ - - - - /caldav.php/resource1/calendar-proxy-write/ - /caldav.php/resource2/calendar-proxy-write/ - - - HTTP/1.1 200 OK - - - - /caldav.php/resmgr1/calendar-proxy-write/ - - - - /caldav.php/resource1/calendar-proxy-write/ - /caldav.php/resource2/calendar-proxy-write/ - - - HTTP/1.1 200 OK - - - + + + + /caldav.php/resmgr1/ + + + + + + diff --git a/testing/tests/regression-suite/528-iCal-PROPFIND.result b/testing/tests/regression-suite/528-iCal-PROPFIND.result index 59fde3ed..c6116e39 100644 --- a/testing/tests/regression-suite/528-iCal-PROPFIND.result +++ b/testing/tests/regression-suite/528-iCal-PROPFIND.result @@ -1,46 +1,17 @@ -HTTP/1.1 207 Multi-Status +HTTP/1.1 403 Forbidden Date: Dow, 01 Jan 2000 00:00:00 GMT DAV: 1, 2, access-control, calendar-access, calendar-schedule, extended-mkcol, calendar-proxy -ETag: "1f0e016ecbd8566bc60b88a167178059" -Content-Length: 1071 +Content-Length: 216 Content-Type: text/xml; charset="utf-8" - - - /caldav.php/resmgr1/ - - - - /caldav.php/resource1/calendar-proxy-write/ - /caldav.php/resource2/calendar-proxy-write/ - - - HTTP/1.1 200 OK - - - - /caldav.php/resmgr1/calendar-proxy-read/ - - - - /caldav.php/resource1/calendar-proxy-write/ - /caldav.php/resource2/calendar-proxy-write/ - - - HTTP/1.1 200 OK - - - - /caldav.php/resmgr1/calendar-proxy-write/ - - - - /caldav.php/resource1/calendar-proxy-write/ - /caldav.php/resource2/calendar-proxy-write/ - - - HTTP/1.1 200 OK - - - + + + + /caldav.php/resmgr1/ + + + + + + diff --git a/testing/tests/regression-suite/602-Soho-PROPFIND.result b/testing/tests/regression-suite/602-Soho-PROPFIND.result index ac65c2ed..0d82a196 100644 --- a/testing/tests/regression-suite/602-Soho-PROPFIND.result +++ b/testing/tests/regression-suite/602-Soho-PROPFIND.result @@ -1,8 +1,8 @@ HTTP/1.1 207 Multi-Status Date: Dow, 01 Jan 2000 00:00:00 GMT DAV: 1, 2, access-control, calendar-access, calendar-schedule, extended-mkcol, calendar-proxy -ETag: "ea92b512c27205b703cb6f52043bb6d3" -Content-Length: 4476 +ETag: "c54c9883b5a5959588d208034cd782e1" +Content-Length: 14796 Content-Type: text/xml; charset="utf-8" @@ -51,6 +51,358 @@ Content-Type: text/xml; charset="utf-8" HTTP/1.1 404 Not Found + + /caldav.php/user1/home/3F4CF6227300FD062D9EF3CDFB30D32D-0.ics + + + + /caldav.php/user1/ + + + mailto:user1@example.net + /caldav.php/user1/ + + + HTTP/1.1 200 OK + + + + + + + HTTP/1.1 404 Not Found + + + + /caldav.php/user1/home/20061101T073004Z.ics + + + + /caldav.php/user1/ + + + mailto:user1@example.net + /caldav.php/user1/ + + + HTTP/1.1 200 OK + + + + + + + HTTP/1.1 404 Not Found + + + + /caldav.php/user1/home/4aaf8f37-f232-4c8e-a72e-e171d4c4fe54.ics + + + + /caldav.php/user1/ + + + mailto:user1@example.net + /caldav.php/user1/ + + + HTTP/1.1 200 OK + + + + + + + HTTP/1.1 404 Not Found + + + + /caldav.php/user1/home/9d050be7-8a02-4355-8ed3-02a9fc5f473f.ics + + + + /caldav.php/user1/ + + + mailto:user1@example.net + /caldav.php/user1/ + + + HTTP/1.1 200 OK + + + + + + + HTTP/1.1 404 Not Found + + + + /caldav.php/user1/home/1906b3ca-4890-468a-9b58-1de74bf2c716.ics + + + + /caldav.php/user1/ + + + mailto:user1@example.net + /caldav.php/user1/ + + + HTTP/1.1 200 OK + + + + + + + HTTP/1.1 404 Not Found + + + + /caldav.php/user1/home/fbd57454-d966-4a14-8341-abe1edb1ae66.ics + + + + /caldav.php/user1/ + + + mailto:user1@example.net + /caldav.php/user1/ + + + HTTP/1.1 200 OK + + + + + + + HTTP/1.1 404 Not Found + + + + /caldav.php/user1/home/2178279a-aec2-471f-832d-1f6df6203f2f.ics + + + + /caldav.php/user1/ + + + mailto:user1@example.net + /caldav.php/user1/ + + + HTTP/1.1 200 OK + + + + + + + HTTP/1.1 404 Not Found + + + + /caldav.php/user1/home/917b9e47-b748-4550-a566-657fbe672447.ics + + + + /caldav.php/user1/ + + + mailto:user1@example.net + /caldav.php/user1/ + + + HTTP/1.1 200 OK + + + + + + + HTTP/1.1 404 Not Found + + + + /caldav.php/user1/home/0575d895-a006-4ed8-9be6-0d1b6b6b1f96.ics + + + + /caldav.php/user1/ + + + mailto:user1@example.net + /caldav.php/user1/ + + + HTTP/1.1 200 OK + + + + + + + HTTP/1.1 404 Not Found + + + + /caldav.php/user1/home/b1679f77-673d-4f46-b3eb-2420e1bba301.ics + + + + /caldav.php/user1/ + + + mailto:user1@example.net + /caldav.php/user1/ + + + HTTP/1.1 200 OK + + + + + + + HTTP/1.1 404 Not Found + + + + /caldav.php/user1/home/e70576e9-c1e0-431e-a507-0386fd82f223.ics + + + + /caldav.php/user1/ + + + mailto:user1@example.net + /caldav.php/user1/ + + + HTTP/1.1 200 OK + + + + + + + HTTP/1.1 404 Not Found + + + + /caldav.php/user1/home/e6eb5bc9-f7f9-4a0a-94e8-8e90eefc7d08.ics + + + + /caldav.php/user1/ + + + mailto:user1@example.net + /caldav.php/user1/ + + + HTTP/1.1 200 OK + + + + + + + HTTP/1.1 404 Not Found + + + + /caldav.php/user1/home/71e2ae82-7870-11db-c6d6-f6927c144649.ics + + + + /caldav.php/user1/ + + + mailto:user1@example.net + /caldav.php/user1/ + + + HTTP/1.1 200 OK + + + + + + + HTTP/1.1 404 Not Found + + + + /caldav.php/user1/home/da81c0ee-7871-11db-c6d6-f6927c144649.ics + + + + /caldav.php/user1/ + + + mailto:user1@example.net + /caldav.php/user1/ + + + HTTP/1.1 200 OK + + + + + + + HTTP/1.1 404 Not Found + + + + /caldav.php/user1/home/AAA9318E-37D9-4319-8626-95ECD3D3B243.ics + + + + /caldav.php/user1/ + + + mailto:user1@example.net + /caldav.php/user1/ + + + HTTP/1.1 200 OK + + + + + + + HTTP/1.1 404 Not Found + + + + /caldav.php/user1/home/70D23799-4A68-4905-AB9F-4D47BA693CFD.ics + + + + /caldav.php/user1/ + + + mailto:user1@example.net + /caldav.php/user1/ + + + HTTP/1.1 200 OK + + + + + + + HTTP/1.1 404 Not Found + + /caldav.php/user1/created/ @@ -139,6 +491,50 @@ Content-Type: text/xml; charset="utf-8" HTTP/1.1 404 Not Found + + /caldav.php/user1/6E20BB7C-EFD9-4F0F-9BDC-5335E04D47E0/6C8A0D88-E1F9-4FC1-9EDD-DA258ABF2CFA.ics + + + + /caldav.php/user1/ + + + mailto:user1@example.net + /caldav.php/user1/ + + + HTTP/1.1 200 OK + + + + + + + HTTP/1.1 404 Not Found + + + + /caldav.php/user1/6E20BB7C-EFD9-4F0F-9BDC-5335E04D47E0/E6BC62F3-77C6-4FB7-BDD3-6882E2F1BE74.ics + + + + /caldav.php/user1/ + + + mailto:user1@example.net + /caldav.php/user1/ + + + HTTP/1.1 200 OK + + + + + + + HTTP/1.1 404 Not Found + + /caldav.php/user1/calendar-proxy-read/ diff --git a/testing/tests/regression-suite/827-Spec-PROPFIND.result b/testing/tests/regression-suite/827-Spec-PROPFIND.result index c7834239..3ff5a83a 100644 --- a/testing/tests/regression-suite/827-Spec-PROPFIND.result +++ b/testing/tests/regression-suite/827-Spec-PROPFIND.result @@ -365,6 +365,158 @@ /manager1/ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + /assistant1/ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + /teamclient1/ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + YYYY-MM-DDThh:mm:ss+ZZ:ZZ Manager 1 @@ -387,12 +539,6 @@ HTTP/1.1 200 OK - - - - - HTTP/1.1 403 Forbidden - @@ -409,6 +555,127 @@ /assistant1/ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + /teamclient1/ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + YYYY-MM-DDThh:mm:ss+ZZ:ZZ Assistant 1 @@ -431,12 +698,6 @@ HTTP/1.1 200 OK - - - - - HTTP/1.1 403 Forbidden - diff --git a/testing/tests/regression-suite/831-Spec-RRULE-1.result b/testing/tests/regression-suite/831-Spec-RRULE-1.result index 1ec7b646..8ba6adca 100644 --- a/testing/tests/regression-suite/831-Spec-RRULE-1.result +++ b/testing/tests/regression-suite/831-Spec-RRULE-1.result @@ -1,12 +1,10 @@ HTTP/1.1 200 OK Date: Dow, 01 Jan 2000 00:00:00 GMT DAV: 1, 2, access-control, calendar-access, calendar-schedule, extended-mkcol, calendar-proxy -Content-Length: 5540 +Content-Length: 5323 Content-Type: text/html #!/usr/bin/php - -Warning: Cannot modify header information - headers already sent by (output started at /home/andrew/projects/davical/testing/test-RRULE-v2.php:2) in /home/andrew/projects/davical/testing/test-RRULE-v2.php on line 15 Testing the RRule v2 Library =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~= 20061103T073000 - RRULE:FREQ=DAILY;COUNT=7 diff --git a/testing/tests/regression-suite/873-GroupDAV-PROPFIND.result b/testing/tests/regression-suite/873-GroupDAV-PROPFIND.result index efcc641f..4306799b 100644 --- a/testing/tests/regression-suite/873-GroupDAV-PROPFIND.result +++ b/testing/tests/regression-suite/873-GroupDAV-PROPFIND.result @@ -2,7 +2,7 @@ HTTP/1.1 207 Multi-Status Date: Dow, 01 Jan 2000 00:00:00 GMT DAV: 1, 2, access-control, calendar-access, calendar-schedule, extended-mkcol, calendar-proxy ETag: "some valid etag" -Content-Length: 8564 +Content-Length: 8808 Content-Type: text/xml; charset="utf-8" @@ -143,16 +143,21 @@ Content-Type: text/xml; charset="utf-8" httpd/unix-directory + + + + + + + + + + + some valid etag HTTP/1.1 200 OK - - - - - HTTP/1.1 403 Forbidden - @@ -176,16 +181,21 @@ Content-Type: text/xml; charset="utf-8" httpd/unix-directory + + + + + + + + + + + some valid etag HTTP/1.1 200 OK - - - - - HTTP/1.1 403 Forbidden -