From f624f9143722a6e32f702f6e75f24ae457f85d8c Mon Sep 17 00:00:00 2001 From: Jim Hu Date: Fri, 12 Dec 2008 06:22:57 +0000 Subject: misc changes for new config model --- functions/calendar_functions.php | 4 ++-- functions/init.inc.php | 8 ++++---- functions/init/configs.php | 16 +++++++--------- functions/template.php | 22 +++++++++++----------- 4 files changed, 24 insertions(+), 26 deletions(-) (limited to 'functions') diff --git a/functions/calendar_functions.php b/functions/calendar_functions.php index f4e7a81..b814cb1 100644 --- a/functions/calendar_functions.php +++ b/functions/calendar_functions.php @@ -288,9 +288,9 @@ function display_ical_list($cals, $pick=FALSE) { // option to open all (non-web) calenders together if (!$pick) { if ($cal == $phpiCal_config->ALL_CALENDARS_COMBINED) { - $return .= ""; + $return .= ""; } else { - $return .= ""; + $return .= ""; } } return $return; diff --git a/functions/init.inc.php b/functions/init.inc.php index fee5d72..0b9f77b 100644 --- a/functions/init.inc.php +++ b/functions/init.inc.php @@ -149,13 +149,13 @@ if (count($local_cals) > 0) { $add_cpath = ''; if (isset($cpath) && $cpath !='') $add_cpath = "$cpath/"; - if (($download_uri == '') && (preg_match('/(^\/|\.\.\/)/', $filename) == 0)) { + if (($phpiCal_config->download_uri == '') && (preg_match('/(^\/|\.\.\/)/', $filename) == 0)) { $subscribe_path = 'webcal://'.$_SERVER['SERVER_NAME'].dirname($_SERVER['PHP_SELF']).'/'.$filename; $download_filename = $filename; - } elseif ($download_uri != '') { - $newurl = eregi_replace("^(http://)", "", $download_uri); + } elseif ($phpiCal_config->download_uri != '') { + $newurl = eregi_replace("^(http://)", "", $phpiCal_config->download_uri); $subscribe_path = 'webcal://'.$newurl.'/'.$add_cpath.basename($filename); - $download_filename = $download_uri.'/'.$add_cpath.basename($filename); + $download_filename = $phpiCal_config->download_uri.'/'.$add_cpath.basename($filename); } else { $subscribe_path = $add_cpath; $download_filename = $add_cpath; diff --git a/functions/init/configs.php b/functions/init/configs.php index 9cea67b..aa79610 100644 --- a/functions/init/configs.php +++ b/functions/init/configs.php @@ -2,16 +2,15 @@ // Pull in the configuration and some functions. include_once(BASE.'default_config.php'); if (is_file(BASE.'config.inc.php')){ - include_once(BASE.'config.inc.php'); + include(BASE.'config.inc.php'); foreach($configs as $key=>$value) $phpiCal_config->setProperty($key, $value); } -// Set the cookie URI. if ($phpiCal_config->cookie_uri == '') { - $phpiCal_config->setProperty('cookie_uri', $_SERVER['SERVER_NAME'].substr($_SERVER['PHP_SELF'],0,strpos($_SERVER['PHP_SELF'], '/') ).'phpicalendar' ); + $phpiCal_config->cookie_uri = $_SERVER['SERVER_NAME'].substr($_SERVER['PHP_SELF'],0,strpos($_SERVER['PHP_SELF'], '/')); } - -if (isset($_COOKIE[$phpiCal_config->cookie_uri]) && !isset($_POST['unset'])) { - $phpicalendar = unserialize(stripslashes($_COOKIE[$cookie_name])); +$cookie_name = 'phpicalendar_'.basename($phpiCal_config->default_path); +if (isset($_COOKIE[$cookie_name]) && !isset($_POST['unset'])) { + $phpicalendar = unserialize(stripslashes($_COOKIE[$phpiCal_config->cookie_uri])); if (isset($phpicalendar['cookie_language'])) $phpiCal_config->setProperty('language', $phpicalendar['cookie_language']); if (isset($phpicalendar['cookie_calendar'])) $phpiCal_config->setProperty('default_cal_check', $phpicalendar['cookie_calendar']); if (isset($phpicalendar['cookie_cpath'])) $phpiCal_config->setProperty('default_cpath_check', $phpicalendar['cookie_cpath']); @@ -20,7 +19,7 @@ if (isset($_COOKIE[$phpiCal_config->cookie_uri]) && !isset($_POST['unset'])) { $phpiCal_config->setProperty('template', $phpicalendar['cookie_style']); } if (isset($phpicalendar['cookie_startday'])) $phpiCal_config->setProperty('week_start_day', $phpicalendar['cookie_startday']); - if (isset($phpicalendar['cookie_time'])) $phpiCal_config->setProperty('day_start', $phpicalendar['cookie_time']); + if (isset($phpicalendar['cookie_time'])) $phpiCal_config->setProperty('day_start', $phpicalendar['cookie_time']); echo "cookie!"; } # language support @@ -51,8 +50,7 @@ while ($fillTime < $phpiCal_config->day_end) { } -/* -echo "
xx";
+/*echo "
xx";
 print_r($configs);
 print_r($phpiCal_config);
 echo "
"; diff --git a/functions/template.php b/functions/template.php index c47d2a6..c5a9c6f 100644 --- a/functions/template.php +++ b/functions/template.php @@ -246,13 +246,13 @@ class Page { }#end draw_search function draw_week($template_p) { - global $phpiCal_config, $start_week_time, $getdate, $cal, $master_array, $dateFormat_week_list, $current_view, $day_array, $timeFormat, $timeFormat_small, $week_length; + global $phpiCal_config, $start_week_time, $getdate, $cal, $master_array, $dateFormat_week_list, $current_view, $day_array, $timeFormat, $timeFormat_small; // Figure out colspans $dayborder = 0; $thisdate = $start_week_time; $swt = $start_week_time; - for ($i=0;$i<7;$i++) { + for ($i=0;$i < 7;$i++) { $thisday = date("Ymd", $thisdate); $nbrGridCols[$thisday] = 1; if (isset($master_array[$thisday])) { @@ -267,7 +267,7 @@ class Page { $thisdate = ($thisdate + (25 * 60 * 60)); } - for ($i=0; $i<$week_length; $i++) { + for ($i=0; $i < $phpiCal_config->week_length; $i++) { $thisdate = date ('Ymd', $start_week_time); $weekarray[$i] = $thisdate; $start_week_time = strtotime('+1 day', $start_week_time); @@ -304,11 +304,11 @@ class Page { $loop_dof = trim($match1[1]); $start_wt = strtotime(dateOfWeek($getdate, $phpiCal_config->week_start_day)); $start_day = strtotime($phpiCal_config->week_start_day); - for ($i=0; $i<$week_length; $i++) { + for ($i=0; $i<$phpiCal_config->week_length; $i++) { $day_num = date("w", $start_day); $daylink = date('Ymd', $start_wt); if ($current_view == 'day') { - $weekday = $phpiCal_config->daysofweek_lang[$day_num]; + $weekday = $daysofweek_lang[$day_num]; } else { $weekday = localizeDate($dateFormat_week_list, strtotime($daylink)); } @@ -345,7 +345,7 @@ class Page { $this_month = $day_array2[2]; $this_year = $day_array2[1]; $thisdate = $swt; - for ($i=0;$i<7;$i++) { + for ($i=0; $i < 7; $i++) { $thisday = date("Ymd", $thisdate); $event_length[$thisday] = array (); $thisdate = ($thisdate + (25 * 60 * 60)); @@ -364,7 +364,7 @@ class Page { } elseif ($cal_time == $phpiCal_config->day_start) { $size_tmp = 60 - (int)substr($cal_time,2,2); $weekdisplay .= ''; - $weekdisplay .= ''.$key.''; + $weekdisplay .= ''.$key.''; $weekdisplay .= ''; } else { $weekdisplay .= ''; @@ -375,7 +375,7 @@ class Page { $thisdate = $swt; // loop this part 7 times, one for each day - for ($week_loop=0; $week_loop<$week_length; $week_loop++) { + for ($week_loop=0; $week_loop<$phpiCal_config->week_length; $week_loop++) { $thisday = date("Ymd", $thisdate); $dayborder = 0; unset($this_time_arr); @@ -768,7 +768,7 @@ class Page { } function get_vtodo() { - global $phpiCal_config, $getdate, $master_array, $next_day, $timeFormat, $tomorrows_events_lines, $show_completed, $show_todos; + global $phpiCal_config, $getdate, $master_array, $next_day, $timeFormat, $tomorrows_events_lines; preg_match("!<\!-- switch show_completed on -->(.*)<\!-- switch show_completed off -->!is", $this->page, $match1); preg_match("!<\!-- switch show_important on -->(.*)<\!-- switch show_important off -->!is", $this->page, $match2); @@ -821,7 +821,7 @@ class Page { // Reset this TODO's category. $temp = ''; if ($status == 'COMPLETED' || (isset($val['completed_date']) && isset($val['completed_time']))) { - if ($show_completed == 'yes') { + if ($phpiCal_config->show_completed == 'yes') { $temp = $completed; } } elseif (isset($val['priority']) && ($val['priority'] != 0) && ($val['priority'] <= 5)) { @@ -842,7 +842,7 @@ class Page { } // If there are no TODO items, completely hide the TODO list. - if (($nugget2 == '') || ($show_todos != 'yes')) { + if (($nugget2 == '') || ($phpiCal_config->show_todos != 'yes')) { $this->page = preg_replace('!<\!-- switch vtodo on -->(.*)<\!-- switch vtodo off -->!is', '', $this->page); } -- cgit v1.2.3