From: <cl...@us...> - 2003-11-18 19:43:16
|
Update of /cvsroot/phpicalendar/phpicalendar/functions In directory sc8-pr-cvs1:/tmp/cvs-serv15513/functions Modified Files: ical_parser.php Log Message: Fix for weekly events in 2004. odd bug. Index: ical_parser.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/functions/ical_parser.php,v retrieving revision 1.128 retrieving revision 1.129 diff -C2 -d -r1.128 -r1.129 *** ical_parser.php 16 Nov 2003 07:19:43 -0000 1.128 --- ical_parser.php 18 Nov 2003 19:43:13 -0000 1.129 *************** *** 96,100 **** $start_time, $end_time, $start_date, $end_date, $summary, $allday_start, $allday_end, $start, $end, $the_duration, ! $beginning, $rrule_array, $start_of_vevent, $description, $valarm_description, $start_unixtime, $end_unixtime, $display_end_tmp, $end_time_tmp1, $recurrence_id, $uid, $class, $location, $rrule, $abs_until, $until_check --- 96,100 ---- $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, $valarm_description, $start_unixtime, $end_unixtime, $display_end_tmp, $end_time_tmp1, $recurrence_id, $uid, $class, $location, $rrule, $abs_until, $until_check *************** *** 394,399 **** if (!isset($number)) $number = 1; // if $until isn't set yet, we set it to the end of our range we're looking at - // The FREQ switch array will always kick our early, so lets try this workaround. - // if (isset($until)) $until = strtotime('+'.$interval.' '.$freq_type, $until);; if (!isset($until)) $until = $end_range_time; --- 394,397 ---- *************** *** 403,406 **** --- 401,410 ---- $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 *************** *** 434,445 **** case 'WEEKLY': if (!isset($byday)) { ! $next_date = date('Ymd', $next_range_time); $next_date_time = strtotime($next_date); $recur_data[] = $next_date_time; } elseif (is_array($byday)) { - // loop through the days on which this event happens foreach($byday as $day) { ! // use my fancy little function to get the date of each day ! $day = two2threeCharDays($day); $next_date = dateOfWeek(date('Ymd', $next_range_time),$day); $next_date_time = strtotime($next_date); --- 438,447 ---- 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); *************** *** 451,457 **** if (!isset($bymonth)) $bymonth = array(1,2,3,4,5,6,7,8,9,10,11,12); $next_range_time = strtotime(date('Y-m-01', $next_range_time)); - // month has two cases, either $bymonthday or $byday if ((isset($bymonthday)) && (!isset($byday))) { - // loop through the days on which this event happens foreach($bymonthday as $day) { $year = date('Y', $next_range_time); --- 453,457 ---- *************** *** 462,468 **** } } - // our other case } else { - // loop through the days on which this event happens foreach($byday as $day) { ereg ('([-\+]{0,1})?([0-9]{1})?([A-Z]{2})', $day, $byday_arr); --- 462,466 ---- |