From: <ji...@us...> - 2008-12-13 23:42:43
|
Update of /cvsroot/phpicalendar/phpicalendar/functions In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv11617/functions Modified Files: date_functions.php ical_parser.php list_functions.php Log Message: debug rrules; fix cookie injection vuln Index: date_functions.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/functions/date_functions.php,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** date_functions.php 12 Oct 2007 06:41:33 -0000 1.38 --- date_functions.php 13 Dec 2008 23:42:31 -0000 1.39 *************** *** 33,38 **** // and returns the date of that day. (ie: "sun" or "sunday" would be acceptable values of $day but not "su") function dateOfWeek($Ymd, $day) { ! global $week_start_day; ! if (!isset($week_start_day)) $week_start_day = 'Sunday'; $timestamp = strtotime($Ymd); $num = date('w', strtotime($week_start_day)); --- 33,39 ---- // and returns the date of that day. (ie: "sun" or "sunday" would be acceptable values of $day but not "su") function dateOfWeek($Ymd, $day) { ! global $phpiCal_config; ! $week_start_day = 'Sunday'; ! if (isset($phpiCal_config->week_start_day)) $week_start_day = $phpiCal_config->week_start_day; $timestamp = strtotime($Ymd); $num = date('w', strtotime($week_start_day)); *************** *** 137,143 **** } ! function chooseOffset($time) { ! global $timezone, $tz_array; ! if (!isset($timezone)) $timezone = ''; switch ($timezone) { case '': --- 138,143 ---- } ! function chooseOffset($time, $timezone = '') { ! global $tz_array; switch ($timezone) { case '': *************** *** 149,153 **** default: if (is_array($tz_array) && array_key_exists($timezone, $tz_array)) { ! $dlst = date('I', $time); $offset = $tz_array[$timezone][$dlst]; } else { --- 149,153 ---- default: if (is_array($tz_array) && array_key_exists($timezone, $tz_array)) { ! $dlst = date('I', $time); $offset = $tz_array[$timezone][$dlst]; } else { *************** *** 211,215 **** // $field = The full field being examined, e.g. DTSTART;TZID=US/Pacific function extractDateTime($data, $property, $field) { ! global $tz_array; // Initialize values. --- 211,215 ---- // $field = The full field being examined, e.g. DTSTART;TZID=US/Pacific function extractDateTime($data, $property, $field) { ! global $tz_array, $phpiCal_config; // Initialize values. *************** *** 239,250 **** $time = ''; $allday = $data; ! } ! ! // Extract date-time values. ! else { // Pull out the timezone, or use GMT if zulu time was indicated. if (preg_match('/^'.$property.';TZID=/i', $field)) { $tz_tmp = explode('=', $field); ! $tz_dt = parse_tz($tz_tmp[1]); unset($tz_tmp); } elseif ($zulu_time) { --- 239,248 ---- $time = ''; $allday = $data; ! }else{ // Extract date-time values. ! // Pull out the timezone, or use GMT if zulu time was indicated. if (preg_match('/^'.$property.';TZID=/i', $field)) { $tz_tmp = explode('=', $field); ! $tz_dt = $tz_tmp[1]; unset($tz_tmp); } elseif ($zulu_time) { *************** *** 260,304 **** $time = $regs[4] . $regs[5]; $unixtime = mktime($regs[4], $regs[5], 0, $regs[2], $regs[3], $regs[1]); - // Check for daylight savings time. $dlst = date('I', $unixtime); ! $server_offset_tmp = chooseOffset($unixtime); if (isset($tz_dt)) { ! if (array_key_exists($tz_dt, $tz_array)) { ! $offset_tmp = $tz_array[$tz_dt][$dlst]; ! } else { ! $offset_tmp = '+0000'; ! } } elseif (isset($calendar_tz)) { ! if (array_key_exists($calendar_tz, $tz_array)) { ! $offset_tmp = $tz_array[$calendar_tz][$dlst]; ! } else { ! $offset_tmp = '+0000'; ! } } else { $offset_tmp = $server_offset_tmp; } - // Set the values. $unixtime = calcTime($offset_tmp, $server_offset_tmp, $unixtime); $date = date('Ymd', $unixtime); $time = date('Hi', $unixtime); ! } ! // Return the results. return array($unixtime, $date, $time, $allday); } ! ! //TZIDs in calendars often contain leading information that should be stripped ! //Example: TZID=/mozilla.org/20050126_1/Europe/Berlin ! //Need to return the last part only ! function parse_tz($data){ ! $fields = explode("/",$data); ! $tz = array_pop($fields); ! $tmp = array_pop($fields); ! if (isset($tmp) && $tmp != "") $tz = "$tmp/$tz"; ! return $tz; ! } ! ! ! ?> --- 258,278 ---- $time = $regs[4] . $regs[5]; $unixtime = mktime($regs[4], $regs[5], 0, $regs[2], $regs[3], $regs[1]); // Check for daylight savings time. $dlst = date('I', $unixtime); ! $server_offset_tmp = chooseOffset($unixtime, $phpiCal_config->timezone); if (isset($tz_dt)) { ! $offset_tmp = chooseOffset($unixtime, $tz_dt); } elseif (isset($calendar_tz)) { ! $offset_tmp = chooseOffset($unixtime, $calendar_tz); } else { $offset_tmp = $server_offset_tmp; } // Set the values. $unixtime = calcTime($offset_tmp, $server_offset_tmp, $unixtime); $date = date('Ymd', $unixtime); $time = date('Hi', $unixtime); ! } // Return the results. return array($unixtime, $date, $time, $allday); } ! ?> \ No newline at end of file Index: ical_parser.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/functions/ical_parser.php,v retrieving revision 1.223 retrieving revision 1.224 diff -C2 -d -r1.223 -r1.224 *** ical_parser.php 11 Dec 2008 21:54:52 -0000 1.223 --- ical_parser.php 13 Dec 2008 23:42:31 -0000 1.224 *************** *** 6,9 **** --- 6,10 ---- include_once(BASE.'functions/parse/overlapping_events.php'); include_once(BASE.'functions/timezones.php'); + include_once(BASE.'functions/parse/recur_functions.php'); // reading the file if it's allowed *************** *** 19,22 **** --- 20,24 ---- $z=1; $y=0; + $webcal_mtime = time() - ($webcal_hours * 3600); if (sizeof($master_array['-4']) == (sizeof($cal_filelist))) { foreach ($master_array['-4'] as $temp_array) { *************** *** 25,29 **** $wcalc = $master_array['-4'][$z]['webcal']; if ($wcalc == 'no') $realcal_mtime = filemtime($fname); - $webcal_mtime = time() - strtotime($webcal_hours * 3600); if (($mtime == $realcal_mtime) && ($wcalc == 'no')) { $y++; --- 27,30 ---- *************** *** 143,148 **** --- 144,151 ---- $except_dates = array(); $except_times = array(); + $byday = array(); $bymonth = array(); $bymonthday = array(); + $bysetpos = array(); $first_duration = TRUE; $count = 1000000; *************** *** 305,309 **** // do nothing } elseif ($eachval[0] == 'TZID') { ! $recurrence_id['tzid'] = parse_tz($eachval[1]); } elseif ($eachval[0] == 'RANGE') { $recurrence_id['range'] = $eachval[1]; --- 308,312 ---- // do nothing } elseif ($eachval[0] == 'TZID') { ! $recurrence_id['tzid'] = $eachval[1]; } elseif ($eachval[0] == 'RANGE') { $recurrence_id['range'] = $eachval[1]; *************** *** 324,336 **** $recur_unixtime = mktime($regs[4], $regs[5], 0, $regs[2], $regs[3], $regs[1]); - $dlst = date('I', $recur_unixtime); - $server_offset_tmp = chooseOffset($recur_unixtime); if (isset($recurrence_id['tzid'])) { ! $tz_tmp = $recurrence_id['tzid']; ! $offset_tmp = $tz_array[$tz_tmp][$dlst]; } elseif (isset($calendar_tz)) { ! $offset_tmp = $tz_array[$calendar_tz][$dlst]; } else { ! $offset_tmp = $server_offset_tmp; } $recur_unixtime = calcTime($offset_tmp, $server_offset_tmp, $recur_unixtime); --- 327,336 ---- $recur_unixtime = mktime($regs[4], $regs[5], 0, $regs[2], $regs[3], $regs[1]); if (isset($recurrence_id['tzid'])) { ! $offset_tmp = chooseOffset($recur_unixtime, $recurrence_id['tzid']); } elseif (isset($calendar_tz)) { ! $offset_tmp = chooseOffset($recur_unixtime, $tz_array[$calendar_tz]); } else { ! $offset_tmp = $chooseOffset($recur_unixtime); } $recur_unixtime = calcTime($offset_tmp, $server_offset_tmp, $recur_unixtime); *************** *** 351,355 **** break; case 'X-WR-TIMEZONE': ! $calendar_tz = parse_tz($data); $master_array['calendar_tz'] = $calendar_tz; break; --- 351,355 ---- break; case 'X-WR-TIMEZONE': ! $calendar_tz = $data; $master_array['calendar_tz'] = $calendar_tz; break; *************** *** 442,453 **** //If you want to see the values in the arrays, uncomment below. ! #print '<pre>'; //print_r($master_array); //print_r($overlap_array); //print_r($day_array); //print_r($rrule_array); //print_r($recurrence_delete); //print_r($cal_displaynames); //print_r($cal_filelist); ! #print '</pre>'; ?> --- 442,455 ---- //If you want to see the values in the arrays, uncomment below. ! //print '<pre>'; //print_r($master_array); //print_r($overlap_array); //print_r($day_array); //print_r($rrule_array); + //print_r($byday_arr); //print_r($recurrence_delete); //print_r($cal_displaynames); //print_r($cal_filelist); ! //print_r($tz_array); ! //print '</pre>'; ?> Index: list_functions.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/functions/list_functions.php,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** list_functions.php 12 Oct 2007 06:42:32 -0000 1.17 --- list_functions.php 13 Dec 2008 23:42:31 -0000 1.18 *************** *** 14,25 **** 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) { ! if ($i > $unique_colors) $i = 1; $val = str_replace ("\,", ",", $val); ! $return .= '<img src="templates/'.$template.'/images/monthdot_'.$i.'.gif" alt="" /> '.$val.'<br />'; $i++; } --- 14,25 ---- function list_calcolors() { ! global $phpiCal_config, $master_array; $return = ''; $i = 1; if (is_array($master_array['-3'])) { foreach ($master_array['-3'] as $key => $val) { ! if ($i > $phpiCal_config->unique_colors) $i = 1; $val = str_replace ("\,", ",", $val); ! $return .= '<img src="templates/'.$phpiCal_config->template.'/images/monthdot_'.$i.'.gif" alt="" /> '.$val.'<br />'; $i++; } |