From: <ji...@us...> - 2008-12-26 05:54:51
|
Update of /cvsroot/phpicalendar/phpicalendar/functions/parse In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv24761/functions/parse Modified Files: end_vevent.php parse_tzs.php recur_functions.php Log Message: fix US holidays; fix 1743686 where byday set and timezone pushes event to different day Index: end_vevent.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/functions/parse/end_vevent.php,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** end_vevent.php 25 Dec 2008 18:45:26 -0000 1.13 --- end_vevent.php 26 Dec 2008 05:54:46 -0000 1.14 *************** *** 293,296 **** --- 293,300 ---- $recur_data_hour = @substr($start_time,0,2); $recur_data_minute = @substr($start_time,2,2); + if (isset($allday_start) && $allday_start != ''){ + $recur_data_hour = '00'; + $recur_data_minute = '00'; + } foreach($recur_data as $recur_data_unixtime) { $recur_data_year = date('Y', $recur_data_unixtime); *************** *** 299,302 **** --- 303,308 ---- $recur_data_date = $recur_data_year.$recur_data_month.$recur_data_day; + /* at this point the recur data year, month, day, hour, and minute are in the default timezone for the phpicalendar installation, if that is set. We need to compare whether both the event timezone and the the phpicaledar timezone are in the same state wrt std vs daylight time. */ + if (isset($allday_start) && $allday_start != '') { $start_time2 = $recur_data_unixtime; Index: parse_tzs.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/functions/parse/parse_tzs.php,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** parse_tzs.php 20 Dec 2008 00:33:14 -0000 1.4 --- parse_tzs.php 26 Dec 2008 05:54:46 -0000 1.5 *************** *** 7,10 **** --- 7,13 ---- // read file in line by line // XXX end line is skipped because of the 1-line readahead + $is_daylight = false; + $is_std = false; + while (!feof($ifile)) { $line = $nextline; *************** *** 17,24 **** $nextline = ereg_replace("[\r\n]", "", $nextline); } ! $line = trim($line); ! $is_daylight = false; ! $is_std = false; ! switch ($line) { case 'BEGIN:VTIMEZONE': --- 20,24 ---- $nextline = ereg_replace("[\r\n]", "", $nextline); } ! $line = trim($line); switch ($line) { case 'BEGIN:VTIMEZONE': *************** *** 56,66 **** default: unset ( $data, $prop_pos, $property); ! if (ereg ("([^:]+):(.*)", $line, $line)){ ! $property = $line[1]; ! $data = $line[2]; $prop_pos = strpos($property,';'); if ($prop_pos !== false) $property = substr($property,0,$prop_pos); $property = strtoupper($property); - switch ($property) { case 'TZID': --- 56,65 ---- default: unset ( $data, $prop_pos, $property); ! if (ereg ("([^:]+):(.*)", $line, $arr)){ ! $property = $arr[1]; ! $data = $arr[2]; $prop_pos = strpos($property,';'); if ($prop_pos !== false) $property = substr($property,0,$prop_pos); $property = strtoupper($property); switch ($property) { case 'TZID': *************** *** 74,79 **** break; case 'DTSTART': ! if($is_std) $begin_std = $data; ! if($is_daylight) $begin_daylight = $data; break; case 'TZNAME': --- 73,84 ---- break; case 'DTSTART': ! if($is_std || $is_daylight){ ! $datetime = extractDateTime($data, $property, $field); ! $start_unixtime = $datetime[0]; ! $start_date = $datetime[1]; ! $year = substr($start_date,0,4); ! if($is_std) $begin_std[$year] = $data; ! if($is_daylight) $begin_daylight[$year] = $data; ! } break; case 'TZNAME': Index: recur_functions.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/functions/parse/recur_functions.php,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** recur_functions.php 25 Dec 2008 18:45:26 -0000 1.11 --- recur_functions.php 26 Dec 2008 05:54:46 -0000 1.12 *************** *** 2,32 **** /* from the std ! BYxxx rule parts modify the recurrence in some manner. BYxxx rule ! parts for a period of time which is the same or greater than the ! frequency generally reduce or limit the number of occurrences of the ! recurrence generated. For example, "FREQ=DAILY;BYMONTH=1" reduces the ! number of recurrence instances from all days (if BYMONTH tag is not ! present) to all days in January. BYxxx rule parts for a period of ! time less than the frequency generally increase or expand the number ! of occurrences of the recurrence. For example, ! "FREQ=YEARLY;BYMONTH=1,2" increases the number of days within the ! yearly recurrence set from 1 (if BYMONTH tag is not present) to 2. ! ! If multiple BYxxx rule parts are specified, then after evaluating the ! specified FREQ and INTERVAL rule parts, the BYxxx rule parts are ! applied to the current set of evaluated occurrences in the following ! order: BYMONTH, BYWEEKNO, BYYEARDAY, BYMONTHDAY, BYDAY, BYHOUR, ! BYMINUTE, BYSECOND and BYSETPOS; then COUNT and UNTIL are evaluated. ! We will use two kinds of functions - those that restrict the date to allowed values and those that expand allowed values */ function add_recur($times,$freq=''){ global $recur_data; ! global $count, $mArray_begin, $mArray_end, $except_dates, $start_date_unixtime,$end_range_unixtime; if (!is_array($times)) $times = array($times); ! /*BYMONTH, BYWEEKNO, BYYEARDAY, BYMONTHDAY, BYDAY, BYHOUR, ! BYMINUTE, BYSECOND and BYSETPOS*/ #dump_times($times); $times = restrict_bymonth($times,$freq); --- 2,17 ---- /* from the std ! "BYxxx rule parts modify the recurrence in some manner. BYxxx rule parts for a period of time which is the same or greater than the frequency generally reduce or limit the number of occurrences of the recurrence generated. For example, "FREQ=DAILY;BYMONTH=1" reduces the number of recurrence instances from all days (if BYMONTH tag is not present) to all days in January. BYxxx rule parts for a period of time less than the frequency generally increase or expand the number of occurrences of the recurrence. For example, "FREQ=YEARLY;BYMONTH=1,2" increases the number of days within the yearly recurrence set from 1 (if BYMONTH tag is not present) to 2. ! If multiple BYxxx rule parts are specified, then after evaluating the specified FREQ and INTERVAL rule parts, the BYxxx rule parts are applied to the current set of evaluated occurrences in the following order: BYMONTH, BYWEEKNO, BYYEARDAY, BYMONTHDAY, BYDAY, BYHOUR, BYMINUTE, BYSECOND and BYSETPOS; then COUNT and UNTIL are evaluated." + We will use two kinds of functions - those that restrict the date to allowed values and those that expand allowed values */ function add_recur($times,$freq=''){ global $recur_data; ! global $count, $mArray_begin, $mArray_end, $except_dates, $start_date, $start_date_unixtime,$end_range_unixtime, $day_offset; if (!is_array($times)) $times = array($times); ! /* BYMONTH, BYWEEKNO, BYYEARDAY, BYMONTHDAY, BYDAY, BYHOUR, BYMINUTE, BYSECOND and BYSETPOS */ #dump_times($times); $times = restrict_bymonth($times,$freq); *************** *** 44,53 **** $date = date("Ymd",$time); $time = strtotime("$date 12:00:00"); ! if(isset($time) && !in_array($time, $recur_data) && ! !in_array($date, $except_dates) && $time >= $start_date_unixtime && $date <= $until_date){ $count--; #echo "\n.$count\n"; ! if($time >= $mArray_begin && ! $time <= $mArray_end ! && $count >= 0 ) $recur_data[] = $time; } --- 29,45 ---- $date = date("Ymd",$time); $time = strtotime("$date 12:00:00"); ! # day offset fixes shifts across day boundaries due to time diffs. ! # These are already fixed for the initial instance, but need to be fixed for recurrences ! if (date("Ymd", $time) != $start_date) $time = $time + $day_offset * (24*60*60); ! if(isset($time) ! && !in_array($time, $recur_data) ! && !in_array($date, $except_dates) ! && $time >= $start_date_unixtime ! && $date <= $until_date ! ){ $count--; #echo "\n.$count\n"; ! if($time >= $mArray_begin ! && $time <= $mArray_end ! && $count >= 0 ) $recur_data[] = $time; } |