From: <da...@us...> - 2005-09-14 00:26:52
|
Update of /cvsroot/phpicalendar/phpicalendar/functions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15993/functions Modified Files: ical_parser.php Log Message: Fixed SF Bug# 1288281 in the new WEEKLY code, so the 1.189 fix is back as well. Also cleaned up some unused code I missed the last time, and a minor spelling fix in a comment. Index: ical_parser.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/functions/ical_parser.php,v retrieving revision 1.194 retrieving revision 1.195 diff -C2 -d -r1.194 -r1.195 *** ical_parser.php 13 Sep 2005 21:36:38 -0000 1.194 --- ical_parser.php 14 Sep 2005 00:26:43 -0000 1.195 *************** *** 151,155 **** $start_time, $end_time, $start_date, $end_date, $summary, $allday_start, $allday_end, $start, $end, $the_duration, ! $beginning, $rrule_array, $start_of_vevent, $description, $bd, $url, $valarm_description, $start_unixtime, $end_unixtime, $display_end_tmp, $end_time_tmp1, $recurrence_id, $uid, $class, $location, $rrule, $abs_until, $until_check, --- 151,155 ---- $start_time, $end_time, $start_date, $end_date, $summary, $allday_start, $allday_end, $start, $end, $the_duration, ! $beginning, $rrule_array, $start_of_vevent, $description, $url, $valarm_description, $start_unixtime, $end_unixtime, $display_end_tmp, $end_time_tmp1, $recurrence_id, $uid, $class, $location, $rrule, $abs_until, $until_check, *************** *** 482,491 **** $end_range_time_tmp = $end_range_time; - // For weekly's without a byday - if ((!isset($byday)) && ($rrule_array['FREQ'] == 'WEEKLY')) { - ereg ('([0-9]{4})([0-9]{2})([0-9]{2})', $start_date, $startregs); - $bd = strtolower(date ("l", mktime($hour,$minute,0,$startregs[2],$startregs[3],$startregs[1]))); - } - // If the $end_range_time is less than the $start_date_time, or $start_range_time is greater // than $end_date_time, we may as well forget the whole thing --- 482,485 ---- *************** *** 498,502 **** if ($end_range_time_tmp > $end_date_time) $end_range_time_tmp = $end_date_time; ! // initialze the time we will increment $next_range_time = $start_range_time_tmp; --- 492,496 ---- if ($end_range_time_tmp > $end_date_time) $end_range_time_tmp = $end_date_time; ! // initialize the time we will increment $next_range_time = $start_range_time_tmp; *************** *** 518,530 **** break; case 'WEEKLY': if (!isset($byday)) { ! $next_date = dateOfWeek(date('Ymd', $next_range_time),$bd); ! $next_date_time = strtotime($next_date); ! $recur_data[] = $next_date_time; ! } elseif (is_array($byday)) { foreach($byday as $day) { $day = two2threeCharDays($day); ! $next_date = dateOfWeek(date('Ymd', $next_range_time),$day); ! $next_date_time = strtotime($next_date); $recur_data[] = $next_date_time; } --- 512,529 ---- break; case 'WEEKLY': + // Populate $byday with the default day if it's not set. if (!isset($byday)) { ! $byday[] = strtoupper(substr($daysofweekshort_lang[date('w', $start_date_time)], 0, 2)); ! } ! if (is_array($byday)) { foreach($byday as $day) { $day = two2threeCharDays($day); ! $next_date_time = strtotime($day,$next_range_time) + (12 * 60 * 60); ! // Since this renders events from $next_range_time to $next_range_time + 1 week, I need to handle intervals ! // as well. This checks to see if $next_date_time is after $day_start (i.e., "next week"), and thus ! // if we need to add $interval weeks to $next_date_time. ! if ($next_date_time > strtotime($week_start_day, $next_range_time) && $interval > 1) { ! $next_date_time = strtotime('+'.($interval - 1).' '.$freq_type, $next_date_time); ! } $recur_data[] = $next_date_time; } |