Update of /cvsroot/phpicalendar/phpicalendar/functions/parse In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv20875/functions/parse Modified Files: Tag: phpicalendar-editor end_vevent.php overlapping_events.php parse_tzs.php recur_functions.php Log Message: merge with HEAD Index: end_vevent.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/functions/parse/end_vevent.php,v retrieving revision 1.25 retrieving revision 1.25.2.1 diff -C2 -d -r1.25 -r1.25.2.1 *** end_vevent.php 26 Jan 2009 05:07:38 -0000 1.25 --- end_vevent.php 12 Apr 2010 18:58:37 -0000 1.25.2.1 *************** *** 30,35 **** $uid_valid = false; }elseif(in_array($uid, $uid_list)) { ! #$uid .= $uid_counter; ! #$uid_counter++; }else{ $uid_valid = true; --- 30,35 ---- $uid_valid = false; }elseif(in_array($uid, $uid_list)) { ! # UID seen before. If sequence is the default, bump it. ! if ($sequence == 0) $sequence++; }else{ $uid_valid = true; *************** *** 67,71 **** } # get hour and minute adjusted to allowed grid times ! $drawKey = drawEventTimes($start_time, $end_time); preg_match ('/([0-9]{2})([0-9]{2})/', $drawKey['draw_start'], $time3); preg_match ('/([0-9]{2})([0-9]{2})/', $drawKey['draw_end'], $time4); --- 67,71 ---- } # get hour and minute adjusted to allowed grid times ! $drawKey = drawEventTimes($start_time, $end_time, ($length >= (60*60*24))); preg_match ('/([0-9]{2})([0-9]{2})/', $drawKey['draw_start'], $time3); preg_match ('/([0-9]{2})([0-9]{2})/', $drawKey['draw_end'], $time4); *************** *** 322,326 **** if($this_date_tmp == $end_date_tmp && ($end_time == '0000')) continue; if(!isset($master_array[$this_date_tmp][$time_key][$uid]['sequence']) || ! $sequence > $master_array[$this_date_tmp][$time_key][$uid]['sequence']){ $master_array[$this_date_tmp][$time_key][$uid] = array ( 'event_start' => $start_time, # hhmm --- 322,327 ---- if($this_date_tmp == $end_date_tmp && ($end_time == '0000')) continue; if(!isset($master_array[$this_date_tmp][$time_key][$uid]['sequence']) || ! $sequence > $master_array[$this_date_tmp][$time_key][$uid]['sequence'] ! ){ $master_array[$this_date_tmp][$time_key][$uid] = array ( 'event_start' => $start_time, # hhmm *************** *** 349,353 **** 'recur' => $recur ); ! } if($time_key > -1) checkOverlap($this_date_tmp, $time_key, $uid); } --- 350,354 ---- 'recur' => $recur ); ! } if($time_key > -1) checkOverlap($this_date_tmp, $time_key, $uid); } Index: overlapping_events.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/functions/parse/overlapping_events.php,v retrieving revision 1.3 retrieving revision 1.3.2.1 diff -C2 -d -r1.3 -r1.3.2.1 *** overlapping_events.php 27 Dec 2008 10:58:51 -0000 1.3 --- overlapping_events.php 12 Apr 2010 18:58:37 -0000 1.3.2.1 *************** *** 141,145 **** $draw_end = $event['event_end']; if (isset($event['display_end'])) $draw_end = $event['display_end']; ! $drawTimes = drawEventTimes($event['event_start'], $draw_end); // Track if $event has been merged in, so we don't re-add the details to 'event' or 'overlapRanges' multiple times. --- 141,147 ---- $draw_end = $event['event_end']; if (isset($event['display_end'])) $draw_end = $event['display_end']; ! $drawTimes = drawEventTimes($event['event_start'], $draw_end, ($event['event_length'] >= (60*60*24))); ! if ($event_time == "0000") $drawTimes['draw_start'] = "0000"; ! if ($draw_end == "2400") $drawTimes['draw_end'] = "2400"; // Track if $event has been merged in, so we don't re-add the details to 'event' or 'overlapRanges' multiple times. Index: parse_tzs.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/functions/parse/parse_tzs.php,v retrieving revision 1.10 retrieving revision 1.10.2.1 diff -C2 -d -r1.10 -r1.10.2.1 *** parse_tzs.php 2 Jan 2009 07:12:12 -0000 1.10 --- parse_tzs.php 12 Apr 2010 18:58:37 -0000 1.10.2.1 *************** *** 3,7 **** if ($ifile == FALSE) exit(error($lang['l_error_cantopen'], $filename)); $nextline = fgets($ifile); ! if (trim($nextline) != 'BEGIN:VCALENDAR') exit(error($lang['l_error_invalidcal'], $filename)); // read file in line by line --- 3,7 ---- if ($ifile == FALSE) exit(error($lang['l_error_cantopen'], $filename)); $nextline = fgets($ifile); ! #if (trim($nextline) != 'BEGIN:VCALENDAR') exit(error($lang['l_error_invalidcal'], $filename)); // read file in line by line Index: recur_functions.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/functions/parse/recur_functions.php,v retrieving revision 1.18 retrieving revision 1.18.2.1 diff -C2 -d -r1.18 -r1.18.2.1 *** recur_functions.php 29 Dec 2008 03:07:34 -0000 1.18 --- recur_functions.php 12 Apr 2010 18:58:37 -0000 1.18.2.1 *************** *** 11,20 **** function add_recur($times,$freq=''){ global $recur_data; ! global $count, $mArray_begin, $mArray_end, $except_dates, $start_date, $start_date_unixtime,$end_range_unixtime,$until_unixtime, $day_offset, $current_view; if (!is_array($times)) $times = array($times); /* BYMONTH, BYWEEKNO, BYYEARDAY, BYMONTHDAY, BYDAY, BYHOUR, BYMINUTE, BYSECOND and BYSETPOS */ #dump_times($times); if ($current_view != 'search'){ ! $times = restrict_bymonth($times,$freq); # $times = restrict_byweekno($times,$freq); $times = restrict_byyearday($times,$freq); --- 11,20 ---- function add_recur($times,$freq=''){ global $recur_data; ! global $count, $mArray_begin, $mArray_end, $except_dates, $start_date, $start_date_unixtime,$end_range_unixtime,$until_unixtime, $day_offset, $current_view; if (!is_array($times)) $times = array($times); /* BYMONTH, BYWEEKNO, BYYEARDAY, BYMONTHDAY, BYDAY, BYHOUR, BYMINUTE, BYSECOND and BYSETPOS */ #dump_times($times); if ($current_view != 'search'){ ! $times = restrict_bymonth($times,$freq); # $times = restrict_byweekno($times,$freq); $times = restrict_byyearday($times,$freq); *************** *** 24,49 **** $times = restrict_bysetpos($times,$freq);#echo "restrict_bysetpos"; $times = array_unique($times); ! sort($times); } $until_date = date("Ymd",$end_range_unixtime); ! foreach ($times as $time){ #echo "time:". date("Ymd",$time)." $until_date<br>\n"; if (!isset($time) || $time == '') continue; $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) && $time != '' ! && !in_array($time, $recur_data) ! && !in_array($date, $except_dates) ! && $time <= $until_unixtime ! && $time >= $start_date_unixtime && $date <= $until_date ! ){ $count--; #echo "\n.$count\n"; ! if($time >= $mArray_begin ! && $time <= $mArray_end && $count >= 0 ) $recur_data[] = $time; --- 24,49 ---- $times = restrict_bysetpos($times,$freq);#echo "restrict_bysetpos"; $times = array_unique($times); ! sort($times); } $until_date = date("Ymd",$end_range_unixtime); ! foreach ($times as $time){ #echo "time:". date("Ymd",$time)." $until_date<br>\n"; if (!isset($time) || $time == '') continue; $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) && $time != '' ! && !in_array($time, $recur_data) ! && !in_array($date, $except_dates) ! && $time <= $until_unixtime ! && $time >= $start_date_unixtime && $date <= $until_date ! ){ $count--; #echo "\n.$count\n"; ! if($time >= $mArray_begin ! && $time <= $mArray_end && $count >= 0 ) $recur_data[] = $time; *************** *** 56,67 **** global $bymonth, $byweekno, $bymonthday, $year, $start_unixtime, $freq_type; if(!empty($byweekno)) return $time; ! if(empty($bymonth)) $bymonth = array(date("m", $start_unixtime)); $d = date("d",$start_unixtime); if (!empty($bymonthday)) $d = 1; ! foreach ($bymonth as $m){ $time = mktime(12,0,0,$m,$d,$year); #echo "exm:".date("Ymd",$time)."\n"; $times[] = $time; ! } ! return $times; } function expand_byweekno($times){ --- 56,67 ---- global $bymonth, $byweekno, $bymonthday, $year, $start_unixtime, $freq_type; if(!empty($byweekno)) return $time; ! if(empty($bymonth)) $bymonth = array(date("m", $start_unixtime)); $d = date("d",$start_unixtime); if (!empty($bymonthday)) $d = 1; ! foreach ($bymonth as $m){ $time = mktime(12,0,0,$m,$d,$year); #echo "exm:".date("Ymd",$time)."\n"; $times[] = $time; ! } ! return $times; } function expand_byweekno($times){ *************** *** 73,78 **** if (empty($byweekno)) return $times; $total_weeks = date("W",mktime(12,0,0,12,24,$year) ) +1; ! $w1_start = strtotime("this $wkst3char", mktime(12,0,0,1,1,$year) ); ! foreach($byweekno as $weekno){ if($weekno < 0) $weekno = $weekno + $total_weeks; #echo "\n $wkst3char w1st:".date("Ymd", $w1_start)." ".date("Ymd", mktime(12,0,0,1,1,$year))." weekno:$weekno"; --- 73,78 ---- if (empty($byweekno)) return $times; $total_weeks = date("W",mktime(12,0,0,12,24,$year) ) +1; ! $w1_start = strtotime("this $wkst3char", mktime(12,0,0,1,1,$year) ); ! foreach($byweekno as $weekno){ if($weekno < 0) $weekno = $weekno + $total_weeks; #echo "\n $wkst3char w1st:".date("Ymd", $w1_start)." ".date("Ymd", mktime(12,0,0,1,1,$year))." weekno:$weekno"; *************** *** 86,98 **** global $byyearday, $year; if (empty($byyearday)) return $times; ! $py = $year-1; $ny = $year+1; $new_times = array(); ! foreach($times as $time){ foreach($byyearday as $yearday){ if($yearday > 0){ $day = strtotime("+$yearday days Dec 31, $py");#echo "\n".date("Ymd",$day)." = +$yearday days Dec 31, $py"; }else $day = strtotime("Jan 1 $ny $yearday days"); if(date("Y",$day == $year)) $new_times[] = $day; ! } } # dump_times($new_times); --- 86,98 ---- global $byyearday, $year; if (empty($byyearday)) return $times; ! $py = $year-1; $ny = $year+1; $new_times = array(); ! foreach($times as $time){ foreach($byyearday as $yearday){ if($yearday > 0){ $day = strtotime("+$yearday days Dec 31, $py");#echo "\n".date("Ymd",$day)." = +$yearday days Dec 31, $py"; }else $day = strtotime("Jan 1 $ny $yearday days"); if(date("Y",$day == $year)) $new_times[] = $day; ! } } # dump_times($new_times); *************** *** 103,114 **** global $bymonthday, $year; if (empty($bymonthday)) return $times; ! foreach($times as $time){ $month = date('m',$time); ! foreach($bymonthday as $monthday){ if($monthday < 0) $monthday = date("t",$time) + $monthday +1; $new_times[] = mktime(12,0,0,$month,$monthday,$year); #echo "monthday:$monthday\n"; ! } ! } return $new_times; } --- 103,114 ---- global $bymonthday, $year; if (empty($bymonthday)) return $times; ! foreach($times as $time){ $month = date('m',$time); ! foreach($bymonthday as $monthday){ if($monthday < 0) $monthday = date("t",$time) + $monthday +1; $new_times[] = mktime(12,0,0,$month,$monthday,$year); #echo "monthday:$monthday\n"; ! } ! } return $new_times; } *************** *** 132,137 **** case 'week': #need to find the first day of the appropriate week. ! $next_date_time = strtotime("this $on_day",strtotime($the_sunday)) + (12 * 60 * 60); ! $times[] = $next_date_time; break; case 'month': --- 132,137 ---- case 'week': #need to find the first day of the appropriate week. ! $next_date_time = strtotime("this $on_day",strtotime($the_sunday)) + (12 * 60 * 60); ! $times[] = $next_date_time; break; case 'month': *************** *** 140,145 **** if(empty($byweekno)){ $week_arr = array(1,2,3,4,5); ! if(isset($byday_arr[2]) && $byday_arr[2] !='') $week_arr = array($byday_arr[2]); ! $month_start = strtotime(date("Ym00",$time)); $month_end = strtotime(date("Ymt",$time))+ (36 * 60 * 60); if($freq_type == 'year' && empty($bymonth)){ --- 140,145 ---- if(empty($byweekno)){ $week_arr = array(1,2,3,4,5); ! if(isset($byday_arr[2]) && $byday_arr[2] !='') $week_arr = array($byday_arr[2]); ! $month_start = strtotime(date("Ym01",$time)) - (24 * 60 * 60); $month_end = strtotime(date("Ymt",$time))+ (36 * 60 * 60); if($freq_type == 'year' && empty($bymonth)){ *************** *** 147,166 **** $month_end = mktime(12,0,0,1,1,$year+1); } foreach($week_arr as $week){ #echo "<pre>$summary ".$byday_arr[1].$week.$on_day." st:".date("Ymd",$month_start)." t:".date("Ymd",$time)."\n"; if($byday_arr[1] == '-') $next_date_time = strtotime($byday_arr[1].$week.$on_day,$month_end); ! else $next_date_time = strtotime($byday_arr[1].$week.$on_day,$month_start); # check that we're still in the same month ! if (date("m",$next_date_time) == date("m",$time) ) $times[] = $next_date_time; } }else{ # byweekno should act like freq_type = week ! $next_date_time = strtotime("this $on_day",strtotime($the_sunday)) + (12 * 60 * 60); ! $times[] = $next_date_time; } break; default: $month_start = strtotime(date("Ym01",$time)); ! $next_date_time = strtotime($byday_arr[1].$byday_arr[2].$on_day, $month_start); } } --- 147,173 ---- $month_end = mktime(12,0,0,1,1,$year+1); } + $month_start_day = strtolower(date("D", $month_start)); foreach($week_arr as $week){ #echo "<pre>$summary ".$byday_arr[1].$week.$on_day." st:".date("Ymd",$month_start)." t:".date("Ymd",$time)."\n"; if($byday_arr[1] == '-') $next_date_time = strtotime($byday_arr[1].$week.$on_day,$month_end); ! else { ! # we need this special offset in case the event day coincides with the month start day ! # eg: month starts on a Sunday, our event is the Nth Sunday of the month... without this ! # special offset, the event will be added to the (N+1)th Sunday of the month ! $special_offset = ($month_start_day == $on_day) ? (24 * 60 * 60) : 0; ! $next_date_time = strtotime($byday_arr[1] . $week . $on_day, ($month_start + $special_offset)); ! } # check that we're still in the same month ! if (date("m",$next_date_time) == date("m",$time) ) $times[] = $next_date_time; } }else{ # byweekno should act like freq_type = week ! $next_date_time = strtotime("this $on_day",strtotime($the_sunday)) + (12 * 60 * 60); ! $times[] = $next_date_time; } break; default: $month_start = strtotime(date("Ym01",$time)); ! $next_date_time = strtotime($byday_arr[1].$byday_arr[2].$on_day, $month_start); } } *************** *** 174,180 **** if (empty($bymonth) || !empty($byyearday)) return $times; $new_times=array(); ! foreach ($times as $time){ if(in_array(date("m", $time), $bymonth)) $new_times[] = $time; ! } return $new_times; } --- 181,187 ---- if (empty($bymonth) || !empty($byyearday)) return $times; $new_times=array(); ! foreach ($times as $time){ if(in_array(date("m", $time), $bymonth)) $new_times[] = $time; ! } return $new_times; } *************** *** 196,205 **** $yearday = 365 + $yearday +1; if(date("L",$time)) $yearday += 1; ! } $yearday_arr[] = $yearday; } # date(z,$time) gives 0 for Jan 1 if(in_array((date("z", $time)+1), $yearday_arr)) $new_times[] = $time; ! } return $new_times; } --- 203,212 ---- $yearday = 365 + $yearday +1; if(date("L",$time)) $yearday += 1; ! } $yearday_arr[] = $yearday; } # date(z,$time) gives 0 for Jan 1 if(in_array((date("z", $time)+1), $yearday_arr)) $new_times[] = $time; ! } return $new_times; } *************** *** 213,219 **** if($monthday < 0) $monthday = date("t",$time) + $monthday +1; $monthday_arr[] = $monthday; ! } if(in_array(date("j", $time), $monthday_arr)) $new_times[] = $time; ! } return $new_times; } --- 220,226 ---- if($monthday < 0) $monthday = date("t",$time) + $monthday +1; $monthday_arr[] = $monthday; ! } if(in_array(date("j", $time), $monthday_arr)) $new_times[] = $time; ! } return $new_times; } *************** *** 233,237 **** $new_times=array(); foreach ($times as $time) if(in_array(strtolower(date("D", $time)), $byday3)) $new_times[] = $time; ! return $new_times; } --- 240,244 ---- $new_times=array(); foreach ($times as $time) if(in_array(strtolower(date("D", $time)), $byday3)) $new_times[] = $time; ! return $new_times; } *************** *** 240,248 **** if(empty($bysetpos)) return $times; sort($times); ! $new_times=array(); foreach($bysetpos as $setpos){ $new_times[] = implode('',array_slice($times, $setpos, 1)); } ! return $new_times; } --- 247,255 ---- if(empty($bysetpos)) return $times; sort($times); ! $new_times=array(); foreach($bysetpos as $setpos){ $new_times[] = implode('',array_slice($times, $setpos, 1)); } ! return $new_times; } |