From fae38172f95e53853037beddd7998af0c676fc3d Mon Sep 17 00:00:00 2001 From: Chad Little Date: Sat, 20 Sep 2003 19:13:12 +0000 Subject: Added BYYEARDAY support, added getdate to switching calendars. --- functions/ical_parser.php | 25 +++++++++++++++++++++---- functions/list_icals.php | 12 ++++++------ 2 files changed, 27 insertions(+), 10 deletions(-) (limited to 'functions') diff --git a/functions/ical_parser.php b/functions/ical_parser.php index 4a368ab..87d66ab 100644 --- a/functions/ical_parser.php +++ b/functions/ical_parser.php @@ -209,10 +209,13 @@ foreach ($cal_filelist as $filename) { // Handling of the all day events if ((isset($allday_start) && $allday_start != '')) { - $start = strtotime($allday_start); - if (isset($allday_end)) { - $end = strtotime($allday_end); - } else { + $start = strtotime($allday_start); + if ($spans_day) { + $allday_end = date('Ymd',$end_unixtime); + } + if (isset($allday_end)) { + $end = strtotime($allday_end); + } else { $end = strtotime('+1 day', $start); } if (($end > $mArray_begin) && ($end < $mArray_end)) { @@ -505,6 +508,19 @@ foreach ($cal_filelist as $filename) { } $recur_data[] = $next_date_time; } + foreach ($byyearday as $yearday) { + ereg ('([-\+]{0,1})?([0-9]{1,3})', $yearday, $byyearday_arr); + if ($byyearday_arr[1] == '-') { + $ydtime = mktime(0,0,0,12,31,$this_year); + $yearnum = $byyearday_arr[2] - 1; + $next_date_time = strtotime('-'.$yearnum.' days', $ydtime); + } else { + $ydtime = mktime(0,0,0,1,1,$this_year); + $yearnum = $byyearday_arr[2] - 1; + $next_date_time = strtotime('+'.$yearnum.' days', $ydtime); + } + $recur_data[] = $next_date_time; + } break; default: // anything else we need to end the loop @@ -740,6 +756,7 @@ foreach ($cal_filelist as $filename) { if (preg_match("/^DTSTART;VALUE=DATE/i", $field)) { $allday_start = $data; $start_date = $allday_start; + $start_unixtime = strtotime($data); } else { if (preg_match("/^DTSTART;TZID=/i", $field)) { $tz_tmp = explode('=', $field); diff --git a/functions/list_icals.php b/functions/list_icals.php index 43b476a..57de27a 100644 --- a/functions/list_icals.php +++ b/functions/list_icals.php @@ -30,18 +30,18 @@ if ($display_ical_list == "yes") { $cal_displayname_tmp = str_replace("32", " ", $cal_filename_tmp); if (!in_array($cal_filename_tmp, $blacklisted_cals)) { if ($cal_tmp == $cal) { - print ""; + print ""; } else { - print ""; + print ""; } } } // option to open all (non-web) calenders together if ($cal == $ALL_CALENDARS_COMBINED) { - print ""; + print ""; } else { - print ""; + print ""; } foreach($list_webcals as $cal_tmp) { @@ -51,9 +51,9 @@ if ($display_ical_list == "yes") { $cal_displayname_tmp = substr($cal_displayname_tmp,0,-4); $cal_encoded_tmp = urlencode($cal_tmp); if ($cal_tmp == $cal_httpPrefix || $cal_tmp == $cal_webcalPrefix) { - print ""; + print ""; } else { - print ""; + print ""; } } } -- cgit v1.2.3