aboutsummaryrefslogtreecommitdiffstats
path: root/functions
diff options
context:
space:
mode:
authordavef <davefd2@users.sourceforge.net>2005-05-06 19:02:05 +0000
committerdavef <davefd2@users.sourceforge.net>2005-05-06 19:02:05 +0000
commit9e1e539ae3913ce939a9cb2c6f80fd6fcc27f342 (patch)
tree696560fada78d17a80ade6e109fbd11fb060507e /functions
parent61d928fa0e23fda416f737c05bf9168b0c394870 (diff)
downloadphpicalendar-9e1e539ae3913ce939a9cb2c6f80fd6fcc27f342.tar.gz
phpicalendar-9e1e539ae3913ce939a9cb2c6f80fd6fcc27f342.tar.bz2
phpicalendar-9e1e539ae3913ce939a9cb2c6f80fd6fcc27f342.zip
Fixed SF Bug #1064410
The bug was when generating $recur_array, the code assumes for each pass, you're filling in $recur_array from $next_range_time to $next_range_time + $interval $freq_type, in this case $next_range_time to $next_range_time + 1 year. However, the previous code used the fixed year of $next_range time, making the range filled into $recur_event per pass (jan 01, year of $next_range_time) to (dec 31st, year of $next_range_time). There was a hack that tried to fix this by saying "assume next year if it's jan/feb", trying to compensate, but it just semi-papered over the issue since the ranges still didn't match up. The fix was to make sure the ranges actually did match up, by adjusting the year used each month. This also meant that a bunch of events outside of start/end_range are no longer rendered. Since the window now matches on a monthly basis, it will still generate events slightly outside of start/end_range, but it should now render correctly in all cases (the extra events are just slightly wasted space, but less wasted space than before). Note that this fixes a bunch of problems w/ rendering yearly events in dec/jan/feb (the year border), beyond the SF bug.
Diffstat (limited to 'functions')
-rw-r--r--functions/ical_parser.php11
1 files changed, 7 insertions, 4 deletions
diff --git a/functions/ical_parser.php b/functions/ical_parser.php
index dabc3fb..600c0d8 100644
--- a/functions/ical_parser.php
+++ b/functions/ical_parser.php
@@ -591,12 +591,15 @@ foreach ($cal_filelist as $filename) {
$m = date('m', $start_date_time);
$bymonth = array("$m");
}
+
foreach($bymonth as $month) {
- // FIXME: Jan 1 does not display in December
- $year = date('Y', $next_range_time);
- if (($year != $this_year) && ($month < 3)) {
- $year = $this_year;
+ // Make sure the month & year used is within the start/end_range.
+ if ($month < date('m', $next_range_time)) {
+ $year = date('Y', strtotime('+1 years', $next_range_time));
+ } else {
+ $year = date('Y', $next_range_time);
}
+
if ((isset($byday)) && (is_array($byday))) {
$checkdate_time = mktime(0,0,0,$month,1,$year);
foreach($byday as $day) {

© 2014-2024 Faster IT GmbH | imprint | privacy policy