$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);
$trigger_type = $trigger->GetParameterValue('VALUE'); if ($trigger_type == 'DATE' || $trigger_type == 'DATE-TIME' || preg_match('{^\\d{8}T\\d{6}Z?$}', $trigger->Value())) { $first = new RepeatRuleDateTime($trigger); if ($first > $expand_range_start && (empty($next) || $first < $next)) { $next = $first; } else { if (empty($next)) { if ($args->set_last && (empty($last) || $first > $last)) { $last = $first; } } } } if ($args->set_last && !isset($last) && (!isset($next) || $next < $expand_range_Start)) { $vc = new vCalendar($alarm->caldav_data); $range = getVCalendarRange($vc); if (isset($range->until) && $range->until < $earliest) { $last = $range->until; } } if (isset($next) && $next < $expand_range_end) { if ($args->debug) { printf("refresh: Found next alarm instance on '%s'\n", $next->UTC()); } $sql = 'UPDATE calendar_alarm SET next_trigger = :next WHERE dav_id = :id AND component = :component'; $update = new AwlQuery($sql, array(':next' => $next->UTC(), ':id' => $alarm->dav_id, ':component' => $alarm->component)); $update->Exec('refresh-alarms', __LINE__, __FILE__); } else { if ($args->set_last && isset($last) && $last < $earliest) { if ($args->debug) { printf("refresh: Found past final alarm instance on '%s'\n", $last->UTC());