From b2b80439dfb4078a003b0a768c634b50759ddcb0 Mon Sep 17 00:00:00 2001 From: Jim Hu Date: Fri, 12 Oct 2007 06:41:33 +0000 Subject: deal with various unset variable warning situations --- functions/calendar_functions.php | 1 + functions/date_functions.php | 1 + functions/ical_parser.php | 2 +- functions/init.inc.php | 2 +- functions/list_functions.php | 5 +++++ functions/template.php | 5 ++++- month.php | 1 + print.php | 3 +-- week.php | 1 - year.php | 1 - 10 files changed, 15 insertions(+), 7 deletions(-) diff --git a/functions/calendar_functions.php b/functions/calendar_functions.php index 23d23ec..d48713d 100644 --- a/functions/calendar_functions.php +++ b/functions/calendar_functions.php @@ -207,6 +207,7 @@ function getCalendarName($cal_path) { function display_ical_list($cals, $pick=FALSE) { global $cal, $ALL_CALENDARS_COMBINED, $current_view, $getdate, $calendar_lang, $all_cal_comb_lang, $cal_filelist, $cal_displaynames; // Print each calendar option. + $return = ''; foreach ($cals as $cal_tmp) { // Format the calendar path for display. // diff --git a/functions/date_functions.php b/functions/date_functions.php index 83e51af..0e2dca4 100644 --- a/functions/date_functions.php +++ b/functions/date_functions.php @@ -236,6 +236,7 @@ function extractDateTime($data, $property, $field) { // Set the values. $unixtime = strtotime($data); $date = date('Ymd', $unixtime); + $time = ''; $allday = $data; } diff --git a/functions/ical_parser.php b/functions/ical_parser.php index 008ab86..6defc11 100644 --- a/functions/ical_parser.php +++ b/functions/ical_parser.php @@ -134,7 +134,7 @@ foreach ($cal_filelist as $cal_key=>$filename) { $nextline = fgets($ifile, 1024); $nextline = ereg_replace("[\r\n]", "", $nextline); #handle continuation lines that start with either a space or a tab (MS Outlook) - while ($nextline{0} == " " || $nextline{0} == "\t") { + while (isset($nextline{0}) && ($nextline{0} == " " || $nextline{0} == "\t")) { $line = $line . substr($nextline, 1); $nextline = fgets($ifile, 1024); $nextline = ereg_replace("[\r\n]", "", $nextline); diff --git a/functions/init.inc.php b/functions/init.inc.php index b6c99ee..1a0007f 100644 --- a/functions/init.inc.php +++ b/functions/init.inc.php @@ -50,7 +50,7 @@ if (isset($user_template["$cpath"])){ $template = $user_template["$cpath"]; } #set up specific webcals for a particular cpath -if (is_array($more_webcals[$cpath])){ +if (isset($more_webcals) && is_array($more_webcals[$cpath])){ $list_webcals = array_merge($list_webcals, $more_webcals["$cpath"]); } include_once(BASE.'error.php'); diff --git a/functions/list_functions.php b/functions/list_functions.php index 875a44b..7f6d817 100644 --- a/functions/list_functions.php +++ b/functions/list_functions.php @@ -14,6 +14,7 @@ function list_jumps() { function list_calcolors() { global $template, $master_array, $unique_colors; + $return = ''; $i = 1; if (is_array($master_array['-3'])) { foreach ($master_array['-3'] as $key => $val) { @@ -30,6 +31,7 @@ function list_months() { global $getdate, $this_year, $cal, $dateFormat_month; $month_time = strtotime("$this_year-01-01"); $getdate_month = date("m", strtotime($getdate)); + $return = ''; for ($i=0; $i<12; $i++) { $monthdate = date ("Ymd", $month_time); $month_month = date("m", $month_time); @@ -48,6 +50,7 @@ function list_months() { function list_years() { global $getdate, $this_year, $cal, $num_years; $year_time = strtotime($getdate); + $return = ''; for ($i=0; $i < $num_years; $i++) { $offset = $num_years - $i; $prev_time = strtotime("-$offset year", $year_time); @@ -81,6 +84,7 @@ function list_weeks() { $check_week = strtotime($getdate); $start_week_time = strtotime(dateOfWeek(date("Ymd", strtotime("$this_year-01-01")), $week_start_day)); $end_week_time = $start_week_time + (6 * 25 * 60 * 60); + $return = ''; do { $weekdate = date ("Ymd", $start_week_time); @@ -101,6 +105,7 @@ function list_weeks() { function list_languages() { global $getdate, $cal, $current_view; + $return = ''; $dir_handle = @opendir(BASE.'languages/'); $tmp_pref_language = urlencode(ucfirst($language)); while ($file = readdir($dir_handle)) { diff --git a/functions/template.php b/functions/template.php index 9efd8ce..e5aab05 100644 --- a/functions/template.php +++ b/functions/template.php @@ -900,6 +900,8 @@ class Page { $langtype = $daysofweek_lang; } + $weekday_loop = ''; + $middle = ''; for ($i=0; $i<7; $i++) { $day_num = date("w", $start_day); $weekday = $langtype[$day_num]; @@ -1006,6 +1008,7 @@ class Page { $u_start = strtotime($m_start); $i=0; $seen_events = array(); + $middle = ''; do { if (isset($master_array[$m_start])) { foreach ($master_array[$m_start] as $cal_time => $event_times) { @@ -1020,7 +1023,7 @@ class Page { $switch['CALNAME'] = $val['calname']; if (!isset($val['event_start'])) { $switch['START_TIME'] = $lang['l_all_day']; - $switch['EVENT_TEXT'] = openevent($m_start, $cal_time, $uid, $val, $month_event_lines, 15, 'psf'); + $switch['EVENT_TEXT'] = openevent($m_start, $cal_time, $uid, $val, @$month_event_lines, 15, 'psf'); $switch['DESCRIPTION'] = urldecode($val['description']); } else { $event_start = $val['start_unixtime']; diff --git a/month.php b/month.php index bd6152a..f817a0b 100644 --- a/month.php +++ b/month.php @@ -12,6 +12,7 @@ $today_today = date('Ymd', time() + $second_offset); $tomorrows_date = date('Ymd', strtotime("+1 day", $unix_time)); $yesterdays_date = date('Ymd', strtotime("-1 day", $unix_time)); $sidebar_date = localizeDate($dateFormat_week_list, $unix_time); +if (!isset($style_select)) $style_select = ''; // find out next month $next_month_month = ($this_month+1 == '13') ? '1' : ($this_month+1); diff --git a/print.php b/print.php index 27230e6..3880cd2 100644 --- a/print.php +++ b/print.php @@ -1,9 +1,8 @@