12$proptype = $qry_content[0]->GetNSTag();
14$need_expansion =
false;
17 $qry_props = $xmltree->GetPath(
'/*/'.$proptype.
'/*');
18 foreach( $qry_content[0]->GetElements() AS $k => $v ) {
19 $properties[$v->GetNSTag()] = 1;
20 if ( $v->GetNSTag() ==
'urn:ietf:params:xml:ns:caldav:calendar-data' ) check_for_expansion($v);
25 $properties[
'DAV::allprop'] = 1;
26 if ( $qry_content[1]->GetNSTag() ==
'DAV::include' ) {
27 foreach( $qry_content[1]->GetElements() AS $k => $v ) {
28 $include_properties[] = $v->GetNSTag();
29 if ( $v->GetNSTag() ==
'urn:ietf:params:xml:ns:caldav:calendar-data' ) check_for_expansion($v);
35 $properties[$proptype] = 1;
37if ( empty($properties) ) $properties[
'DAV::allprop'] = 1;
40$bound_from = $collection->bound_from();
45$mg_hrefs = $xmltree->GetPath(
'/*/DAV::href');
48foreach( $mg_hrefs AS $k => $v ) {
54 $rawurl = rawurldecode($v->GetContent());
55 $path_pos = strpos($rawurl,$request->path);
56 if ( $path_pos ===
false ) {
57 $href = $bound_from . $rawurl;
60 $href = $bound_from . substr( $rawurl, $path_pos + strlen($request->path));
62 @dbg_error_log(
"REPORT",
'Reporting on href "%s"', $href );
63 $href_in .= ($href_in ==
'' ?
'' :
', ');
64 $href_in .=
':href'.$k;
65 $params[
':href'.$k] = $href;
68$where =
" WHERE caldav_data.collection_id = " . $collection->resource_id();
69$where .=
" AND caldav_data.dav_name IN ( $href_in ) ";
71if ( $mode ==
'caldav' ) {
72 if ( $collection->Privileges() != privilege_to_bits(
'DAV::all') ) {
73 $where .=
" AND (calendar_item.class != 'PRIVATE' OR calendar_item.class IS NULL) ";
76$sql =
'SELECT calendar_item.*, addressbook_resource.*, caldav_data.* FROM caldav_data
77 LEFT JOIN calendar_item USING(dav_id, user_no, dav_name, collection_id)
78 LEFT JOIN addressbook_resource USING(dav_id)
79 LEFT JOIN collection USING(collection_id)';
87if ( isset($c->strict_result_ordering) && $c->strict_result_ordering ) $where .=
" ORDER BY caldav_data.dav_id";
88$qry =
new AwlQuery( $sql . $where, $params );
89if ( $qry->Exec(
'REPORT',__LINE__,__FILE__) && $qry->rows() > 0 ) {
90 while( $dav_object = $qry->Fetch() ) {
91 if ( $bound_from != $collection->dav_name() ) {
92 $dav_object->dav_name = str_replace( $bound_from, $collection->dav_name(), $dav_object->dav_name);
94 if ( $need_expansion ) {
95 $vResource =
new vComponent($dav_object->caldav_data);
96 $expanded = expand_event_instances($vResource, $expand_range_start, $expand_range_end);
97 $dav_object->caldav_data = $expanded->Render();
99 $responses[] = component_to_xml( $properties, $dav_object );
103$multistatus =
new XMLElement(
"multistatus", $responses, $reply->GetXmlNsArray() );
105$request->XMLResponse( 207, $multistatus );