Update of /cvsroot/phpicalendar/phpicalendar/functions In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv7568/functions Modified Files: calendar_functions.php date_functions.php draw_functions.php init.inc.php template.php Log Message: fix misc bugs; rewrite some places where warnings squelched with @; require php5.1 or greater Index: calendar_functions.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/functions/calendar_functions.php,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** calendar_functions.php 28 Dec 2008 11:55:43 -0000 1.32 --- calendar_functions.php 28 Dec 2008 19:30:41 -0000 1.33 *************** *** 74,80 **** // Open the directory. $dir_handle = opendir($search_path) ! or die(error("cal fn 78:".sprintf($lang['l_error_path'], $search_path), implode(',', $cal_filename))); if ($dir_handle === false) ! die(error(" cal fn 80:".sprintf($lang['l_error_path'], $search_path), implode(',', $cal_filename))); // Add each file in the directory that does not begin with a dot. --- 74,80 ---- // Open the directory. $dir_handle = opendir($search_path) ! or die(error(sprintf($lang['l_error_path'], $search_path), implode(',', $cal_filename))); if ($dir_handle === false) ! die(error(sprintf($lang['l_error_path'], $search_path), implode(',', $cal_filename))); // Add each file in the directory that does not begin with a dot. Index: date_functions.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/functions/date_functions.php,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** date_functions.php 27 Dec 2008 10:58:51 -0000 1.45 --- date_functions.php 28 Dec 2008 19:30:41 -0000 1.46 *************** *** 1,17 **** <?php // date_functions.php // functions for returning or comparing dates - // not a date function, but I didn't know where to put it - // for backwards compatibility - if (phpversion() < '4.1') { - function array_key_exists($key, $arr) { - if (!is_array($arr)) return false; - foreach (array_keys($arr) as $k) { - if ("$k" == "$key") return true; - } - return false; - } - } // takes iCalendar 2 day format and makes it into 3 characters --- 1,7 ---- <?php + require_once(BASE."functions/is_daylight.php"); // date_functions.php // functions for returning or comparing dates // takes iCalendar 2 day format and makes it into 3 characters *************** *** 291,317 **** } return $data; ! } ! ! require_once(BASE."functions/is_daylight.php"); ! /* function is_daylight($date, $timezone) returns 1 if daylight time, 0 if not ! ! default is to use the server's date function. This will be off when the timezone's rules are not the same as the server's rules. In php5.2+ there seems to be a better way to do this, but we can't count on users having php5.2+. ! ! Although we set dt_start and st_start in parse_tzs.php, these are not rrules and I don't know how to use them yet. So we'll do it by brute force for the ones we know about, from: http://www.webexhibits.org/daylightsaving/g.html ! ! Note that this sends a screwy time value - it's not necessarily UTC unixtime, since the mktime functions that create the time are not using the timezone. ! ! function is_daylight($time, $timezone){ ! global $tz_array; ! # default to std time, overwrite if daylight. ! $dlst = 0; ! switch ($timezone){ ! default: ! $dlst = date('I', $time); ! } ! ! return $dlst; ! ! } ! */ ! ?> \ No newline at end of file --- 281,283 ---- } return $data; ! }?> \ No newline at end of file Index: draw_functions.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/functions/draw_functions.php,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** draw_functions.php 23 Dec 2008 10:20:50 -0000 1.8 --- draw_functions.php 28 Dec 2008 19:30:41 -0000 1.9 *************** *** 1,11 **** <?php ! // function returns starttime and endtime and event length for drawing into a grid ! 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_min = sprintf("%02d", floor($sta_min / $gridLength) * $gridLength); if ($sta_min == 60) { --- 1,12 ---- <?php ! # drawEventTimes returns starttime and endtime and event length for drawing into a grid function drawEventTimes ($start, $end) { global $phpiCal_config; + $sta_h = $sta_min = $end_h = $end_min = "00"; $gridLength = $phpiCal_config->gridLength; ! if (preg_match ('/([0-9]{2})([0-9]{2})/', $start, $time)){ ! $sta_h = $time[1]; ! $sta_min = $time[2]; ! } $sta_min = sprintf("%02d", floor($sta_min / $gridLength) * $gridLength); if ($sta_min == 60) { *************** *** 14,20 **** } ! preg_match ('/([0-9]{2})([0-9]{2})/', $end, $time); ! $end_h = @$time[1]; ! $end_min = @$time[2]; $end_min = sprintf("%02d", floor($end_min / $gridLength) * $gridLength); if ($end_min == 60) { --- 15,22 ---- } ! if (preg_match ('/([0-9]{2})([0-9]{2})/', $end, $time)){ ! $end_h = $time[1]; ! $end_min = $time[2]; ! } $end_min = sprintf("%02d", floor($end_min / $gridLength) * $gridLength); if ($end_min == 60) { *************** *** 29,36 **** $end_min = "00"; } ! } ! $draw_len = ($end_h * 60 + $end_min) - ($sta_h * 60 + $sta_min); - return array ("draw_start" => ($sta_h . $sta_min), "draw_end" => ($end_h . $end_min), "draw_length" => $draw_len); } --- 31,36 ---- $end_min = "00"; } ! } $draw_len = ($end_h * 60 + $end_min) - ($sta_h * 60 + $sta_min); return array ("draw_start" => ($sta_h . $sta_min), "draw_end" => ($end_h . $end_min), "draw_length" => $draw_len); } Index: init.inc.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/functions/init.inc.php,v retrieving revision 1.119 retrieving revision 1.120 diff -C2 -d -r1.119 -r1.120 *** init.inc.php 28 Dec 2008 11:58:46 -0000 1.119 --- init.inc.php 28 Dec 2008 19:30:41 -0000 1.120 *************** *** 12,20 **** include_once(BASE.'functions/userauth_functions.php'); ! // Grab the action (login or logout). if (isset($_GET['action'])) $action = $_GET['action']; ! else if (isset($_POST['action'])) $action = $_POST['action']; ! else $action = ''; // Login and/or logout. --- 12,21 ---- include_once(BASE.'functions/userauth_functions.php'); ! # require php 5 ! if (phpversion() < '5.1') die (error(sprintf($lang['l_php_version_required'],phpversion()) ) ); // Grab the action (login or logout). + $action = ''; if (isset($_GET['action'])) $action = $_GET['action']; ! else if (isset($_POST['action'])) $action = $_POST['action']; // Login and/or logout. Index: template.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/functions/template.php,v retrieving revision 1.107 retrieving revision 1.108 diff -C2 -d -r1.107 -r1.108 *** template.php 28 Dec 2008 10:50:58 -0000 1.107 --- template.php 28 Dec 2008 19:30:41 -0000 1.108 *************** *** 1063,1067 **** } if (!is_file($file)){ ! exit(error($lang['l_error_path']." template 1065", $file)); } ob_start(); --- 1063,1067 ---- } if (!is_file($file)){ ! exit(error($lang['l_error_path'], $file)); } ob_start(); |