|
From: <par...@us...> - 2009-12-29 16:09:09
|
Update of /cvsroot/phpicalendar/phpicalendar/functions/parse In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv22505/functions/parse Modified Files: recur_functions.php Log Message: Fixed recurring events across multiple versions of PHP; thanks to Len and gueba! Index: recur_functions.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/functions/parse/recur_functions.php,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** recur_functions.php 29 Dec 2008 03:07:34 -0000 1.18 --- recur_functions.php 29 Dec 2009 16:08:55 -0000 1.19 *************** *** 141,145 **** $week_arr = array(1,2,3,4,5); if(isset($byday_arr[2]) && $byday_arr[2] !='') $week_arr = array($byday_arr[2]); ! $month_start = strtotime(date("Ym00",$time)); $month_end = strtotime(date("Ymt",$time))+ (36 * 60 * 60); if($freq_type == 'year' && empty($bymonth)){ --- 141,145 ---- $week_arr = array(1,2,3,4,5); if(isset($byday_arr[2]) && $byday_arr[2] !='') $week_arr = array($byday_arr[2]); ! $month_start = strtotime(date("Ym01",$time)) - (24 * 60 * 60); $month_end = strtotime(date("Ymt",$time))+ (36 * 60 * 60); if($freq_type == 'year' && empty($bymonth)){ *************** *** 150,154 **** #echo "<pre>$summary ".$byday_arr[1].$week.$on_day." st:".date("Ymd",$month_start)." t:".date("Ymd",$time)."\n"; if($byday_arr[1] == '-') $next_date_time = strtotime($byday_arr[1].$week.$on_day,$month_end); ! else $next_date_time = strtotime($byday_arr[1].$week.$on_day,$month_start); # check that we're still in the same month if (date("m",$next_date_time) == date("m",$time) ) $times[] = $next_date_time; --- 150,160 ---- #echo "<pre>$summary ".$byday_arr[1].$week.$on_day." st:".date("Ymd",$month_start)." t:".date("Ymd",$time)."\n"; if($byday_arr[1] == '-') $next_date_time = strtotime($byday_arr[1].$week.$on_day,$month_end); ! else { ! # we need this special offset in case the event day coincides with the month start day ! # eg: month starts on a Sunday, our event is the Nth Sunday of the month... without this ! # special offset, the event will be added to the (N+1)th Sunday of the month ! $special_offset = ($month_start_day == $on_day) ? (24 * 60 * 60) : 0; ! $next_date_time = strtotime($byday_arr[1] . $week . $on_day, ($month_start + $special_offset)); ! } # check that we're still in the same month if (date("m",$next_date_time) == date("m",$time) ) $times[] = $next_date_time; |