diff --git a/inc/caldav-REPORT-calquery.php b/inc/caldav-REPORT-calquery.php index b49590c1..f71269b1 100644 --- a/inc/caldav-REPORT-calquery.php +++ b/inc/caldav-REPORT-calquery.php @@ -2,27 +2,6 @@ include_once('vCalendar.php'); -$need_expansion = false; -function check_for_expansion( $calendar_data_node ) { - global $need_expansion, $expand_range_start, $expand_range_end, $expand_as_floating; - - if ( !class_exists('DateTime') ) return; /** We don't support expansion on PHP5.1 */ - - $expansion = $calendar_data_node->GetElements('urn:ietf:params:xml:ns:caldav:expand'); - if ( isset($expansion[0]) ) { - $need_expansion = true; - $expand_range_start = $expansion[0]->GetAttribute('start'); - $expand_range_end = $expansion[0]->GetAttribute('end'); - $expand_as_floating = $expansion[0]->GetAttribute('floating'); - if ( isset($expand_range_start) ) $expand_range_start = new RepeatRuleDateTime($expand_range_start); - if ( isset($expand_range_end) ) $expand_range_end = new RepeatRuleDateTime($expand_range_end); - if ( isset($expand_as_floating) && $expand_as_floating == "yes" ) - $expand_as_floating = true; - else - $expand_as_floating = false; - } -} - /** * Build the array of properties to include in the report output */ @@ -30,6 +9,7 @@ $qry_content = $xmltree->GetContent('urn:ietf:params:xml:ns:caldav:calendar-quer $properties = array(); $include_properties = array(); +$need_expansion = false; while (list($idx, $qqq) = each($qry_content)) { $proptype = $qry_content[$idx]->GetNSTag(); diff --git a/inc/caldav-REPORT-multiget.php b/inc/caldav-REPORT-multiget.php index 594b2422..88933e5c 100644 --- a/inc/caldav-REPORT-multiget.php +++ b/inc/caldav-REPORT-multiget.php @@ -5,29 +5,13 @@ $responses = array(); -$need_expansion = false; -function check_for_expansion( $calendar_data_node ) { - global $need_expansion, $expand_range_start, $expand_range_end; - - if ( !class_exists('DateTime') ) return; /** We don't support expansion on PHP5.1 */ - - $expansion = $calendar_data_node->GetElements('urn:ietf:params:xml:ns:caldav:expand'); - if ( isset($expansion[0]) ) { - $need_expansion = true; - $expand_range_start = $expansion[0]->GetAttribute('start'); - $expand_range_end = $expansion[0]->GetAttribute('end'); - if ( isset($expand_range_start) ) $expand_range_start = new RepeatRuleDateTime($expand_range_start); - if ( isset($expand_range_end) ) $expand_range_end = new RepeatRuleDateTime($expand_range_end); - } -} - - /** * Build the array of properties to include in the report output */ $proptype = $qry_content[0]->GetNSTag(); $properties = array(); +$need_expansion = false; switch( $proptype ) { case 'DAV::prop': $qry_props = $xmltree->GetPath('/*/'.$proptype.'/*'); diff --git a/inc/caldav-REPORT.php b/inc/caldav-REPORT.php index 08623e0a..9505886b 100644 --- a/inc/caldav-REPORT.php +++ b/inc/caldav-REPORT.php @@ -79,6 +79,29 @@ switch( $xmltree->GetNSTag() ) { exit; // Not that it should return anyway. } +/** +* check if we need to do expansion of recurring events +* @param object $calendar_data_node +*/ +function check_for_expansion( $calendar_data_node ) { + global $need_expansion, $expand_range_start, $expand_range_end, $expand_as_floating; + + if ( !class_exists('DateTime') ) return; /** We don't support expansion on PHP5.1 */ + + $expansion = $calendar_data_node->GetElements('urn:ietf:params:xml:ns:caldav:expand'); + if ( isset($expansion[0]) ) { + $need_expansion = true; + $expand_range_start = $expansion[0]->GetAttribute('start'); + $expand_range_end = $expansion[0]->GetAttribute('end'); + $expand_as_floating = $expansion[0]->GetAttribute('floating'); + if ( isset($expand_range_start) ) $expand_range_start = new RepeatRuleDateTime($expand_range_start); + if ( isset($expand_range_end) ) $expand_range_end = new RepeatRuleDateTime($expand_range_end); + if ( isset($expand_as_floating) && $expand_as_floating == "yes" ) + $expand_as_floating = true; + else + $expand_as_floating = false; + } +} /**