예제 #1
0
    $components = array();
    $filter_fragment = SqlFilterCardDAV($qry_filters, $components);
    if ($filter_fragment !== false) {
        $where .= ' ' . $filter_fragment['sql'];
        $params = $filter_fragment['params'];
    }
} else {
    dbg_error_log('cardquery', 'No query filters');
}
$sql = 'SELECT * FROM caldav_data INNER JOIN addressbook_resource USING(dav_id)' . $where;
if (isset($c->strict_result_ordering) && $c->strict_result_ordering) {
    $sql .= " ORDER BY dav_id";
}
$qry = new AwlQuery($sql, $params);
if ($qry->Exec("cardquery", __LINE__, __FILE__) && $qry->rows() > 0) {
    while ($address_object = $qry->Fetch()) {
        if (!$need_post_filter || apply_filter($qry_filters, $address_object)) {
            if ($bound_from != $target_collection->dav_name()) {
                $address_object->dav_name = str_replace($bound_from, $target_collection->dav_name(), $address_object->dav_name);
            }
            if (count($address_data_properties) > 0) {
                $vcard = new VCard($address_object->caldav_data);
                $vcard->MaskProperties($address_data_properties);
                $address_object->caldav_data = $vcard->Render();
            }
            $responses[] = component_to_xml($properties, $address_object);
        }
    }
}
$multistatus = new XMLElement("multistatus", $responses, $reply->GetXmlNsArray());
$request->XMLResponse(207, $multistatus);
                    $vResource = new vComponent($dav_object->caldav_data);
                    $expanded = getVCalendarRange($vResource);
                    if (!$expanded->overlaps($range_filter)) {
                        continue;
                    }
                    $expanded = expand_event_instances($vResource, $expand_range_start, $expand_range_end, $expand_as_floating);
                    if ($expanded->ComponentCount() == 0) {
                        continue;
                    }
                    if ($need_expansion) {
                        $dav_object->caldav_data = $expanded->Render();
                    }
                } else {
                    if (isset($range_filter)) {
                        $vResource = new vComponent($dav_object->caldav_data);
                        $expanded = getVCalendarRange($vResource);
                        dbg_error_log('calquery', 'Expanded to %s:%s which might overlap %s:%s', $expanded->from, $expanded->until, $range_filter->from, $range_filter->until);
                        if (!$expanded->overlaps($range_filter)) {
                            continue;
                        }
                    }
                }
                $responses[] = component_to_xml($properties, $dav_object);
            }
        } catch (Exception $e) {
            dbg_error_log('ERROR', 'Exception handling "%s" - skipping', $dav_object->dav_name);
        }
    }
}
$multistatus = new XMLElement("multistatus", $responses, $reply->GetXmlNsArray());
$request->XMLResponse(207, $multistatus);