Changes to Depth handling.

This commit is contained in:
Andrew McMillan 2012-03-22 13:47:11 +13:00
parent 85017681d0
commit 946e0719ef
2 changed files with 7 additions and 3 deletions

View File

@ -230,8 +230,11 @@ class CalDAVRequest
$this->depth = 'infinity';
break;
case 'PROPFIND':
case 'REPORT':
$this->depth = 0;
break;
case 'PROPFIND':
default:
$this->depth = 0;
}
@ -740,8 +743,9 @@ EOSQL;
* Returns the tail of a Regex appropriate for this Depth, when appended to
*
*/
function DepthRegexTail() {
function DepthRegexTail( $for_collection_report = false) {
if ( $this->IsInfiniteDepth() ) return '';
if ( $this->depth == 0 && $for_collection_report ) return '[^/]+$';
if ( $this->depth == 0 ) return '$';
return '[^/]*/?$';
}

View File

@ -15,7 +15,7 @@ $range_end = new RepeatRuleDateTime($fbq_end);
/** We use the same code for the REPORT, the POST and the freebusy GET... */
$freebusy = get_freebusy( '^'.$request->path.$request->DepthRegexTail(), $range_start, $range_end );
$freebusy = get_freebusy( '^' . $request->path . $request->DepthRegexTail(true), $range_start, $range_end );
$result = new iCalComponent();
$result->VCalendar();