From a430b6f5528f4698cefb45edde90bf869f05eeda Mon Sep 17 00:00:00 2001 From: Jim Hu Date: Tue, 21 Mar 2006 09:52:29 +0000 Subject: add year printview, fix misc bugs --- functions/ical_parser.php | 2 +- functions/init.inc.php | 4 +++- functions/template.php | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) (limited to 'functions') diff --git a/functions/ical_parser.php b/functions/ical_parser.php index e24b953..fe8ca33 100644 --- a/functions/ical_parser.php +++ b/functions/ical_parser.php @@ -423,7 +423,7 @@ 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)) { + 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 { diff --git a/functions/init.inc.php b/functions/init.inc.php index d22ba78..7f55713 100644 --- a/functions/init.inc.php +++ b/functions/init.inc.php @@ -134,6 +134,8 @@ $local_cals = array(); foreach ($cal_filenames as $cal_filename) { // If the calendar identifier begins with a web protocol, this is a web // calendar. + $cal_filename = urldecode($cal_filename); #need to decode for substr statements to identify webcals + $cal_filename = str_replace(' ','%20', $cal_filename); #need to reencode blank spaces for matching with $list_webcals if (substr($cal_filename, 0, 7) == 'http://' || substr($cal_filename, 0, 8) == 'https://' || substr($cal_filename, 0, 9) == 'webcal://') @@ -147,7 +149,7 @@ foreach ($cal_filenames as $cal_filename) { if (in_array($cal_filename, $blacklisted_cals)) { exit(error($lang['l_error_restrictedcal'], $cal_filename)); } - $local_cals[] = str_replace(".ics", '', basename($cal_filename)); + $local_cals[] = urldecode(str_replace(".ics", '', basename($cal_filename))); } } diff --git a/functions/template.php b/functions/template.php index af93258..32e0b2d 100644 --- a/functions/template.php +++ b/functions/template.php @@ -61,10 +61,11 @@ class Page { $loop_event = trim($match1[1]); $loop_day = trim($match3[1]); $parse_month = date ("Ym", strtotime($getdate)); + $parse_year = date ("Y", strtotime($getdate)); foreach($master_array as $key => $val) { preg_match ('/([0-9]{6})([0-9]{2})/', $key, $regs); - if ((($regs[1] == $parse_month) && ($printview == 'month')) || (($key == $getdate) && ($printview == 'day')) || ((($key >= $week_start) && ($key <= $week_end)) && ($printview == 'week'))) { + if ((($regs[1] == $parse_month) && ($printview == 'month')) || (($key == $getdate) && ($printview == 'day')) || ((($key >= $week_start) && ($key <= $week_end)) && ($printview == 'week')) || ((substr($regs[1],0,4) == $parse_year) && ($printview == 'year'))) { $events_week++; $dayofmonth = strtotime ($key); $dayofmonth = localizeDate ($dateFormat_day, $dayofmonth); -- cgit v1.2.3