From 09643a5841c1cec29871e0b4d1eb4d6e10108a4b Mon Sep 17 00:00:00 2001 From: Jim Hu Date: Thu, 2 Nov 2006 08:06:03 +0000 Subject: bug fix for repeating events where first day of month is same as repeat day --- functions/ical_parser.php | 4 ++-- functions/init.inc.php | 1 + index.php | 7 ++++++- month.php | 4 ++-- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/functions/ical_parser.php b/functions/ical_parser.php index af1da64..b754d75 100644 --- a/functions/ical_parser.php +++ b/functions/ical_parser.php @@ -660,7 +660,7 @@ foreach ($cal_filelist as $cal_key=>$filename) { $last_day_tmp = date('t',$next_range_time); $next_range_time = strtotime(date('Y-m-'.$last_day_tmp, $next_range_time)); $last_tmp = (date('w',$next_range_time) == $on_day_num) ? '' : 'last '; - $next_date_time = strtotime($last_tmp.$on_day.' -'.$nth.' week', $next_range_time); + $next_date_time = strtotime($last_tmp.$on_day, $next_range_time) - $nth * 604800; $month = date('m', $next_date_time); if (in_array($month, $bymonth)) { $recur_data[] = $next_date_time; @@ -682,7 +682,7 @@ foreach ($cal_filelist as $cal_key=>$filename) { } } } elseif ((isset($byday_arr[1])) && ($byday_arr[1] != '-')) { - $next_date_time = strtotime($on_day.' +'.$nth.' week', $next_range_time); + $next_date_time = strtotime($on_day, $next_range_time) + $nth * 604800; $month = date('m', $next_date_time); if (in_array($month, $bymonth)) { $recur_data[] = $next_date_time; diff --git a/functions/init.inc.php b/functions/init.inc.php index 83b540e..c554f81 100644 --- a/functions/init.inc.php +++ b/functions/init.inc.php @@ -13,6 +13,7 @@ $ALL_CALENDARS_COMBINED = 'all_calendars_combined971'; // Pull in the configuration and some functions. if (!defined('BASE')) define('BASE', './'); +include_once(BASE.'default_config.inc.php'); include_once(BASE.'config.inc.php'); $cookie_name = 'phpicalendar_'.basename($default_path); diff --git a/index.php b/index.php index a63454b..aee10ea 100644 --- a/index.php +++ b/index.php @@ -1,7 +1,12 @@ replace_files(array( 'header' => BASE.'templates/'.$template.'/header.tpl', 'event_js' => BASE.'functions/event.js', 'footer' => BASE.'templates/'.$template.'/footer.tpl', - 'calendar_nav' => BASE.'templates/'.$template.'/calendar_nav.tpl', - 'search_box' => BASE.'templates/'.$template.'/search_box.tpl' + 'calendar_nav' => BASE.'templates/'.$template.'/calendar_nav.tpl', + 'search_box' => BASE.'templates/'.$template.'/search_box.tpl' )); $page->replace_tags(array( -- cgit v1.2.3