From 9b00469b471a8b159c60ecca333f0f7064ba1d27 Mon Sep 17 00:00:00 2001 From: Jim Hu Date: Sat, 20 Dec 2008 03:22:54 +0000 Subject: misc error warnings and notices --- functions/draw_functions.php | 8 ++++---- functions/ical_parser.php | 20 +++++++++++++++----- functions/init/date_range.php | 2 +- functions/parse/end_vevent.php | 5 +++-- functions/parse/recur_functions.php | 2 +- functions/template.php | 37 ++++++++++++++++++++++--------------- 6 files changed, 46 insertions(+), 28 deletions(-) (limited to 'functions') diff --git a/functions/draw_functions.php b/functions/draw_functions.php index 20938a9..cc1c363 100644 --- a/functions/draw_functions.php +++ b/functions/draw_functions.php @@ -5,8 +5,8 @@ function drawEventTimes ($start, $end) { global $phpiCal_config; $gridLength = $phpiCal_config->gridLength; preg_match ('/([0-9]{2})([0-9]{2})/', $start, $time); - $sta_h = $time[1]; - $sta_min = $time[2]; + $sta_h = @$time[1]; + $sta_min = @$time[2]; $sta_min = sprintf("%02d", floor($sta_min / $gridLength) * $gridLength); if ($sta_min == 60) { $sta_h = sprintf("%02d", ($sta_h + 1)); @@ -14,8 +14,8 @@ function drawEventTimes ($start, $end) { } preg_match ('/([0-9]{2})([0-9]{2})/', $end, $time); - $end_h = $time[1]; - $end_min = $time[2]; + $end_h = @$time[1]; + $end_min = @$time[2]; $end_min = sprintf("%02d", floor($end_min / $gridLength) * $gridLength); if ($end_min == 60) { $end_h = sprintf("%02d", ($end_h + 1)); diff --git a/functions/ical_parser.php b/functions/ical_parser.php index c52594d..393a076 100644 --- a/functions/ical_parser.php +++ b/functions/ical_parser.php @@ -135,7 +135,7 @@ foreach ($cal_filelist as $cal_key=>$filename) { $allday_start, $allday_end, $start, $end, $the_duration, $beginning, $start_of_vevent, $url, $valarm_description, $start_unixtime, $end_unixtime, $display_end_tmp, $end_time_tmp1, - $recurrence_id, $uid, $rrule, $abs_until, $until_check, + $recurrence_id, $uid, $rrule, $until_check, $until, $byweek, $byweekno, $byminute, $byhour, $bysecond ); @@ -170,9 +170,9 @@ foreach ($cal_filelist as $cal_key=>$filename) { include BASE."functions/parse/end_vevent.php"; break; case 'END:VTODO': - if ((!$vtodo_priority) && ($status == 'COMPLETED')) { + if (($vtodo_priority == '') && ($status == 'COMPLETED')) { $vtodo_sort = 11; - } elseif (!$vtodo_priority) { + } elseif ($vtodo_priority == '') { $vtodo_sort = 10; } else { $vtodo_sort = $vtodo_priority; @@ -209,6 +209,16 @@ foreach ($cal_filelist as $cal_key=>$filename) { case 'BEGIN:VTODO': $vtodo_set = TRUE; + $summary = ''; + $due_date = ''; + $due_time = ''; + $completed_date = ''; + $completed_time = ''; + $vtodo_priority = ''; + $vtodo_categories = ''; + $status = ''; + $class = ''; + $description = ''; break; case 'BEGIN:VALARM': $valarm_set = TRUE; @@ -287,7 +297,7 @@ foreach ($cal_filelist as $cal_key=>$filename) { preg_match ('/([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{0,2})([0-9]{0,2})/', $exdata, $regs); $except_dates[] = $regs[1] . $regs[2] . $regs[3]; // Added for Evolution, since they dont think they need to tell me which time to exclude. - if (($regs[4] == '') && ($start_time != '')) { + if ($regs[4] == '' && isset($start_time) && $start_time != '') { $except_times[] = $start_time; } else { $except_times[] = $regs[4] . $regs[5]; @@ -356,7 +366,7 @@ foreach ($cal_filelist as $cal_key=>$filename) { } else { $offset_tmp = $chooseOffset($recur_unixtime); } - $recur_unixtime = calcTime($offset_tmp, $server_offset_tmp, $recur_unixtime); + $recur_unixtime = calcTime($offset_tmp, @$server_offset_tmp, $recur_unixtime); $recurrence_id['date'] = date('Ymd', $recur_unixtime); $recurrence_id['time'] = date('Hi', $recur_unixtime); $recurrence_d = date('Ymd', $recur_unixtime); diff --git a/functions/init/date_range.php b/functions/init/date_range.php index d7e4235..c74b1dc 100644 --- a/functions/init/date_range.php +++ b/functions/init/date_range.php @@ -3,7 +3,7 @@ if (!isset($getdate)) { if (isset($_GET['getdate']) && ($_GET['getdate'] !== '')) { $getdate = $_GET['getdate']; } else { - $getdate = date('Ymd', time() + $phpIcal_config->second_offset); + $getdate = date('Ymd', time() + $phpiCal_config->second_offset); } } diff --git a/functions/parse/end_vevent.php b/functions/parse/end_vevent.php index 88f94fa..e9e3064 100644 --- a/functions/parse/end_vevent.php +++ b/functions/parse/end_vevent.php @@ -11,6 +11,8 @@ What happens in this file: 3. Add occurrences to master_array */ +if (!isset($start_date)) echo "no start date for $summary
"; + // Handle DURATION if (!isset($end_unixtime)) { if(!isset($the_duration)) $the_duration = 0; @@ -132,7 +134,6 @@ foreach ($rrule_array as $key => $val) { $until = str_replace('T', '', $val); $until = str_replace('Z', '', $until); if (strlen($until) == 8) $until = $until.'235959'; - $abs_until = $until; ereg ('([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})', $until, $regs); $until_unixtime = mktime($regs[4],$regs[5],@$regs[6],$regs[2],$regs[3],$regs[1]); $recur_array[($start_date)][($hour.$minute)][$uid]['recur'][$key] = localizeDate($dateFormat_week,$until); @@ -330,7 +331,7 @@ foreach($recur_data as $recur_data_unixtime) { // Let's double check the until to not write past it $until_check = $start_date_tmp.$time_tmp.'00'; - if ($abs_until > $until_check) { + if (@$until > $until_check) { $master_array[$start_date_tmp][$time_tmp][$uid] = array ( 'event_start' => $start_time_tmp, 'event_end' => $end_time_tmp, diff --git a/functions/parse/recur_functions.php b/functions/parse/recur_functions.php index daf7399..c0ea88f 100644 --- a/functions/parse/recur_functions.php +++ b/functions/parse/recur_functions.php @@ -57,7 +57,7 @@ function add_recur($times,$freq=''){ } function expand_bymonth($time){ global $bymonth, $byweekno, $bymonthday, $year, $start_unixtime, $freq_type; - if(!empty($byweekno)) return $times; + if(!empty($byweekno)) return $time; if(empty($bymonth)) $bymonth = array(date("m", $start_unixtime)); $d = date("d",$start_unixtime); if (!empty($bymonthday)) $d = 1; diff --git a/functions/template.php b/functions/template.php index ed73672..5338b44 100644 --- a/functions/template.php +++ b/functions/template.php @@ -64,32 +64,34 @@ class Page { $parse_year = date ("Y", strtotime($getdate)); $seen_events = array(); + $final = ''; foreach($master_array as $key => $val) { preg_match ('/([0-9]{6})([0-9]{2})/', $key, $regs); - if ((($regs[1] == $parse_month) && ($printview == 'month')) || (($key == $getdate) && ($printview == 'day')) || ((($key >= $week_start) && ($key <= $week_end)) && ($printview == 'week')) || ((substr($regs[1],0,4) == $parse_year) && ($printview == 'year'))) { - $events_week++; + if (((@$regs[1] == $parse_month) && ($printview == 'month')) || (($key == $getdate) && ($printview == 'day')) || ((($key >= $week_start) && ($key <= $week_end)) && ($printview == 'week')) || ((substr(@$regs[1],0,4) == $parse_year) && ($printview == 'year'))) { + @$events_week++; $dayofmonth = strtotime ($key); $dayofmonth = localizeDate ($dateFormat_day, $dayofmonth); $events_tmp = $loop_event; $day_tmp = $loop_day; $day_events = 0; // Pull out each day + $some_events = ''; foreach ($val as $new_val) { foreach ($new_val as $new_key2 => $new_val2) { - if (isset($seen_events["$new_key2"]) && $new_val2['spans_day'] == 1){ + if (isset($seen_events["$new_key2"]) && isset($new_val2['spans_day']) && $new_val2['spans_day'] == 1){ $new_val2['event_text'] .= " second instance of ".$new_key2; continue; } $seen_events["$new_key2"] = 1; $day_events++; - if ($new_val2['event_text']) { + if (isset($new_val2['event_text'])) { $event_text = stripslashes(urldecode($new_val2['event_text'])); - $location = stripslashes(urldecode($new_val2['location'])); - $description = stripslashes(urldecode($new_val2['description'])); - $event_start = $new_val2['event_start']; - $event_end = $new_val2['event_end']; + $location = stripslashes(urldecode(@$new_val2['location'])); + $description = stripslashes(urldecode(@$new_val2['description'])); + $event_start = @$new_val2['event_start']; + $event_end = @$new_val2['event_end']; if (isset($new_val2['display_end'])) $event_end = $new_val2['display_end']; - if (!$new_val2['event_start']) { + if (!isset($new_val2['event_start'])) { $event_start = $lang['l_all_day']; $event_start2 = ''; $event_end = ''; @@ -119,7 +121,8 @@ class Page { if ($day_events == 0) continue; $day_tmp = str_replace('{DAYOFMONTH}', $dayofmonth, $day_tmp); $final .= $day_tmp.$some_events; - unset ($day_tmp, $some_events); + unset ($day_tmp); + $some_events = ''; } } @@ -279,11 +282,12 @@ class Page { $loop_ad = trim($match1[1]); $loop_begin = trim($match2[1]); $loop_end = trim($match3[1]); + $weekreplace = ''; foreach ($weekarray as $get_date) { $replace = $loop_begin; $colspan = 'colspan="'.$nbrGridCols[$get_date].'"'; $replace = str_replace('{COLSPAN}', $colspan, $replace); - if (is_array($master_array[$get_date]['-1']) && !empty($master_array[$get_date]['-1']) ) { + if (isset($master_array[$get_date]['-1']) && is_array($master_array[$get_date]['-1']) && !empty($master_array[$get_date]['-1']) ) { foreach ($master_array[$get_date]['-1'] as $uid => $allday) { $event_calno = $allday['calnumber']; $event_calno = (($event_calno - 1) % $phpiCal_config->unique_colors) + 1; @@ -350,6 +354,7 @@ class Page { $event_length[$thisday] = array (); $thisdate = ($thisdate + (25 * 60 * 60)); } + $weekdisplay = ''; foreach ($day_array as $key) { $cal_time = $key; preg_match('/([0-9]{2})([0-9]{2})/', $key, $regs_tmp); @@ -467,7 +472,7 @@ class Page { // Start drawing the event $event_temp = $loop_event; - $event = openevent($thisday, $cal_time, $uid, $this_time_arr[$uid], $week_events_lines, 25, 'ps'); + $event = openevent($thisday, $cal_time, $uid, $this_time_arr[$uid], $phpiCal_config->week_events_lines, 25, 'ps'); $event_temp = str_replace('{EVENT}', $event, $event_temp); $event_temp = str_replace('{EVENT_START}', $event_start, $event_temp); $event_temp = str_replace('{CONFIRMED}', $confirmed, $event_temp); @@ -738,10 +743,12 @@ class Page { preg_match("!<\!-- switch t_event on -->(.*)<\!-- switch t_event off -->!Uis", $this->page, $match2); $loop_t_ad = trim($match1[1]); $loop_t_e = trim($match2[1]); + $replace_ad = ''; + $replace_e = ''; $return_adtmp = ''; $return_etmp = ''; - if (is_array($master_array[$next_day]) && sizeof($master_array[$next_day]) > 0) { + if (isset($master_array[$next_day]) && is_array($master_array[$next_day]) && sizeof($master_array[$next_day]) > 0) { foreach ($master_array[$next_day] as $cal_time => $event_times) { foreach ($event_times as $uid => $val) { $event_text = stripslashes(urldecode($val["event_text"])); @@ -811,7 +818,7 @@ class Page { document.todo_popup_data[$todo_popup_data_index] = todoData; // -->"; - $todo .= ''; + $todo .= ''; $todo_popup_data_index++; $vtodo_array = $todo; @@ -1015,7 +1022,7 @@ class Page { # $switch['START_DATE'] = localizeDate ($dateFormat_week_list, $u_start); $start_date = localizeDate ($dateFormat_week_list, $u_start); foreach ($event_times as $uid => $val) { - if (isset($seen_events[$uid]) && $val['spans_day'] == 1) continue; + if (isset($seen_events[$uid]) && @$val['spans_day'] == 1) continue; $seen_events[$uid] = 1; $switch['CAL'] = $cal; $switch['START_DATE'] = $start_date; -- cgit v1.2.3