Update of /cvsroot/phpicalendar/phpicalendar/functions
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19200/functions
Modified Files:
ical_parser.php
Log Message:
SF Bug #1023229
Relatively simple fix to a complex, that changes the weekly code to render to the window of $next_date_range -> $next_date_range + $interval weeks. Took me a while to wrap my head around this one - I knew what the solution was, but wasn't sure if it handles everything. Still not 100% sure about the edge cases, though.
Index: ical_parser.php
===================================================================
RCS file: /cvsroot/phpicalendar/phpicalendar/functions/ical_parser.php,v
retrieving revision 1.188
retrieving revision 1.189
diff -C2 -d -r1.188 -r1.189
*** ical_parser.php 6 May 2005 23:01:37 -0000 1.188
--- ical_parser.php 9 May 2005 18:46:12 -0000 1.189
***************
*** 516,528 ****
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;
}
--- 516,533 ----
break;
case 'WEEKLY':
+ // Populate $byday with the default day if it's not set.
if (!isset($byday)) {
! $byday[] = strtoupper(substr($daysofweekshort_lang[date('w', $next_range_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;
}
|