From 5e9bdcce333efc2efc277ac15c627981236c9c53 Mon Sep 17 00:00:00 2001 From: Jim Hu Date: Mon, 26 Jan 2009 05:07:38 +0000 Subject: for bug 2525176 require sequence to increment for modified events. Also fix uid handling --- config.inc.php | 2 +- functions/ical_parser.php | 6 ++++- functions/parse/end_vevent.php | 58 ++++++++++++++++++++++-------------------- 3 files changed, 37 insertions(+), 29 deletions(-) diff --git a/config.inc.php b/config.inc.php index b5ba5ee..2968a4e 100644 --- a/config.inc.php +++ b/config.inc.php @@ -99,7 +99,7 @@ these arrays provide extra calendar options. */ $list_webcals = array( -# 'webcal://dimer.tamu.edu/calendars/seminars/Biochem.ics' + 'webcal://dimer.tamu.edu/calendars/seminars/Biochem.ics' ); $more_webcals['recur_tests'] = array(); $locked_cals = array( diff --git a/functions/ical_parser.php b/functions/ical_parser.php index ad4ed81..ae6c335 100644 --- a/functions/ical_parser.php +++ b/functions/ical_parser.php @@ -26,7 +26,7 @@ if ($phpiCal_config->save_parsed_cals == 'yes') { $fname = $master_array['-4'][$z]['filename']; $wcalc = $master_array['-4'][$z]['webcal']; if ($wcalc == 'no') $realcal_mtime = filemtime($fname); - if (($mtime == $realcal_mtime) && ($wcalc == 'no')) { + if (isset($realcal_mtime) && ($mtime == $realcal_mtime) && ($wcalc == 'no')) { $y++; } elseif (($wcalc == 'yes') && ($mtime > $webcal_mtime)) { //echo date('H:i',$mtime). ' > '. date('H:i',$webcal_mtime); @@ -142,6 +142,7 @@ foreach ($cal_filelist as $cal_key=>$filename) { ); $interval = 1; + $sequence = 0; $summary = ''; $description = ''; $status = ''; @@ -388,6 +389,9 @@ foreach ($cal_filelist as $cal_key=>$filename) { unset($server_offset_tmp); break; + case 'SEQUENCE': + $sequence = $data; + break; case 'UID': $uid = $data; break; diff --git a/functions/parse/end_vevent.php b/functions/parse/end_vevent.php index addca3a..bd122f4 100644 --- a/functions/parse/end_vevent.php +++ b/functions/parse/end_vevent.php @@ -29,8 +29,8 @@ if (!isset($uid)) { $uid_counter++; $uid_valid = false; }elseif(in_array($uid, $uid_list)) { - $uid .= $uid_counter; - $uid_counter++; + #$uid .= $uid_counter; + #$uid_counter++; }else{ $uid_valid = true; } @@ -320,31 +320,35 @@ foreach($recur_data as $recur_data_unixtime) { if ($this_date_tmp < $end_date_tmp) $display_end_tmp = '2400'; } if($this_date_tmp == $end_date_tmp && ($end_time == '0000')) continue; - $master_array[$this_date_tmp][$time_key][$uid] = array ( - 'event_start' => $start_time, # hhmm - 'event_end' => $end_time, # hhmm - 'display_end' => $display_end_tmp, # hhmm display_start is $time_key - 'start_unixtime' => $start_unixtime_tmp, # start unixtime for this recurrence - 'end_unixtime' => $end_unixtime_tmp, # end unixtime for this recurrence - 'event_text' => $summary, # - 'event_length' => $length, # length in seconds - 'event_overlap' => 0, # checkOverlap modifies this - 'description' => $description, - 'status' => $status, - 'class' => $class, - 'spans_day' => $spans_day, - 'location' => $location, - 'categories' => $vtodo_categories, - 'organizer' => serialize($organizer), - 'attendee' => serialize($attendee), - 'calnumber' => $calnumber, - 'calname' => $actual_calname, - 'timezone' => $start_tz, - 'other' => trim($other), - 'geo' => $geo, - 'url' => $url, - 'recur' => $recur - ); + if(!isset($master_array[$this_date_tmp][$time_key][$uid]['sequence']) || + $sequence > $master_array[$this_date_tmp][$time_key][$uid]['sequence']){ + $master_array[$this_date_tmp][$time_key][$uid] = array ( + 'event_start' => $start_time, # hhmm + 'event_end' => $end_time, # hhmm + 'display_end' => $display_end_tmp, # hhmm display_start is $time_key + 'start_unixtime' => $start_unixtime_tmp, # start unixtime for this recurrence + 'end_unixtime' => $end_unixtime_tmp, # end unixtime for this recurrence + 'event_text' => $summary, # + 'event_length' => $length, # length in seconds + 'event_overlap' => 0, # checkOverlap modifies this + 'description' => $description, + 'status' => $status, + 'class' => $class, + 'spans_day' => $spans_day, + 'location' => $location, + 'categories' => $vtodo_categories, + 'organizer' => serialize($organizer), + 'attendee' => serialize($attendee), + 'calnumber' => $calnumber, + 'calname' => $actual_calname, + 'timezone' => $start_tz, + 'other' => trim($other), + 'geo' => $geo, + 'url' => $url, + 'sequence' => $sequence, + 'recur' => $recur + ); + } if($time_key > -1) checkOverlap($this_date_tmp, $time_key, $uid); } } # end foreach recur_data -- cgit v1.2.3