From 15e50df43b59493358d034ca684450aec36093c9 Mon Sep 17 00:00:00 2001 From: jwangen Date: Sat, 2 Nov 2002 05:17:17 +0000 Subject: fixed all errors which error_reporting() was returning --- day.php | 11 ++++++----- footer.inc.php | 2 +- functions/error.php | 9 ++++++--- functions/ical_parser.php | 30 +++++++++++++++++++----------- functions/init.inc.php | 4 ++-- functions/overlapping_events.php | 2 +- month_bottom.php | 23 ++++++++++++----------- search.php | 6 ++++-- sidebar.php | 2 +- week.php | 6 ++++-- 10 files changed, 56 insertions(+), 39 deletions(-) diff --git a/day.php b/day.php index e2e2d57..b4bbe06 100644 --- a/day.php +++ b/day.php @@ -26,7 +26,7 @@ $this_day = $day_array2[3]; $this_month = $day_array2[2]; $this_year = $day_array2[1]; -$parse_month = date ('Ym', $date); +$parse_month = date ('Ym', $unix_time); $thisday2 = localizeDate($dateFormat_week_list, $unix_time); $start_week_time = strtotime(dateOfWeek($getdate, $week_start_day)); @@ -99,7 +99,8 @@ if (is_array($master_array[($getdate)])) { $event_text = stripslashes(urldecode($allday['event_text'])); $description = addslashes(urlencode($allday['description'])); $event_text2 = rawurlencode(addslashes($allday['event_text'])); - + $event_start = ''; + $event_end = ''; echo ''."\n"; echo ''.$event_text.''."\n"; echo ''."\n"; @@ -167,7 +168,7 @@ if (is_array($master_array[($getdate)])) { // add events that overlap $day_start instead of cutting them out completely if ("$day_start" == "$cal_time" && is_array($master_array[$getdate])) { foreach($master_array[$getdate] as $time_key => $time_arr) { - if ((int)$time_key < (int)$cal_time && is_array($time_arr)) { + if ((int)$time_key < (int)$cal_time && is_array($time_arr) && $time_key != '-1') { foreach($time_arr as $event_tmp) { if ((int)$event_tmp['event_end'] > (int)$cal_time) { $this_time_arr[] = $event_tmp; @@ -184,7 +185,7 @@ if (is_array($master_array[($getdate)])) { foreach ($this_time_arr as $eventKey => $loopevent) { $drawEvent = drawEventTimes ($cal_time, $loopevent['event_end']); $j = 0; - while ($event_length[$j]) { + while (isset($event_length[$j])) { if ($event_length[$j]['state'] == 'ended') { $event_length[$j] = array ('length' => ($drawEvent['draw_length'] / $gridLength), 'key' => $eventKey, 'overlap' => $loopevent['event_overlap'],'state' => 'begin'); break; @@ -269,7 +270,7 @@ if (is_array($master_array[($getdate)])) { if ($emptyWidth > 0) { echo ' '."\n"; } - while ($event_length[(sizeof($event_length) - 1)]['state'] == 'ended') { + while (isset($event_length[(sizeof($event_length) - 1)]) && $event_length[(sizeof($event_length) - 1)]['state'] == 'ended') { array_pop($event_length); } diff --git a/footer.inc.php b/footer.inc.php index efa7a3e..4ee0979 100644 --- a/footer.inc.php +++ b/footer.inc.php @@ -1 +1 @@ -
$powered_by_lang PHP iCalendar $version_lang"; if ($enable_rss == yes) { echo "
\n"; echo $this_site_is_lang.' RSS-Enabled
'; } echo ''; ?> \ No newline at end of file +
$powered_by_lang PHP iCalendar $version_lang"; if ($enable_rss == 'yes') { echo "
\n"; echo $this_site_is_lang.' RSS-Enabled
'; } echo ''; ?> \ No newline at end of file diff --git a/functions/error.php b/functions/error.php index 8f36b5c..1bc4fca 100644 --- a/functions/error.php +++ b/functions/error.php @@ -1,7 +1,8 @@ 2345) { - $allday_start = $start_date; - $allday_end = ($start_date + 1); + if (isset($start_time) && isset($end_time)) { + // Mozilla style all-day events or just really long events + if (($end_time - $start_time) > 2345) { + $allday_start = $start_date; + $allday_end = ($start_date + 1); + } + + // If the events go past midnight + if ($end_time < $start_time) $end_time = 2359; } - // If the events go past midnight - if ($end_time < $start_time) $end_time = 2359; - if (isset($start_time) && $start_time != '') { ereg ('([0-9]{2})([0-9]{2})', $start_time, $time); ereg ('([0-9]{2})([0-9]{2})', $end_time, $time2); @@ -155,7 +160,7 @@ if ($parse_file) { $hour = $time3[1]; $minute = $time3[2]; } - + // handle single changes in recurring events if ($uid_valid && $write_processed) { $processed[$uid] = array($start_date,($hour.$minute)); @@ -187,7 +192,7 @@ if ($parse_file) { } // Handling of the recurring events, RRULE - if (is_array($rrule_array)) { + if (isset($rrule_array) && is_array($rrule_array)) { if (isset($allday_start) && $allday_start != '') { $hour = '-'; $minute = '1'; @@ -484,6 +489,7 @@ if ($parse_file) { $data = ereg_replace('Z', '', $data); if (preg_match("/^DTSTART;VALUE=DATE/i", $field)) { $allday_start = $data; + $start_date = $allday_start; //echo "$summary - $allday_start
"; } else { if (preg_match("/^DTSTART;TZID=/i", $field)) { @@ -594,7 +600,9 @@ if ($parse_file) { $parts = explode(';', $field); foreach($parts as $part) { $eachval = split('=',$part); - if ($eachval[0] == 'TZID') { + if ($eachval[0] == 'RECURRENCE-ID') { + // do nothing + } elseif ($eachval[0] == 'TZID') { $recurrence_id['tzid'] = $eachval[1]; } elseif ($eachval[0] == 'RANGE') { $recurrence_id['range'] = $eachval[1]; diff --git a/functions/init.inc.php b/functions/init.inc.php index c92be45..744f49e 100644 --- a/functions/init.inc.php +++ b/functions/init.inc.php @@ -6,7 +6,7 @@ //chmod(BASE.'calendars/School.ics',0666); // uncomment when developing, comment for shipping version -//error_reporting (E_ALL); +// error_reporting (E_ALL); // Retain some compatibility backwards like. //jared.20021003 I think we're always going to make sure these are extracted by hand @@ -25,7 +25,7 @@ if(phpversion() >= '4.2.0') } */ -define('BASE', './'); +if (!defined('BASE')) define('BASE', './'); include(BASE.'config.inc.php'); include(BASE.'functions/error.php'); diff --git a/functions/overlapping_events.php b/functions/overlapping_events.php index 8a55f09..11e5322 100644 --- a/functions/overlapping_events.php +++ b/functions/overlapping_events.php @@ -109,7 +109,7 @@ function checkOverlap($ol_start_date, $ol_start_time, $ol_end_time) { if (isset($master_array[($ol_start_date)])) { foreach ($master_array[($ol_start_date)] as $keyTime => $eventTime) { foreach ($eventTime as $keyEvent => $event) { - $entryDrawTimes = drawEventTimes($event["event_start"], $event["event_end"]); + if ($keyTime != '-1') $entryDrawTimes = drawEventTimes($event["event_start"], $event["event_end"]); if (isset($entryDrawTimes["draw_start"], $entryDrawTimes["draw_end"], $drawTimes["draw_end"], $drawTimes["draw_start"]) && ($entryDrawTimes["draw_start"] < $drawTimes["draw_end"]) and ($entryDrawTimes["draw_end"] > $drawTimes["draw_start"])) { // define start time of overlap range and overlap block if ($entryDrawTimes["draw_start"] < $drawTimes["draw_start"]) { diff --git a/month_bottom.php b/month_bottom.php index 41c3c5d..d7210d7 100644 --- a/month_bottom.php +++ b/month_bottom.php @@ -375,21 +375,22 @@ $event_text2 = urlencode($event_text2); $description = addslashes(urlencode($new_val2["description"])); $description = str_replace("\"", """, $description); - $event_start = $new_val2["event_start"]; - $event_end = $new_val2["event_end"]; - $event_start = date ($timeFormat, strtotime ("$event_start")); - $event_end = date ($timeFormat, strtotime ("$event_end")); - $event_text = str_replace ("
", "", $event_text); - $event_start2 = $event_start; + if (isset($new_val2["event_start"])) { + $event_start = $new_val2["event_start"]; + $event_end = $new_val2["event_end"]; + $event_start = date ($timeFormat, strtotime ("$event_start")); + $event_end = date ($timeFormat, strtotime ("$event_end")); + $event_text = str_replace ("
", "", $event_text); + $event_start2 = $event_start; + } else { + $event_start = "$all_day_lang"; + $event_start2 = ''; + $event_end = ''; } if (strlen($event_text) > 70) { $event_text = substr("$event_text", 0, 65); $event_text = $event_text . "..."; } - if (!$new_val2["event_start"]) { - $event_start = "$all_day_lang"; - $event_start2 = ''; - $event_end = ''; - } + echo "\n"; echo " $dayofmonth ($event_start)\n"; echo "\n"; diff --git a/search.php b/search.php index c755d0c..b0f70e7 100644 --- a/search.php +++ b/search.php @@ -452,8 +452,9 @@ function format_recur($arr) { if ($arr['BYMONTHDAY'][(count($arr['BYMONTHDAY']) - 1)] == '0') unset($arr['BYMONTHDAY'][$last]); $last = count($arr['BYMONTHDAY']) - 1; foreach ($arr['BYMONTHDAY'] as $key => $day) { - ereg('([\-]{0,1})([0-9]{1,2})',$day,$regs); + ereg('(-{0,1})([0-9]{1,2})',$day,$regs); list($junk,$sign,$day) = $regs; + if ($sign != '') $list .= $sign; if ($key == $last) $list .= $day; else $list .= $day.$d; } @@ -465,9 +466,10 @@ function format_recur($arr) { $list = ''; $last = count($arr['BYDAY']) - 1; foreach ($arr['BYDAY'] as $key => $day) { - ereg('([\-]{0,1})([0-9]{0,1})([A-Z]{2})',$day,$regs); + ereg('([-\+]{0,1})([0-9]{0,1})([A-Z]{2})',$day,$regs); list($junk,$sign,$day_num,$day_txt) = $regs; $num = two2threeCharDays($day_txt,false); + if ($sign != '') $list .= $sign; if ($day_num != '') $list .= $day_num.' '; if ($key == $last) $list .= $daysofweek_lang[$num]; else $list .= $daysofweek_lang[$num].$d; diff --git a/sidebar.php b/sidebar.php index cd3774a..c814991 100644 --- a/sidebar.php +++ b/sidebar.php @@ -6,7 +6,7 @@ $cal_displayname2 = $cal_displayname2 . "..."; } - $search_box .= '
'; + $search_box = '
'; ?> diff --git a/week.php b/week.php index 880d1c5..a7bb38b 100644 --- a/week.php +++ b/week.php @@ -169,6 +169,8 @@ for ($i=0;$i<7;$i++) { $event_text2 = urlencode(addslashes($all_day_text)); $all_day_text = word_wrap($all_day_text, 12, $allday_week_lines); $description = addslashes(urlencode($allday["description"])); + $event_start = ''; + $event_end = ''; echo "\n"; echo "$all_day_text\n"; echo "\n"; @@ -224,9 +226,9 @@ for ($i=0;$i<7;$i++) { $this_time_arr = $master_array[$thisday][$cal_time]; } - if ("$day_start" == "$cal_time" && is_array($master_array[$thisday])) { + if ("$day_start" == "$cal_time" && isset($master_array[$thisday]) && is_array($master_array[$thisday])) { foreach($master_array[$thisday] as $time_key => $time_arr) { - if ((int)$time_key < (int)$cal_time && is_array($time_arr)) { + if ((int)$time_key < (int)$cal_time && is_array($time_arr) && $time_key != '-1') { foreach($time_arr as $event_tmp) { if ((int)$event_tmp['event_end'] > (int)$cal_time) { $this_time_arr[] = $event_tmp; -- cgit v1.2.3