aboutsummaryrefslogtreecommitdiffstats
path: root/functions
diff options
context:
space:
mode:
authorjwangen <jwangen>2002-11-02 05:17:17 +0000
committerjwangen <jwangen>2002-11-02 05:17:17 +0000
commit15e50df43b59493358d034ca684450aec36093c9 (patch)
treed052ede69aec8cf4fde15499f6d17c775451cac3 /functions
parentc1b79428e7e0ce1c094457932e1941fd397768ce (diff)
downloadphpicalendar-15e50df43b59493358d034ca684450aec36093c9.tar.gz
phpicalendar-15e50df43b59493358d034ca684450aec36093c9.tar.bz2
phpicalendar-15e50df43b59493358d034ca684450aec36093c9.zip
fixed all errors which error_reporting() was returning
Diffstat (limited to 'functions')
-rw-r--r--functions/error.php9
-rw-r--r--functions/ical_parser.php30
-rw-r--r--functions/init.inc.php4
-rw-r--r--functions/overlapping_events.php2
4 files changed, 28 insertions, 17 deletions
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"]) {

© 2014-2024 Faster IT GmbH | imprint | privacy policy