diff options
author | jwangen <jwangen> | 2002-11-02 05:17:17 +0000 |
---|---|---|
committer | jwangen <jwangen> | 2002-11-02 05:17:17 +0000 |
commit | 15e50df43b59493358d034ca684450aec36093c9 (patch) | |
tree | d052ede69aec8cf4fde15499f6d17c775451cac3 | |
parent | c1b79428e7e0ce1c094457932e1941fd397768ce (diff) | |
download | phpicalendar-15e50df43b59493358d034ca684450aec36093c9.tar.gz phpicalendar-15e50df43b59493358d034ca684450aec36093c9.tar.bz2 phpicalendar-15e50df43b59493358d034ca684450aec36093c9.zip |
fixed all errors which error_reporting() was returning
-rw-r--r-- | day.php | 11 | ||||
-rw-r--r-- | footer.inc.php | 2 | ||||
-rw-r--r-- | functions/error.php | 9 | ||||
-rw-r--r-- | functions/ical_parser.php | 30 | ||||
-rw-r--r-- | functions/init.inc.php | 4 | ||||
-rw-r--r-- | functions/overlapping_events.php | 2 | ||||
-rw-r--r-- | month_bottom.php | 23 | ||||
-rw-r--r-- | search.php | 6 | ||||
-rw-r--r-- | sidebar.php | 2 | ||||
-rw-r--r-- | week.php | 6 |
10 files changed, 56 insertions, 39 deletions
@@ -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 '<tr>'."\n"; echo '<td valign="top" align="center" class="eventbg"><a class="psf" href="javascript:openEventInfo(\''.$event_text2.'\', \''.$calendar_name.'\', \''.$event_start.'\', \''.$event_end.'\', \''.$description.'\')"><font color="#ffffff"><i>'.$event_text.'</i></font></a></td>'."\n"; echo '</tr>'."\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 '<td bgcolor="#ffffff" colspan="' . $emptyWidth . '" ' . $class . '> </td>'."\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 @@ -<?php
echo "<center><font class=\"V9\"><br>$powered_by_lang <a class=\"psf\" href=\"http://phpicalendar.sourceforge.net/\">PHP iCalendar $version_lang</a>";
if ($enable_rss == yes) {
echo "<br>\n";
echo $this_site_is_lang.' <a class="psf" href="'.BASE.'rss/">RSS-Enabled</a></font></center>';
}
echo '</font></center>';
?>
\ No newline at end of file +<?php
echo "<center><font class=\"V9\"><br>$powered_by_lang <a class=\"psf\" href=\"http://phpicalendar.sourceforge.net/\">PHP iCalendar $version_lang</a>";
if ($enable_rss == 'yes') {
echo "<br>\n";
echo $this_site_is_lang.' <a class="psf" href="'.BASE.'rss/">RSS-Enabled</a></font></center>';
}
echo '</font></center>';
?>
\ 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 @@ <?php -define('BASE','../'); +if (!defined('BASE')) define('BASE','../'); + function error($error_msg='There was an error processing the request.', $file='NONE') { - global $style_sheet, $powered_by_lang, $version_lang, $error_title_lang, $error_window_lang, $error_calendar_lang, $error_back_lang; + global $style_sheet, $powered_by_lang, $version_lang, $error_title_lang, $error_window_lang, $error_calendar_lang, $error_back_lang, $enable_rss, $this_site_is_lang; if (!isset($style_sheet)) $style_sheet = 'silver'; if (!isset($powered_by_lang)) $powered_by_lang = 'Powered by'; if (!isset($version_lang)) $version_lang = '0.8'; @@ -9,7 +10,9 @@ function error($error_msg='There was an error processing the request.', $file='N if (!isset($error_window_lang)) $error_window_lang = 'There was an error!'; if (!isset($error_calendar_lang)) $error_calendar_lang = 'The calendar "%s" was being processed when this error occurred.'; if (!isset($error_back_lang)) $error_back_lang = 'Please use the "Back" button to return.'; - + if (!isset($enable_rss)) $enable_rss = 'no'; + if (!isset($this_site_is_lang)) $this_site_is_lang = 'This site is'; + $error_calendar = sprintf($error_calendar_lang, $file); ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" diff --git a/functions/ical_parser.php b/functions/ical_parser.php index f8b6487..288751b 100644 --- a/functions/ical_parser.php +++ b/functions/ical_parser.php @@ -1,6 +1,6 @@ <?php -define('BASE', './'); +if (!defined('BASE')) define('BASE', './'); include(BASE.'functions/init.inc.php'); include(BASE.'functions/date_functions.php'); include(BASE.'functions/draw_functions.php'); @@ -132,19 +132,24 @@ if ($parse_file) { $write_processed = true; } + if (!isset($summary)) $summary = ''; + if (!isset($description)) $description = ''; + $mArray_begin = mktime (0,0,0,1,1,$this_year); $mArray_end = mktime (0,0,0,1,10,($this_year + 1)); //if ((!$allday_end) && (!$end_time)) $allday_end = $mArray_end; - // 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 (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<br>"; } 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 ("<br>", "", $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 ("<br>", "", $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 "<tr>\n"; echo "<td align=\"left\" valign=\"top\" width =\"160\" class=\"montheventline\" nowrap><font $fontclass> <a class=\"psf\" href=\"day.php?cal=$cal&getdate=$key\">$dayofmonth</a></font> <font class=\"V9G\">($event_start)</font></td>\n"; echo "<td align=\"left\" valign=\"top\" colspan=\"2\">\n"; @@ -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 .= '<form action="search.php" method="GET"><input type="hidden" name="cal" value="'.$cal.'"><input type="hidden" name="getdate" value="'.$getdate.'"><input type="text" size="15" class="search_style" name="query" value="'.$search_lang.'" onfocus="javascript:if(this.value==\''.$search_lang.'\') {this.value=\'\';}" onblur="javascript:if(this.value==\'\') {this.value=\''.$search_lang.'\'}"><INPUT type="image" src="styles/'.$style_sheet.'/search.gif" border=0 height="19" width="18" name="submit" value="Search"></form>'; + $search_box = '<form action="search.php" method="GET"><input type="hidden" name="cal" value="'.$cal.'"><input type="hidden" name="getdate" value="'.$getdate.'"><input type="text" size="15" class="search_style" name="query" value="'.$search_lang.'" onfocus="javascript:if(this.value==\''.$search_lang.'\') {this.value=\'\';}" onblur="javascript:if(this.value==\'\') {this.value=\''.$search_lang.'\'}"><INPUT type="image" src="styles/'.$style_sheet.'/search.gif" border=0 height="19" width="18" name="submit" value="Search"></form>'; ?> @@ -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 "<tr>\n"; echo "<td valign=\"top\" align=\"center\" class=\"eventbg\"><a class=\"psf\" href=\"javascript:openEventInfo('$event_text2', '$calendar_name', '$event_start', '$event_end', '$description')\"><font color=\"#ffffff\">$all_day_text</font></a></td>\n"; echo "</tr>\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; |