From 281851bf42f3a2503bded854ad593693e224a0b8 Mon Sep 17 00:00:00 2001 From: Jim Hu Date: Thu, 16 Mar 2006 00:28:54 +0000 Subject: changes to fix several warnings and notices --- functions/date_functions.php | 4 +- functions/ical_parser.php | 99 +++++++++++++++++++++++++++++++++++++--- functions/init.inc.php | 2 +- functions/overlapping_events.php | 2 +- functions/template.php | 2 +- 5 files changed, 96 insertions(+), 13 deletions(-) diff --git a/functions/date_functions.php b/functions/date_functions.php index a9ebcc7..8cc8f90 100644 --- a/functions/date_functions.php +++ b/functions/date_functions.php @@ -219,9 +219,7 @@ function extractDateTime($data, $property, $field) { // Initialize values. unset($unixtime, $date, $time, $allday); - // What the heck is this doing in here? - #$data = str_replace ('/softwarestudio.org/Olson_20011030_5/', '', $data); - + $allday =''; #suppress error on returning undef. // Check for zulu time. $zulu_time = false; if (substr($data,-1) == 'Z') $zulu_time = true; diff --git a/functions/ical_parser.php b/functions/ical_parser.php index 76e8557..8b26468 100644 --- a/functions/ical_parser.php +++ b/functions/ical_parser.php @@ -104,9 +104,9 @@ foreach ($cal_filelist as $filename) { if ($parse_file) { // Let's see if we're doing a webcal - $is_webcal == FALSE; + $is_webcal = FALSE; if (substr($filename, 0, 7) == 'http://' || substr($filename, 0, 8) == 'https://' || substr($filename, 0, 9) == 'webcal://') { - $is_webcal == TRUE; + $is_webcal = TRUE; $cal_webcalPrefix = str_replace('http://','webcal://',$filename); $cal_httpPrefix = str_replace('webcal://','http://',$filename); $cal_httpsPrefix = str_replace('webcal://','https://',$filename); @@ -327,7 +327,27 @@ foreach ($cal_filelist as $filename) { $display_end_tmp = $end_time; } - $master_array[$start_date_tmp][$time_tmp][$uid] = array ('event_start' => $start_time_tmp, 'event_end' => $end_time_tmp, 'display_end' => $display_end_tmp, 'start_unixtime' => $start_unixtime, 'end_unixtime' => $end_unixtime, 'event_text' => $summary, 'event_length' => $length, 'event_overlap' => 0, 'description' => $description, 'status' => $status, 'class' => $class, 'spans_day' => true, 'location' => $location, 'organizer' => serialize($organizer), 'attendee' => serialize($attendee), 'calnumber' => $calnumber, 'calname' => $actual_calname, 'url' => $url ); + $master_array[$start_date_tmp][$time_tmp][$uid] = array ( + 'event_start' => $start_time_tmp, + 'event_end' => $end_time_tmp, + 'start_unixtime' => $start_unixtime, + 'end_unixtime' => $end_unixtime, + 'event_text' => $summary, + 'event_length' => $length, + 'event_overlap' => 0, + 'description' => $description, + 'status' => $status, + 'class' => $class, + 'spans_day' => true, + 'location' => $location, + 'organizer' => serialize($organizer), + 'attendee' => serialize($attendee), + 'calnumber' => $calnumber, + 'calname' => $actual_calname, + 'url' => $url ); + if (isset($display_end_tmp)){ + $master_array[$start_date_tmp][$time_tmp][$uid]['display_end'] = $display_end_tmp; + } checkOverlap($start_date_tmp, $time_tmp, $uid); $start_tmp = strtotime('+1 day',$start_tmp); } @@ -342,7 +362,27 @@ foreach ($cal_filelist as $filename) { // This if statement should prevent writing of an excluded date if its the first recurrance - CL if (!in_array($start_date, $except_dates)) { - $master_array[($start_date)][($hour.$minute)][$uid] = array ('event_start' => $start_time, 'event_end' => $end_time_tmp1, 'display_end' => $display_end_tmp, 'start_unixtime' => $start_unixtime, 'end_unixtime' => $end_unixtime, 'event_text' => $summary, 'event_length' => $length, 'event_overlap' => 0, 'description' => $description, 'status' => $status, 'class' => $class, 'spans_day' => false, 'location' => $location, 'organizer' => serialize($organizer), 'attendee' => serialize($attendee), 'calnumber' => $calnumber, 'calname' => $actual_calname, 'url' => $url ); + $master_array[($start_date)][($hour.$minute)][$uid] = array ( + 'event_start' => $start_time, + 'event_end' => $end_time_tmp1, + 'start_unixtime' => $start_unixtime, + 'end_unixtime' => $end_unixtime, + 'event_text' => $summary, + 'event_length' => $length, + 'event_overlap' => 0, + 'description' => $description, + 'status' => $status, + 'class' => $class, + 'spans_day' => false, + 'location' => $location, + 'organizer' => serialize($organizer), + 'attendee' => serialize($attendee), + 'calnumber' => $calnumber, + 'calname' => $actual_calname, + 'url' => $url ); + if (isset($display_end_tmp)){ + $master_array[($start_date)][($hour.$minute)][$uid]['display_end'] = $display_end_tmp; + } checkOverlap($start_date, ($hour.$minute), $uid); if (!$write_processed) $master_array[($start_date)][($hour.$minute)][$uid]['exception'] = true; } @@ -704,7 +744,28 @@ foreach ($cal_filelist as $filename) { // Let's double check the until to not write past it $until_check = $start_date_tmp.$time_tmp.'00'; if ($abs_until > $until_check) { - $master_array[$start_date_tmp][$time_tmp][$uid] = array ('event_start' => $start_time_tmp, 'event_end' => $end_time_tmp, 'display_end' => $display_end_tmp, 'start_unixtime' => $start_unixtime_tmp, 'end_unixtime' => $end_unixtime_tmp, 'event_text' => $summary, 'event_length' => $length, 'event_overlap' => 0, 'description' => $description, 'status' => $status, 'class' => $class, 'spans_day' => true, 'location' => $location, 'organizer' => serialize($organizer), 'attendee' => serialize($attendee), 'calnumber' => $calnumber, 'calname' => $actual_calname, 'url' => $url, 'recur' => $recur); + $master_array[$start_date_tmp][$time_tmp][$uid] = array ( + 'event_start' => $start_time_tmp, + 'event_end' => $end_time_tmp, + 'start_unixtime' => $start_unixtime_tmp, + 'end_unixtime' => $end_unixtime_tmp, + 'event_text' => $summary, + 'event_length' => $length, + 'event_overlap' => 0, + 'description' => $description, + 'status' => $status, + 'class' => $class, + 'spans_day' => true, + 'location' => $location, + 'organizer' => serialize($organizer), + 'attendee' => serialize($attendee), + 'calnumber' => $calnumber, + 'calname' => $actual_calname, + 'url' => $url, + 'recur' => $recur); + if (isset($display_end_tmp)){ + $master_array[$start_date_tmp][$time_tmp][$uid]['display_end'] = $display_end_tmp; + } checkOverlap($start_date_tmp, $time_tmp, $uid); } $start_tmp = strtotime('+1 day',$start_tmp); @@ -720,7 +781,28 @@ foreach ($cal_filelist as $filename) { // Let's double check the until to not write past it $until_check = $recur_data_date.$hour.$minute.'00'; if ($abs_until > $until_check) { - $master_array[($recur_data_date)][($hour.$minute)][$uid] = array ('event_start' => $start_time, 'event_end' => $end_time_tmp1, 'display_end' => $display_end_tmp, 'start_unixtime' => $start_unixtime_tmp, 'end_unixtime' => $end_unixtime_tmp, 'event_text' => $summary, 'event_length' => $length, 'event_overlap' => 0, 'description' => $description, 'status' => $status, 'class' => $class, 'spans_day' => false, 'location' => $location, 'organizer' => serialize($organizer), 'attendee' => serialize($attendee), 'calnumber' => $calnumber, 'calname' => $actual_calname, 'url' => $url, 'recur' => $recur); + $master_array[($recur_data_date)][($hour.$minute)][$uid] = array ( + 'event_start' => $start_time, + 'event_end' => $end_time_tmp1, + 'start_unixtime' => $start_unixtime_tmp, + 'end_unixtime' => $end_unixtime_tmp, + 'event_text' => $summary, + 'event_length' => $length, + 'event_overlap' => 0, + 'description' => $description, + 'status' => $status, + 'class' => $class, + 'spans_day' => false, + 'location' => $location, + 'organizer' => serialize($organizer), + 'attendee' => serialize($attendee), + 'calnumber' => $calnumber, + 'calname' => $actual_calname, + 'url' => $url, + 'recur' => $recur); + if (isset($display_end_tmp)){ + $master_array[($recur_data_date)][($hour.$minute)][$uid]['display_end'] = $display_end_tmp; + } checkOverlap($recur_data_date, ($hour.$minute), $uid); } } @@ -739,6 +821,7 @@ foreach ($cal_filelist as $filename) { // Added for version 0.9.5 if (is_array($except_dates)) { foreach ($except_dates as $key => $value) { + if (isset ($master_array[$value])){ $time = $except_times[$key]; unset($master_array[$value][$time][$uid]); if (count($master_array[$value][$time]) < 1) { @@ -749,6 +832,7 @@ foreach ($cal_filelist as $filename) { } } } + } // Clear event data now that it's been saved. unset($start_time, $start_time_tmp, $end_time, $end_time_tmp, $start_unixtime, $start_unixtime_tmp, $end_unixtime, $end_unixtime_tmp, $summary, $length, $description, $status, $class, $location, $organizer, $attendee); @@ -793,7 +877,7 @@ foreach ($cal_filelist as $filename) { default: unset ($field, $data, $prop_pos, $property); - ereg ("([^:]+):(.*)", $line, $line); + if (ereg ("([^:]+):(.*)", $line, $line)){ $field = $line[1]; $data = $line[2]; @@ -995,6 +1079,7 @@ foreach ($cal_filelist as $filename) { } } } + } if (!isset($master_array['-3'][$calnumber])) $master_array['-3'][$calnumber] = $actual_calname; if (!isset($master_array['-4'][$calnumber]['mtime'])) $master_array['-4'][$calnumber]['mtime'] = $actual_mtime; if (!isset($master_array['-4'][$calnumber]['filename'])) $master_array['-4'][$calnumber]['filename'] = $filename; diff --git a/functions/init.inc.php b/functions/init.inc.php index 4ebd0f6..96b9e6b 100644 --- a/functions/init.inc.php +++ b/functions/init.inc.php @@ -30,7 +30,7 @@ if ($calendar_path == '') { $calendar_path = BASE.'calendars'; } $cpath = ''; #initialize cpath to prevent later undef warnings. -if($_REQUEST['cpath']){ +if(isset($_REQUEST['cpath'])){ $cpath = str_replace('..','',$_REQUEST['cpath']); $calendar_path .= "/$cpath"; $tmp_dir .= "/$cpath"; diff --git a/functions/overlapping_events.php b/functions/overlapping_events.php index d5bcb9f..84e2afa 100644 --- a/functions/overlapping_events.php +++ b/functions/overlapping_events.php @@ -110,7 +110,7 @@ function flatten_ol_blocks($event_date, $ol_blocks, $new_block_key) { // Builds $overlap_array structure, and updates event_overlap in $master_array for the given events. function checkOverlap($event_date, $event_time, $uid) { global $master_array, $overlap_array; - + if (!isset($event_date)) return; $event = $master_array[$event_date][$event_time][$uid]; // Copy out the array - we replace this at the end. $ol_day_array = $overlap_array[$event_date]; diff --git a/functions/template.php b/functions/template.php index 8b4eb17..af93258 100644 --- a/functions/template.php +++ b/functions/template.php @@ -907,7 +907,7 @@ class Page { } else { $temp = $t_month[2]; } - if ($master_array[$daylink]) { + if (isset($master_array[$daylink])) { if ($type != 'small') { foreach ($master_array[$daylink] as $cal_time => $event_times) { foreach ($event_times as $uid => $val) { -- cgit v1.2.3