From 03d63c81c1e6f46be4d145ea84aa2c1198bc0984 Mon Sep 17 00:00:00 2001 From: Jim Hu Date: Tue, 14 Nov 2006 07:00:51 +0000 Subject: change date calcs to allow rss feeds to go across years --- functions/ical_parser.php | 28 +++++++++++++--------------- functions/init.inc.php | 7 ++++++- rss/rss.php | 2 +- 3 files changed, 20 insertions(+), 17 deletions(-) diff --git a/functions/ical_parser.php b/functions/ical_parser.php index 56475b2..6db0351 100644 --- a/functions/ical_parser.php +++ b/functions/ical_parser.php @@ -24,13 +24,6 @@ while ($fillTime < $day_end) { $fillTime = $fill_h . $fill_min; } -// what date we want to get data for (for day calendar) -if (!isset($getdate) || $getdate == '') $getdate = date('Ymd'); -preg_match ("/([0-9]{4})([0-9]{2})([0-9]{2})/", $getdate, $day_array2); -$this_day = $day_array2[3]; -$this_month = $day_array2[2]; -$this_year = $day_array2[1]; - // reading the file if it's allowed $parse_file = true; if ($save_parsed_cals == 'yes') { @@ -427,15 +420,20 @@ foreach ($cal_filelist as $cal_key=>$filename) { } $start_date_time = strtotime($start_date); - $this_month_start_time = strtotime($this_year.$this_month.'01'); - if ($current_view == 'year' || ($save_parsed_cals == 'yes' && !$is_webcal)|| $current_view == 'print' && $printview == 'year') { - $start_range_time = strtotime($this_year.'-01-01 -2 weeks'); - $end_range_time = strtotime($this_year.'-12-31 +2 weeks'); - } else { - $start_range_time = strtotime('-1 month -2 day', $this_month_start_time); - $end_range_time = strtotime('+2 month +2 day', $this_month_start_time); + if (!isset($fromdate)){ + #this should happen if not in one of the rss views + $this_month_start_time = strtotime($this_year.$this_month.'01'); + if ($current_view == 'year' || ($save_parsed_cals == 'yes' && !$is_webcal)|| $current_view == 'print' && $printview == 'year') { + $start_range_time = strtotime($this_year.'-01-01 -2 weeks'); + $end_range_time = strtotime($this_year.'-12-31 +2 weeks'); + } else { + $start_range_time = strtotime('-1 month -2 day', $this_month_start_time); + $end_range_time = strtotime('+2 month +2 day', $this_month_start_time); + } + }else{ + $start_range_time = strtotime($fromdate); + $end_range_time = strtotime($todate)+60*60*24; } - foreach ($rrule_array as $key => $val) { switch($key) { case 'FREQ': diff --git a/functions/init.inc.php b/functions/init.inc.php index 83b540e..883ab36 100644 --- a/functions/init.inc.php +++ b/functions/init.inc.php @@ -1,5 +1,5 @@ $filemod) $filemod = $calinfo['mtime']; } $filemodtime = date("r", $filemod); - +/* //send relevant headers header ("Last-Modified: $filemodtime"); header ("ETag:\"$filemodtime\""); -- cgit v1.2.3