You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(5) |
Feb
(25) |
Mar
(18) |
Apr
|
May
(26) |
Jun
(14) |
Jul
(1) |
Aug
(5) |
Sep
(82) |
Oct
(3) |
Nov
(130) |
Dec
(9) |
2004 |
Jan
(4) |
Feb
(62) |
Mar
|
Apr
(3) |
May
(100) |
Jun
|
Jul
(6) |
Aug
(49) |
Sep
(33) |
Oct
(47) |
Nov
(2) |
Dec
(1) |
2005 |
Jan
|
Feb
(4) |
Mar
(1) |
Apr
(8) |
May
(17) |
Jun
|
Jul
(1) |
Aug
(2) |
Sep
(26) |
Oct
(18) |
Nov
(37) |
Dec
(14) |
2006 |
Jan
(2) |
Feb
(18) |
Mar
(34) |
Apr
(52) |
May
(7) |
Jun
(3) |
Jul
(2) |
Aug
(10) |
Sep
|
Oct
|
Nov
(18) |
Dec
(4) |
2007 |
Jan
|
Feb
(7) |
Mar
(7) |
Apr
(6) |
May
(52) |
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
(15) |
Nov
|
Dec
(1) |
2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(250) |
2009 |
Jan
(35) |
Feb
(45) |
Mar
|
Apr
(4) |
May
(35) |
Jun
(13) |
Jul
(49) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(11) |
2010 |
Jan
(3) |
Feb
(30) |
Mar
|
Apr
(35) |
May
(12) |
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(4) |
From: <ji...@us...> - 2008-12-16 15:46:31
|
Update of /cvsroot/phpicalendar/phpicalendar/functions/parse In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv2088/functions/parse Modified Files: end_vevent.php recur_functions.php Log Message: progress on recurrence Index: end_vevent.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/functions/parse/end_vevent.php,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** end_vevent.php 16 Dec 2008 07:55:50 -0000 1.4 --- end_vevent.php 16 Dec 2008 15:46:24 -0000 1.5 *************** *** 190,195 **** /* ============================ Load $recur_data ============================ ! $recur_data is an array of unix times for instances of an event. This code handles repeats. ! Note that dates with exceptions are counted as instances. RDATE is currently not supported --- 190,194 ---- /* ============================ Load $recur_data ============================ ! $recur_data is an array of unix times for days of recurrences of an event. This code handles repeats at the day level or above. The next loop handles the times. RDATE is currently not supported *************** *** 211,223 **** $end_range_unixtime = $mArray_end+60*60*24; $start_date_unixtime = strtotime($start_date); ! $next_range_unixtime = $start_date_unixtime; if(isset($until) && $end_range_unixtime > $until_unixtime) $end_range_unixtime = $until_unixtime; if(!isset($rrule_array['FREQ'])){ $end_range_unixtime = strtotime($end_date); $count = 1; } - // if the beginning of our range is less than the start of the item, we may as well set it equal to it - if ($next_range_unixtime < $start_date_unixtime) $next_range_unixtime = $start_date_unixtime; - // convert wkst to a 3 char day for strtotime to work $wkst3char = two2threeCharDays($wkst); --- 210,226 ---- $end_range_unixtime = $mArray_end+60*60*24; $start_date_unixtime = strtotime($start_date); ! $next_range_unixtime = $start_date_unixtime; ! ! #conditions where we can not iterate over the whole range ! if($count == 1000000 && $interval == 1) $next_range_unixtime = $mArray_begin; ! // if the beginning of our range is less than the start of the item, we may as well set it equal to it ! if ($next_range_unixtime < $start_date_unixtime) $next_range_unixtime = $start_date_unixtime; ! if(isset($until) && $end_range_unixtime > $until_unixtime) $end_range_unixtime = $until_unixtime; + if($freq_type == 'year') $end_range_unixtime += 366*24*60*60; if(!isset($rrule_array['FREQ'])){ $end_range_unixtime = strtotime($end_date); $count = 1; } // convert wkst to a 3 char day for strtotime to work $wkst3char = two2threeCharDays($wkst); *************** *** 226,230 **** one $next_range_time per repeat, but the BYXXX rules may write more than one event in that repeat cycle $next_date_time handles those instances within a $freq_type */ ! #echo "<pre>$summary\n\tstart mArray time:".date("Ymd his",$mArray_begin)."\n\tstart range time:".date("Ymd his",$next_range_unixtime)."\n\tend range time ".date("Ymd his",$end_range_unixtime)."</pre>"; $recur_data = array(); while ($next_range_unixtime <= $end_range_unixtime && $count > 0) { --- 229,233 ---- one $next_range_time per repeat, but the BYXXX rules may write more than one event in that repeat cycle $next_date_time handles those instances within a $freq_type */ ! echo "<pre>$summary\n\tstart mArray time:".date("Ymd his",$mArray_begin)."\n\tstart range time:".date("Ymd his",$next_range_unixtime)."\n\tend range time ".date("Ymd his",$end_range_unixtime)."\n"; $recur_data = array(); while ($next_range_unixtime <= $end_range_unixtime && $count > 0) { *************** *** 243,247 **** break; case 'month': ! $times = expand_bymonthday(array($next_range_unixtime)); foreach($times as $time){ add_recur(expand_byday($time)); --- 246,251 ---- break; case 'month': ! $time = mktime(12,0,0,$month,date("d",$start_unixtime),$year); ! $times = expand_bymonthday(array($time)); foreach($times as $time){ add_recur(expand_byday($time)); *************** *** 249,257 **** break; case 'year': ! $times = expand_bymonth($next_range_unixtime); ! $times = expand_byweekno($times); $times = expand_byyearday($times); $times = expand_bymonthday($times); - foreach($times as $time){ add_recur(expand_byday($time)); --- 253,260 ---- break; case 'year': ! $times = expand_bymonth($next_range_unixtime); ! $times = expand_byweekno($times); $times = expand_byyearday($times); $times = expand_bymonthday($times); foreach($times as $time){ add_recur(expand_byday($time)); *************** *** 262,275 **** break 2; } ! $next_range_unixtime = strtotime('+'.$interval.' '.$freq_type, $next_range_unixtime); } #end while loop sort($recur_data); - echo "<pre>$summary recur_data:"; - #var_dump($recur_data); - foreach($recur_data as $time) echo "\n".date("Ymd his",$time); - echo "</pre>"; ! # use recur_data array to write the master array ! // use the same code to write the data instead of always changing it 5 times $recur_data_hour = @substr($start_unixtime,0,2); $recur_data_minute = @substr($start_unixtime,2,2); --- 265,274 ---- break 2; } ! $next_range_unixtime = strtotime('+'.$interval.' '.$freq_type, $next_range_unixtime); echo "\nnext $interval $freq_type".date("Ymd",$next_range_unixtime)."\n"; } #end while loop sort($recur_data); ! /* ============================ Use $recur_data array to write the master array ============================*/ ! // This used to use 5 different blocks to write the array... can it be reduced further? $recur_data_hour = @substr($start_unixtime,0,2); $recur_data_minute = @substr($start_unixtime,2,2); *************** *** 279,366 **** $recur_data_day = date('d', $recur_data_unixtime); $recur_data_date = $recur_data_year.$recur_data_month.$recur_data_day; ! if ( !in_array($recur_data_date, $except_dates) ) { ! if (isset($allday_start) && $allday_start != '') { ! $start_time2 = $recur_data_unixtime; ! $end_time2 = strtotime('+'.$diff_allday_days.' days', $recur_data_unixtime); ! while ($start_time2 < $end_time2) { ! $start_date2 = date('Ymd', $start_time2); ! $master_array[($start_date2)][('-1')][$uid] = array ( ! 'event_text' => $summary, ! 'description' => $description, ! 'location' => $location, ! 'organizer' => serialize($organizer), ! 'attendee' => serialize($attendee), ! 'calnumber' => $calnumber, ! 'calname' => $actual_calname, ! 'url' => $url, ! 'status' => $status, ! 'class' => $class, ! 'recur' => $recur ); ! $start_time2 = strtotime('+1 day', $start_time2); ! } ! } else { ! $start_unixtime_tmp = mktime($recur_data_hour,$recur_data_minute,0,$recur_data_month,$recur_data_day,$recur_data_year); ! $end_unixtime_tmp = $start_unixtime_tmp + $length; ! ! if (($end_time >= $phpiCal_config->bleed_time) && ($bleed_check == '-1')) { ! $start_tmp = strtotime(date('Ymd',$start_unixtime_tmp)); ! $end_date_tmp = date('Ymd',$end_unixtime_tmp); ! while ($start_tmp < $end_unixtime_tmp) { ! $start_date_tmp = date('Ymd',$start_tmp); ! if ($start_date_tmp == $recur_data_year.$recur_data_month.$recur_data_day) { ! $time_tmp = $hour.$minute; ! $start_time_tmp = $start_time; ! } else { ! $time_tmp = '0000'; ! $start_time_tmp = '0000'; ! } ! if ($start_date_tmp == $end_date_tmp) { ! $end_time_tmp = $end_time; ! } else { ! $end_time_tmp = '2400'; ! $display_end_tmp = $end_time; ! } ! ! // Let's double check the until to not write past it ! $until_check = $start_date_tmp.$time_tmp.'00'; ! if ($abs_until > $until_check) { ! $master_array[$start_date_tmp][$time_tmp][$uid] = array ( ! 'event_start' => $start_time_tmp, ! 'event_end' => $end_time_tmp, ! 'start_unixtime' => $start_unixtime_tmp, ! 'end_unixtime' => $end_unixtime_tmp, ! 'event_text' => $summary, ! 'event_length' => $length, ! 'event_overlap' => 0, ! 'description' => $description, ! 'status' => $status, ! 'class' => $class, ! 'spans_day' => true, ! 'location' => $location, ! 'organizer' => serialize($organizer), ! 'attendee' => serialize($attendee), ! 'calnumber' => $calnumber, ! 'calname' => $actual_calname, ! 'url' => $url, ! 'recur' => $recur); ! if (isset($display_end_tmp)){ ! $master_array[$start_date_tmp][$time_tmp][$uid]['display_end'] = $display_end_tmp; ! } ! checkOverlap($start_date_tmp, $time_tmp, $uid); ! } ! $start_tmp = strtotime('+1 day',$start_tmp); } ! } else { ! if ($bleed_check == '-1') { $display_end_tmp = $end_time; - $end_time_tmp1 = '2400'; - } ! if (!isset($end_time_tmp1)) $end_time_tmp1 = $end_time; ! // Let's double check the until to not write past it ! $master_array[($recur_data_date)][($hour.$minute)][$uid] = array ( ! 'event_start' => $start_time, ! 'event_end' => $end_time_tmp1, 'start_unixtime' => $start_unixtime_tmp, 'end_unixtime' => $end_unixtime_tmp, --- 278,330 ---- $recur_data_day = date('d', $recur_data_unixtime); $recur_data_date = $recur_data_year.$recur_data_month.$recur_data_day; ! ! if (isset($allday_start) && $allday_start != '') { ! $start_time2 = $recur_data_unixtime; ! $end_time2 = strtotime('+'.$diff_allday_days.' days', $recur_data_unixtime); ! while ($start_time2 < $end_time2) { ! $start_date2 = date('Ymd', $start_time2); ! $master_array[($start_date2)][('-1')][$uid] = array ( ! 'event_text' => $summary, ! 'description' => $description, ! 'location' => $location, ! 'organizer' => serialize($organizer), ! 'attendee' => serialize($attendee), ! 'calnumber' => $calnumber, ! 'calname' => $actual_calname, ! 'url' => $url, ! 'status' => $status, ! 'class' => $class, ! 'recur' => $recur ); ! $start_time2 = strtotime('+1 day', $start_time2); ! } ! } else { ! $start_unixtime_tmp = mktime($recur_data_hour,$recur_data_minute,0,$recur_data_month,$recur_data_day,$recur_data_year); ! $end_unixtime_tmp = $start_unixtime_tmp + $length; ! ! if (($end_time >= $phpiCal_config->bleed_time) && ($bleed_check == '-1')) { ! $start_tmp = strtotime(date('Ymd',$start_unixtime_tmp)); ! $end_date_tmp = date('Ymd',$end_unixtime_tmp); ! while ($start_tmp < $end_unixtime_tmp) { ! $start_date_tmp = date('Ymd',$start_tmp); ! if ($start_date_tmp == $recur_data_year.$recur_data_month.$recur_data_day) { ! $time_tmp = $hour.$minute; ! $start_time_tmp = $start_time; ! } else { ! $time_tmp = '0000'; ! $start_time_tmp = '0000'; } ! if ($start_date_tmp == $end_date_tmp) { ! $end_time_tmp = $end_time; ! } else { ! $end_time_tmp = '2400'; $display_end_tmp = $end_time; } ! // Let's double check the until to not write past it ! $until_check = $start_date_tmp.$time_tmp.'00'; ! if ($abs_until > $until_check) { ! $master_array[$start_date_tmp][$time_tmp][$uid] = array ( ! 'event_start' => $start_time_tmp, ! 'event_end' => $end_time_tmp, 'start_unixtime' => $start_unixtime_tmp, 'end_unixtime' => $end_unixtime_tmp, *************** *** 371,375 **** 'status' => $status, 'class' => $class, ! 'spans_day' => false, 'location' => $location, 'organizer' => serialize($organizer), --- 335,339 ---- 'status' => $status, 'class' => $class, ! 'spans_day' => true, 'location' => $location, 'organizer' => serialize($organizer), *************** *** 380,390 **** 'recur' => $recur); if (isset($display_end_tmp)){ ! $master_array[($recur_data_date)][($hour.$minute)][$uid]['display_end'] = $display_end_tmp; } ! checkOverlap($recur_data_date, ($hour.$minute), $uid); ! } } } } --- 344,389 ---- 'recur' => $recur); if (isset($display_end_tmp)){ ! $master_array[$start_date_tmp][$time_tmp][$uid]['display_end'] = $display_end_tmp; } ! checkOverlap($start_date_tmp, $time_tmp, $uid); ! } ! $start_tmp = strtotime('+1 day',$start_tmp); ! } ! } else { ! if ($bleed_check == '-1') { ! $display_end_tmp = $end_time; ! $end_time_tmp1 = '2400'; ! } + if (!isset($end_time_tmp1)) $end_time_tmp1 = $end_time; + + // Let's double check the until to not write past it + $master_array[($recur_data_date)][($hour.$minute)][$uid] = array ( + 'event_start' => $start_time, + 'event_end' => $end_time_tmp1, + 'start_unixtime' => $start_unixtime_tmp, + 'end_unixtime' => $end_unixtime_tmp, + 'event_text' => $summary, + 'event_length' => $length, + 'event_overlap' => 0, + 'description' => $description, + 'status' => $status, + 'class' => $class, + 'spans_day' => false, + 'location' => $location, + 'organizer' => serialize($organizer), + 'attendee' => serialize($attendee), + 'calnumber' => $calnumber, + 'calname' => $actual_calname, + 'url' => $url, + 'recur' => $recur); + if (isset($display_end_tmp)){ + $master_array[($recur_data_date)][($hour.$minute)][$uid]['display_end'] = $display_end_tmp; + } + checkOverlap($recur_data_date, ($hour.$minute), $uid); + } } + } Index: recur_functions.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/functions/parse/recur_functions.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** recur_functions.php 16 Dec 2008 07:55:50 -0000 1.2 --- recur_functions.php 16 Dec 2008 15:46:24 -0000 1.3 *************** *** 25,35 **** function add_recur($times,$freq=''){ ! global $recur_data, $count, $mArray_begin, $mArray_end; if (!is_array($times)) $times = array($times); $times = array_unique($times); ! sort($times); /*BYMONTH, BYWEEKNO, BYYEARDAY, BYMONTHDAY, BYDAY, BYHOUR, BYMINUTE, BYSECOND and BYSETPOS*/ ! $times = restrict_bymonth($times,$freq); $times = restrict_byweekno($times,$freq); $times = restrict_byyearday($times,$freq); --- 25,35 ---- function add_recur($times,$freq=''){ ! global $recur_data, $count, $mArray_begin, $mArray_end, $except_dates; if (!is_array($times)) $times = array($times); $times = array_unique($times); ! sort($times); /*BYMONTH, BYWEEKNO, BYYEARDAY, BYMONTHDAY, BYDAY, BYHOUR, BYMINUTE, BYSECOND and BYSETPOS*/ ! $times = restrict_bymonth($times,$freq); $times = restrict_byweekno($times,$freq); $times = restrict_byyearday($times,$freq); *************** *** 39,43 **** foreach ($times as $time){ ! if(isset($time) ) $count--; if($time >= $mArray_begin && $time <= $mArray_end && $count >= 0) $recur_data[] = $time; } --- 39,44 ---- foreach ($times as $time){ ! echo "time:". date("Ymd",$time); ! if(isset($time) && !in_array(date("Ymd",$time), $except_dates)) $count--; if($time >= $mArray_begin && $time <= $mArray_end && $count >= 0) $recur_data[] = $time; } *************** *** 46,51 **** function expand_bymonth($time){ global $bymonth, $year, $start_unixtime; ! if(empty($bymonth)) $bymonth = date("m", $start_unixtime); ! foreach ($bymonth as $m) $times[] = strtotime("$year".str_pad($m,2,"0",STR_PAD_LEFT).date("d",$start_unixtime)); return $times; } --- 47,55 ---- function expand_bymonth($time){ global $bymonth, $year, $start_unixtime; ! if(empty($bymonth)) $bymonth = array(date("m", $start_unixtime)); ! foreach ($bymonth as $m){ ! $time = mktime(12,0,0,$m,date("d",$start_unixtime),$year); #echo "exm:".date("Ymd",$time)."\n"; ! $times[] = $time; ! } return $times; } *************** *** 83,87 **** global $bymonthday, $year, $month; if (empty($bymonthday)) return $times; ! foreach($times as $time) foreach($bymonthday as $monthday) $new_times[] = strtotime("$year.$month".str_pad($monthday,2,"0",STR_PAD_LEFT)); return $new_times; } --- 87,91 ---- global $bymonthday, $year, $month; if (empty($bymonthday)) return $times; ! foreach($times as $time) foreach($bymonthday as $monthday) $new_times[] = mktime(12,0,0,$month,$monthday,$year); return $new_times; } *************** *** 89,93 **** function expand_byday($time){ global $freq_type, $byday, $wkst3char, $year, $month, $start_unixtime; ! if (empty($byday)) return array(strtotime("$year$month".date("d",$start_unixtime))); $the_sunday = dateOfWeek(date("Ymd",$time), $wkst3char); # echo "$freq_type, ".print_r($byday,true)."$wkst3char $the_sunday"; --- 93,97 ---- function expand_byday($time){ global $freq_type, $byday, $wkst3char, $year, $month, $start_unixtime; ! if (empty($byday)) return array($time); $the_sunday = dateOfWeek(date("Ymd",$time), $wkst3char); # echo "$freq_type, ".print_r($byday,true)."$wkst3char $the_sunday"; *************** *** 114,121 **** case 'year': $week_arr = array(1,2,3,4,5); ! if(!isset($byday_arr[2])) $week_arr = array($byday_arr[2]); $month_start = strtotime(date("Ym01",$time)); foreach($week_arr as $week){ ! $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",$month_start) ) $times[] = $next_date_time; --- 118,125 ---- case 'year': $week_arr = array(1,2,3,4,5); ! if(isset($byday_arr[2])) $week_arr = array($byday_arr[2]); $month_start = strtotime(date("Ym01",$time)); foreach($week_arr as $week){ ! $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",$month_start) ) $times[] = $next_date_time; *************** *** 127,130 **** --- 131,135 ---- } } + dump_times($times); return $times; } *************** *** 134,138 **** global $bymonth; if (empty($bymonth)) return $times; ! foreach ($times as $time) if(in_array(date("m", $time), $bymonth)) $new_times[] = $time; return $new_times; } --- 139,146 ---- global $bymonth; if (empty($bymonth)) return $times; ! $new_times=array(); ! foreach ($times as $time){ ! if(in_array(date("m", $time), $bymonth)) $new_times[] = $time; ! } return $new_times; } *************** *** 140,143 **** --- 148,152 ---- global $byweekno; if(empty($byweekno)) return $times; + $new_times=array(); foreach ($times as $time) if(in_array(date("W", $time), $byweekno)) $new_times[] = $time; return $new_times; *************** *** 147,150 **** --- 156,160 ---- global $byyearday; if(empty($byyearday)) return $times; + $new_times=array(); foreach ($times as $time) if(in_array(date("z", $time), $byyearday)) $new_times[] = $time; return $new_times; *************** *** 154,157 **** --- 164,168 ---- global $bymonthday; if(empty($bymonthday)) return $times; + $new_times=array(); foreach ($times as $time) if(in_array(date("j", $time), $bymonthday)) $new_times[] = $time; return $new_times; *************** *** 160,164 **** global $byday; if(empty($byday)) return $times; ! foreach($byday as $key=>$day) $byday3[] = two2threeCharDays($day); foreach ($times as $time) if(in_array(strtolower(date("D", $time)), $byday3)) $new_times[] = $time; return $new_times; --- 171,185 ---- global $byday; if(empty($byday)) return $times; ! foreach($byday as $key=>$day) { ! /* set $byday_arr ! [0] => byday string, e.g. 4TH ! [1] => sign/modifier ! [2] => 4 number ! [3] => TH day abbr ! */ ! ereg ('([-\+]{0,1})?([0-9]{1})?([A-Z]{2})', $day, $byday_arr); ! $byday3[] = two2threeCharDays($byday_arr[3]); ! } ! $new_times=array(); foreach ($times as $time) if(in_array(strtolower(date("D", $time)), $byday3)) $new_times[] = $time; return $new_times; *************** *** 168,171 **** --- 189,193 ---- global $rrule_array, $bysetpos; if(empty($bysetpos)) return $times; + $new_times=array(); $n = count($times); foreach($bysetpos as $setpos){ *************** *** 173,175 **** } return $new_times; ! } \ No newline at end of file --- 195,205 ---- } return $new_times; ! } ! ! function dump_times($recur_data){ ! global $summary; ! echo "<pre>$summary recur_data:"; ! var_dump($recur_data); ! foreach($recur_data as $time) echo "\n".date("Ymd his",$time); ! echo "</pre>"; ! } |
From: <ji...@us...> - 2008-12-16 07:55:56
|
Update of /cvsroot/phpicalendar/phpicalendar/functions/parse In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv31048/functions/parse Modified Files: end_vevent.php recur_functions.php Log Message: progress on recurrence Index: end_vevent.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/functions/parse/end_vevent.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** end_vevent.php 15 Dec 2008 17:25:28 -0000 1.3 --- end_vevent.php 16 Dec 2008 07:55:50 -0000 1.4 *************** *** 200,213 **** variables ending in unixtime are in unixtime ! mArray_begin and mArray_end are set in initialization by date_range.php and may be overwritten by rss_common.php. These should be the default for start_range and end_range unixtimes. Conditions where overwrite these: ! COUNT < 1,000,000 - we have to count occurrences; reset next_range_unixtime starting value $until_unixtime < $mArray_end - stop iterating early !isset($rrule_array['FREQ']) - only iterate once, set the end_range_unixtime to the end_date_unixtime Note that start_range_unixtime and end_range_unixtime are not the same as start_date_unixtime and end_date_unixtime */ - $next_range_unixtime = $mArray_begin; $end_range_unixtime = $mArray_end+60*60*24; $start_date_unixtime = strtotime($start_date); ! if($count < 1000000) $next_range_unixtime = $start_date_unixtime; if(isset($until) && $end_range_unixtime > $until_unixtime) $end_range_unixtime = $until_unixtime; if(!isset($rrule_array['FREQ'])){ --- 200,215 ---- variables ending in unixtime are in unixtime ! mArray_begin and mArray_end are set in initialization by date_range.php and may be overwritten by rss_common.php. ! ! $start_date_unixtime should be the default for starting the range. Need this for the intervals to work out (e.g. every other day, week, month etc) ! mArray_end should be the default for end_range unixtimes. ! Conditions where overwrite these: $until_unixtime < $mArray_end - stop iterating early !isset($rrule_array['FREQ']) - only iterate once, set the end_range_unixtime to the end_date_unixtime Note that start_range_unixtime and end_range_unixtime are not the same as start_date_unixtime and end_date_unixtime */ $end_range_unixtime = $mArray_end+60*60*24; $start_date_unixtime = strtotime($start_date); ! $next_range_unixtime = $start_date_unixtime; if(isset($until) && $end_range_unixtime > $until_unixtime) $end_range_unixtime = $until_unixtime; if(!isset($rrule_array['FREQ'])){ *************** *** 226,230 **** #echo "<pre>$summary\n\tstart mArray time:".date("Ymd his",$mArray_begin)."\n\tstart range time:".date("Ymd his",$next_range_unixtime)."\n\tend range time ".date("Ymd his",$end_range_unixtime)."</pre>"; $recur_data = array(); ! while ($next_range_unixtime <= $end_range_unixtime) { $year = date('Y', $next_range_unixtime); $month = date('m', $next_range_unixtime); --- 228,232 ---- #echo "<pre>$summary\n\tstart mArray time:".date("Ymd his",$mArray_begin)."\n\tstart range time:".date("Ymd his",$next_range_unixtime)."\n\tend range time ".date("Ymd his",$end_range_unixtime)."</pre>"; $recur_data = array(); ! while ($next_range_unixtime <= $end_range_unixtime && $count > 0) { $year = date('Y', $next_range_unixtime); $month = date('m', $next_range_unixtime); *************** *** 241,250 **** break; case 'month': ! $next_date_unixtime = mktime(12,0,0,$month,date('d',$start_unixtime),$year); echo "month".date("Ymd his",$next_date_unixtime); ! add_recur(($next_date_unixtime)); break; case 'year': ! $next_date_unixtime = mktime(12,0,0,date('m',$start_unixtime),date('d',$start_unixtime),$year); echo "year:$hour,$min,0,".date('m',$start_unixtime).",".date('d',$start_unixtime).",$year".date("Ymd his",$next_date_unixtime);print_r($datetime); ! add_recur(($next_date_unixtime)); break; default: --- 243,260 ---- break; case 'month': ! $times = expand_bymonthday(array($next_range_unixtime)); ! foreach($times as $time){ ! add_recur(expand_byday($time)); ! } break; case 'year': ! $times = expand_bymonth($next_range_unixtime); ! $times = expand_byweekno($times); ! $times = expand_byyearday($times); ! $times = expand_bymonthday($times); ! ! foreach($times as $time){ ! add_recur(expand_byday($time)); ! } break; default: *************** *** 254,258 **** $next_range_unixtime = strtotime('+'.$interval.' '.$freq_type, $next_range_unixtime); } #end while loop - $recur_data = array_unique($recur_data); sort($recur_data); echo "<pre>$summary recur_data:"; --- 264,267 ---- *************** *** 260,267 **** foreach($recur_data as $time) echo "\n".date("Ymd his",$time); echo "</pre>"; - if ($count < count($recur_data)){ - $arr = array_slice($recur_data,0,$count); - $recur_data =$arr; - } # use recur_data array to write the master array --- 269,272 ---- Index: recur_functions.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/functions/parse/recur_functions.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** recur_functions.php 15 Dec 2008 17:25:28 -0000 1.1 --- recur_functions.php 16 Dec 2008 07:55:50 -0000 1.2 *************** *** 25,30 **** function add_recur($times,$freq=''){ ! global $recur_data; if (!is_array($times)) $times = array($times); /*BYMONTH, BYWEEKNO, BYYEARDAY, BYMONTHDAY, BYDAY, BYHOUR, BYMINUTE, BYSECOND and BYSETPOS*/ --- 25,32 ---- function add_recur($times,$freq=''){ ! global $recur_data, $count, $mArray_begin, $mArray_end; if (!is_array($times)) $times = array($times); + $times = array_unique($times); + sort($times); /*BYMONTH, BYWEEKNO, BYYEARDAY, BYMONTHDAY, BYDAY, BYHOUR, BYMINUTE, BYSECOND and BYSETPOS*/ *************** *** 36,48 **** $times = restrict_bysetpos($times,$freq); ! foreach ($times as $time) if(isset($time)) $recur_data[] = $time; return; } function expand_byday($time){ ! global $freq_type, $byday, $wkst3char; $the_sunday = dateOfWeek(date("Ymd",$time), $wkst3char); # echo "$freq_type, ".print_r($byday,true)."$wkst3char $the_sunday"; - if (empty($byday)) $byday[] = strtoupper(substr(date('D', $time), 0, 2)); foreach($byday as $key=>$day) { /* set $byday_arr --- 38,95 ---- $times = restrict_bysetpos($times,$freq); ! foreach ($times as $time){ ! if(isset($time) ) $count--; ! if($time >= $mArray_begin && $time <= $mArray_end && $count >= 0) $recur_data[] = $time; ! } return; } + function expand_bymonth($time){ + global $bymonth, $year, $start_unixtime; + if(empty($bymonth)) $bymonth = date("m", $start_unixtime); + foreach ($bymonth as $m) $times[] = strtotime("$year".str_pad($m,2,"0",STR_PAD_LEFT).date("d",$start_unixtime)); + return $times; + } + function expand_byweekno($times){ + global $byweekno, $year; + if (empty($byweekno)) return $times; + $py = $year-1; + $ny = $year+1; + foreach($times as $time){ + foreach($byweekno as $weekno){ + if($yearday >= 0) $day = strtotime("Jan 1 $year +$weekno weeks"); + else $day = strtotime("Jan 1 $year $weekno weeks"); + if(date("Y",$day == $year)) $new_times[] = $day; + } + } + return $new_times; + } + + function expand_byyearday($times){ + global $byyearday, $year; + if (empty($byyearday)) return $times; + $py = $year-1; + $ny = $year+1; + foreach($times as $time){ + foreach($byyearday as $yearday){ + if($yearday > 0) $day = strtotime("Dec 31 $py +$yearday days"); + else $day = strtotime("Jan 1 $ny $yearday days"); + if(date("Y",$day == $year)) $new_times[] = $day; + } + } + return $new_times; + } + + function expand_bymonthday($times){ + global $bymonthday, $year, $month; + if (empty($bymonthday)) return $times; + foreach($times as $time) foreach($bymonthday as $monthday) $new_times[] = strtotime("$year.$month".str_pad($monthday,2,"0",STR_PAD_LEFT)); + return $new_times; + } function expand_byday($time){ ! global $freq_type, $byday, $wkst3char, $year, $month, $start_unixtime; ! if (empty($byday)) return array(strtotime("$year$month".date("d",$start_unixtime))); $the_sunday = dateOfWeek(date("Ymd",$time), $wkst3char); # echo "$freq_type, ".print_r($byday,true)."$wkst3char $the_sunday"; foreach($byday as $key=>$day) { /* set $byday_arr *************** *** 62,69 **** $next_date_time = strtotime("next $on_day",$next_date_time) + (12 * 60 * 60); } ! default: ! $next_date_time = strtotime($byday_arr[1].$byday_arr[2].$on_day, $time); } - $times[] = $next_date_time; } return $times; --- 109,129 ---- $next_date_time = strtotime("next $on_day",$next_date_time) + (12 * 60 * 60); } ! $times[] = $next_date_time; ! break; ! case 'month': ! case 'year': ! $week_arr = array(1,2,3,4,5); ! if(!isset($byday_arr[2])) $week_arr = array($byday_arr[2]); ! $month_start = strtotime(date("Ym01",$time)); ! foreach($week_arr as $week){ ! $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",$month_start) ) $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); } } return $times; *************** *** 108,111 **** global $rrule_array, $bysetpos; if(empty($bysetpos)) return $times; ! } \ No newline at end of file --- 168,175 ---- global $rrule_array, $bysetpos; if(empty($bysetpos)) return $times; ! $n = count($times); ! foreach($bysetpos as $setpos){ ! $new_times[] = array_slice($times, $setpos, 1); ! } ! return $new_times; } \ No newline at end of file |
From: <ji...@us...> - 2008-12-15 17:25:50
|
Update of /cvsroot/phpicalendar/phpicalendar/functions/init In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv11278/functions/init Modified Files: set_error_reporting.php Log Message: big changes to recurrence; trying to get closer to the spec Index: set_error_reporting.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/functions/init/set_error_reporting.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** set_error_reporting.php 11 Dec 2008 23:48:39 -0000 1.1 --- set_error_reporting.php 15 Dec 2008 17:25:27 -0000 1.2 *************** *** 5,9 **** */ // uncomment when developing, comment for shipping version ! error_reporting (E_ERROR | E_WARNING | E_PARSE); #error_reporting(0); // Older versions of PHP do not define $_SERVER. Define it here instead. --- 5,10 ---- */ // uncomment when developing, comment for shipping version ! error_reporting (E_ALL); ! #error_reporting (E_ERROR | E_WARNING | E_PARSE); #error_reporting(0); // Older versions of PHP do not define $_SERVER. Define it here instead. |
From: <ji...@us...> - 2008-12-15 17:25:33
|
Update of /cvsroot/phpicalendar/phpicalendar/calendars In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv11278/calendars Modified Files: US Holidays.ics Log Message: big changes to recurrence; trying to get closer to the spec Index: US Holidays.ics =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/calendars/US Holidays.ics,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** US Holidays.ics 13 Dec 2008 23:42:31 -0000 1.4 --- US Holidays.ics 15 Dec 2008 17:25:27 -0000 1.5 *************** *** 75,89 **** BEGIN:VEVENT - SUMMARY:Secretaries Day - DESCRIPTION:Wednesday of last full week in April - DTSTAMP:20030701T000000Z - UID:hol...@ic... - CATEGORIES:Holiday - US - DTSTART;VALUE=DATE:19520423 - RRULE:FREQ=MONTHLY;INTERVAL=1;BYDAY=WE;BYMONTHDAY=25,26,27,21,22,23,24;BYMONTH=4 - END:VEVENT - - - BEGIN:VEVENT SUMMARY:Mardi Gras (Fat Tuesday) DESCRIPTION:47 days before Easter --- 75,78 ---- *************** *** 96,100 **** END:VEVENT - BEGIN:VEVENT SUMMARY:St. Patrick's Day --- 85,88 ---- *************** *** 108,111 **** --- 96,109 ---- BEGIN:VEVENT + SUMMARY:Daylight Savings +1 hr + DESCRIPTION:2nd Sunday of March + DTSTAMP:20030701T000000Z + UID:hol...@ic... + CATEGORIES:Holiday - US + DTSTART:20070311T020000 + RRULE:FREQ=MONTHLY;BYMONTH=3;BYDAY=2SU + END:VEVENT + + BEGIN:VEVENT SUMMARY:April Fools Day DESCRIPTION:April 1 *************** *** 118,128 **** BEGIN:VEVENT ! SUMMARY:Daylight Savings +1 hr ! DESCRIPTION:2nd Sunday of March DTSTAMP:20030701T000000Z ! UID:hol...@ic... CATEGORIES:Holiday - US ! DTSTART:20070311T020000 ! RRULE:FREQ=MONTHLY;BYMONTH=3;BYDAY=2SU END:VEVENT --- 116,136 ---- BEGIN:VEVENT ! SUMMARY:Secretaries Day ! DESCRIPTION:Wednesday of last full week in April DTSTAMP:20030701T000000Z ! UID:hol...@ic... CATEGORIES:Holiday - US ! DTSTART;VALUE=DATE:19520423 ! RRULE:FREQ=MONTHLY;INTERVAL=1;BYDAY=WE;BYMONTHDAY=25,26,27,21,22,23,24;BYMONTH=4 ! END:VEVENT ! ! BEGIN:VEVENT ! SUMMARY:Mother's Day ! DESCRIPTION:2nd Sunday of May ! DTSTAMP:20030701T000000Z ! UID:hol...@ic... ! CATEGORIES:Holiday - US ! DTSTART;VALUE=DATE:17530513 ! RRULE:FREQ=MONTHLY;BYMONTH=5;BYDAY=2SU END:VEVENT *************** *** 148,158 **** BEGIN:VEVENT ! SUMMARY:Mother's Day ! DESCRIPTION:2nd Sunday of May DTSTAMP:20030701T000000Z ! UID:hol...@ic... CATEGORIES:Holiday - US ! DTSTART;VALUE=DATE:17530513 ! RRULE:FREQ=MONTHLY;BYMONTH=5;BYDAY=2SU END:VEVENT --- 156,166 ---- BEGIN:VEVENT ! SUMMARY:Flag Day ! DESCRIPTION:June 14 DTSTAMP:20030701T000000Z ! UID:hol...@ic... CATEGORIES:Holiday - US ! DTSTART;VALUE=DATE:17530614 ! RRULE:FREQ=YEARLY END:VEVENT *************** *** 168,181 **** BEGIN:VEVENT - SUMMARY:Flag Day - DESCRIPTION:June 14 - DTSTAMP:20030701T000000Z - UID:hol...@ic... - CATEGORIES:Holiday - US - DTSTART;VALUE=DATE:17530614 - RRULE:FREQ=YEARLY - END:VEVENT - - BEGIN:VEVENT SUMMARY:Independence Day DESCRIPTION:July 4 --- 176,179 ---- |
From: <ji...@us...> - 2008-12-15 17:25:33
|
Update of /cvsroot/phpicalendar/phpicalendar/functions/parse In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv11278/functions/parse Modified Files: end_vevent.php overlapping_events.php parse_tzs.php Added Files: recur_functions.php Log Message: big changes to recurrence; trying to get closer to the spec --- NEW FILE: recur_functions.php --- <?php /* 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; if (!is_array($times)) $times = array($times); /*BYMONTH, BYWEEKNO, BYYEARDAY, BYMONTHDAY, BYDAY, BYHOUR, BYMINUTE, BYSECOND and BYSETPOS*/ $times = restrict_bymonth($times,$freq); $times = restrict_byweekno($times,$freq); $times = restrict_byyearday($times,$freq); $times = restrict_bymonthday($times,$freq); $times = restrict_byday($times,$freq); $times = restrict_bysetpos($times,$freq); foreach ($times as $time) if(isset($time)) $recur_data[] = $time; return; } function expand_byday($time){ global $freq_type, $byday, $wkst3char; $the_sunday = dateOfWeek(date("Ymd",$time), $wkst3char); # echo "$freq_type, ".print_r($byday,true)."$wkst3char $the_sunday"; if (empty($byday)) $byday[] = strtoupper(substr(date('D', $time), 0, 2)); foreach($byday as $key=>$day) { /* set $byday_arr [0] => byday string, e.g. 4TH [1] => sign/modifier [2] => 4 number [3] => TH day abbr */ ereg ('([-\+]{0,1})?([0-9]{1})?([A-Z]{2})', $day, $byday_arr); $on_day = two2threeCharDays($byday_arr[3]); switch($freq_type){ case 'week': #need to find the first day of the appropriate week. if ($key == 0){ $next_date_time = strtotime("next $on_day",strtotime($the_sunday)) + (12 * 60 * 60); }else{ $next_date_time = strtotime("next $on_day",$next_date_time) + (12 * 60 * 60); } default: $next_date_time = strtotime($byday_arr[1].$byday_arr[2].$on_day, $time); } $times[] = $next_date_time; } return $times; } function restrict_bymonth($times,$freq=''){ global $bymonth; if (empty($bymonth)) return $times; foreach ($times as $time) if(in_array(date("m", $time), $bymonth)) $new_times[] = $time; return $new_times; } function restrict_byweekno($times,$freq=''){ global $byweekno; if(empty($byweekno)) return $times; foreach ($times as $time) if(in_array(date("W", $time), $byweekno)) $new_times[] = $time; return $new_times; } function restrict_byyearday($times,$freq=''){ global $byyearday; if(empty($byyearday)) return $times; foreach ($times as $time) if(in_array(date("z", $time), $byyearday)) $new_times[] = $time; return $new_times; } function restrict_bymonthday($times,$freq=''){ global $bymonthday; if(empty($bymonthday)) return $times; foreach ($times as $time) if(in_array(date("j", $time), $bymonthday)) $new_times[] = $time; return $new_times; } function restrict_byday($times,$freq=''){ global $byday; if(empty($byday)) return $times; foreach($byday as $key=>$day) $byday3[] = two2threeCharDays($day); foreach ($times as $time) if(in_array(strtolower(date("D", $time)), $byday3)) $new_times[] = $time; return $new_times; } function restrict_bysetpos($times,$freq=''){ global $rrule_array, $bysetpos; if(empty($bysetpos)) return $times; } Index: end_vevent.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/functions/parse/end_vevent.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** end_vevent.php 13 Dec 2008 23:42:31 -0000 1.2 --- end_vevent.php 15 Dec 2008 17:25:28 -0000 1.3 *************** *** 4,13 **** What happens in this file: 1. Initialization: add information not present by default ! 2. */ - if (!isset($url)) $url = ''; - if (!isset($type)) $type = ''; - // Handle DURATION if (!isset($end_unixtime)) { --- 4,15 ---- What happens in this file: 1. Initialization: add information not present by default ! a. duration ! b. class ! c. uid ! d. adjust start_time and end_time ! 2. Build recur_data array ! 3. Add occurrences to master_array */ // Handle DURATION if (!isset($end_unixtime)) { *************** *** 37,47 **** } - if (!isset($summary)) $summary = ''; - if (!isset($description)) $description = ''; - if (!isset($status)) $status = ''; - if (!isset($class)) $class = ''; - if (!isset($location)) $location = ''; - - # adjust event start and end times if (isset($start_time) && isset($end_time)) { --- 39,42 ---- *************** *** 113,136 **** # $rrule_array['END'] = 'end'; } - - $start_date_time = strtotime($start_date); - if (!isset($fromdate)){ - #this should happen if not in one of the rss views - $this_month_start_time = strtotime($this_year.$this_month.'01'); - if ($current_view == 'year' || ($save_parsed_cals == 'yes' && !$is_webcal)|| $current_view == 'print' && $printview == 'year') { - $start_range_time = strtotime($this_year.'-01-01 -2 weeks'); - $end_range_time = strtotime($this_year.'-12-31 +2 weeks'); - } else { - $start_range_time = strtotime('-1 month -2 day', $this_month_start_time); - $end_range_time = strtotime('+2 month +2 day', $this_month_start_time); - } - }else{ - $start_range_time = strtotime($fromdate); - $end_range_time = strtotime($todate)+60*60*24; - } - ! $freq_type = 'year'; ! $interval = 1; # Load $rrule_array foreach ($rrule_array as $key => $val) { --- 108,113 ---- # $rrule_array['END'] = 'end'; } ! $freq_type = 'none'; # Load $rrule_array foreach ($rrule_array as $key => $val) { *************** *** 158,162 **** $abs_until = $until; ereg ('([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})', $until, $regs); ! $until = mktime($regs[4],$regs[5],$regs[6],$regs[2],$regs[3],$regs[1]); $recur_array[($start_date)][($hour.$minute)][$uid]['recur'][$key] = localizeDate($dateFormat_week,$until); break; --- 135,139 ---- $abs_until = $until; ereg ('([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})', $until, $regs); ! $until_unixtime = mktime($regs[4],$regs[5],@$regs[6],$regs[2],$regs[3],$regs[1]); $recur_array[($start_date)][($hour.$minute)][$uid]['recur'][$key] = localizeDate($dateFormat_week,$until); break; *************** *** 168,212 **** break; case 'BYSECOND': ! $bysecond = $val; ! $bysecond = split (',', $bysecond); $recur_array[($start_date)][($hour.$minute)][$uid]['recur'][$key] = $bysecond; break; case 'BYMINUTE': ! $byminute = $val; ! $byminute = split (',', $byminute); $recur_array[($start_date)][($hour.$minute)][$uid]['recur'][$key] = $byminute; break; case 'BYHOUR': ! $byhour = $val; ! $byhour = split (',', $byhour); $recur_array[($start_date)][($hour.$minute)][$uid]['recur'][$key] = $byhour; break; case 'BYDAY': ! $byday = $val; ! $byday = split (',', $byday); $recur_array[($start_date)][($hour.$minute)][$uid]['recur'][$key] = $byday; break; case 'BYMONTHDAY': ! $bymonthday = $val; ! $bymonthday = split (',', $bymonthday); $recur_array[($start_date)][($hour.$minute)][$uid]['recur'][$key] = $bymonthday; break; case 'BYYEARDAY': ! $byyearday = $val; ! $byyearday = split (',', $byyearday); $recur_array[($start_date)][($hour.$minute)][$uid]['recur'][$key] = $byyearday; break; case 'BYWEEKNO': ! $byweekno = $val; ! $byweekno = split (',', $byweekno); $recur_array[($start_date)][($hour.$minute)][$uid]['recur'][$key] = $byweekno; break; case 'BYMONTH': ! $bymonth = $val; ! $bymonth = split (',', $bymonth); $recur_array[($start_date)][($hour.$minute)][$uid]['recur'][$key] = $bymonth; break; case 'BYSETPOS': ! $bysetpos = $val; $recur_array[($start_date)][($hour.$minute)][$uid]['recur'][$key] = $bysetpos; break; --- 145,181 ---- break; case 'BYSECOND': ! $bysecond = split (',', $val); $recur_array[($start_date)][($hour.$minute)][$uid]['recur'][$key] = $bysecond; break; case 'BYMINUTE': ! $byminute = split (',', $val); $recur_array[($start_date)][($hour.$minute)][$uid]['recur'][$key] = $byminute; break; case 'BYHOUR': ! $byhour = split (',', $val); $recur_array[($start_date)][($hour.$minute)][$uid]['recur'][$key] = $byhour; break; case 'BYDAY': ! $byday = split (',', $val); $recur_array[($start_date)][($hour.$minute)][$uid]['recur'][$key] = $byday; break; case 'BYMONTHDAY': ! $bymonthday = split (',', $val); $recur_array[($start_date)][($hour.$minute)][$uid]['recur'][$key] = $bymonthday; break; case 'BYYEARDAY': ! $byyearday = split (',', $val); $recur_array[($start_date)][($hour.$minute)][$uid]['recur'][$key] = $byyearday; break; case 'BYWEEKNO': ! $byweekno = split (',', $val); $recur_array[($start_date)][($hour.$minute)][$uid]['recur'][$key] = $byweekno; break; case 'BYMONTH': ! $bymonth = split (',', $val); $recur_array[($start_date)][($hour.$minute)][$uid]['recur'][$key] = $bymonth; break; case 'BYSETPOS': ! $bysetpos = split (',', $val); $recur_array[($start_date)][($hour.$minute)][$uid]['recur'][$key] = $bysetpos; break; *************** *** 217,457 **** } } - /* - Load $recur_array - $recur_array is an array of unix times for instances of an event. This code handles repeats. - Note that dates with exceptions are counted as instances. - RDATE is currently not supported - */ # $recur is the recurrence info that goes into the master array for this VEVENT ! $recur = $recur_array[($start_date)][($hour.$minute)][$uid]['recur']; ! ! // if $until isn't set yet, we set it to the end of our range we're looking at ! if (!isset($until)) $until = $end_range_time; ! if (!isset($abs_until)) $abs_until = date('YmdHis', $end_range_time); ! $end_date_time = $until; ! ! // If the $end_range_time is less than the $start_date_time, or $start_range_time is greater ! // than $end_date_time, we may as well forget the whole thing ! // It doesn't do us any good to spend time adding data we aren't even looking at ! // this will prevent the year view from taking way longer than it needs to ! if ($end_range_time >= $start_date_time && $start_range_time_tmp <= $end_date_time) { ! ! // if the beginning of our range is less than the start of the item, we may as well set it equal to it ! if ($start_range_time < $start_date_time){ ! $start_range_time = $start_date_time; ! } ! if ($end_range_time > $end_date_time) $end_range_time = $end_date_time; ! ! // initialize the time we will increment ! $next_range_time = $start_range_time; ! ! // start at the $start_range and go until we hit the end of our range. ! if(!isset($wkst)) $wkst='SU'; ! $wkst3char = two2threeCharDays($wkst); ! # set first instance if it's in range ! $recur_data = array(); ! if ($start_unixtime < $mArray_end && $end_unixtime > $mArray_begin){ ! $recur_data[] = $start_unixtime; ! } ! /* ! The while loop below increments $next_range_time by $freq type. For the larger freq types, there is only ! one $next_range_time per repeat, but the BYXXX rules may write more than one event in that repeat cycle ! $next_date_time handles those instances within a $freq_type ! */ ! #echo "<br><br>$summary<br>next range time:".date("Ymd his",$next_range_time)." <br>start range time ".date("Ymd his",$start_range_time)." <br>end range time ".date("Ymd his",$end_range_time); ! while (($next_range_time >= $start_range_time) && ($next_range_time <= $end_range_time)) { ! # pick the right compare function from date_functions.php ! # $diff is the number of occurrences between start_date and next_range_time ! $func = $freq_type.'Compare'; ! $diff = $func(date('Ymd',$next_range_time), $start_date); ! $rcount = $diff; ! if(count($byday) > 1) $rcount = $diff * count($byday); ! if ($rcount < $count && $diff % $interval == 0) { ! $year = date('Y', $next_range_time); ! $month = date('m', $next_range_time); ! switch ($rrule_array['FREQ']) { ! case 'DAILY': ! $recur_data[] = $next_range_time; ! break; ! case 'WEEKLY': ! // Populate $byday with the default day if it's not set. ! if (!isset($byday)) $byday[] = strtoupper(substr(date('D', $start_date_time), 0, 2)); ! $the_sunday = dateOfWeek(date("Ymd",$next_range_time), $wkst3char); ! foreach($byday as $key=>$day) { ! $day = two2threeCharDays($day); ! #need to find the first day of the appropriate week. ! if ($key == 0){ ! $next_date_time = strtotime("next $day",strtotime($the_sunday)) + (12 * 60 * 60); ! }else{ ! $next_date_time = strtotime("next $day",$next_date_time) + (12 * 60 * 60); ! } ! $recur_data[] = $next_date_time; #echo "<br>$key $day ".strtotime("Ymd his", $next_date_time); ! } ! break; ! case 'MONTHLY': ! if (empty($bymonth)) $bymonth = array(1,2,3,4,5,6,7,8,9,10,11,12); ! if (!empty($bysetpos)){ ! /* bysetpos code from dustinbutler ! start on day 1 or last day. ! if day matches any BYDAY the count is incremented. ! SETPOS = 4, need 4th match ! SETPOS = -1, need 1st match ! */ ! if ($bysetpos > 0) { ! $next_day = '+1 day'; ! $day = 1; ! } else { ! $next_day = '-1 day'; ! $day = $totalDays[$month]; ! } ! $day = mktime(0, 0, 0, $month, $day, $year); ! $countMatch = 0; ! while ($countMatch != abs($bysetpos)) { ! /* Does this day match a BYDAY value? */ ! $thisDay = $day; ! $textDay = strtoupper(substr(date('D', $thisDay), 0, 2)); ! if (in_array($textDay, $byday)) { ! $countMatch++; ! } ! $day = strtotime($next_day, $thisDay); ! } ! if(in_array(date("m", $next_date_time), $bymonth)) $recur_data[] = $next_date_time; ! }elseif (count($bymonthday) > 0 && empty($byday)) { ! foreach($bymonthday as $day) { ! if ($day < 0) $day = ((date('t', $next_range_time)) + ($day)) + 1; ! if (checkdate($month,$day,$year)) { ! $next_date_time = mktime(0,0,0,$month,$day,$year); ! if(in_array(date("m", $next_date_time), $bymonth)) $recur_data[] = $next_date_time; ! } ! } ! } else { ! foreach($byday as $day) { ! /* set $byday_arr ! [0] => byday string, e.g. 4TH ! [1] => sign/modifier ! [2] => 4 number ! [3] => TH day abbr ! */ ! ereg ('([-\+]{0,1})?([0-9]{1})?([A-Z]{2})', $day, $byday_arr); ! $on_day = two2threeCharDays($byday_arr[3]); ! $next_date_time = strtotime($byday_arr[1].$byday_arr[2].$on_day, $next_range_time); ! if(empty($bymonthday) && in_array(date("m", $next_date_time), $bymonth)) $recur_data[] = $next_date_time; ! ! if (isset($bymonthday) && (!empty($bymonthday))) { ! // This supports MONTHLY where BYDAY and BYMONTH are both set ! foreach($bymonthday as $day) { ! if (checkdate($month,$day,$year)) { ! $next_date_time = mktime(0,0,0,$month,$day,$year); ! $daday = strtolower(strftime("%a", $next_date_time)); ! if ($daday == $on_day && in_array($month, $bymonth)) { ! if(in_array(date("m", $next_date_time), $bymonth)) $recur_data[] = $next_date_time; ! } ! } ! } ! } ! } # end foreach $byday ! } ! break; ! case 'YEARLY': ! if ((!isset($bymonth)) || (sizeof($bymonth) == 0)) $bymonth = array(date('m', $start_date_time)); ! foreach($bymonth as $month) { ! if (isset($bysetpos)){ ! /* bysetpos code from dustinbutler ! start on day 1 or last day. ! if day matches any BYDAY the count is incremented. ! SETPOS = 4, need 4th match ! SETPOS = -1, need 1st match ! */ ! if ($bysetpos > 0) { ! $next_day = '+1 day'; ! $day = 1; ! } else { ! $next_day = '-1 day'; ! $day = date("t",$month); ! } ! $day = mktime(12, 0, 0, $month, $day, $year); ! $countMatch = 0; ! while ($countMatch != abs($bysetpos)) { ! /* Does this day match a BYDAY value? */ ! $thisDay = $day; ! $textDay = strtoupper(substr(date('D', $thisDay), 0, 2)); ! if (in_array($textDay, $byday)) { ! $countMatch++; ! } ! $day = strtotime($next_day, $thisDay); ! } ! $recur_data[] = $thisDay; ! } ! if ((isset($byday)) && (is_array($byday))) { ! $checkdate_time = mktime(0,0,0,$month,1,$year); ! foreach($byday as $day) { ! ereg ('([-\+]{0,1})?([0-9]{1})?([A-Z]{2})', $day, $byday_arr); ! if ($byday_arr[2] != '') { ! $nth = $byday_arr[2]-1; ! } else { ! $nth = 0; ! } ! $on_day = two2threeCharDays($byday_arr[3]); ! $on_day_num = two2threeCharDays($byday_arr[3],false); ! if ($byday_arr[1] == '-') { ! $last_day_tmp = date('t',$checkdate_time); ! $checkdate_time = strtotime(date('Y-m-'.$last_day_tmp, $checkdate_time)); ! $last_tmp = (date('w',$checkdate_time) == $on_day_num) ? '' : 'last '; ! $next_date_time = strtotime($last_tmp.$on_day.' -'.$nth.' week', $checkdate_time); ! } else { ! $next_date_time = strtotime($on_day.' +'.$nth.' week', $checkdate_time); ! } ! } ! } else { ! $day = date('d', $start_date_time); ! $next_date_time = mktime(0,0,0,$month,$day,$year+1); ! //echo date('Ymd',$next_date_time).$summary.'<br>'; ! } ! if (isset($next_date_time) && $next_date_time != '') $recur_data[] = $next_date_time; ! } ! if (isset($byyearday)) { ! foreach ($byyearday as $yearday) { ! ereg ('([-\+]{0,1})?([0-9]{1,3})', $yearday, $byyearday_arr); ! if ($byyearday_arr[1] == '-') { ! $ydtime = mktime(0,0,0,12,31,$this_year); ! $yearnum = $byyearday_arr[2] - 1; ! $next_date_time = strtotime('-'.$yearnum.' days', $ydtime); ! } else { ! $ydtime = mktime(0,0,0,1,1,$this_year); ! $yearnum = $byyearday_arr[2] - 1; ! $next_date_time = strtotime('+'.$yearnum.' days', $ydtime); ! } ! if (isset($next_date_time) && $next_date_time != '') $recur_data[] = $next_date_time; ! } ! } ! break; ! default: ! // anything else we need to end the loop ! $next_range_time = $end_range_time + 100; ! } # end switch ! } ! $next_range_time = strtotime('+'.$interval.' '.$freq_type, $next_range_time); ! } #end while loop ! } # end if time compare ! #foreach($recur_data as $time) echo "<br>".date("Ymd his",$time); # use recur_data array to write the master array // use the same code to write the data instead of always changing it 5 times ! $recur_data_hour = @substr($start_time,0,2); ! $recur_data_minute = @substr($start_time,2,2); ! foreach($recur_data as $recur_data_time) { ! $recur_data_year = date('Y', $recur_data_time); ! $recur_data_month = date('m', $recur_data_time); ! $recur_data_day = date('d', $recur_data_time); $recur_data_date = $recur_data_year.$recur_data_month.$recur_data_day; ! if (($recur_data_time >= $start_date_time) && ($recur_data_time <= $end_date_time) && ($count_to != $count) && !in_array($recur_data_date, $except_dates)) { if (isset($allday_start) && $allday_start != '') { ! $start_time2 = $recur_data_time; ! $end_time2 = strtotime('+'.$diff_allday_days.' days', $recur_data_time); while ($start_time2 < $end_time2) { $start_date2 = date('Ymd', $start_time2); --- 186,281 ---- } } # $recur is the recurrence info that goes into the master array for this VEVENT ! $recur = @$recur_array[($start_date)][($hour.$minute)][$uid]['recur']; ! /* ============================ Load $recur_data ============================ ! $recur_data is an array of unix times for instances of an event. This code handles repeats. ! Note that dates with exceptions are counted as instances. ! RDATE is currently not supported + A. Set up the time range to scan for events. + If COUNT is not set (default is 1,000,000) then we don't have to start at start_date; we can start at the minimum interval for the view. + variables ending in date are in phpical date format: YYYYMMDD + variables ending with time are in phpical time format: HHMM + variables ending in unixtime are in unixtime ! mArray_begin and mArray_end are set in initialization by date_range.php and may be overwritten by rss_common.php. These should be the default for start_range and end_range unixtimes. Conditions where overwrite these: ! COUNT < 1,000,000 - we have to count occurrences; reset next_range_unixtime starting value ! $until_unixtime < $mArray_end - stop iterating early ! !isset($rrule_array['FREQ']) - only iterate once, set the end_range_unixtime to the end_date_unixtime ! Note that start_range_unixtime and end_range_unixtime are not the same as start_date_unixtime and end_date_unixtime */ + $next_range_unixtime = $mArray_begin; + $end_range_unixtime = $mArray_end+60*60*24; + $start_date_unixtime = strtotime($start_date); + if($count < 1000000) $next_range_unixtime = $start_date_unixtime; + if(isset($until) && $end_range_unixtime > $until_unixtime) $end_range_unixtime = $until_unixtime; + if(!isset($rrule_array['FREQ'])){ + $end_range_unixtime = strtotime($end_date); + $count = 1; + } + // if the beginning of our range is less than the start of the item, we may as well set it equal to it + if ($next_range_unixtime < $start_date_unixtime) $next_range_unixtime = $start_date_unixtime; + + // convert wkst to a 3 char day for strtotime to work + $wkst3char = two2threeCharDays($wkst); + /* The while loop below increments $next_range_time by $freq type. For the larger freq types, there is only + one $next_range_time per repeat, but the BYXXX rules may write more than one event in that repeat cycle + $next_date_time handles those instances within a $freq_type */ + #echo "<pre>$summary\n\tstart mArray time:".date("Ymd his",$mArray_begin)."\n\tstart range time:".date("Ymd his",$next_range_unixtime)."\n\tend range time ".date("Ymd his",$end_range_unixtime)."</pre>"; + $recur_data = array(); + while ($next_range_unixtime <= $end_range_unixtime) { + $year = date('Y', $next_range_unixtime); + $month = date('m', $next_range_unixtime); + # pick the right compare function from date_functions.php + # $diff is the number of occurrences between start_date and next_range_time + $func = $freq_type.'Compare'; + $diff = $func(date('Ymd',$next_range_time), $start_date); + switch ($freq_type){ + case 'day': + add_recur($next_range_unixtime); + break; + case 'week': + add_recur(expand_byday($next_range_unixtime)); + break; + case 'month': + $next_date_unixtime = mktime(12,0,0,$month,date('d',$start_unixtime),$year); echo "month".date("Ymd his",$next_date_unixtime); + add_recur(($next_date_unixtime)); + break; + case 'year': + $next_date_unixtime = mktime(12,0,0,date('m',$start_unixtime),date('d',$start_unixtime),$year); echo "year:$hour,$min,0,".date('m',$start_unixtime).",".date('d',$start_unixtime).",$year".date("Ymd his",$next_date_unixtime);print_r($datetime); + add_recur(($next_date_unixtime)); + break; + default: + add_recur($start_unixtime); + break 2; + } + $next_range_unixtime = strtotime('+'.$interval.' '.$freq_type, $next_range_unixtime); + } #end while loop + $recur_data = array_unique($recur_data); + sort($recur_data); + echo "<pre>$summary recur_data:"; + #var_dump($recur_data); + foreach($recur_data as $time) echo "\n".date("Ymd his",$time); + echo "</pre>"; + if ($count < count($recur_data)){ + $arr = array_slice($recur_data,0,$count); + $recur_data =$arr; + } # use recur_data array to write the master array // use the same code to write the data instead of always changing it 5 times ! $recur_data_hour = @substr($start_unixtime,0,2); ! $recur_data_minute = @substr($start_unixtime,2,2); ! foreach($recur_data as $recur_data_unixtime) { ! $recur_data_year = date('Y', $recur_data_unixtime); ! $recur_data_month = date('m', $recur_data_unixtime); ! $recur_data_day = date('d', $recur_data_unixtime); $recur_data_date = $recur_data_year.$recur_data_month.$recur_data_day; ! if ( !in_array($recur_data_date, $except_dates) ) { if (isset($allday_start) && $allday_start != '') { ! $start_time2 = $recur_data_unixtime; ! $end_time2 = strtotime('+'.$diff_allday_days.' days', $recur_data_unixtime); while ($start_time2 < $end_time2) { $start_date2 = date('Ymd', $start_time2); *************** *** 474,478 **** $end_unixtime_tmp = $start_unixtime_tmp + $length; ! if (($end_time >= $bleed_time) && ($bleed_check == '-1')) { $start_tmp = strtotime(date('Ymd',$start_unixtime_tmp)); $end_date_tmp = date('Ymd',$end_unixtime_tmp); --- 298,302 ---- $end_unixtime_tmp = $start_unixtime_tmp + $length; ! if (($end_time >= $phpiCal_config->bleed_time) && ($bleed_check == '-1')) { $start_tmp = strtotime(date('Ymd',$start_unixtime_tmp)); $end_date_tmp = date('Ymd',$end_unixtime_tmp); *************** *** 531,536 **** // Let's double check the until to not write past it - $until_check = $recur_data_date.$hour.$minute.'00'; - if ($abs_until > $until_check) { $master_array[($recur_data_date)][($hour.$minute)][$uid] = array ( 'event_start' => $start_time, --- 355,358 ---- *************** *** 556,560 **** } checkOverlap($recur_data_date, ($hour.$minute), $uid); ! } } } --- 378,382 ---- } checkOverlap($recur_data_date, ($hour.$minute), $uid); ! } } *************** *** 581,584 **** // Clear event data now that it's been saved. unset($start_time, $start_time_tmp, $end_time, $end_time_tmp, $start_unixtime, $start_unixtime_tmp, $end_unixtime, $end_unixtime_tmp, $summary, $length, $description, $status, $class, $location, $organizer, $attendee); ! ?> \ No newline at end of file --- 403,417 ---- // Clear event data now that it's been saved. unset($start_time, $start_time_tmp, $end_time, $end_time_tmp, $start_unixtime, $start_unixtime_tmp, $end_unixtime, $end_unixtime_tmp, $summary, $length, $description, $status, $class, $location, $organizer, $attendee); ! //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>'; ?> \ No newline at end of file Index: overlapping_events.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/functions/parse/overlapping_events.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** overlapping_events.php 11 Dec 2008 23:48:39 -0000 1.1 --- overlapping_events.php 15 Dec 2008 17:25:28 -0000 1.2 *************** *** 115,119 **** $event = $master_array[$event_date][$event_time][$uid]; // Copy out the array - we replace this at the end. ! $ol_day_array = $overlap_array[$event_date]; $drawTimes = drawEventTimes($event['event_start'], $event['event_end']); --- 115,119 ---- $event = $master_array[$event_date][$event_time][$uid]; // Copy out the array - we replace this at the end. ! $ol_day_array = @$overlap_array[$event_date]; $drawTimes = drawEventTimes($event['event_start'], $event['event_end']); *************** *** 142,146 **** // 'end' - end_time for the overlap block. ! $ol_day_array = $overlap_array[$event_date]; // Track if $event has been merged in, so we don't re-add the details to 'event' or 'overlapRanges' multiple times. $already_merged_once = false; --- 142,146 ---- // 'end' - end_time for the overlap block. ! $ol_day_array = @$overlap_array[$event_date]; // Track if $event has been merged in, so we don't re-add the details to 'event' or 'overlapRanges' multiple times. $already_merged_once = false; Index: parse_tzs.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/functions/parse/parse_tzs.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** parse_tzs.php 13 Dec 2008 23:42:31 -0000 1.2 --- parse_tzs.php 15 Dec 2008 17:25:28 -0000 1.3 *************** *** 18,21 **** --- 18,23 ---- } $line = trim($line); + $is_daylight = false; + $is_std = false; switch ($line) { *************** *** 26,29 **** --- 28,32 ---- unset ($offset_s); $is_std = true; + $is_daylight = false; break; case 'END:STANDARD': *************** *** 34,37 **** --- 37,41 ---- unset ($offset_d); $is_daylight = true; + $is_std = false; break; case 'END:DAYLIGHT': |
From: <ji...@us...> - 2008-12-15 17:25:33
|
Update of /cvsroot/phpicalendar/phpicalendar In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv11278 Modified Files: day.php month.php week.php Log Message: big changes to recurrence; trying to get closer to the spec Index: day.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/day.php,v retrieving revision 1.134 retrieving revision 1.135 diff -C2 -d -r1.134 -r1.135 *** day.php 12 Dec 2008 06:22:57 -0000 1.134 --- day.php 15 Dec 2008 17:25:27 -0000 1.135 *************** *** 1,19 **** <?php if (isset($_GET['jumpto_day'])) { $jumpto_day_time = strtotime($_GET['jumpto_day']); if ($jumpto_day_time == -1) { ! $getdate = date('Ymd', time() + $second_offset); } else { $getdate = date('Ymd', $jumpto_day_time); } } - $current_view = 'day'; - if (!defined('BASE')) define('BASE', './'); require_once(BASE.'functions/ical_parser.php'); require_once(BASE.'functions/list_functions.php'); require_once(BASE.'functions/template.php'); - header("Content-Type: text/html; charset=$charset"); ! if ($minical_view == 'current') $minical_view = 'day'; $weekstart = 1; --- 1,20 ---- <?php + $current_view = 'day'; + if (!defined('BASE')) define('BASE', './'); + require_once(BASE.'functions/init.inc.php'); + header("Content-Type: text/html; charset=$phpiCal_config->charset"); if (isset($_GET['jumpto_day'])) { $jumpto_day_time = strtotime($_GET['jumpto_day']); if ($jumpto_day_time == -1) { ! $getdate = date('Ymd', time() + $phpiCal_config->second_offset); } else { $getdate = date('Ymd', $jumpto_day_time); } } require_once(BASE.'functions/ical_parser.php'); require_once(BASE.'functions/list_functions.php'); require_once(BASE.'functions/template.php'); ! if ($phpiCal_config->minical_view == 'current') $minical_view = 'day'; $weekstart = 1; *************** *** 25,29 **** $display_date = localizeDate($dateFormat_day, $unix_time); $sidebar_date = localizeDate($dateFormat_week_list, $unix_time); ! $start_week_time = strtotime(dateOfWeek($getdate, $week_start_day)); --- 26,30 ---- $display_date = localizeDate($dateFormat_day, $unix_time); $sidebar_date = localizeDate($dateFormat_week_list, $unix_time); ! $start_week_time = strtotime(dateOfWeek($getdate, $phpiCal_config->week_start_day)); Index: month.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/month.php,v retrieving revision 1.143 retrieving revision 1.144 diff -C2 -d -r1.143 -r1.144 *** month.php 13 Dec 2008 23:42:30 -0000 1.143 --- month.php 15 Dec 2008 17:25:27 -0000 1.144 *************** *** 6,13 **** require_once(BASE.'functions/template.php'); header("Content-Type: text/html; charset=$charset"); ! if ($minical_view == 'current') $minical_view = 'month'; $unix_time = strtotime($getdate); ! $today_today = date('Ymd', time() + $second_offset); $tomorrows_date = date('Ymd', strtotime("+1 day", $unix_time)); $yesterdays_date = date('Ymd', strtotime("-1 day", $unix_time)); --- 6,13 ---- require_once(BASE.'functions/template.php'); header("Content-Type: text/html; charset=$charset"); ! if ($phpiCal_config->minical_view == 'current') $minical_view = 'month'; $unix_time = strtotime($getdate); ! $today_today = date('Ymd', time() + $phpiCal_config->second_offset); $tomorrows_date = date('Ymd', strtotime("+1 day", $unix_time)); $yesterdays_date = date('Ymd', strtotime("-1 day", $unix_time)); *************** *** 34,38 **** $parse_month = date ("Ym", $unix_time); $first_of_month = $this_year.$this_month."01"; ! $start_month_day = dateOfWeek($first_of_month, $week_start_day); $thisday2 = localizeDate($dateFormat_week_list, $unix_time); $num_of_events2 = 0; --- 34,38 ---- $parse_month = date ("Ym", $unix_time); $first_of_month = $this_year.$this_month."01"; ! $start_month_day = dateOfWeek($first_of_month, $phpiCal_config->week_start_day); $thisday2 = localizeDate($dateFormat_week_list, $unix_time); $num_of_events2 = 0; *************** *** 71,75 **** 'rss_available' => '', 'rss_valid' => '', ! 'show_search' => $show_search, 'next_month' => $next_month, 'prev_month' => $prev_month, --- 71,75 ---- 'rss_available' => '', 'rss_valid' => '', ! 'show_search' => $phpiCal_config->show_search, 'next_month' => $next_month, 'prev_month' => $prev_month, Index: week.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/week.php,v retrieving revision 1.134 retrieving revision 1.135 diff -C2 -d -r1.134 -r1.135 *** week.php 13 Dec 2008 23:42:31 -0000 1.134 --- week.php 15 Dec 2008 17:25:27 -0000 1.135 *************** *** 5,15 **** require_once(BASE.'functions/list_functions.php'); require_once(BASE.'functions/template.php'); ! header("Content-Type: text/html; charset=$charset"); ! if ($minical_view == "current") $minical_view = "week"; $starttime = "0500"; $weekstart = 1; $unix_time = strtotime($getdate); ! $today_today = date('Ymd', time() + $second_offset); $next_week = date("Ymd", strtotime("+1 week", $unix_time)); $prev_week = date("Ymd", strtotime("-1 week", $unix_time)); --- 5,15 ---- require_once(BASE.'functions/list_functions.php'); require_once(BASE.'functions/template.php'); ! header("Content-Type: text/html; charset=$phpiCal_config->charset"); ! if ($phpiCal_config->minical_view == "current") $minical_view = "week"; $starttime = "0500"; $weekstart = 1; $unix_time = strtotime($getdate); ! $today_today = date('Ymd', time() + $second_offset); $next_week = date("Ymd", strtotime("+1 week", $unix_time)); $prev_week = date("Ymd", strtotime("-1 week", $unix_time)); *************** *** 89,93 **** 'list_jumps' => $list_jumps, 'legend' => $list_calcolors, ! 'style_select' => $style_select, 'l_goprint' => $lang['l_goprint'], 'l_preferences' => $lang['l_preferences'], --- 89,93 ---- 'list_jumps' => $list_jumps, 'legend' => $list_calcolors, ! 'style_select' => '', 'l_goprint' => $lang['l_goprint'], 'l_preferences' => $lang['l_preferences'], |
From: <ji...@us...> - 2008-12-13 23:42:43
|
Update of /cvsroot/phpicalendar/phpicalendar/functions/init In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv11617/functions/init Modified Files: configs.php Log Message: debug rrules; fix cookie injection vuln Index: configs.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/functions/init/configs.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** configs.php 12 Dec 2008 06:37:29 -0000 1.3 --- configs.php 13 Dec 2008 23:42:31 -0000 1.4 *************** *** 7,11 **** } if ($phpiCal_config->cookie_uri == '') { ! $phpiCal_config->cookie_uri = $_SERVER['SERVER_NAME'].substr($_SERVER['PHP_SELF'],0,strpos($_SERVER['PHP_SELF'], '/')); } $cookie_name = 'phpicalendar_'.basename($phpiCal_config->default_path); --- 7,13 ---- } if ($phpiCal_config->cookie_uri == '') { ! $phpiCal_config->setProperty('cookie_uri', $_SERVER['SERVER_NAME'].substr($_SERVER['PHP_SELF'],0,strpos($_SERVER['PHP_SELF'], '/')) ); ! if ($phpiCal_config->cookie_uri == 'localhost') $phpiCal_config->setProperty('cookie_uri', ''); ! ; } $cookie_name = 'phpicalendar_'.basename($phpiCal_config->default_path); *************** *** 14,18 **** 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']); if (isset($phpicalendar['cookie_view'])) $phpiCal_config->setProperty('default_view', $phpicalendar['cookie_view']); if (isset($phpicalendar['cookie_style']) && is_dir(BASE.'templates/'.$phpicalendar['cookie_style'].'/')){ --- 16,20 ---- 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']) && strpos($phpicalendar['cookie_cpath'],'../') === false) $phpiCal_config->setProperty('default_cpath_check', $phpicalendar['cookie_cpath']); if (isset($phpicalendar['cookie_view'])) $phpiCal_config->setProperty('default_view', $phpicalendar['cookie_view']); if (isset($phpicalendar['cookie_style']) && is_dir(BASE.'templates/'.$phpicalendar['cookie_style'].'/')){ *************** *** 21,25 **** 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']); - echo "cookie!"; } --- 23,26 ---- *************** *** 51,55 **** } ! /*echo "<pre>xx"; print_r($configs); --- 52,56 ---- } ! $tz_array=array(); /*echo "<pre>xx"; print_r($configs); |
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++; } |
From: <ji...@us...> - 2008-12-13 23:42:37
|
Update of /cvsroot/phpicalendar/phpicalendar/functions/parse In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv11617/functions/parse Modified Files: end_vevent.php parse_tzs.php Log Message: debug rrules; fix cookie injection vuln Index: end_vevent.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/functions/parse/end_vevent.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** end_vevent.php 11 Dec 2008 23:48:39 -0000 1.1 --- end_vevent.php 13 Dec 2008 23:42:31 -0000 1.2 *************** *** 3,7 **** What happens in this file: ! 1. Initialization 2. */ --- 3,7 ---- What happens in this file: ! 1. Initialization: add information not present by default 2. */ *************** *** 90,94 **** $rrule_array['START_DATE'] = $start_date; $rrule_array['UNTIL'] = $start_date; ! $rrule_array['END'] = 'end'; } --- 90,94 ---- $rrule_array['START_DATE'] = $start_date; $rrule_array['UNTIL'] = $start_date; ! # $rrule_array['END'] = 'end'; } *************** *** 99,103 **** $rrule_array['START_DAY'] = $allday_start; # $rrule_array['END_DAY'] = $allday_end; # this doesn't seem to be used anywhere. ! $rrule_array['END'] = 'end'; $recur_start = $allday_start; $start_date = $allday_start; --- 99,103 ---- $rrule_array['START_DAY'] = $allday_start; # $rrule_array['END_DAY'] = $allday_end; # this doesn't seem to be used anywhere. ! # $rrule_array['END'] = 'end'; $recur_start = $allday_start; $start_date = $allday_start; *************** *** 111,115 **** $rrule_array['START_TIME'] = $start_time; $rrule_array['END_TIME'] = $end_time; ! $rrule_array['END'] = 'end'; } --- 111,115 ---- $rrule_array['START_TIME'] = $start_time; $rrule_array['END_TIME'] = $end_time; ! # $rrule_array['END'] = 'end'; } *************** *** 130,134 **** --- 130,137 ---- } + $freq_type = 'year'; + $interval = 1; + # Load $rrule_array foreach ($rrule_array as $key => $val) { switch($key) { *************** *** 160,165 **** case 'INTERVAL': if ($val > 0){ ! $number = $val; ! $recur_array[($start_date)][($hour.$minute)][$uid]['recur'][$key] = $number; } break; --- 163,168 ---- case 'INTERVAL': if ($val > 0){ ! $interval = $val; ! $recur_array[($start_date)][($hour.$minute)][$uid]['recur'][$key] = $interval; } break; *************** *** 212,616 **** $recur_array[($start_date)][($hour.$minute)][$uid]['recur'][$key] = $wkst; break; ! case 'END': ! ! $recur = $recur_array[($start_date)][($hour.$minute)][$uid]['recur']; ! ! // Modify the COUNT based on BYDAY ! if ((isset ($byday) && is_array($byday)) && (isset($count))) { ! $blah = sizeof($byday); ! $count = ($count / $blah); ! unset ($blah); ! } ! if (!isset($number)) $number = 1; ! // if $until isn't set yet, we set it to the end of our range we're looking at ! ! if (!isset($until)) $until = $end_range_time; ! if (!isset($abs_until)) $abs_until = date('YmdHis', $end_range_time); ! $end_date_time = $until; ! $start_range_time_tmp = $start_range_time; ! $end_range_time_tmp = $end_range_time; ! ! // If the $end_range_time is less than the $start_date_time, or $start_range_time is greater ! // than $end_date_time, we may as well forget the whole thing ! // It doesn't do us any good to spend time adding data we aren't even looking at ! // this will prevent the year view from taking way longer than it needs to ! if ($end_range_time_tmp >= $start_date_time && $start_range_time_tmp <= $end_date_time) { ! // if the beginning of our range is less than the start of the item, we may as well set it equal to it ! if ($start_range_time_tmp < $start_date_time){ ! $start_range_time_tmp = $start_date_time; ! } ! if ($end_range_time_tmp > $end_date_time) $end_range_time_tmp = $end_date_time; ! ! // initialize the time we will increment ! $next_range_time = $start_range_time_tmp; ! ! // FIXME: This is a hack to fix repetitions with $interval > 1 ! if ($count > 1 && $number > 1) $count = 1 + ($count - 1) * $number; ! ! $count_to = 0; ! // start at the $start_range and go until we hit the end of our range. ! if(!isset($wkst)) $wkst='SU'; ! $wkst3char = two2threeCharDays($wkst); ! # set first instance if it's in range ! if ($start_unixtime < $mArray_end && $end_unixtime > $mArray_begin){ ! $recur_data[] = $start_unixtime; ! } ! while (($next_range_time >= $start_range_time_tmp) && ($next_range_time <= $end_range_time_tmp) && ($count_to != $count)) { ! $func = $freq_type.'Compare'; ! $diff = $func(date('Ymd',$next_range_time), $start_date); ! if ($diff < $count) { ! if ($diff % $number == 0) { ! $interval = $number; ! switch ($rrule_array['FREQ']) { ! case 'DAILY': ! $next_date_time = $next_range_time; ! $recur_data[] = $next_date_time; ! break; ! case 'WEEKLY': ! // Populate $byday with the default day if it's not set. ! if (!isset($byday)) { ! $byday[] = strtoupper(substr(date('D', $start_date_time), 0, 2)); ! } ! if (is_array($byday)) { ! foreach($byday as $day) { ! $day = two2threeCharDays($day); ! #need to find the first day of the appropriate week. ! #dateOfweek uses weekstartday as a global variable. This has to be changed to $wkst, ! #but then needs to be reset for other functions ! $week_start_day_tmp = $week_start_day; ! $week_start_day = $wkst3char; ! ! $the_sunday = dateOfWeek(date("Ymd",$next_range_time), $wkst3char); ! $next_date_time = strtotime($day,strtotime($the_sunday)) + (12 * 60 * 60); ! $week_start_day = $week_start_day_tmp; #see above reset to global value ! ! #reset $next_range_time to first instance in this week. ! if ($next_date_time < $next_range_time){ ! $next_range_time = $next_date_time; ! } ! // Since this renders events from $next_range_time to $next_range_time + 1 week, I need to handle intervals ! // as well. This checks to see if $next_date_time is after $day_start (i.e., "next week"), and thus ! // if we need to add $interval weeks to $next_date_time. ! if ($next_date_time > strtotime($week_start_day, $next_range_time) && $interval > 1) { ! # $next_date_time = strtotime('+'.($interval - 1).' '.$freq_type, $next_date_time); ! } ! $recur_data[] = $next_date_time; ! } ! } ! break; ! case 'MONTHLY': ! if (empty($bymonth)) $bymonth = array(1,2,3,4,5,6,7,8,9,10,11,12); ! $next_range_time = strtotime(date('Y-m-01', $next_range_time)); ! $next_date_time = $next_date_time; ! if (isset($bysetpos)){ ! /* bysetpos code from dustinbutler ! start on day 1 or last day. ! if day matches any BYDAY the count is incremented. ! SETPOS = 4, need 4th match ! SETPOS = -1, need 1st match ! */ ! $year = date('Y', $next_range_time); ! $month = date('m', $next_range_time); ! if ($bysetpos > 0) { ! $next_day = '+1 day'; ! $day = 1; ! } else { ! $next_day = '-1 day'; ! $day = $totalDays[$month]; ! } ! $day = mktime(0, 0, 0, $month, $day, $year); ! $countMatch = 0; ! while ($countMatch != abs($bysetpos)) { ! /* Does this day match a BYDAY value? */ ! $thisDay = $day; ! $textDay = strtoupper(substr(date('D', $thisDay), 0, 2)); ! if (in_array($textDay, $byday)) { ! $countMatch++; ! } ! $day = strtotime($next_day, $thisDay); ! } ! $recur_data[] = $thisDay; ! }elseif ((isset($bymonthday)) && (!isset($byday))) { ! foreach($bymonthday as $day) { ! if ($day < 0) $day = ((date('t', $next_range_time)) + ($day)) + 1; ! $year = date('Y', $next_range_time); ! $month = date('m', $next_range_time); ! if (checkdate($month,$day,$year)) { ! $next_date_time = mktime(0,0,0,$month,$day,$year); ! $recur_data[] = $next_date_time; ! } ! } ! } elseif (is_array($byday)) { ! foreach($byday as $day) { ! ereg ('([-\+]{0,1})?([0-9]{1})?([A-Z]{2})', $day, $byday_arr); ! //Added for 2.0 when no modifier is set ! if ($byday_arr[2] != '') { ! $nth = $byday_arr[2]-1; ! } else { ! $nth = 0; ! } ! $on_day = two2threeCharDays($byday_arr[3]); ! $on_day_num = two2threeCharDays($byday_arr[3],false); ! if ((isset($byday_arr[1])) && ($byday_arr[1] == '-')) { ! $last_day_tmp = date('t',$next_range_time); ! $next_range_time = strtotime(date('Y-m-'.$last_day_tmp, $next_range_time)); ! $last_tmp = (date('w',$next_range_time) == $on_day_num) ? '' : 'last '; ! $next_date_time = strtotime($last_tmp.$on_day, $next_range_time) - ($nth * 604800); ! $month = date('m', $next_date_time); ! if (in_array($month, $bymonth)) { ! $recur_data[] = $next_date_time; ! } ! #reset next_range_time to start of month ! $next_range_time = strtotime(date('Y-m-'.'1', $next_range_time)); ! } elseif (isset($bymonthday) && (!empty($bymonthday))) { ! // This supports MONTHLY where BYDAY and BYMONTH are both set ! foreach($bymonthday as $day) { ! $year = date('Y', $next_range_time); ! $month = date('m', $next_range_time); ! if (checkdate($month,$day,$year)) { ! $next_date_time = mktime(0,0,0,$month,$day,$year); ! $daday = strtolower(strftime("%a", $next_date_time)); ! if ($daday == $on_day && in_array($month, $bymonth)) { ! $recur_data[] = $next_date_time; ! } ! } ! } ! } elseif ((isset($byday_arr[1])) && ($byday_arr[1] != '-')) { ! $next_date_time = strtotime($on_day, strtotime($on_day, $next_range_time) + $nth * 604800); ! $month = date('m', $next_date_time); ! if (in_array($month, $bymonth)) { ! if (isset($next_date_time) && $next_date_time != '') $recur_data[] = $next_date_time; ! } ! } ! $next_date = date('Ymd', $next_date_time); ! } ! } ! break; ! case 'YEARLY': ! if ((!isset($bymonth)) || (sizeof($bymonth) == 0)) { ! $m = date('m', $start_date_time); ! $bymonth = array("$m"); ! } ! foreach($bymonth as $month) { ! // Make sure the month & year used is within the start/end_range. ! if ($month < date('m', $next_range_time)) { ! $year = date('Y', $next_range_time); ! } else { ! $year = date('Y', $next_range_time); ! } ! if (isset($bysetpos)){ ! /* bysetpos code from dustinbutler ! start on day 1 or last day. ! if day matches any BYDAY the count is incremented. ! SETPOS = 4, need 4th match ! SETPOS = -1, need 1st match ! */ ! if ($bysetpos > 0) { ! $next_day = '+1 day'; ! $day = 1; ! } else { ! $next_day = '-1 day'; ! $day = date("t",$month); ! } ! $day = mktime(12, 0, 0, $month, $day, $year); ! $countMatch = 0; ! while ($countMatch != abs($bysetpos)) { ! /* Does this day match a BYDAY value? */ ! $thisDay = $day; ! $textDay = strtoupper(substr(date('D', $thisDay), 0, 2)); ! if (in_array($textDay, $byday)) { ! $countMatch++; ! } ! $day = strtotime($next_day, $thisDay); ! } ! $recur_data[] = $thisDay; ! } ! if ((isset($byday)) && (is_array($byday))) { ! $checkdate_time = mktime(0,0,0,$month,1,$year); ! foreach($byday as $day) { ! ereg ('([-\+]{0,1})?([0-9]{1})?([A-Z]{2})', $day, $byday_arr); ! if ($byday_arr[2] != '') { ! $nth = $byday_arr[2]-1; ! } else { ! $nth = 0; ! } ! $on_day = two2threeCharDays($byday_arr[3]); ! $on_day_num = two2threeCharDays($byday_arr[3],false); ! if ($byday_arr[1] == '-') { ! $last_day_tmp = date('t',$checkdate_time); ! $checkdate_time = strtotime(date('Y-m-'.$last_day_tmp, $checkdate_time)); ! $last_tmp = (date('w',$checkdate_time) == $on_day_num) ? '' : 'last '; ! $next_date_time = strtotime($last_tmp.$on_day.' -'.$nth.' week', $checkdate_time); ! } else { ! $next_date_time = strtotime($on_day.' +'.$nth.' week', $checkdate_time); ! } ! } ! } else { ! $day = date('d', $start_date_time); ! $next_date_time = mktime(0,0,0,$month,$day,$year+1); ! //echo date('Ymd',$next_date_time).$summary.'<br>'; ! } ! if (isset($next_date_time) && $next_date_time != '') $recur_data[] = $next_date_time; ! } ! if (isset($byyearday)) { ! foreach ($byyearday as $yearday) { ! ereg ('([-\+]{0,1})?([0-9]{1,3})', $yearday, $byyearday_arr); ! if ($byyearday_arr[1] == '-') { ! $ydtime = mktime(0,0,0,12,31,$this_year); ! $yearnum = $byyearday_arr[2] - 1; ! $next_date_time = strtotime('-'.$yearnum.' days', $ydtime); ! } else { ! $ydtime = mktime(0,0,0,1,1,$this_year); ! $yearnum = $byyearday_arr[2] - 1; ! $next_date_time = strtotime('+'.$yearnum.' days', $ydtime); ! } ! if (isset($next_date_time) && $next_date_time != '') $recur_data[] = $next_date_time; ! } ! } ! break; ! default: ! // anything else we need to end the loop ! $next_range_time = $end_range_time_tmp + 100; ! $count_to = $count; } } else { ! $interval = 1; ! } ! $next_range_time = strtotime('+'.$interval.' '.$freq_type, $next_range_time); ! } else { ! // end the loop because we aren't going to write this event anyway ! $count_to = $count; ! } ! // use the same code to write the data instead of always changing it 5 times ! if (isset($recur_data) && is_array($recur_data)) { ! $recur_data_hour = @substr($start_time,0,2); ! $recur_data_minute = @substr($start_time,2,2); ! foreach($recur_data as $recur_data_time) { ! $recur_data_year = date('Y', $recur_data_time); ! $recur_data_month = date('m', $recur_data_time); ! $recur_data_day = date('d', $recur_data_time); ! $recur_data_date = $recur_data_year.$recur_data_month.$recur_data_day; ! if (($recur_data_time >= $start_date_time) && ($recur_data_time <= $end_date_time) && ($count_to != $count) && !in_array($recur_data_date, $except_dates)) { ! if (isset($allday_start) && $allday_start != '') { ! $start_time2 = $recur_data_time; ! $end_time2 = strtotime('+'.$diff_allday_days.' days', $recur_data_time); ! while ($start_time2 < $end_time2) { ! $start_date2 = date('Ymd', $start_time2); ! $master_array[($start_date2)][('-1')][$uid] = array ( ! 'event_text' => $summary, ! 'description' => $description, ! 'location' => $location, ! 'organizer' => serialize($organizer), ! 'attendee' => serialize($attendee), ! 'calnumber' => $calnumber, ! 'calname' => $actual_calname, ! 'url' => $url, ! 'status' => $status, ! 'class' => $class, ! 'recur' => $recur ); ! $start_time2 = strtotime('+1 day', $start_time2); ! } ! } else { ! $start_unixtime_tmp = mktime($recur_data_hour,$recur_data_minute,0,$recur_data_month,$recur_data_day,$recur_data_year); ! $end_unixtime_tmp = $start_unixtime_tmp + $length; ! if (($end_time >= $bleed_time) && ($bleed_check == '-1')) { ! $start_tmp = strtotime(date('Ymd',$start_unixtime_tmp)); ! $end_date_tmp = date('Ymd',$end_unixtime_tmp); ! while ($start_tmp < $end_unixtime_tmp) { ! $start_date_tmp = date('Ymd',$start_tmp); ! if ($start_date_tmp == $recur_data_year.$recur_data_month.$recur_data_day) { ! $time_tmp = $hour.$minute; ! $start_time_tmp = $start_time; ! } else { ! $time_tmp = '0000'; ! $start_time_tmp = '0000'; ! } ! if ($start_date_tmp == $end_date_tmp) { ! $end_time_tmp = $end_time; ! } else { ! $end_time_tmp = '2400'; ! $display_end_tmp = $end_time; ! } ! ! // Let's double check the until to not write past it ! $until_check = $start_date_tmp.$time_tmp.'00'; ! if ($abs_until > $until_check) { ! $master_array[$start_date_tmp][$time_tmp][$uid] = array ( ! 'event_start' => $start_time_tmp, ! 'event_end' => $end_time_tmp, ! 'start_unixtime' => $start_unixtime_tmp, ! 'end_unixtime' => $end_unixtime_tmp, ! 'event_text' => $summary, ! 'event_length' => $length, ! 'event_overlap' => 0, ! 'description' => $description, ! 'status' => $status, ! 'class' => $class, ! 'spans_day' => true, ! 'location' => $location, ! 'organizer' => serialize($organizer), ! 'attendee' => serialize($attendee), ! 'calnumber' => $calnumber, ! 'calname' => $actual_calname, ! 'url' => $url, ! 'recur' => $recur); ! if (isset($display_end_tmp)){ ! $master_array[$start_date_tmp][$time_tmp][$uid]['display_end'] = $display_end_tmp; ! } ! checkOverlap($start_date_tmp, $time_tmp, $uid); } - $start_tmp = strtotime('+1 day',$start_tmp); } } else { ! if ($bleed_check == '-1') { ! $display_end_tmp = $end_time; ! $end_time_tmp1 = '2400'; ! ! } ! if (!isset($end_time_tmp1)) $end_time_tmp1 = $end_time; ! ! // Let's double check the until to not write past it ! $until_check = $recur_data_date.$hour.$minute.'00'; ! if ($abs_until > $until_check) { ! $master_array[($recur_data_date)][($hour.$minute)][$uid] = array ( ! 'event_start' => $start_time, ! 'event_end' => $end_time_tmp1, ! 'start_unixtime' => $start_unixtime_tmp, ! 'end_unixtime' => $end_unixtime_tmp, ! 'event_text' => $summary, ! 'event_length' => $length, ! 'event_overlap' => 0, ! 'description' => $description, ! 'status' => $status, ! 'class' => $class, ! 'spans_day' => false, ! 'location' => $location, ! 'organizer' => serialize($organizer), ! 'attendee' => serialize($attendee), ! 'calnumber' => $calnumber, ! 'calname' => $actual_calname, ! 'url' => $url, ! 'recur' => $recur); ! if (isset($display_end_tmp)){ ! $master_array[($recur_data_date)][($hour.$minute)][$uid]['display_end'] = $display_end_tmp; ! } ! checkOverlap($recur_data_date, ($hour.$minute), $uid); ! } } } } } } ! } #end while loop ! } # end if time compare ! unset($recur_data); ! } # end switch $key (rrule type) ! } # end foreach rrule --- 215,566 ---- $recur_array[($start_date)][($hour.$minute)][$uid]['recur'][$key] = $wkst; break; ! } ! } ! /* ! Load $recur_array ! $recur_array is an array of unix times for instances of an event. This code handles repeats. ! Note that dates with exceptions are counted as instances. ! RDATE is currently not supported ! */ ! # $recur is the recurrence info that goes into the master array for this VEVENT ! $recur = $recur_array[($start_date)][($hour.$minute)][$uid]['recur']; ! // if $until isn't set yet, we set it to the end of our range we're looking at ! if (!isset($until)) $until = $end_range_time; ! if (!isset($abs_until)) $abs_until = date('YmdHis', $end_range_time); ! $end_date_time = $until; ! // If the $end_range_time is less than the $start_date_time, or $start_range_time is greater ! // than $end_date_time, we may as well forget the whole thing ! // It doesn't do us any good to spend time adding data we aren't even looking at ! // this will prevent the year view from taking way longer than it needs to ! if ($end_range_time >= $start_date_time && $start_range_time_tmp <= $end_date_time) { ! // if the beginning of our range is less than the start of the item, we may as well set it equal to it ! if ($start_range_time < $start_date_time){ ! $start_range_time = $start_date_time; ! } ! if ($end_range_time > $end_date_time) $end_range_time = $end_date_time; ! // initialize the time we will increment ! $next_range_time = $start_range_time; ! ! // start at the $start_range and go until we hit the end of our range. ! if(!isset($wkst)) $wkst='SU'; ! $wkst3char = two2threeCharDays($wkst); ! # set first instance if it's in range ! $recur_data = array(); ! if ($start_unixtime < $mArray_end && $end_unixtime > $mArray_begin){ ! $recur_data[] = $start_unixtime; ! } ! /* ! The while loop below increments $next_range_time by $freq type. For the larger freq types, there is only ! one $next_range_time per repeat, but the BYXXX rules may write more than one event in that repeat cycle ! $next_date_time handles those instances within a $freq_type ! */ ! #echo "<br><br>$summary<br>next range time:".date("Ymd his",$next_range_time)." <br>start range time ".date("Ymd his",$start_range_time)." <br>end range time ".date("Ymd his",$end_range_time); ! while (($next_range_time >= $start_range_time) && ($next_range_time <= $end_range_time)) { ! # pick the right compare function from date_functions.php ! # $diff is the number of occurrences between start_date and next_range_time ! $func = $freq_type.'Compare'; ! $diff = $func(date('Ymd',$next_range_time), $start_date); ! $rcount = $diff; ! if(count($byday) > 1) $rcount = $diff * count($byday); ! if ($rcount < $count && $diff % $interval == 0) { ! $year = date('Y', $next_range_time); ! $month = date('m', $next_range_time); ! switch ($rrule_array['FREQ']) { ! case 'DAILY': ! $recur_data[] = $next_range_time; ! break; ! case 'WEEKLY': ! // Populate $byday with the default day if it's not set. ! if (!isset($byday)) $byday[] = strtoupper(substr(date('D', $start_date_time), 0, 2)); ! $the_sunday = dateOfWeek(date("Ymd",$next_range_time), $wkst3char); ! foreach($byday as $key=>$day) { ! $day = two2threeCharDays($day); ! #need to find the first day of the appropriate week. ! if ($key == 0){ ! $next_date_time = strtotime("next $day",strtotime($the_sunday)) + (12 * 60 * 60); ! }else{ ! $next_date_time = strtotime("next $day",$next_date_time) + (12 * 60 * 60); ! } ! $recur_data[] = $next_date_time; #echo "<br>$key $day ".strtotime("Ymd his", $next_date_time); ! } ! break; ! case 'MONTHLY': ! if (empty($bymonth)) $bymonth = array(1,2,3,4,5,6,7,8,9,10,11,12); ! if (!empty($bysetpos)){ ! /* bysetpos code from dustinbutler ! start on day 1 or last day. ! if day matches any BYDAY the count is incremented. ! SETPOS = 4, need 4th match ! SETPOS = -1, need 1st match ! */ ! if ($bysetpos > 0) { ! $next_day = '+1 day'; ! $day = 1; ! } else { ! $next_day = '-1 day'; ! $day = $totalDays[$month]; ! } ! $day = mktime(0, 0, 0, $month, $day, $year); ! $countMatch = 0; ! while ($countMatch != abs($bysetpos)) { ! /* Does this day match a BYDAY value? */ ! $thisDay = $day; ! $textDay = strtoupper(substr(date('D', $thisDay), 0, 2)); ! if (in_array($textDay, $byday)) { ! $countMatch++; ! } ! $day = strtotime($next_day, $thisDay); ! } ! if(in_array(date("m", $next_date_time), $bymonth)) $recur_data[] = $next_date_time; ! }elseif (count($bymonthday) > 0 && empty($byday)) { ! foreach($bymonthday as $day) { ! if ($day < 0) $day = ((date('t', $next_range_time)) + ($day)) + 1; ! if (checkdate($month,$day,$year)) { ! $next_date_time = mktime(0,0,0,$month,$day,$year); ! if(in_array(date("m", $next_date_time), $bymonth)) $recur_data[] = $next_date_time; ! } } } else { ! foreach($byday as $day) { ! /* set $byday_arr ! [0] => byday string, e.g. 4TH ! [1] => sign/modifier ! [2] => 4 number ! [3] => TH day abbr ! */ ! ereg ('([-\+]{0,1})?([0-9]{1})?([A-Z]{2})', $day, $byday_arr); ! $on_day = two2threeCharDays($byday_arr[3]); ! $next_date_time = strtotime($byday_arr[1].$byday_arr[2].$on_day, $next_range_time); ! if(empty($bymonthday) && in_array(date("m", $next_date_time), $bymonth)) $recur_data[] = $next_date_time; ! if (isset($bymonthday) && (!empty($bymonthday))) { ! // This supports MONTHLY where BYDAY and BYMONTH are both set ! foreach($bymonthday as $day) { ! if (checkdate($month,$day,$year)) { ! $next_date_time = mktime(0,0,0,$month,$day,$year); ! $daday = strtolower(strftime("%a", $next_date_time)); ! if ($daday == $on_day && in_array($month, $bymonth)) { ! if(in_array(date("m", $next_date_time), $bymonth)) $recur_data[] = $next_date_time; } } + } + } + } # end foreach $byday + } + break; + case 'YEARLY': + if ((!isset($bymonth)) || (sizeof($bymonth) == 0)) $bymonth = array(date('m', $start_date_time)); + foreach($bymonth as $month) { + if (isset($bysetpos)){ + /* bysetpos code from dustinbutler + start on day 1 or last day. + if day matches any BYDAY the count is incremented. + SETPOS = 4, need 4th match + SETPOS = -1, need 1st match + */ + if ($bysetpos > 0) { + $next_day = '+1 day'; + $day = 1; + } else { + $next_day = '-1 day'; + $day = date("t",$month); + } + $day = mktime(12, 0, 0, $month, $day, $year); + $countMatch = 0; + while ($countMatch != abs($bysetpos)) { + /* Does this day match a BYDAY value? */ + $thisDay = $day; + $textDay = strtoupper(substr(date('D', $thisDay), 0, 2)); + if (in_array($textDay, $byday)) { + $countMatch++; + } + $day = strtotime($next_day, $thisDay); + } + $recur_data[] = $thisDay; + } + if ((isset($byday)) && (is_array($byday))) { + $checkdate_time = mktime(0,0,0,$month,1,$year); + foreach($byday as $day) { + ereg ('([-\+]{0,1})?([0-9]{1})?([A-Z]{2})', $day, $byday_arr); + if ($byday_arr[2] != '') { + $nth = $byday_arr[2]-1; } else { ! $nth = 0; ! } ! $on_day = two2threeCharDays($byday_arr[3]); ! $on_day_num = two2threeCharDays($byday_arr[3],false); ! if ($byday_arr[1] == '-') { ! $last_day_tmp = date('t',$checkdate_time); ! $checkdate_time = strtotime(date('Y-m-'.$last_day_tmp, $checkdate_time)); ! $last_tmp = (date('w',$checkdate_time) == $on_day_num) ? '' : 'last '; ! $next_date_time = strtotime($last_tmp.$on_day.' -'.$nth.' week', $checkdate_time); ! } else { ! $next_date_time = strtotime($on_day.' +'.$nth.' week', $checkdate_time); } } + } else { + $day = date('d', $start_date_time); + $next_date_time = mktime(0,0,0,$month,$day,$year+1); + //echo date('Ymd',$next_date_time).$summary.'<br>'; } + if (isset($next_date_time) && $next_date_time != '') $recur_data[] = $next_date_time; } + if (isset($byyearday)) { + foreach ($byyearday as $yearday) { + ereg ('([-\+]{0,1})?([0-9]{1,3})', $yearday, $byyearday_arr); + if ($byyearday_arr[1] == '-') { + $ydtime = mktime(0,0,0,12,31,$this_year); + $yearnum = $byyearday_arr[2] - 1; + $next_date_time = strtotime('-'.$yearnum.' days', $ydtime); + } else { + $ydtime = mktime(0,0,0,1,1,$this_year); + $yearnum = $byyearday_arr[2] - 1; + $next_date_time = strtotime('+'.$yearnum.' days', $ydtime); + } + if (isset($next_date_time) && $next_date_time != '') $recur_data[] = $next_date_time; + } + } + break; + default: + // anything else we need to end the loop + $next_range_time = $end_range_time + 100; + } # end switch + } + $next_range_time = strtotime('+'.$interval.' '.$freq_type, $next_range_time); + } #end while loop + } # end if time compare + + + #foreach($recur_data as $time) echo "<br>".date("Ymd his",$time); + + + + # use recur_data array to write the master array + // use the same code to write the data instead of always changing it 5 times + $recur_data_hour = @substr($start_time,0,2); + $recur_data_minute = @substr($start_time,2,2); + foreach($recur_data as $recur_data_time) { + $recur_data_year = date('Y', $recur_data_time); + $recur_data_month = date('m', $recur_data_time); + $recur_data_day = date('d', $recur_data_time); + $recur_data_date = $recur_data_year.$recur_data_month.$recur_data_day; + if (($recur_data_time >= $start_date_time) && ($recur_data_time <= $end_date_time) && ($count_to != $count) && !in_array($recur_data_date, $except_dates)) { + if (isset($allday_start) && $allday_start != '') { + $start_time2 = $recur_data_time; + $end_time2 = strtotime('+'.$diff_allday_days.' days', $recur_data_time); + while ($start_time2 < $end_time2) { + $start_date2 = date('Ymd', $start_time2); + $master_array[($start_date2)][('-1')][$uid] = array ( + 'event_text' => $summary, + 'description' => $description, + 'location' => $location, + 'organizer' => serialize($organizer), + 'attendee' => serialize($attendee), + 'calnumber' => $calnumber, + 'calname' => $actual_calname, + 'url' => $url, + 'status' => $status, + 'class' => $class, + 'recur' => $recur ); + $start_time2 = strtotime('+1 day', $start_time2); + } + } else { + $start_unixtime_tmp = mktime($recur_data_hour,$recur_data_minute,0,$recur_data_month,$recur_data_day,$recur_data_year); + $end_unixtime_tmp = $start_unixtime_tmp + $length; + + if (($end_time >= $bleed_time) && ($bleed_check == '-1')) { + $start_tmp = strtotime(date('Ymd',$start_unixtime_tmp)); + $end_date_tmp = date('Ymd',$end_unixtime_tmp); + while ($start_tmp < $end_unixtime_tmp) { + $start_date_tmp = date('Ymd',$start_tmp); + if ($start_date_tmp == $recur_data_year.$recur_data_month.$recur_data_day) { + $time_tmp = $hour.$minute; + $start_time_tmp = $start_time; + } else { + $time_tmp = '0000'; + $start_time_tmp = '0000'; + } + if ($start_date_tmp == $end_date_tmp) { + $end_time_tmp = $end_time; + } else { + $end_time_tmp = '2400'; + $display_end_tmp = $end_time; + } + + // Let's double check the until to not write past it + $until_check = $start_date_tmp.$time_tmp.'00'; + if ($abs_until > $until_check) { + $master_array[$start_date_tmp][$time_tmp][$uid] = array ( + 'event_start' => $start_time_tmp, + 'event_end' => $end_time_tmp, + 'start_unixtime' => $start_unixtime_tmp, + 'end_unixtime' => $end_unixtime_tmp, + 'event_text' => $summary, + 'event_length' => $length, + 'event_overlap' => 0, + 'description' => $description, + 'status' => $status, + 'class' => $class, + 'spans_day' => true, + 'location' => $location, + 'organizer' => serialize($organizer), + 'attendee' => serialize($attendee), + 'calnumber' => $calnumber, + 'calname' => $actual_calname, + 'url' => $url, + 'recur' => $recur); + if (isset($display_end_tmp)){ + $master_array[$start_date_tmp][$time_tmp][$uid]['display_end'] = $display_end_tmp; + } + checkOverlap($start_date_tmp, $time_tmp, $uid); + } + $start_tmp = strtotime('+1 day',$start_tmp); } ! } else { ! if ($bleed_check == '-1') { ! $display_end_tmp = $end_time; ! $end_time_tmp1 = '2400'; ! ! } ! if (!isset($end_time_tmp1)) $end_time_tmp1 = $end_time; ! ! // Let's double check the until to not write past it ! $until_check = $recur_data_date.$hour.$minute.'00'; ! if ($abs_until > $until_check) { ! $master_array[($recur_data_date)][($hour.$minute)][$uid] = array ( ! 'event_start' => $start_time, ! 'event_end' => $end_time_tmp1, ! 'start_unixtime' => $start_unixtime_tmp, ! 'end_unixtime' => $end_unixtime_tmp, ! 'event_text' => $summary, ! 'event_length' => $length, ! 'event_overlap' => 0, ! 'description' => $description, ! 'status' => $status, ! 'class' => $class, ! 'spans_day' => false, ! 'location' => $location, ! 'organizer' => serialize($organizer), ! 'attendee' => serialize($attendee), ! 'calnumber' => $calnumber, ! 'calname' => $actual_calname, ! 'url' => $url, ! 'recur' => $recur); ! if (isset($display_end_tmp)){ ! $master_array[($recur_data_date)][($hour.$minute)][$uid]['display_end'] = $display_end_tmp; ! } ! checkOverlap($recur_data_date, ($hour.$minute), $uid); ! } ! } ! } ! } ! } ! ! unset($recur_data); Index: parse_tzs.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/functions/parse/parse_tzs.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** parse_tzs.php 11 Dec 2008 23:48:39 -0000 1.1 --- parse_tzs.php 13 Dec 2008 23:42:31 -0000 1.2 *************** *** 2,6 **** $ifile = @fopen($filename, "r"); if ($ifile == FALSE) exit(error($lang['l_error_cantopen'], $filename)); ! $nextline = fgets($ifile, 1024); if (trim($nextline) != 'BEGIN:VCALENDAR') exit(error($lang['l_error_invalidcal'], $filename)); --- 2,6 ---- $ifile = @fopen($filename, "r"); 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)); *************** *** 25,40 **** case 'BEGIN:STANDARD': unset ($offset_s); break; case 'END:STANDARD': $offset_s = $offset_to; break; case 'BEGIN:DAYLIGHT': unset ($offset_d); break; case 'END:DAYLIGHT': $offset_d = $offset_to; break; case 'END:VTIMEZONE': ! $tz_array[$tz_id] = array($offset_s, $offset_d); #echo "<pre>$tz_id"; print_r($tz_array[$tz_id]);echo"</pre>"; break; default: --- 25,52 ---- case 'BEGIN:STANDARD': unset ($offset_s); + $is_std = true; break; case 'END:STANDARD': $offset_s = $offset_to; + $is_std = false; break; case 'BEGIN:DAYLIGHT': unset ($offset_d); + $is_daylight = true; break; case 'END:DAYLIGHT': $offset_d = $offset_to; + $is_daylight = false; break; case 'END:VTIMEZONE': ! $tz_array[$tz_id] = array( ! 0 => $offset_s, ! 1 => $offset_d, ! 'dt_start' => $begin_daylight, ! 'st_start' => $begin_std, ! 'st_name' => $st_name, ! 'dt_name' => $dt_name ! ! ); #echo "<pre>$tz_id"; print_r($tz_array[$tz_id]);echo"</pre>"; break; default: *************** *** 57,60 **** --- 69,80 ---- $offset_to = $data; break; + case 'DTSTART': + if($is_std) $begin_std = $data; + if($is_daylight) $begin_daylight = $data; + break; + case 'TZNAME': + if($is_std) $st_name = $data; + if($is_daylight) $dt_name = $data; + break; } } |
From: <ji...@us...> - 2008-12-13 23:42:36
|
Update of /cvsroot/phpicalendar/phpicalendar In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv11617 Modified Files: month.php preferences.php week.php Log Message: debug rrules; fix cookie injection vuln Index: month.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/month.php,v retrieving revision 1.142 retrieving revision 1.143 diff -C2 -d -r1.142 -r1.143 *** month.php 12 Dec 2008 06:22:58 -0000 1.142 --- month.php 13 Dec 2008 23:42:30 -0000 1.143 *************** *** 67,71 **** 'calendar_name' => $cal_displayname, 'display_date' => $display_date, ! 'rss_powered' => $phpiCal_config->rss_powered, 'default_path' => '', 'rss_available' => '', --- 67,71 ---- 'calendar_name' => $cal_displayname, 'display_date' => $display_date, ! 'rss_powered' => $rss_powered, 'default_path' => '', 'rss_available' => '', Index: preferences.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/preferences.php,v retrieving revision 1.62 retrieving revision 1.63 diff -C2 -d -r1.62 -r1.63 *** preferences.php 12 Dec 2008 06:37:29 -0000 1.62 --- preferences.php 13 Dec 2008 23:42:31 -0000 1.63 *************** *** 100,104 **** // select for calendars $calendar_select = display_ical_list(availableCalendars($username, $password, $ALL_CALENDARS_COMBINED),TRUE); ! $calendar_select .="<option value=\"$ALL_CALENDARS_COMBINED\">$all_cal_comb_lang</option>"; $calendar_select = str_replace("<option value=\"$cookie_calendar\">","<option value=\"$cookie_calendar\" selected='selected'>",$calendar_select); // select for dayview --- 100,104 ---- // select for calendars $calendar_select = display_ical_list(availableCalendars($username, $password, $ALL_CALENDARS_COMBINED),TRUE); ! $calendar_select .="<option value=\"$phpiCal_config->ALL_CALENDARS_COMBINED\">$all_cal_comb_lang</option>"; $calendar_select = str_replace("<option value=\"$cookie_calendar\">","<option value=\"$cookie_calendar\" selected='selected'>",$calendar_select); // select for dayview *************** *** 194,197 **** $page->output(); - print_r($_COOKIE[$cookie_name]); ?> --- 194,196 ---- Index: week.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/week.php,v retrieving revision 1.133 retrieving revision 1.134 diff -C2 -d -r1.133 -r1.134 *** week.php 12 Dec 2008 06:22:58 -0000 1.133 --- week.php 13 Dec 2008 23:42:31 -0000 1.134 *************** *** 67,74 **** 'current_view' => $current_view, 'sidebar_date' => $sidebar_date, ! 'rss_powered' => $phpiCal_config->rss_powered, 'rss_available' => '', 'rss_valid' => '', ! 'show_search' => $show_search, 'next_day' => $next_day, 'next_week' => $next_week, --- 67,74 ---- 'current_view' => $current_view, 'sidebar_date' => $sidebar_date, ! 'rss_powered' => $rss_powered, 'rss_available' => '', 'rss_valid' => '', ! 'show_search' => $phpiCal_config->show_search, 'next_day' => $next_day, 'next_week' => $next_week, |
From: <ji...@us...> - 2008-12-13 23:42:36
|
Update of /cvsroot/phpicalendar/phpicalendar/languages In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv11617/languages Modified Files: german.inc.php portuguese.inc.php Log Message: debug rrules; fix cookie injection vuln Index: german.inc.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/languages/german.inc.php,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** german.inc.php 14 Aug 2006 05:03:40 -0000 1.32 --- german.inc.php 13 Dec 2008 23:42:31 -0000 1.33 *************** *** 8,12 **** // Revised for version 2.0 by Holger Schleicher (ho...@vc...) // ! // Submit new translations to ch...@ch... $lang['l_day'] = 'Tag'; --- 8,12 ---- // Revised for version 2.0 by Holger Schleicher (ho...@vc...) // ! // Submit new translations to php...@gm... $lang['l_day'] = 'Tag'; *************** *** 67,76 **** $lang['l_preferences'] = 'Einstellungen'; $lang['l_printer'] = 'Drucker'; ! $lang['l_select_lang'] = 'Standardsprache wählen:'; ! $lang['l_select_cal'] = 'Standardkalender wählen:'; ! $lang['l_select_view'] = 'Standardansicht wählen:'; ! $lang['l_select_time'] = 'Tag beginnt um:'; ! $lang['l_select_day'] = 'Woche beginnt mit:'; ! $lang['l_select_style'] = 'Standardstil wählen:'; $lang['l_set_prefs'] = 'Einstellungen speichern'; $lang['l_completed_date'] = 'Erledigt am'; --- 67,76 ---- $lang['l_preferences'] = 'Einstellungen'; $lang['l_printer'] = 'Drucker'; ! $lang['l_select_lang'] = 'Standardsprache wählen'; ! $lang['l_select_cal'] = 'Standardkalender wählen'; ! $lang['l_select_view'] = 'Standardansicht wählen'; ! $lang['l_select_time'] = 'Tag beginnt um'; ! $lang['l_select_day'] = 'Woche beginnt mit'; ! $lang['l_select_style'] = 'Standardstil wählen'; $lang['l_set_prefs'] = 'Einstellungen speichern'; $lang['l_completed_date'] = 'Erledigt am'; *************** *** 163,168 **** $daysofweek_lang = array ('Sonntag','Montag','Dienstag','Mittwoch','Donnerstag','Freitag','Samstag'); ! $daysofweekshort_lang = array ('Son','Mon','Die','Mit','Don','Fre','Sam'); ! $daysofweekreallyshort_lang = array ('S','M','D','M','D','F','S'); $monthsofyear_lang = array ('Januar','Februar','März','April','Mai','Juni','Juli','August','September','Oktober','November','Dezember'); $monthsofyearshort_lang = array ('Jan','Feb','Mär','Apr','Mai','Jun','Jul','Aug','Sep','Okt','Nov','Dez'); --- 163,168 ---- $daysofweek_lang = array ('Sonntag','Montag','Dienstag','Mittwoch','Donnerstag','Freitag','Samstag'); ! $daysofweekshort_lang = array ('So','Mo','Di','Mi','Do','Fr','Sa'); ! $daysofweekreallyshort_lang = array ('So','Mo','Di','Mi','Do','Fr','Sa'); $monthsofyear_lang = array ('Januar','Februar','März','April','Mai','Juni','Juli','August','September','Oktober','November','Dezember'); $monthsofyearshort_lang = array ('Jan','Feb','Mär','Apr','Mai','Jun','Jul','Aug','Sep','Okt','Nov','Dez'); Index: portuguese.inc.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/languages/portuguese.inc.php,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** portuguese.inc.php 21 Mar 2006 09:52:29 -0000 1.17 --- portuguese.inc.php 13 Dec 2008 23:42:31 -0000 1.18 *************** *** 3,8 **** // Portuguese language include // For version 2.0 PHP iCalendar ! // Translation by David Morgado (dcr...@ya...) ! // Based on Translation by Wilton, Bennet (su...@be...) // 21-sep-2004 13:06 PM GMT // Submit new translations to ch...@ch... --- 3,8 ---- // Portuguese language include // For version 2.0 PHP iCalendar ! // Translation by Luciano Antonio Costa (bit...@gm...) ! // Based on Translation by Wilton, Bennet (su...@be...) and David Morgado (dcr...@ya...) // 21-sep-2004 13:06 PM GMT // Submit new translations to ch...@ch... *************** *** 44,48 **** $lang['l_search'] = 'Buscar'; // the verb $lang['l_results'] = 'Buscar Resultados'; ! $lang['l_pick_multiple'] = 'Pick multiple'; $lang['l_query'] = 'Questão: '; // will be followed by the search query $lang['l_no_results'] = 'Registos não encontrados'; --- 44,48 ---- $lang['l_search'] = 'Buscar'; // the verb $lang['l_results'] = 'Buscar Resultados'; ! $lang['l_pick_multiple'] = 'Seleção Múltipla'; $lang['l_query'] = 'Questão: '; // will be followed by the search query $lang['l_no_results'] = 'Registos não encontrados'; *************** *** 59,118 **** $lang['l_rss_month_date'] = '%b %e'; // Lists just the day $lang['l_rsslanguage'] = 'en-us'; ! $lang['l_search_took'] = 'Search took %s seconds'; ! $lang['l_recurring_event'] = 'Recurring event'; ! $lang['l_exception'] = 'Exception'; ! $lang['l_no_query'] = 'No query given'; $lang['l_preferences'] = 'Opções'; ! $lang['l_printer'] = 'Printer'; ! $lang['l_select_lang'] = 'Select your default language:'; ! $lang['l_select_cal'] = 'Select your default calendar:'; ! $lang['l_select_view'] = 'Select your default view:'; ! $lang['l_select_time'] = 'Select your default start time:'; ! $lang['l_select_day'] = 'Select your default start day of week:'; ! $lang['l_select_style'] = 'Select your default style:'; ! $lang['l_set_prefs'] = 'Set preferences'; $lang['l_completed_date'] = 'Completed on'; $lang['l_completed'] = 'Completed'; ! $lang['l_created'] = 'Created:'; $lang['l_due'] = 'Due:'; ! $lang['l_priority'] = 'Priority:'; ! $lang['l_priority_high'] = 'High'; ! $lang['l_priority_low'] = 'Low'; ! $lang['l_priority_medium'] = 'Medium'; ! $lang['l_priority_none'] = 'None'; ! $lang['l_status'] = 'Estado'; ! $lang['l_status_confirmed'] = 'CONFIRMED' ; ! $lang['l_status_cancelled'] = 'CANCELLED'; ! $lang['l_status_tentative'] = 'TENTATIVE'; ! $lang['l_todo'] = 'To do items'; ! $lang['l_unfinished'] = 'Unfinished'; ! $lang['l_prefs_set'] = 'Your preferences have been set.'; ! $lang['l_prefs_unset'] = 'Preferences unset. Changes will take place next page load.'; ! $lang['l_unset_prefs'] = 'Unset preferences:'; ! $lang['l_organizer'] = 'Organizer'; ! $lang['l_attendee'] = 'Attendee'; $lang['l_location'] = 'Local'; ! $lang['l_admin_header'] = 'PHP iCalendar Administration'; ! $lang['l_username'] = 'Username'; ! $lang['l_password'] = 'Password'; $lang['l_login'] = 'Login'; ! $lang['l_invalid_login'] = 'Wrong username or password.'; ! $lang['l_addupdate_cal'] = 'Add or Update a Calendar'; ! $lang['l_addupdate_desc'] = 'Add a calendar by uploading a new file. Update a calendar by uploading a file of the same name.'; ! $lang['l_delete_cal'] = 'Delete a Calendar'; $lang['l_logout'] = 'Logout'; ! $lang['l_cal_file'] = 'Calendar File'; ! $lang['l_php_error'] = 'PHP Error'; ! $lang['l_upload_error_gen'] = 'There was a problem with your upload.'; ! $lang['l_upload_error'][0] = 'There was a problem with your upload.'; ! $lang['l_upload_error'][1] = 'The file you are trying to upload is too big.'; ! $lang['l_upload_error'][2] = 'The file you are trying to upload is too big.'; ! $lang['l_upload_error'][3] = 'The file you are trying upload was only partially uploaded.'; ! $lang['l_upload_error'][4] = 'You must select a file for upload.'; ! $lang['l_upload_error_type'] = 'Only .ics files may be uploaded.'; ! $lang['l_copy_error'] = 'Failed to copy file'; ! $lang['l_delete_error'] = 'Failed to delete file'; ! $lang['l_delete_success'] = 'was deleted successfully.'; ! $lang['l_action_success'] = 'Your action was successful.'; $lang['l_submit'] = 'Enviar'; $lang['l_delete'] = 'Apagar'; --- 59,118 ---- $lang['l_rss_month_date'] = '%b %e'; // Lists just the day $lang['l_rsslanguage'] = 'en-us'; ! $lang['l_search_took'] = 'Busca realizada em %s segundos'; ! $lang['l_recurring_event'] = 'Evento recorrente'; ! $lang['l_exception'] = 'Exceção'; ! $lang['l_no_query'] = 'Nenhuma consulta fornecida'; $lang['l_preferences'] = 'Opções'; ! $lang['l_printer'] = 'Impressora'; ! $lang['l_select_lang'] = 'Selecione sua linguagem principal:'; ! $lang['l_select_cal'] = 'Selecione seu calendáo padrã:'; ! $lang['l_select_view'] = 'Selecione sua visão padrã:'; ! $lang['l_select_time'] = 'Selecione sua horário de início padrã:'; ! $lang['l_select_day'] = 'Selecione seu dia de inicío da semana padrã:'; ! $lang['l_select_style'] = 'Selecione seu estilo padrã:'; ! $lang['l_set_prefs'] = 'Define preferências'; $lang['l_completed_date'] = 'Completed on'; $lang['l_completed'] = 'Completed'; ! $lang['l_created'] = 'Criado:'; $lang['l_due'] = 'Due:'; ! $lang['l_priority'] = 'Prioridade:'; ! $lang['l_priority_high'] = 'Alta'; ! $lang['l_priority_low'] = 'Baixa'; ! $lang['l_priority_medium'] = 'Média'; ! $lang['l_priority_none'] = 'Nenhuma'; ! $lang['l_status'] = 'Status'; ! $lang['l_status_confirmed'] = 'CONFIRMADO' ; ! $lang['l_status_cancelled'] = 'CANCELADO'; ! $lang['l_status_tentative'] = 'TENTATIVA'; ! $lang['l_todo'] = 'Todo items'; ! $lang['l_unfinished'] = 'Não finalizado'; ! $lang['l_prefs_set'] = 'Suas preferências foram definidas.'; ! $lang['l_prefs_unset'] = 'Preferências não definidas. As mudanças serão carregadas na próxima página.'; ! $lang['l_unset_prefs'] = 'Limpa as preferências:'; ! $lang['l_organizer'] = 'Organizador'; ! $lang['l_attendee'] = 'Confirmação'; $lang['l_location'] = 'Local'; ! $lang['l_admin_header'] = 'Administração do PHP iCalendar'; ! $lang['l_username'] = 'Usuário'; ! $lang['l_password'] = 'Senha'; $lang['l_login'] = 'Login'; ! $lang['l_invalid_login'] = 'Usuário ou senha incorretos.'; ! $lang['l_addupdate_cal'] = 'Adiciona ou Atualiza um Calendário'; ! $lang['l_addupdate_desc'] = 'Adiciona um calendário através do upload de um novo arquivo com o mesmo nome.'; ! $lang['l_delete_cal'] = 'Remove um Calendário'; $lang['l_logout'] = 'Logout'; ! $lang['l_cal_file'] = 'Arquivo do Calendário'; ! $lang['l_php_error'] = 'Erro do PHP'; ! $lang['l_upload_error_gen'] = 'Existe um problem com o upload.'; ! $lang['l_upload_error'][0] = 'Existe um problem com o upload.'; ! $lang['l_upload_error'][1] = 'O arquivo que você está tentando fazer o upload é muito grande.'; ! $lang['l_upload_error'][2] = 'O arquivo que você está tentando fazer o upload é muito grande.'; ! $lang['l_upload_error'][3] = 'O arquivo que você está tentando fazer o upload foi salvo incompleto.'; ! $lang['l_upload_error'][4] = 'Você deve selecionar um arquivo para o upload.'; ! $lang['l_upload_error_type'] = 'Somente arquivos .ics podem ser feitos upload.'; ! $lang['l_copy_error'] = 'Falha ao copiar arquivo'; ! $lang['l_delete_error'] = 'Falha ao apagar arquivo'; ! $lang['l_delete_success'] = 'foi apagado com sucesso.'; ! $lang['l_action_success'] = 'Sua ação foi bem sucedida.'; $lang['l_submit'] = 'Enviar'; $lang['l_delete'] = 'Apagar'; *************** *** 121,138 **** // New for 2.0 $lang['l_legend'] = 'Legenda'; ! $lang['l_admin_subhead'] = 'Manage your calendars from this page'; ! $lang['l_prefs_subhead'] = 'Sets a cookie for visiting this site'; ! $lang['l_rss_info'] = 'RSS Information'; ! $lang['l_rss_subhead'] = 'Basic RSS feeds available for each calendar'; ! $lang['l_rss_notenabled'] = 'RSS is not enabled on this site'; // - navigation ! $lang['l_back'] = 'Back'; ! $lang['l_next'] = 'Next'; ! $lang['l_prev'] = 'Prev'; ! $lang['l_day_view'] = 'Day View'; ! $lang['l_week_view'] = 'Week View'; ! $lang['l_month_view'] = 'Month View'; ! $lang['l_year_view'] = 'Year View'; // --------------------------------- --- 121,138 ---- // New for 2.0 $lang['l_legend'] = 'Legenda'; ! $lang['l_admin_subhead'] = 'Gerencie seus calendários a partir desta página'; ! $lang['l_prefs_subhead'] = 'Define um cookie para visitar este site'; ! $lang['l_rss_info'] = 'Informação do RSS'; ! $lang['l_rss_subhead'] = 'RSS feeds básicos disponíveis para cada calendário'; ! $lang['l_rss_notenabled'] = 'RSS não está disponível para este site'; // - navigation ! $lang['l_back'] = 'Voltar'; ! $lang['l_next'] = 'Próximo'; ! $lang['l_prev'] = 'Prévio'; ! $lang['l_day_view'] = 'Visão do Dia'; ! $lang['l_week_view'] = 'Visão da Semana'; ! $lang['l_month_view'] = 'Visão do Mês'; ! $lang['l_year_view'] = 'Visão do Ano'; // --------------------------------- *************** *** 141,166 **** $format_recur_lang['delimiter'] = ', '; // ie, 'one, two, three' ! $format_recur_lang['yearly'] = array('year','years'); // for these, put singular ! $format_recur_lang['monthly'] = array('month','months'); // and plural forms ! $format_recur_lang['weekly'] = array('week','weeks'); // these will be %freq% ! $format_recur_lang['daily'] = array('day','days'); // in the replacement below ! $format_recur_lang['hourly'] = array('hour','hours'); ! $format_recur_lang['minutely'] = array('minute','minutes'); ! $format_recur_lang['secondly'] = array('second','seconds'); ! $format_recur_lang['start'] = 'Every %int% %freq% %for%'; // ie, 'Every 1 day until January 4' or 'Every 1 day for a count of 5' ! $format_recur_lang['until'] = 'until %date%'; // ie, 'until January 4' ! $format_recur_lang['count'] = 'for a count of %int%'; // ie, 'for 5 times' ! $format_recur_lang['bymonth'] = 'In months: %list%'; // ie, 'In months: January, February, March' ! $format_recur_lang['bymonthday'] = 'On dates: %list%'; // ie, 'On dates: 1, 2, 3, 4' ! $format_recur_lang['byday'] = 'On days: %list%'; // ie, 'On days: Mon, Tues, Wed, Thurs' // --------------------------------- $daysofweek_lang = array ('Domingo','Segunda','Terça','Quarta','Quinta','Sexta','Sábado'); ! $daysofweekshort_lang = array ('Dom','Seg','Ter','Qua','Qui','Sex','Sáb'); $daysofweekreallyshort_lang = array ('D','S','T','Q','Q','S','S'); ! $monthsofyear_lang = array ('Janeiro','Fevereiro','Março','Abril','Maio','Junho','Julho','Agosto','Setembro','Outubro','Novembro','Dezembro'); $monthsofyearshort_lang = array ('Jan','Fev','Mar','Abr','Mai','Jun','Jul','Ago','Set','Out','Nov','Dez'); --- 141,166 ---- $format_recur_lang['delimiter'] = ', '; // ie, 'one, two, three' ! $format_recur_lang['yearly'] = array('ano','anos'); // for these, put singular ! $format_recur_lang['monthly'] = array('mês','meses'); // and plural forms ! $format_recur_lang['weekly'] = array('semana','semanas'); // these will be %freq% ! $format_recur_lang['daily'] = array('dia','dias'); // in the replacement below ! $format_recur_lang['hourly'] = array('hora','horas'); ! $format_recur_lang['minutely'] = array('minuto','minutos'); ! $format_recur_lang['secondly'] = array('segundo','segundos'); ! $format_recur_lang['start'] = 'A cada %int% %freq% %for%'; // ie, 'Every 1 day until January 4' or 'Every 1 day for a count of 5' ! $format_recur_lang['until'] = 'até %date%'; // ie, 'until January 4' ! $format_recur_lang['count'] = 'durante %int% vezes'; // ie, 'for 5 times' ! $format_recur_lang['bymonth'] = 'Nos meses: %list%'; // ie, 'In months: January, February, March' ! $format_recur_lang['bymonthday'] = 'Nas datas: %list%'; // ie, 'On dates: 1, 2, 3, 4' ! $format_recur_lang['byday'] = 'Nos dias: %list%'; // ie, 'On days: Mon, Tues, Wed, Thurs' // --------------------------------- $daysofweek_lang = array ('Domingo','Segunda','Terça','Quarta','Quinta','Sexta','Sábado'); ! $daysofweekshort_lang = array ('Dom','Seg','Ter','Qua','Qui','Sex','Sáb'); $daysofweekreallyshort_lang = array ('D','S','T','Q','Q','S','S'); ! $monthsofyear_lang = array ('Janeiro','Fevereiro','Março','Abril','Maio','Junho','Julho','Agosto','Setembro','Outubro','Novembro','Dezembro'); $monthsofyearshort_lang = array ('Jan','Fev','Mar','Abr','Mai','Jun','Jul','Ago','Set','Out','Nov','Dez'); *************** *** 199,203 **** $lang['l_error_calendar'] = 'O calendário "%s" estava sendo processado quando ocorreu este erro.'; $lang['l_error_path'] = 'Não foi possível abrir: "%s"'; ! $lang['l_error_back'] = 'Por favor use o botão de "Back" para voltar.'; $lang['l_error_remotecal'] = 'Este servidor bloqueia calendários remotos que nao foram aprovados.'; $lang['l_error_restrictedcal'] = 'Tentou acessar um calendário o qual é restrito o acesso neste servidor.'; --- 199,203 ---- $lang['l_error_calendar'] = 'O calendário "%s" estava sendo processado quando ocorreu este erro.'; $lang['l_error_path'] = 'Não foi possível abrir: "%s"'; ! $lang['l_error_back'] = 'Por favor use o botão de "Voltar" para voltar.'; $lang['l_error_remotecal'] = 'Este servidor bloqueia calendários remotos que nao foram aprovados.'; $lang['l_error_restrictedcal'] = 'Tentou acessar um calendário o qual é restrito o acesso neste servidor.'; |
From: <ji...@us...> - 2008-12-13 23:42:36
|
Update of /cvsroot/phpicalendar/phpicalendar/calendars In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv11617/calendars Modified Files: US Holidays.ics Log Message: debug rrules; fix cookie injection vuln Index: US Holidays.ics =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/calendars/US Holidays.ics,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** US Holidays.ics 24 Sep 2003 04:18:33 -0000 1.3 --- US Holidays.ics 13 Dec 2008 23:42:31 -0000 1.4 *************** *** 1,574 **** BEGIN:VCALENDAR - - VERSION:2.0 - - PRODID:-//Rockin' Software//WinDates 5.0//EN - - METHOD:PUBLISH - - - BEGIN:VEVENT ! ! ! SUMMARY:Grandparent's Day ! ! ! DESCRIPTION:First Sunday after Labor Day ! ! ! DTSTAMP:20030701T000000Z ! ! UID:hol...@ic... ! ! CATEGORIES:Holiday - US ! ! ! DTSTART;VALUE=DATE:19780910 ! ! ! RRULE:FREQ=MONTHLY;INTERVAL=1;BYDAY=SU;BYMONTHDAY=13,7,8,9,10,11,12;BYMONTH=9 ! ! ! END:VEVENT ! ! ! ! ! BEGIN:VEVENT ! ! ! SUMMARY:Election Day ! ! ! DESCRIPTION:Tuesday after 1st Monday in November ! ! ! DTSTAMP:20030701T000000Z ! ! UID:hol...@ic... ! ! CATEGORIES:Holiday - US ! ! ! DTSTART;VALUE=DATE:17531106 ! ! ! RRULE:FREQ=MONTHLY;INTERVAL=1;BYDAY=TU;BYMONTHDAY=2,3,4,5,6,7,8;BYMONTH=11 ! ! ! END:VEVENT ! ! ! ! ! BEGIN:VEVENT ! ! SUMMARY:April Fools Day ! ! DESCRIPTION:April 1 ! ! DTSTAMP:20030701T000000Z ! ! UID:hol...@ic... ! ! CATEGORIES:Holiday - US ! ! DTSTART;VALUE=DATE:17530401 ! ! RRULE:FREQ=YEARLY;INTERVAL=1; ! ! END:VEVENT ! ! ! ! BEGIN:VEVENT ! ! SUMMARY:Armed Forces Day ! ! DESCRIPTION:3rd Saturday of May ! DTSTAMP:20030701T000000Z ! ! UID:hol...@ic... ! CATEGORIES:Holiday - US ! ! DTSTART;VALUE=DATE:17530519 ! ! RRULE:FREQ=MONTHLY;BYMONTH=5;BYDAY=3SA ! END:VEVENT - - BEGIN:VEVENT ! ! SUMMARY:Columbus Day ! ! DESCRIPTION:2nd Monday of October ! DTSTAMP:20030701T000000Z ! ! UID:hol...@ic... ! CATEGORIES:Holiday - US ! ! DTSTART;VALUE=DATE:17531008 ! ! RRULE:FREQ=MONTHLY;BYMONTH=10;BYDAY=2MO ! END:VEVENT - - BEGIN:VEVENT ! ! SUMMARY:Daylight Savings +1 hr ! ! DESCRIPTION:1st Sunday of April ! DTSTAMP:20030701T000000Z ! ! UID:hol...@ic... ! CATEGORIES:Holiday - US ! ! DTSTART;VALUE=DATE:17530401 ! ! RRULE:FREQ=MONTHLY;BYMONTH=4;BYDAY=1SU ! END:VEVENT - - BEGIN:VEVENT ! ! SUMMARY:Daylight Savings -1 hr ! ! DESCRIPTION:Last Sunday of October ! DTSTAMP:20030701T000000Z ! ! UID:hol...@ic... ! CATEGORIES:Holiday - US ! ! DTSTART;VALUE=DATE:17531028 ! ! RRULE:FREQ=MONTHLY;BYMONTH=10;BYDAY=-1SU ! END:VEVENT - - BEGIN:VEVENT ! ! SUMMARY:Father's Day ! ! DESCRIPTION:3rd Sunday of June ! DTSTAMP:20030701T000000Z ! ! UID:hol...@ic... ! CATEGORIES:Holiday - US ! ! DTSTART;VALUE=DATE:17530617 ! ! RRULE:FREQ=MONTHLY;BYMONTH=6;BYDAY=3SU ! END:VEVENT - - BEGIN:VEVENT ! ! SUMMARY:Flag Day ! ! DESCRIPTION:June 14 ! DTSTAMP:20030701T000000Z ! ! UID:hol...@ic... ! CATEGORIES:Holiday - US ! ! DTSTART;VALUE=DATE:17530614 ! RRULE:FREQ=YEARLY - END:VEVENT - - BEGIN:VEVENT ! ! SUMMARY:Groundhog Day ! ! DESCRIPTION:February 2 ! DTSTAMP:20030701T000000Z ! ! UID:hol...@ic... ! CATEGORIES:Holiday - US ! ! DTSTART;VALUE=DATE:17530202 ! ! RRULE:FREQ=YEARLY ! END:VEVENT - - BEGIN:VEVENT ! ! SUMMARY:Halloween ! ! DESCRIPTION:October 31 ! DTSTAMP:20030701T000000Z ! ! UID:hol...@ic... ! CATEGORIES:Holiday - US ! ! DTSTART;VALUE=DATE:17531031 ! ! RRULE:FREQ=YEARLY ! END:VEVENT - BEGIN:VEVENT ! ! SUMMARY:Independence Day ! ! DESCRIPTION:July 4 ! DTSTAMP:20030701T000000Z ! ! UID:hol...@ic... ! CATEGORIES:Holiday - US ! ! DTSTART;VALUE=DATE:17530704 ! ! RRULE:FREQ=YEARLY ! END:VEVENT - BEGIN:VEVENT ! ! SUMMARY:Labor Day ! ! DESCRIPTION:1st Monday of September ! DTSTAMP:20030701T000000Z ! ! UID:hol...@ic... ! CATEGORIES:Holiday - US ! ! DTSTART;VALUE=DATE:17530903 ! ! RRULE:FREQ=MONTHLY;BYMONTH=9;BYDAY=1MO ! END:VEVENT - - BEGIN:VEVENT ! ! SUMMARY:Lincoln's Birthday ! ! DESCRIPTION:February 12 ! DTSTAMP:20030701T000000Z ! ! UID:hol...@ic... ! CATEGORIES:Holiday - US ! ! DTSTART;VALUE=DATE:17530212 ! ! RRULE:FREQ=YEARLY ! END:VEVENT - - BEGIN:VEVENT ! ! SUMMARY:Mardi Gras (Fat Tuesday) ! ! DESCRIPTION:47 days before Easter ! DTSTAMP:20030701T000000Z ! ! UID:hol...@ic... ! CATEGORIES:Holiday - US ! ! DTSTART;VALUE=DATE:17530308 ! ! X-WD-RECUR-EASTER:TRUE ! ! X-WD-RECUR-OFFSET:-47 ! END:VEVENT - - BEGIN:VEVENT ! ! SUMMARY:Martin Luther King Jr. ! ! DESCRIPTION:3rd Monday of January ! DTSTAMP:20030701T000000Z ! ! UID:hol...@ic... ! CATEGORIES:Holiday - US ! ! DTSTART;VALUE=DATE:17530115 ! ! RRULE:FREQ=MONTHLY;BYMONTH=1;BYDAY=3MO ! END:VEVENT - - BEGIN:VEVENT - SUMMARY:Memorial Day - DESCRIPTION:Last Monday of May - DTSTAMP:20030701T000000Z - UID:hol...@ic... - CATEGORIES:Holiday - US - DTSTART;VALUE=DATE:17530528 - RRULE:FREQ=MONTHLY;BYMONTH=5;BYDAY=-1MO - END:VEVENT - - BEGIN:VEVENT - SUMMARY:Mother's Day - DESCRIPTION:2nd Sunday of May - DTSTAMP:20030701T000000Z - UID:hol...@ic... - CATEGORIES:Holiday - US - DTSTART;VALUE=DATE:17530513 - RRULE:FREQ=MONTHLY;BYMONTH=5;BYDAY=2SU - END:VEVENT - - BEGIN:VEVENT ! ! SUMMARY:New Year's Day ! ! DESCRIPTION:January 1 ! DTSTAMP:20030701T000000Z ! ! UID:hol...@ic... ! CATEGORIES:Holiday - US ! DTSTART;VALUE=DATE:17530101 ! RRULE:FREQ=YEARLY - END:VEVENT - - BEGIN:VEVENT ! ! SUMMARY:New Year's Eve ! ! DESCRIPTION:December 31 ! DTSTAMP:20030701T000000Z ! ! UID:hol...@ic... ! CATEGORIES:Holiday - US ! ! DTSTART;VALUE=DATE:17531231 ! RRULE:FREQ=YEARLY - END:VEVENT - - BEGIN:VEVENT ! ! SUMMARY:President's Day ! ! DESCRIPTION:3rd Monday of February ! DTSTAMP:20030701T000000Z ! ! UID:hol...@ic... ! CATEGORIES:Holiday - US ! ! DTSTART;VALUE=DATE:17530219 ! ! RRULE:FREQ=MONTHLY;BYMONTH=2;BYDAY=3MO ! END:VEVENT - - BEGIN:VEVENT ! ! SUMMARY:Secretaries Day ! ! DESCRIPTION:Wednesday of last full week in April ! DTSTAMP:20030701T000000Z ! ! UID:hol...@ic... ! CATEGORIES:Holiday - US ! ! DTSTART;VALUE=DATE:19520423 ! ! ! RRULE:FREQ=MONTHLY;INTERVAL=1;BYDAY=WE;BYMONTHDAY=25,26,27,21,22,23,24;BYMONTH=4 ! ! END:VEVENT - - BEGIN:VEVENT ! ! SUMMARY:St. Patrick's Day ! ! DESCRIPTION:March 17 ! DTSTAMP:20030701T000000Z ! ! UID:hol...@ic... ! CATEGORIES:Holiday - US ! DTSTART;VALUE=DATE:17530317 ! RRULE:FREQ=YEARLY - END:VEVENT ! BEGIN:VEVENT SUMMARY:Thanksgiving - DESCRIPTION:4th Thursday of November - DTSTAMP:20030701T000000Z - UID:hol...@ic... - CATEGORIES:Holiday - US - DTSTART;VALUE=DATE:17531122 - RRULE:FREQ=MONTHLY;BYMONTH=11;BYDAY=4TH - - END:VEVENT - - - - BEGIN:VEVENT - - SUMMARY:Valentine's Day - - DESCRIPTION:February 14 - - DTSTAMP:20030701T000000Z - - UID:hol...@ic... - - CATEGORIES:Holiday - US - - DTSTART;VALUE=DATE:17530214 - - RRULE:FREQ=YEARLY - END:VEVENT - - BEGIN:VEVENT - SUMMARY:Veteran's Day - DESCRIPTION:November 11 - DTSTAMP:20030701T000000Z - UID:hol...@ic... - CATEGORIES:Holiday - US - DTSTART;VALUE=DATE:17531111 - RRULE:FREQ=YEARLY - END:VEVENT - - BEGIN:VEVENT ! ! SUMMARY:Washington's Birthday ! ! DESCRIPTION:February 22 ! DTSTAMP:20030701T000000Z ! ! UID:hol...@ic... ! CATEGORIES:Holiday - US ! ! DTSTART;VALUE=DATE:17530222 ! RRULE:FREQ=YEARLY - END:VEVENT - END:VCALENDAR --- 1,281 ---- BEGIN:VCALENDAR VERSION:2.0 PRODID:-//Rockin' Software//WinDates 5.0//EN METHOD:PUBLISH BEGIN:VEVENT ! SUMMARY:New Year's Day ! DESCRIPTION:January 1 DTSTAMP:20030701T000000Z ! UID:hol...@ic... CATEGORIES:Holiday - US ! DTSTART;VALUE=DATE:17530101 ! RRULE:FREQ=YEARLY END:VEVENT BEGIN:VEVENT ! SUMMARY:Martin Luther King Jr. ! DESCRIPTION:3rd Monday of January DTSTAMP:20030701T000000Z ! UID:hol...@ic... CATEGORIES:Holiday - US ! DTSTART;VALUE=DATE:17530115 ! RRULE:FREQ=MONTHLY;BYMONTH=1;BYDAY=3MO END:VEVENT BEGIN:VEVENT ! SUMMARY:Groundhog Day ! DESCRIPTION:February 2 DTSTAMP:20030701T000000Z ! UID:hol...@ic... CATEGORIES:Holiday - US ! DTSTART;VALUE=DATE:17530202 ! RRULE:FREQ=YEARLY END:VEVENT BEGIN:VEVENT ! SUMMARY:Lincoln's Birthday ! DESCRIPTION:February 12 DTSTAMP:20030701T000000Z ! UID:hol...@ic... CATEGORIES:Holiday - US ! DTSTART;VALUE=DATE:17530212 ! RRULE:FREQ=YEARLY END:VEVENT BEGIN:VEVENT ! SUMMARY:Valentine's Day ! DESCRIPTION:February 14 DTSTAMP:20030701T000000Z ! UID:hol...@ic... CATEGORIES:Holiday - US ! DTSTART;VALUE=DATE:17530214 ! RRULE:FREQ=YEARLY END:VEVENT BEGIN:VEVENT ! SUMMARY:Washington's Birthday ! DESCRIPTION:February 22 DTSTAMP:20030701T000000Z ! UID:hol...@ic... CATEGORIES:Holiday - US ! DTSTART;VALUE=DATE:17530222 RRULE:FREQ=YEARLY END:VEVENT BEGIN:VEVENT ! SUMMARY:President's Day ! DESCRIPTION:3rd Monday of February DTSTAMP:20030701T000000Z ! UID:hol...@ic... CATEGORIES:Holiday - US ! DTSTART;VALUE=DATE:17530219 ! RRULE:FREQ=MONTHLY;BYMONTH=2;BYDAY=3MO END:VEVENT BEGIN:VEVENT ! SUMMARY:Secretaries Day ! DESCRIPTION:Wednesday of last full week in April DTSTAMP:20030701T000000Z ! UID:hol...@ic... CATEGORIES:Holiday - US ! DTSTART;VALUE=DATE:19520423 ! RRULE:FREQ=MONTHLY;INTERVAL=1;BYDAY=WE;BYMONTHDAY=25,26,27,21,22,23,24;BYMONTH=4 END:VEVENT BEGIN:VEVENT ! SUMMARY:Mardi Gras (Fat Tuesday) ! DESCRIPTION:47 days before Easter DTSTAMP:20030701T000000Z ! UID:hol...@ic... CATEGORIES:Holiday - US ! DTSTART;VALUE=DATE:17530308 ! X-WD-RECUR-EASTER:TRUE ! X-WD-RECUR-OFFSET:-47 END:VEVENT BEGIN:VEVENT ! SUMMARY:St. Patrick's Day ! DESCRIPTION:March 17 DTSTAMP:20030701T000000Z ! UID:hol...@ic... CATEGORIES:Holiday - US ! DTSTART;VALUE=DATE:17530317 ! RRULE:FREQ=YEARLY END:VEVENT BEGIN:VEVENT ! SUMMARY:April Fools Day ! DESCRIPTION:April 1 DTSTAMP:20030701T000000Z ! UID:hol...@ic... CATEGORIES:Holiday - US ! DTSTART;VALUE=DATE:17530401 ! RRULE:FREQ=YEARLY;INTERVAL=1; END:VEVENT BEGIN:VEVENT ! SUMMARY:Daylight Savings +1 hr ! DESCRIPTION:2nd Sunday of March DTSTAMP:20030701T000000Z ! UID:hol...@ic... CATEGORIES:Holiday - US ! DTSTART:20070311T020000 ! RRULE:FREQ=MONTHLY;BYMONTH=3;BYDAY=2SU END:VEVENT BEGIN:VEVENT ! SUMMARY:Armed Forces Day ! DESCRIPTION:3rd Saturday of May DTSTAMP:20030701T000000Z ! UID:hol...@ic... CATEGORIES:Holiday - US ! DTSTART;VALUE=DATE:17530519 ! RRULE:FREQ=MONTHLY;BYMONTH=5;BYDAY=3SA END:VEVENT BEGIN:VEVENT SUMMARY:Memorial Day DESCRIPTION:Last Monday of May DTSTAMP:20030701T000000Z UID:hol...@ic... CATEGORIES:Holiday - US DTSTART;VALUE=DATE:17530528 RRULE:FREQ=MONTHLY;BYMONTH=5;BYDAY=-1MO END:VEVENT BEGIN:VEVENT SUMMARY:Mother's Day DESCRIPTION:2nd Sunday of May DTSTAMP:20030701T000000Z UID:hol...@ic... CATEGORIES:Holiday - US DTSTART;VALUE=DATE:17530513 RRULE:FREQ=MONTHLY;BYMONTH=5;BYDAY=2SU END:VEVENT BEGIN:VEVENT ! SUMMARY:Father's Day ! DESCRIPTION:3rd Sunday of June DTSTAMP:20030701T000000Z ! UID:hol...@ic... CATEGORIES:Holiday - US + DTSTART;VALUE=DATE:17530617 + RRULE:FREQ=MONTHLY;BYMONTH=6;BYDAY=3SU + END:VEVENT ! BEGIN:VEVENT ! SUMMARY:Flag Day ! DESCRIPTION:June 14 ! DTSTAMP:20030701T000000Z ! UID:hol...@ic... ! CATEGORIES:Holiday - US ! DTSTART;VALUE=DATE:17530614 RRULE:FREQ=YEARLY END:VEVENT BEGIN:VEVENT ! SUMMARY:Independence Day ! DESCRIPTION:July 4 DTSTAMP:20030701T000000Z ! UID:hol...@ic... CATEGORIES:Holiday - US ! DTSTART;VALUE=DATE:17530704 RRULE:FREQ=YEARLY END:VEVENT BEGIN:VEVENT ! SUMMARY:Labor Day ! DESCRIPTION:1st Monday of September DTSTAMP:20030701T000000Z ! UID:hol...@ic... CATEGORIES:Holiday - US ! DTSTART;VALUE=DATE:17530903 ! RRULE:FREQ=MONTHLY;BYMONTH=9;BYDAY=1MO END:VEVENT BEGIN:VEVENT ! SUMMARY:Grandparent's Day ! DESCRIPTION:First Sunday after Labor Day DTSTAMP:20030701T000000Z ! UID:hol...@ic... CATEGORIES:Holiday - US ! DTSTART;VALUE=DATE:19780910 ! RRULE:FREQ=YEARLY;BYDAY=SU;BYMONTHDAY=13,7,8,9,10,11,12;BYMONTH=9 END:VEVENT BEGIN:VEVENT ! SUMMARY:Columbus Day ! DESCRIPTION:2nd Monday of October DTSTAMP:20030701T000000Z ! UID:hol...@ic... CATEGORIES:Holiday - US + DTSTART;VALUE=DATE:17531008 + RRULE:FREQ=MONTHLY;BYMONTH=10;BYDAY=2MO + END:VEVENT ! BEGIN:VEVENT ! SUMMARY:Halloween ! DESCRIPTION:October 31 ! DTSTAMP:20030701T000000Z ! UID:hol...@ic... ! CATEGORIES:Holiday - US ! DTSTART;VALUE=DATE:17531031 RRULE:FREQ=YEARLY END:VEVENT ! BEGIN:VEVENT ! SUMMARY:Daylight Savings -1 hr ! DESCRIPTION:1st Sunday of Nov ! DTSTAMP:20030701T000000Z ! UID:hol...@ic... ! CATEGORIES:Holiday - US ! DTSTART:20071104T020000 ! RRULE:FREQ=YEARLY;BYMONTH=11;BYDAY=1SU ! END:VEVENT BEGIN:VEVENT + SUMMARY:Election Day + DESCRIPTION:Tuesday after 1st Monday in November + DTSTAMP:20030701T000000Z + UID:hol...@ic... + CATEGORIES:Holiday - US + DTSTART;VALUE=DATE:17531106 + RRULE:FREQ=MONTHLY;INTERVAL=1;BYDAY=TU;BYMONTHDAY=2,3,4,5,6,7,8;BYMONTH=11 + END:VEVENT + BEGIN:VEVENT SUMMARY:Thanksgiving DESCRIPTION:4th Thursday of November DTSTAMP:20030701T000000Z UID:hol...@ic... CATEGORIES:Holiday - US DTSTART;VALUE=DATE:17531122 RRULE:FREQ=MONTHLY;BYMONTH=11;BYDAY=4TH END:VEVENT BEGIN:VEVENT SUMMARY:Veteran's Day DESCRIPTION:November 11 DTSTAMP:20030701T000000Z UID:hol...@ic... CATEGORIES:Holiday - US DTSTART;VALUE=DATE:17531111 RRULE:FREQ=YEARLY END:VEVENT BEGIN:VEVENT ! SUMMARY:New Year's Eve ! DESCRIPTION:December 31 DTSTAMP:20030701T000000Z ! UID:hol...@ic... CATEGORIES:Holiday - US ! DTSTART;VALUE=DATE:17531231 RRULE:FREQ=YEARLY END:VEVENT END:VCALENDAR |
From: <ji...@us...> - 2008-12-12 06:37:35
|
Update of /cvsroot/phpicalendar/phpicalendar In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv9533 Modified Files: preferences.php Log Message: misc changes for new config model Index: preferences.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/preferences.php,v retrieving revision 1.61 retrieving revision 1.62 diff -C2 -d -r1.61 -r1.62 *** preferences.php 12 Dec 2008 06:22:58 -0000 1.61 --- preferences.php 12 Dec 2008 06:37:29 -0000 1.62 *************** *** 4,8 **** require_once(BASE.'functions/ical_parser.php'); require_once(BASE.'functions/template.php'); - header("Content-Type: text/html; charset=$charset"); $display_date = $preferences_lang; --- 4,7 ---- *************** *** 38,42 **** setcookie("$cookie_name","$the_cookie",time()-(60*60*24*7) ,"/","$phpiCal_config->cookie_uri",0); } else { ! setcookie("$cookie_name","$the_cookie",time()+(60*60*24*7*12*10) ,"/","$phpiCal_config->cookie_uri",0); echo "setcookie"; if (isset($_POST['cookie_view'])) $default_view = $_POST['cookie_view']; --- 37,41 ---- setcookie("$cookie_name","$the_cookie",time()-(60*60*24*7) ,"/","$phpiCal_config->cookie_uri",0); } else { ! setcookie("$cookie_name","$the_cookie",time()+(60*60*24*7*12*10) ,"/","$phpiCal_config->cookie_uri",0); if (isset($_POST['cookie_view'])) $default_view = $_POST['cookie_view']; *************** *** 195,198 **** $page->output(); ! ?> --- 194,197 ---- $page->output(); ! print_r($_COOKIE[$cookie_name]); ?> |
From: <ji...@us...> - 2008-12-12 06:37:35
|
Update of /cvsroot/phpicalendar/phpicalendar/functions/init In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv9533/functions/init Modified Files: configs.php Log Message: misc changes for new config model Index: configs.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/functions/init/configs.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** configs.php 12 Dec 2008 06:22:59 -0000 1.2 --- configs.php 12 Dec 2008 06:37:29 -0000 1.3 *************** *** 11,15 **** $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']); --- 11,15 ---- $cookie_name = 'phpicalendar_'.basename($phpiCal_config->default_path); if (isset($_COOKIE[$cookie_name]) && !isset($_POST['unset'])) { ! $phpicalendar = unserialize(stripslashes($_COOKIE[$cookie_name])); 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']); *************** *** 20,24 **** } 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']); echo "cookie!"; } --- 20,25 ---- } 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']); ! echo "cookie!"; } |
From: <ji...@us...> - 2008-12-12 06:23:04
|
Update of /cvsroot/phpicalendar/phpicalendar In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv9036 Modified Files: day.php month.php preferences.php week.php year.php Log Message: misc changes for new config model Index: day.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/day.php,v retrieving revision 1.133 retrieving revision 1.134 diff -C2 -d -r1.133 -r1.134 *** day.php 12 Dec 2008 00:08:47 -0000 1.133 --- day.php 12 Dec 2008 06:22:57 -0000 1.134 *************** *** 39,43 **** // login/logout $is_logged_in = ($username != '' && !$invalid_login) ? true : false; ! $show_user_login = (!$is_logged_in && $allow_login == 'yes'); $login_querys = login_querys(); $logout_querys = logout_querys(); --- 39,43 ---- // login/logout $is_logged_in = ($username != '' && !$invalid_login) ? true : false; ! $show_user_login = (!$is_logged_in && $phpiCal_config->allow_login == 'yes'); $login_querys = login_querys(); $logout_querys = logout_querys(); *************** *** 46,54 **** $page->replace_files(array( ! 'header' => BASE.'templates/'.$template.'/header.tpl', 'event_js' => BASE.'functions/event.js', ! 'footer' => BASE.'templates/'.$template.'/footer.tpl', ! 'sidebar' => BASE.'templates/'.$template.'/sidebar.tpl', ! 'search_box' => BASE.'templates/'.$template.'/search_box.tpl' )); --- 46,54 ---- $page->replace_files(array( ! 'header' => BASE.'templates/'.$phpiCal_config->template.'/header.tpl', 'event_js' => BASE.'functions/event.js', ! 'footer' => BASE.'templates/'.$phpiCal_config->template.'/footer.tpl', ! 'sidebar' => BASE.'templates/'.$phpiCal_config->template.'/sidebar.tpl', ! 'search_box' => BASE.'templates/'.$phpiCal_config->template.'/search_box.tpl' )); *************** *** 69,73 **** 'rss_available' => '', 'rss_valid' => '', ! 'show_search' => $show_search, 'next_day' => $next_day, 'prev_day' => $prev_day, --- 69,73 ---- 'rss_available' => '', 'rss_valid' => '', ! 'show_search' => $phpiCal_config->show_search, 'next_day' => $next_day, 'prev_day' => $prev_day, *************** *** 106,110 **** )); ! if ($allow_preferences != 'yes') { $page->replace_tags(array( 'allow_preferences' => '' --- 106,110 ---- )); ! if ($phpiCal_config->allow_preferences != 'yes') { $page->replace_tags(array( 'allow_preferences' => '' *************** *** 112,116 **** } ! if ($allow_login == 'yes') { $page->replace_tags(array( 'l_invalid_login' => $lang['l_invalid_login'], --- 112,116 ---- } ! if ($phpiCal_config->allow_login == 'yes') { $page->replace_tags(array( 'l_invalid_login' => $lang['l_invalid_login'], *************** *** 122,126 **** } ! if ($show_search != 'yes') { $page->nosearch($page); } --- 122,126 ---- } ! if ($phpiCal_config->show_search != 'yes') { $page->nosearch($page); } Index: month.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/month.php,v retrieving revision 1.141 retrieving revision 1.142 diff -C2 -d -r1.141 -r1.142 *** month.php 11 Dec 2008 21:54:52 -0000 1.141 --- month.php 12 Dec 2008 06:22:58 -0000 1.142 *************** *** 47,58 **** $list_icals_pick = display_ical_list(availableCalendars($username, $password, $phpiCal_config->ALL_CALENDARS_COMBINED), TRUE); ! $page = new Page(BASE.'templates/'.$template.'/month.tpl'); $page->replace_files(array( ! 'header' => BASE.'templates/'.$template.'/header.tpl', 'event_js' => BASE.'functions/event.js', ! 'footer' => BASE.'templates/'.$template.'/footer.tpl', ! 'calendar_nav' => BASE.'templates/'.$template.'/calendar_nav.tpl', ! 'search_box' => BASE.'templates/'.$template.'/search_box.tpl' )); --- 47,58 ---- $list_icals_pick = display_ical_list(availableCalendars($username, $password, $phpiCal_config->ALL_CALENDARS_COMBINED), TRUE); ! $page = new Page(BASE.'templates/'.$phpiCal_config->template.'/month.tpl'); $page->replace_files(array( ! 'header' => BASE.'templates/'.$phpiCal_config->template.'/header.tpl', 'event_js' => BASE.'functions/event.js', ! 'footer' => BASE.'templates/'.$phpiCal_config->template.'/footer.tpl', ! 'calendar_nav' => BASE.'templates/'.$phpiCal_config->template.'/calendar_nav.tpl', ! 'search_box' => BASE.'templates/'.$phpiCal_config->template.'/search_box.tpl' )); *************** *** 106,110 **** )); ! if ($allow_preferences != 'yes') { $page->replace_tags(array( 'allow_preferences' => '' --- 106,110 ---- )); ! if ($phpiCal_config->allow_preferences != 'yes') { $page->replace_tags(array( 'allow_preferences' => '' *************** *** 112,116 **** } ! if ($allow_login == 'yes') { $page->replace_tags(array( 'l_invalid_login' => $lang['l_invalid_login'], --- 112,116 ---- } ! if ($phpiCal_config->allow_login == 'yes') { $page->replace_tags(array( 'l_invalid_login' => $lang['l_invalid_login'], *************** *** 122,126 **** } ! if ($show_search != 'yes') { $page->nosearch($page); } --- 122,126 ---- } ! if ($phpiCal_config->show_search != 'yes') { $page->nosearch($page); } Index: preferences.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/preferences.php,v retrieving revision 1.60 retrieving revision 1.61 diff -C2 -d -r1.60 -r1.61 *** preferences.php 10 Apr 2006 02:21:07 -0000 1.60 --- preferences.php 12 Dec 2008 06:22:58 -0000 1.61 *************** *** 7,21 **** $display_date = $preferences_lang; ! if ($allow_preferences != 'yes') { exit(error('Preferences are not available for this installation.', $cal)); } - if ($cookie_uri == '') { - $cookie_uri = $_SERVER['SERVER_NAME'].substr($_SERVER['PHP_SELF'],0,strpos($_SERVER['PHP_SELF'], '/')); - } - $current_view = "preferences"; $back_page = BASE.$default_view.'.php?cal='.$cal.'&getdate='.$getdate.'&cpath='.$cpath; ! if ($allow_preferences == 'no') header("Location: $back_page"); if (isset($_GET['action'])) { --- 7,17 ---- $display_date = $preferences_lang; ! if ($phpiCal_config->allow_preferences != 'yes') { exit(error('Preferences are not available for this installation.', $cal)); } $current_view = "preferences"; $back_page = BASE.$default_view.'.php?cal='.$cal.'&getdate='.$getdate.'&cpath='.$cpath; ! if ($phpiCal_config->allow_preferences == 'no') header("Location: $back_page"); if (isset($_GET['action'])) { *************** *** 40,46 **** $the_cookie = serialize($the_cookie); if ($cookie_unset) { ! setcookie("$cookie_name","$the_cookie",time()-(60*60*24*7) ,"/","$cookie_uri",0); } else { ! setcookie("$cookie_name","$the_cookie",time()+(60*60*24*7*12*10) ,"/","$cookie_uri",0); if (isset($_POST['cookie_view'])) $default_view = $_POST['cookie_view']; --- 36,42 ---- $the_cookie = serialize($the_cookie); if ($cookie_unset) { ! setcookie("$cookie_name","$the_cookie",time()-(60*60*24*7) ,"/","$phpiCal_config->cookie_uri",0); } else { ! setcookie("$cookie_name","$the_cookie",time()+(60*60*24*7*12*10) ,"/","$phpiCal_config->cookie_uri",0); echo "setcookie"; if (isset($_POST['cookie_view'])) $default_view = $_POST['cookie_view']; *************** *** 71,79 **** # No cookie set -> use defaults from config file. $cookie_language = ucfirst($language); ! $cookie_calendar = $default_cal; ! $cookie_view = $default_view; ! $cookie_style = $template; ! $cookie_startday = $week_start_day; ! $cookie_time = $day_start; } --- 67,75 ---- # No cookie set -> use defaults from config file. $cookie_language = ucfirst($language); ! $cookie_calendar = $phpiCal_config->default_cal; ! $cookie_view = $phpiCal_config->default_view; ! $cookie_style = $phpiCal_config->template; ! $cookie_startday = $phpiCal_config->week_start_day; ! $cookie_time = $phpiCal_config->day_start; } *************** *** 147,161 **** $generated = number_format(($php_ended-$php_started),3); ! $page = new Page(BASE.'templates/'.$template.'/preferences.tpl'); $page->replace_files(array( ! 'header' => BASE.'templates/'.$template.'/header.tpl', ! 'footer' => BASE.'templates/'.$template.'/footer.tpl' )); $page->replace_tags(array( ! 'version' => $phpicalendar_version, ! 'charset' => $charset, ! 'template' => $template, 'default_path' => '', 'cpath' => $cpath, --- 143,157 ---- $generated = number_format(($php_ended-$php_started),3); ! $page = new Page(BASE.'templates/'.$phpiCal_config->template.'/preferences.tpl'); $page->replace_files(array( ! 'header' => BASE.'templates/'.$phpiCal_config->template.'/header.tpl', ! 'footer' => BASE.'templates/'.$phpiCal_config->template.'/footer.tpl' )); $page->replace_tags(array( ! 'version' => $phpiCal_config->phpicalendar_version, ! 'charset' => $phpiCal_config->charset, ! 'template' => $phpiCal_config->template, 'default_path' => '', 'cpath' => $cpath, Index: week.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/week.php,v retrieving revision 1.132 retrieving revision 1.133 diff -C2 -d -r1.132 -r1.133 *** week.php 11 Dec 2008 21:54:52 -0000 1.132 --- week.php 12 Dec 2008 06:22:58 -0000 1.133 *************** *** 16,21 **** $next_day = date('Ymd', strtotime("+1 day", $unix_time)); $prev_day = date('Ymd', strtotime("-1 day", $unix_time)); ! $start_week_time = strtotime(dateOfWeek($getdate, $week_start_day)); ! $end_week_time = $start_week_time + (($week_length - 1) * 25 * 60 * 60); $start_week = localizeDate($dateFormat_week, $start_week_time); $end_week = localizeDate($dateFormat_week, $end_week_time); --- 16,21 ---- $next_day = date('Ymd', strtotime("+1 day", $unix_time)); $prev_day = date('Ymd', strtotime("-1 day", $unix_time)); ! $start_week_time = strtotime(dateOfWeek($getdate, $phpiCal_config->week_start_day)); ! $end_week_time = $start_week_time + (($phpiCal_config->week_length - 1) * 25 * 60 * 60); $start_week = localizeDate($dateFormat_week, $start_week_time); $end_week = localizeDate($dateFormat_week, $end_week_time); *************** *** 40,55 **** // login/logout $is_logged_in = ($username != '' && !$invalid_login) ? true : false; ! $show_user_login = (!$is_logged_in && $allow_login == 'yes'); $login_querys = login_querys(); $logout_querys = logout_querys(); ! $page = new Page(BASE.'templates/'.$template.'/week.tpl'); $page->replace_files(array( ! 'header' => BASE.'templates/'.$template.'/header.tpl', 'event_js' => BASE.'functions/event.js', ! 'footer' => BASE.'templates/'.$template.'/footer.tpl', ! 'sidebar' => BASE.'templates/'.$template.'/sidebar.tpl', ! 'search_box' => BASE.'templates/'.$template.'/search_box.tpl' )); --- 40,55 ---- // login/logout $is_logged_in = ($username != '' && !$invalid_login) ? true : false; ! $show_user_login = (!$is_logged_in && $phpiCal_config->allow_login == 'yes'); $login_querys = login_querys(); $logout_querys = logout_querys(); ! $page = new Page(BASE.'templates/'.$phpiCal_config->template.'/week.tpl'); $page->replace_files(array( ! 'header' => BASE.'templates/'.$phpiCal_config->template.'/header.tpl', 'event_js' => BASE.'functions/event.js', ! 'footer' => BASE.'templates/'.$phpiCal_config->template.'/footer.tpl', ! 'sidebar' => BASE.'templates/'.$phpiCal_config->template.'/sidebar.tpl', ! 'search_box' => BASE.'templates/'.$phpiCal_config->template.'/search_box.tpl' )); *************** *** 62,66 **** 'getdate' => $getdate, 'getcpath' => "&cpath=$cpath", ! 'cpath' => $cpath, 'calendar_name' => $cal_displayname, 'display_date' => $display_date, --- 62,66 ---- 'getdate' => $getdate, 'getcpath' => "&cpath=$cpath", ! 'cpath' => $cpath, 'calendar_name' => $cal_displayname, 'display_date' => $display_date, *************** *** 70,74 **** 'rss_available' => '', 'rss_valid' => '', ! 'show_search' => $show_search, 'next_day' => $next_day, 'next_week' => $next_week, --- 70,74 ---- 'rss_available' => '', 'rss_valid' => '', ! 'show_search' => $show_search, 'next_day' => $next_day, 'next_week' => $next_week, *************** *** 109,113 **** )); ! if ($allow_preferences != 'yes') { $page->replace_tags(array( 'allow_preferences' => '' --- 109,113 ---- )); ! if ($phpiCal_config->allow_preferences != 'yes') { $page->replace_tags(array( 'allow_preferences' => '' *************** *** 115,119 **** } ! if ($allow_login == 'yes') { $page->replace_tags(array( 'l_invalid_login' => $lang['l_invalid_login'], --- 115,119 ---- } ! if ($phpiCal_config->allow_login == 'yes') { $page->replace_tags(array( 'l_invalid_login' => $lang['l_invalid_login'], *************** *** 125,129 **** } ! if ($show_search != 'yes') { $page->nosearch($page); } --- 125,129 ---- } ! if ($phpiCal_config->show_search != 'yes') { $page->nosearch($page); } Index: year.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/year.php,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -d -r1.47 -r1.48 *** year.php 11 Dec 2008 21:54:52 -0000 1.47 --- year.php 12 Dec 2008 06:22:58 -0000 1.48 *************** *** 113,117 **** )); ! if ($allow_preferences != 'yes') { $page->replace_tags(array( 'allow_preferences' => '' --- 113,117 ---- )); ! if ($phpiCal_config->allow_preferences != 'yes') { $page->replace_tags(array( 'allow_preferences' => '' *************** *** 119,123 **** } ! if ($allow_login == 'yes') { $page->replace_tags(array( 'l_invalid_login' => $lang['l_invalid_login'], --- 119,123 ---- } ! if ($phpiCal_config->allow_login == 'yes') { $page->replace_tags(array( 'l_invalid_login' => $lang['l_invalid_login'], |
From: <ji...@us...> - 2008-12-12 06:23:04
|
Update of /cvsroot/phpicalendar/phpicalendar/functions In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv9036/functions Modified Files: calendar_functions.php init.inc.php template.php Log Message: misc changes for new config model Index: calendar_functions.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/functions/calendar_functions.php,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** calendar_functions.php 11 Dec 2008 21:54:52 -0000 1.27 --- calendar_functions.php 12 Dec 2008 06:22:58 -0000 1.28 *************** *** 289,295 **** if (!$pick) { if ($cal == $phpiCal_config->ALL_CALENDARS_COMBINED) { ! $return .= "<option value=\"$current_view.php?cal=$ALL_CALENDARS_COMBINED&getdate=$getdate\" selected=\"selected\">$all_cal_comb_lang</option>"; } else { ! $return .= "<option value=\"$current_view.php?cal=$ALL_CALENDARS_COMBINED&getdate=$getdate\">$all_cal_comb_lang</option>"; } } --- 289,295 ---- if (!$pick) { if ($cal == $phpiCal_config->ALL_CALENDARS_COMBINED) { ! $return .= "<option value=\"$current_view.php?cal=$phpiCal_config->ALL_CALENDARS_COMBINED&getdate=$getdate\" selected=\"selected\">$all_cal_comb_lang</option>"; } else { ! $return .= "<option value=\"$current_view.php?cal=$phpiCal_config->ALL_CALENDARS_COMBINED&getdate=$getdate\">$all_cal_comb_lang</option>"; } } Index: init.inc.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/functions/init.inc.php,v retrieving revision 1.113 retrieving revision 1.114 diff -C2 -d -r1.113 -r1.114 *** init.inc.php 11 Dec 2008 21:54:52 -0000 1.113 --- init.inc.php 12 Dec 2008 06:22:59 -0000 1.114 *************** *** 150,160 **** if (isset($cpath) && $cpath !='') $add_cpath = "$cpath/"; ! if (($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); $subscribe_path = 'webcal://'.$newurl.'/'.$add_cpath.basename($filename); ! $download_filename = $download_uri.'/'.$add_cpath.basename($filename); } else { $subscribe_path = $add_cpath; --- 150,160 ---- if (isset($cpath) && $cpath !='') $add_cpath = "$cpath/"; ! if (($phpiCal_config->download_uri == '') && (preg_match('/(^\/|\.\.\/)/', $filename) == 0)) { $subscribe_path = 'webcal://'.$_SERVER['SERVER_NAME'].dirname($_SERVER['PHP_SELF']).'/'.$filename; $download_filename = $filename; ! } elseif ($phpiCal_config->download_uri != '') { ! $newurl = eregi_replace("^(http://)", "", $phpiCal_config->download_uri); $subscribe_path = 'webcal://'.$newurl.'/'.$add_cpath.basename($filename); ! $download_filename = $phpiCal_config->download_uri.'/'.$add_cpath.basename($filename); } else { $subscribe_path = $add_cpath; Index: template.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/functions/template.php,v retrieving revision 1.95 retrieving revision 1.96 diff -C2 -d -r1.95 -r1.96 *** template.php 11 Dec 2008 21:54:52 -0000 1.95 --- template.php 12 Dec 2008 06:22:59 -0000 1.96 *************** *** 247,251 **** 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; // Figure out colspans --- 247,251 ---- 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; // Figure out colspans *************** *** 253,257 **** $thisdate = $start_week_time; $swt = $start_week_time; ! for ($i=0;$i<7;$i++) { $thisday = date("Ymd", $thisdate); $nbrGridCols[$thisday] = 1; --- 253,257 ---- $thisdate = $start_week_time; $swt = $start_week_time; ! for ($i=0;$i < 7;$i++) { $thisday = date("Ymd", $thisdate); $nbrGridCols[$thisday] = 1; *************** *** 268,272 **** } ! for ($i=0; $i<$week_length; $i++) { $thisdate = date ('Ymd', $start_week_time); $weekarray[$i] = $thisdate; --- 268,272 ---- } ! for ($i=0; $i < $phpiCal_config->week_length; $i++) { $thisdate = date ('Ymd', $start_week_time); $weekarray[$i] = $thisdate; *************** *** 305,313 **** $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++) { $day_num = date("w", $start_day); $daylink = date('Ymd', $start_wt); if ($current_view == 'day') { ! $weekday = $phpiCal_config->daysofweek_lang[$day_num]; } else { $weekday = localizeDate($dateFormat_week_list, strtotime($daylink)); --- 305,313 ---- $start_wt = strtotime(dateOfWeek($getdate, $phpiCal_config->week_start_day)); $start_day = strtotime($phpiCal_config->week_start_day); ! 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 = $daysofweek_lang[$day_num]; } else { $weekday = localizeDate($dateFormat_week_list, strtotime($daylink)); *************** *** 346,350 **** $this_year = $day_array2[1]; $thisdate = $swt; ! for ($i=0;$i<7;$i++) { $thisday = date("Ymd", $thisdate); $event_length[$thisday] = array (); --- 346,350 ---- $this_year = $day_array2[1]; $thisdate = $swt; ! for ($i=0; $i < 7; $i++) { $thisday = date("Ymd", $thisdate); $event_length[$thisday] = array (); *************** *** 365,369 **** $size_tmp = 60 - (int)substr($cal_time,2,2); $weekdisplay .= '<tr>'; ! $weekdisplay .= '<td colspan="4" rowspan="' . ($size_tmp / $phpiCal_config->gridLength) . '" align="center" valign="top" width="60" class="timeborder">'.$key.'</td>'; $weekdisplay .= '<td bgcolor="#a1a5a9" width="1" height="' . $phpiCal_config->gridLength . '"></td>'; } else { --- 365,369 ---- $size_tmp = 60 - (int)substr($cal_time,2,2); $weekdisplay .= '<tr>'; ! $weekdisplay .= '<td colspan="4" rowspan="' . ($size_tmp / $phpiCal_config->gridLength) . '" align="center" valign="top" width="60" class="timeborder">'.$key.'</td>'; $weekdisplay .= '<td bgcolor="#a1a5a9" width="1" height="' . $phpiCal_config->gridLength . '"></td>'; } else { *************** *** 376,380 **** // loop this part 7 times, one for each day ! for ($week_loop=0; $week_loop<$week_length; $week_loop++) { $thisday = date("Ymd", $thisdate); $dayborder = 0; --- 376,380 ---- // loop this part 7 times, one for each day ! for ($week_loop=0; $week_loop<$phpiCal_config->week_length; $week_loop++) { $thisday = date("Ymd", $thisdate); $dayborder = 0; *************** *** 769,773 **** function get_vtodo() { ! global $phpiCal_config, $getdate, $master_array, $next_day, $timeFormat, $tomorrows_events_lines, $show_completed, $show_todos; preg_match("!<\!-- switch show_completed on -->(.*)<\!-- switch show_completed off -->!is", $this->page, $match1); --- 769,773 ---- function get_vtodo() { ! 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); *************** *** 822,826 **** $temp = ''; if ($status == 'COMPLETED' || (isset($val['completed_date']) && isset($val['completed_time']))) { ! if ($show_completed == 'yes') { $temp = $completed; } --- 822,826 ---- $temp = ''; if ($status == 'COMPLETED' || (isset($val['completed_date']) && isset($val['completed_time']))) { ! if ($phpiCal_config->show_completed == 'yes') { $temp = $completed; } *************** *** 843,847 **** // If there are no TODO items, completely hide the TODO list. ! if (($nugget2 == '') || ($show_todos != 'yes')) { $this->page = preg_replace('!<\!-- switch vtodo on -->(.*)<\!-- switch vtodo off -->!is', '', $this->page); } --- 843,847 ---- // If there are no TODO items, completely hide the TODO list. ! if (($nugget2 == '') || ($phpiCal_config->show_todos != 'yes')) { $this->page = preg_replace('!<\!-- switch vtodo on -->(.*)<\!-- switch vtodo off -->!is', '', $this->page); } |
From: <ji...@us...> - 2008-12-12 06:23:04
|
Update of /cvsroot/phpicalendar/phpicalendar/functions/init In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv9036/functions/init Modified Files: configs.php Log Message: misc changes for new config model Index: configs.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/functions/init/configs.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** configs.php 11 Dec 2008 23:48:39 -0000 1.1 --- configs.php 12 Dec 2008 06:22:59 -0000 1.2 *************** *** 3,16 **** include_once(BASE.'default_config.php'); if (is_file(BASE.'config.inc.php')){ ! include_once(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' ); } ! ! if (isset($_COOKIE[$phpiCal_config->cookie_uri]) && !isset($_POST['unset'])) { ! $phpicalendar = unserialize(stripslashes($_COOKIE[$cookie_name])); 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']); --- 3,15 ---- include_once(BASE.'default_config.php'); if (is_file(BASE.'config.inc.php')){ ! include(BASE.'config.inc.php'); foreach($configs as $key=>$value) $phpiCal_config->setProperty($key, $value); } if ($phpiCal_config->cookie_uri == '') { ! $phpiCal_config->cookie_uri = $_SERVER['SERVER_NAME'].substr($_SERVER['PHP_SELF'],0,strpos($_SERVER['PHP_SELF'], '/')); } ! $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']); *************** *** 21,25 **** } 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']); } --- 20,24 ---- } 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']); echo "cookie!"; } *************** *** 52,57 **** ! /* ! echo "<pre>xx"; print_r($configs); print_r($phpiCal_config); --- 51,55 ---- ! /*echo "<pre>xx"; print_r($configs); print_r($phpiCal_config); |
From: <ji...@us...> - 2008-12-12 00:08:53
|
Update of /cvsroot/phpicalendar/phpicalendar/functions/init In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv13781/functions/init Modified Files: cpaths.php Log Message: fix calendar path bug in initialization Index: cpaths.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/functions/init/cpaths.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** cpaths.php 11 Dec 2008 23:48:39 -0000 1.1 --- cpaths.php 12 Dec 2008 00:08:47 -0000 1.2 *************** *** 1,7 **** <?php #cpath modifies the calendar path based on the url or cookie values. This allows you to run multiple calendar subsets from a single phpicalendar installation. Operations on cpath are largely hidden from the end user. if ($phpiCal_config->calendar_path == '') { ! $calendar_path = BASE.'calendars'; ! }else $calendar_path = $phpiCal_config->calendar_path; $cpath = ''; #initialize cpath to prevent later undef warnings. if(isset($_REQUEST['cpath'])&& $_REQUEST['cpath'] !=''){ --- 1,13 ---- <?php + # adjust paths in case they are incorrect + if ($phpiCal_config->default_path == '') { + $phpiCal_config->setProperty('default_path', BASE); + } + #cpath modifies the calendar path based on the url or cookie values. This allows you to run multiple calendar subsets from a single phpicalendar installation. Operations on cpath are largely hidden from the end user. if ($phpiCal_config->calendar_path == '') { ! $phpiCal_config->setProperty('calendar_path', BASE.'calendars'); ! } ! $calendar_path = $phpiCal_config->calendar_path; $cpath = ''; #initialize cpath to prevent later undef warnings. if(isset($_REQUEST['cpath'])&& $_REQUEST['cpath'] !=''){ |
From: <ji...@us...> - 2008-12-12 00:08:53
|
Update of /cvsroot/phpicalendar/phpicalendar In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv13781 Modified Files: day.php Log Message: fix calendar path bug in initialization Index: day.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/day.php,v retrieving revision 1.132 retrieving revision 1.133 diff -C2 -d -r1.132 -r1.133 *** day.php 11 Dec 2008 21:54:52 -0000 1.132 --- day.php 12 Dec 2008 00:08:47 -0000 1.133 *************** *** 56,60 **** 'version' => $phpiCal_config->phpicalendar_version, 'charset' => $phpiCal_config->charset, ! 'default_path' => '', 'template' => $phpiCal_config->template, 'cal' => $cal, --- 56,60 ---- 'version' => $phpiCal_config->phpicalendar_version, 'charset' => $phpiCal_config->charset, ! 'default_path' => $phpiCal_config->default_path, 'template' => $phpiCal_config->template, 'cal' => $cal, |
From: <ji...@us...> - 2008-12-11 23:48:45
|
Update of /cvsroot/phpicalendar/phpicalendar/functions/parse In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv11887/functions/parse Added Files: end_vevent.php overlapping_events.php parse_tzs.php Log Message: add new files --- NEW FILE: end_vevent.php --- <?php /* end_vevent.php What happens in this file: 1. Initialization 2. */ if (!isset($url)) $url = ''; if (!isset($type)) $type = ''; // Handle DURATION if (!isset($end_unixtime)) { if(!isset($the_duration)) $the_duration = 0; $end_unixtime = $start_unixtime + $the_duration; $end_time = date ('Hi', $end_unixtime); } // CLASS support if (isset($class)) { if ($class == 'PRIVATE') { $summary ='**PRIVATE**'; $description ='**PRIVATE**'; } elseif ($class == 'CONFIDENTIAL') { $summary ='**CONFIDENTIAL**'; $description ='**CONFIDENTIAL**'; } } // make sure we have some value for $uid if (!isset($uid)) { $uid = $uid_counter; $uid_counter++; $uid_valid = false; } else { $uid_valid = true; } if (!isset($summary)) $summary = ''; if (!isset($description)) $description = ''; if (!isset($status)) $status = ''; if (!isset($class)) $class = ''; if (!isset($location)) $location = ''; # adjust event start and end times if (isset($start_time) && isset($end_time)) { // Mozilla style all-day events or just really long events if (($end_time - $start_time) > 2345) { $allday_start = $start_date; $allday_end = ($start_date + 1); } } # look for events that span more than one day if (isset($start_unixtime,$end_unixtime) && date('Ymd',$start_unixtime) != date('Ymd',$end_unixtime)) { $spans_day = true; $bleed_check = (($start_unixtime - $end_unixtime) < (60*60*24)) ? '-1' : '0'; } else { $spans_day = false; $bleed_check = 0; } # get hour and minute adjusted to allowed grid times if (isset($start_time) && $start_time != '') { preg_match ('/([0-9]{2})([0-9]{2})/', $start_time, $time); preg_match ('/([0-9]{2})([0-9]{2})/', $end_time, $time2); if (isset($start_unixtime) && isset($end_unixtime)) { $length = $end_unixtime - $start_unixtime; } else { $length = ($time2[1]*60+$time2[2]) - ($time[1]*60+$time[2]); } $drawKey = drawEventTimes($start_time, $end_time); preg_match ('/([0-9]{2})([0-9]{2})/', $drawKey['draw_start'], $time3); $hour = $time3[1]; $minute = $time3[2]; } // RECURRENCE-ID Support if (isset($recurrence_d)) { $recurrence_delete["$recurrence_d"]["$recurrence_t"] = $uid; } # treat nonrepeating events as rrule events with one instance if (!isset($rrule_array) && $start_unixtime < $mArray_end && $end_unixtime > $mArray_begin){ $rrule_array['FREQ'] = 'YEARLY'; $rrule_array['START_DATE'] = $start_date; $rrule_array['UNTIL'] = $start_date; $rrule_array['END'] = 'end'; } if (isset($allday_start) && $allday_start != '') { $hour = '-'; $minute = '1'; $rrule_array['START_DAY'] = $allday_start; # $rrule_array['END_DAY'] = $allday_end; # this doesn't seem to be used anywhere. $rrule_array['END'] = 'end'; $recur_start = $allday_start; $start_date = $allday_start; if (isset($allday_end)) { $diff_allday_days = dayCompare($allday_end, $allday_start); } else { $diff_allday_days = 1; } } else { $rrule_array['START_DATE'] = $start_date; $rrule_array['START_TIME'] = $start_time; $rrule_array['END_TIME'] = $end_time; $rrule_array['END'] = 'end'; } $start_date_time = strtotime($start_date); if (!isset($fromdate)){ #this should happen if not in one of the rss views $this_month_start_time = strtotime($this_year.$this_month.'01'); if ($current_view == 'year' || ($save_parsed_cals == 'yes' && !$is_webcal)|| $current_view == 'print' && $printview == 'year') { $start_range_time = strtotime($this_year.'-01-01 -2 weeks'); $end_range_time = strtotime($this_year.'-12-31 +2 weeks'); } else { $start_range_time = strtotime('-1 month -2 day', $this_month_start_time); $end_range_time = strtotime('+2 month +2 day', $this_month_start_time); } }else{ $start_range_time = strtotime($fromdate); $end_range_time = strtotime($todate)+60*60*24; } $freq_type = 'year'; foreach ($rrule_array as $key => $val) { switch($key) { case 'FREQ': switch ($val) { case 'YEARLY': $freq_type = 'year'; break; case 'MONTHLY': $freq_type = 'month'; break; case 'WEEKLY': $freq_type = 'week'; break; case 'DAILY': $freq_type = 'day'; break; case 'HOURLY': $freq_type = 'hour'; break; case 'MINUTELY': $freq_type = 'minute'; break; case 'SECONDLY': $freq_type = 'second'; break; } $recur_array[($start_date)][($hour.$minute)][$uid]['recur'][$key] = strtolower($val); break; case 'COUNT': $count = $val; $recur_array[($start_date)][($hour.$minute)][$uid]['recur'][$key] = $count; break; case 'UNTIL': $until = str_replace('T', '', $val); $until = str_replace('Z', '', $until); if (strlen($until) == 8) $until = $until.'235959'; $abs_until = $until; ereg ('([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})', $until, $regs); $until = mktime($regs[4],$regs[5],$regs[6],$regs[2],$regs[3],$regs[1]); $recur_array[($start_date)][($hour.$minute)][$uid]['recur'][$key] = localizeDate($dateFormat_week,$until); break; case 'INTERVAL': if ($val > 0){ $number = $val; $recur_array[($start_date)][($hour.$minute)][$uid]['recur'][$key] = $number; } break; case 'BYSECOND': $bysecond = $val; $bysecond = split (',', $bysecond); $recur_array[($start_date)][($hour.$minute)][$uid]['recur'][$key] = $bysecond; break; case 'BYMINUTE': $byminute = $val; $byminute = split (',', $byminute); $recur_array[($start_date)][($hour.$minute)][$uid]['recur'][$key] = $byminute; break; case 'BYHOUR': $byhour = $val; $byhour = split (',', $byhour); $recur_array[($start_date)][($hour.$minute)][$uid]['recur'][$key] = $byhour; break; case 'BYDAY': $byday = $val; $byday = split (',', $byday); $recur_array[($start_date)][($hour.$minute)][$uid]['recur'][$key] = $byday; break; case 'BYMONTHDAY': $bymonthday = $val; $bymonthday = split (',', $bymonthday); $recur_array[($start_date)][($hour.$minute)][$uid]['recur'][$key] = $bymonthday; break; case 'BYYEARDAY': $byyearday = $val; $byyearday = split (',', $byyearday); $recur_array[($start_date)][($hour.$minute)][$uid]['recur'][$key] = $byyearday; break; case 'BYWEEKNO': $byweekno = $val; $byweekno = split (',', $byweekno); $recur_array[($start_date)][($hour.$minute)][$uid]['recur'][$key] = $byweekno; break; case 'BYMONTH': $bymonth = $val; $bymonth = split (',', $bymonth); $recur_array[($start_date)][($hour.$minute)][$uid]['recur'][$key] = $bymonth; break; case 'BYSETPOS': $bysetpos = $val; $recur_array[($start_date)][($hour.$minute)][$uid]['recur'][$key] = $bysetpos; break; case 'WKST': $wkst = $val; $recur_array[($start_date)][($hour.$minute)][$uid]['recur'][$key] = $wkst; break; case 'END': $recur = $recur_array[($start_date)][($hour.$minute)][$uid]['recur']; // Modify the COUNT based on BYDAY if ((isset ($byday) && is_array($byday)) && (isset($count))) { $blah = sizeof($byday); $count = ($count / $blah); unset ($blah); } if (!isset($number)) $number = 1; // if $until isn't set yet, we set it to the end of our range we're looking at if (!isset($until)) $until = $end_range_time; if (!isset($abs_until)) $abs_until = date('YmdHis', $end_range_time); $end_date_time = $until; $start_range_time_tmp = $start_range_time; $end_range_time_tmp = $end_range_time; // If the $end_range_time is less than the $start_date_time, or $start_range_time is greater // than $end_date_time, we may as well forget the whole thing // It doesn't do us any good to spend time adding data we aren't even looking at // this will prevent the year view from taking way longer than it needs to if ($end_range_time_tmp >= $start_date_time && $start_range_time_tmp <= $end_date_time) { // if the beginning of our range is less than the start of the item, we may as well set it equal to it if ($start_range_time_tmp < $start_date_time){ $start_range_time_tmp = $start_date_time; } if ($end_range_time_tmp > $end_date_time) $end_range_time_tmp = $end_date_time; // initialize the time we will increment $next_range_time = $start_range_time_tmp; // FIXME: This is a hack to fix repetitions with $interval > 1 if ($count > 1 && $number > 1) $count = 1 + ($count - 1) * $number; $count_to = 0; // start at the $start_range and go until we hit the end of our range. if(!isset($wkst)) $wkst='SU'; $wkst3char = two2threeCharDays($wkst); # set first instance if it's in range if ($start_unixtime < $mArray_end && $end_unixtime > $mArray_begin){ $recur_data[] = $start_unixtime; } while (($next_range_time >= $start_range_time_tmp) && ($next_range_time <= $end_range_time_tmp) && ($count_to != $count)) { $func = $freq_type.'Compare'; $diff = $func(date('Ymd',$next_range_time), $start_date); if ($diff < $count) { if ($diff % $number == 0) { $interval = $number; switch ($rrule_array['FREQ']) { case 'DAILY': $next_date_time = $next_range_time; $recur_data[] = $next_date_time; break; case 'WEEKLY': // Populate $byday with the default day if it's not set. if (!isset($byday)) { $byday[] = strtoupper(substr(date('D', $start_date_time), 0, 2)); } if (is_array($byday)) { foreach($byday as $day) { $day = two2threeCharDays($day); #need to find the first day of the appropriate week. #dateOfweek uses weekstartday as a global variable. This has to be changed to $wkst, #but then needs to be reset for other functions $week_start_day_tmp = $week_start_day; $week_start_day = $wkst3char; $the_sunday = dateOfWeek(date("Ymd",$next_range_time), $wkst3char); $next_date_time = strtotime($day,strtotime($the_sunday)) + (12 * 60 * 60); $week_start_day = $week_start_day_tmp; #see above reset to global value #reset $next_range_time to first instance in this week. if ($next_date_time < $next_range_time){ $next_range_time = $next_date_time; } // Since this renders events from $next_range_time to $next_range_time + 1 week, I need to handle intervals // as well. This checks to see if $next_date_time is after $day_start (i.e., "next week"), and thus // if we need to add $interval weeks to $next_date_time. if ($next_date_time > strtotime($week_start_day, $next_range_time) && $interval > 1) { # $next_date_time = strtotime('+'.($interval - 1).' '.$freq_type, $next_date_time); } $recur_data[] = $next_date_time; } } break; case 'MONTHLY': if (empty($bymonth)) $bymonth = array(1,2,3,4,5,6,7,8,9,10,11,12); $next_range_time = strtotime(date('Y-m-01', $next_range_time)); $next_date_time = $next_date_time; if (isset($bysetpos)){ /* bysetpos code from dustinbutler start on day 1 or last day. if day matches any BYDAY the count is incremented. SETPOS = 4, need 4th match SETPOS = -1, need 1st match */ $year = date('Y', $next_range_time); $month = date('m', $next_range_time); if ($bysetpos > 0) { $next_day = '+1 day'; $day = 1; } else { $next_day = '-1 day'; $day = $totalDays[$month]; } $day = mktime(0, 0, 0, $month, $day, $year); $countMatch = 0; while ($countMatch != abs($bysetpos)) { /* Does this day match a BYDAY value? */ $thisDay = $day; $textDay = strtoupper(substr(date('D', $thisDay), 0, 2)); if (in_array($textDay, $byday)) { $countMatch++; } $day = strtotime($next_day, $thisDay); } $recur_data[] = $thisDay; }elseif ((isset($bymonthday)) && (!isset($byday))) { foreach($bymonthday as $day) { if ($day < 0) $day = ((date('t', $next_range_time)) + ($day)) + 1; $year = date('Y', $next_range_time); $month = date('m', $next_range_time); if (checkdate($month,$day,$year)) { $next_date_time = mktime(0,0,0,$month,$day,$year); $recur_data[] = $next_date_time; } } } elseif (is_array($byday)) { foreach($byday as $day) { ereg ('([-\+]{0,1})?([0-9]{1})?([A-Z]{2})', $day, $byday_arr); //Added for 2.0 when no modifier is set if ($byday_arr[2] != '') { $nth = $byday_arr[2]-1; } else { $nth = 0; } $on_day = two2threeCharDays($byday_arr[3]); $on_day_num = two2threeCharDays($byday_arr[3],false); if ((isset($byday_arr[1])) && ($byday_arr[1] == '-')) { $last_day_tmp = date('t',$next_range_time); $next_range_time = strtotime(date('Y-m-'.$last_day_tmp, $next_range_time)); $last_tmp = (date('w',$next_range_time) == $on_day_num) ? '' : 'last '; $next_date_time = strtotime($last_tmp.$on_day, $next_range_time) - ($nth * 604800); $month = date('m', $next_date_time); if (in_array($month, $bymonth)) { $recur_data[] = $next_date_time; } #reset next_range_time to start of month $next_range_time = strtotime(date('Y-m-'.'1', $next_range_time)); } elseif (isset($bymonthday) && (!empty($bymonthday))) { // This supports MONTHLY where BYDAY and BYMONTH are both set foreach($bymonthday as $day) { $year = date('Y', $next_range_time); $month = date('m', $next_range_time); if (checkdate($month,$day,$year)) { $next_date_time = mktime(0,0,0,$month,$day,$year); $daday = strtolower(strftime("%a", $next_date_time)); if ($daday == $on_day && in_array($month, $bymonth)) { $recur_data[] = $next_date_time; } } } } elseif ((isset($byday_arr[1])) && ($byday_arr[1] != '-')) { $next_date_time = strtotime($on_day, strtotime($on_day, $next_range_time) + $nth * 604800); $month = date('m', $next_date_time); if (in_array($month, $bymonth)) { if (isset($next_date_time) && $next_date_time != '') $recur_data[] = $next_date_time; } } $next_date = date('Ymd', $next_date_time); } } break; case 'YEARLY': if ((!isset($bymonth)) || (sizeof($bymonth) == 0)) { $m = date('m', $start_date_time); $bymonth = array("$m"); } foreach($bymonth as $month) { // Make sure the month & year used is within the start/end_range. if ($month < date('m', $next_range_time)) { $year = date('Y', $next_range_time); } else { $year = date('Y', $next_range_time); } if (isset($bysetpos)){ /* bysetpos code from dustinbutler start on day 1 or last day. if day matches any BYDAY the count is incremented. SETPOS = 4, need 4th match SETPOS = -1, need 1st match */ if ($bysetpos > 0) { $next_day = '+1 day'; $day = 1; } else { $next_day = '-1 day'; $day = date("t",$month); } $day = mktime(12, 0, 0, $month, $day, $year); $countMatch = 0; while ($countMatch != abs($bysetpos)) { /* Does this day match a BYDAY value? */ $thisDay = $day; $textDay = strtoupper(substr(date('D', $thisDay), 0, 2)); if (in_array($textDay, $byday)) { $countMatch++; } $day = strtotime($next_day, $thisDay); } $recur_data[] = $thisDay; } if ((isset($byday)) && (is_array($byday))) { $checkdate_time = mktime(0,0,0,$month,1,$year); foreach($byday as $day) { ereg ('([-\+]{0,1})?([0-9]{1})?([A-Z]{2})', $day, $byday_arr); if ($byday_arr[2] != '') { $nth = $byday_arr[2]-1; } else { $nth = 0; } $on_day = two2threeCharDays($byday_arr[3]); $on_day_num = two2threeCharDays($byday_arr[3],false); if ($byday_arr[1] == '-') { $last_day_tmp = date('t',$checkdate_time); $checkdate_time = strtotime(date('Y-m-'.$last_day_tmp, $checkdate_time)); $last_tmp = (date('w',$checkdate_time) == $on_day_num) ? '' : 'last '; $next_date_time = strtotime($last_tmp.$on_day.' -'.$nth.' week', $checkdate_time); } else { $next_date_time = strtotime($on_day.' +'.$nth.' week', $checkdate_time); } } } else { $day = date('d', $start_date_time); $next_date_time = mktime(0,0,0,$month,$day,$year+1); //echo date('Ymd',$next_date_time).$summary.'<br>'; } if (isset($next_date_time) && $next_date_time != '') $recur_data[] = $next_date_time; } if (isset($byyearday)) { foreach ($byyearday as $yearday) { ereg ('([-\+]{0,1})?([0-9]{1,3})', $yearday, $byyearday_arr); if ($byyearday_arr[1] == '-') { $ydtime = mktime(0,0,0,12,31,$this_year); $yearnum = $byyearday_arr[2] - 1; $next_date_time = strtotime('-'.$yearnum.' days', $ydtime); } else { $ydtime = mktime(0,0,0,1,1,$this_year); $yearnum = $byyearday_arr[2] - 1; $next_date_time = strtotime('+'.$yearnum.' days', $ydtime); } if (isset($next_date_time) && $next_date_time != '') $recur_data[] = $next_date_time; } } break; default: // anything else we need to end the loop $next_range_time = $end_range_time_tmp + 100; $count_to = $count; } } else { $interval = 1; } $next_range_time = strtotime('+'.$interval.' '.$freq_type, $next_range_time); } else { // end the loop because we aren't going to write this event anyway $count_to = $count; } // use the same code to write the data instead of always changing it 5 times if (isset($recur_data) && is_array($recur_data)) { $recur_data_hour = @substr($start_time,0,2); $recur_data_minute = @substr($start_time,2,2); foreach($recur_data as $recur_data_time) { $recur_data_year = date('Y', $recur_data_time); $recur_data_month = date('m', $recur_data_time); $recur_data_day = date('d', $recur_data_time); $recur_data_date = $recur_data_year.$recur_data_month.$recur_data_day; if (($recur_data_time >= $start_date_time) && ($recur_data_time <= $end_date_time) && ($count_to != $count) && !in_array($recur_data_date, $except_dates)) { if (isset($allday_start) && $allday_start != '') { $start_time2 = $recur_data_time; $end_time2 = strtotime('+'.$diff_allday_days.' days', $recur_data_time); while ($start_time2 < $end_time2) { $start_date2 = date('Ymd', $start_time2); $master_array[($start_date2)][('-1')][$uid] = array ( 'event_text' => $summary, 'description' => $description, 'location' => $location, 'organizer' => serialize($organizer), 'attendee' => serialize($attendee), 'calnumber' => $calnumber, 'calname' => $actual_calname, 'url' => $url, 'status' => $status, 'class' => $class, 'recur' => $recur ); $start_time2 = strtotime('+1 day', $start_time2); } } else { $start_unixtime_tmp = mktime($recur_data_hour,$recur_data_minute,0,$recur_data_month,$recur_data_day,$recur_data_year); $end_unixtime_tmp = $start_unixtime_tmp + $length; if (($end_time >= $bleed_time) && ($bleed_check == '-1')) { $start_tmp = strtotime(date('Ymd',$start_unixtime_tmp)); $end_date_tmp = date('Ymd',$end_unixtime_tmp); while ($start_tmp < $end_unixtime_tmp) { $start_date_tmp = date('Ymd',$start_tmp); if ($start_date_tmp == $recur_data_year.$recur_data_month.$recur_data_day) { $time_tmp = $hour.$minute; $start_time_tmp = $start_time; } else { $time_tmp = '0000'; $start_time_tmp = '0000'; } if ($start_date_tmp == $end_date_tmp) { $end_time_tmp = $end_time; } else { $end_time_tmp = '2400'; $display_end_tmp = $end_time; } // Let's double check the until to not write past it $until_check = $start_date_tmp.$time_tmp.'00'; if ($abs_until > $until_check) { $master_array[$start_date_tmp][$time_tmp][$uid] = array ( 'event_start' => $start_time_tmp, 'event_end' => $end_time_tmp, 'start_unixtime' => $start_unixtime_tmp, 'end_unixtime' => $end_unixtime_tmp, 'event_text' => $summary, 'event_length' => $length, 'event_overlap' => 0, 'description' => $description, 'status' => $status, 'class' => $class, 'spans_day' => true, 'location' => $location, 'organizer' => serialize($organizer), 'attendee' => serialize($attendee), 'calnumber' => $calnumber, 'calname' => $actual_calname, 'url' => $url, 'recur' => $recur); if (isset($display_end_tmp)){ $master_array[$start_date_tmp][$time_tmp][$uid]['display_end'] = $display_end_tmp; } checkOverlap($start_date_tmp, $time_tmp, $uid); } $start_tmp = strtotime('+1 day',$start_tmp); } } else { if ($bleed_check == '-1') { $display_end_tmp = $end_time; $end_time_tmp1 = '2400'; } if (!isset($end_time_tmp1)) $end_time_tmp1 = $end_time; // Let's double check the until to not write past it $until_check = $recur_data_date.$hour.$minute.'00'; if ($abs_until > $until_check) { $master_array[($recur_data_date)][($hour.$minute)][$uid] = array ( 'event_start' => $start_time, 'event_end' => $end_time_tmp1, 'start_unixtime' => $start_unixtime_tmp, 'end_unixtime' => $end_unixtime_tmp, 'event_text' => $summary, 'event_length' => $length, 'event_overlap' => 0, 'description' => $description, 'status' => $status, 'class' => $class, 'spans_day' => false, 'location' => $location, 'organizer' => serialize($organizer), 'attendee' => serialize($attendee), 'calnumber' => $calnumber, 'calname' => $actual_calname, 'url' => $url, 'recur' => $recur); if (isset($display_end_tmp)){ $master_array[($recur_data_date)][($hour.$minute)][$uid]['display_end'] = $display_end_tmp; } checkOverlap($recur_data_date, ($hour.$minute), $uid); } } } } } } } #end while loop } # end if time compare unset($recur_data); } # end switch $key (rrule type) } # end foreach rrule // This should remove any exdates that were missed. // Added for version 0.9.5 modified in 2.22 remove anything that doesn't have an event_start if (is_array($except_dates)) { foreach ($except_dates as $key => $value) { if (isset ($master_array[$value])){ foreach ($master_array[$value] as $time => $value2){ if (!isset($value2[$uid]['event_start'])){ unset($master_array[$value][$time][$uid]); } } } } } // Clear event data now that it's been saved. unset($start_time, $start_time_tmp, $end_time, $end_time_tmp, $start_unixtime, $start_unixtime_tmp, $end_unixtime, $end_unixtime_tmp, $summary, $length, $description, $status, $class, $location, $organizer, $attendee); ?> --- NEW FILE: overlapping_events.php --- <?php // function to determine maximum necessary columns per day // actually an algorithm to get the smallest multiple for two numbers function kgv($a, $b) { $x = $a; $y = $b; while ($x != $y) { if ($x < $y) $x += $a; else $y += $b; } return $x; } // merge a given range into $ol_ranges. Returns the merged $ol_ranges. // if count = -2, treat as a "delete" call (for removeOverlap) // Why -2? That way, there's less fudging of the math in the code. function merge_range($ol_ranges, $start, $end, $count = 0) { foreach ($ol_ranges as $loop_range_key => $loop_range) { if ($start < $end) { // handle ranges between $start and $loop_range['start'] if ($start < $loop_range['start']) { $new_ol_ranges[] = array('count' => $count, 'start' => $start, 'end' => min($loop_range['start'], $end)); $start = $loop_range['start']; } // $start is always >= $loop_range['start'] at this point. // handles ranges between $loop_range['start'] and $loop_range['end'] if ($loop_range['start'] < $end && $start < $loop_range['end']) { // handles ranges between $loop_range['start'] and $start if ($loop_range['start'] < $start) { $new_ol_ranges[] = array('count' => $loop_range['count'], 'start' => $loop_range['start'], 'end' => $start); } // handles ranges between $start and $end (where they're between $loop_range['start'] and $loop_range['end']) $new_count = $loop_range['count'] + $count + 1; if ($new_count >= 0) { $new_ol_ranges[] = array('count' => $new_count, 'start' => $start, 'end' => min($loop_range['end'], $end)); } // handles ranges between $end and $loop_range['end'] if ($loop_range['end'] > $end) { $new_ol_ranges[] = array('count' => $loop_range['count'], 'start' => $end, 'end' => $loop_range['end']); } $start = $loop_range['end']; } else { $new_ol_ranges[] = $loop_range; } } else { $new_ol_ranges[] = $loop_range; } } // Catches anything left over. if ($start < $end) { $new_ol_ranges[] = array('count' => $count, 'start' => $start, 'end' => $end); } return $new_ol_ranges; } // Finds the highest value of 'count' in $ol_ranges function find_max_overlap($ol_ranges) { $count = 0; foreach ($ol_ranges as $loop_range) { if ($count < $loop_range['count']) $count = $loop_range['count']; } return $count; } // Merges overlapping blocks function flatten_ol_blocks($event_date, $ol_blocks, $new_block_key) { global $master_array; // Loop block = each other block in the array, the ones we're merging into new block. // New block = the changed block that caused the flatten_ol_blocks call. Everything gets merged into this. $new_block = $ol_blocks[$new_block_key]; reset($ol_blocks); while ($loop_block_array = each($ol_blocks)) { $loop_block_key = $loop_block_array['key']; $loop_block = $loop_block_array['value']; // only compare with other blocks if ($loop_block_key != $new_block_key) { // check if blocks overlap if (($loop_block['blockStart'] < $new_block['blockEnd']) && ($loop_block['blockEnd'] > $new_block['blockStart'])) { // define start and end of merged overlap block if ($new_block['blockStart'] > $loop_block['blockStart']) $ol_blocks[$new_block_key]['blockStart'] = $loop_block['blockStart']; if ($new_block['blockEnd'] < $loop_block['blockEnd']) $ol_blocks[$new_block_key]['blockEnd'] = $loop_block['blockEnd']; $ol_blocks[$new_block_key]['events'] = array_merge($new_block['events'], $loop_block['events']); $new_block['events'] = $ol_blocks[$new_block_key]['events']; foreach ($loop_block['overlapRanges'] as $ol_range) { $new_block['overlapRanges'] = merge_range($new_block['overlapRanges'], $ol_range['start'], $ol_range['end'], $ol_range['count']); } $ol_blocks[$new_block_key]['overlapRanges'] = $new_block['overlapRanges']; $ol_blocks[$new_block_key]['maxOverlaps'] = find_max_overlap($new_block['overlapRanges']); foreach ($ol_blocks[$new_block_key]['events'] as $event) { $master_array[$event_date][$event['time']][$event['key']]['event_overlap'] = $ol_blocks[$new_block_key]['maxOverlaps']; } unset($ol_blocks[$loop_block_key]); reset($ol_blocks); } } } return $ol_blocks; } // Builds $overlap_array structure, and updates event_overlap in $master_array for the given events. function checkOverlap($event_date, $event_time, $uid) { global $master_array, $overlap_array; if (!isset($event_date)) return; $event = $master_array[$event_date][$event_time][$uid]; // Copy out the array - we replace this at the end. $ol_day_array = $overlap_array[$event_date]; $drawTimes = drawEventTimes($event['event_start'], $event['event_end']); // For a given date, // - check to see if the event's already in a block, and if so, add it. // - make sure the new block doesn't overlap another block, and if so, merge the blocks. // - check that there aren't any events we already passed that we should handle. // - "flatten" the structure again, merging the blocks. // $overlap_array structure: // array of ($event_dates) // array of unique overlap blocks (no index) - // $overlap_block structure // 'blockStart' - $start_time of block - earliest $start_time of the events in the block. // Shouldn't be any overlap w/ a different overlap block in that day (as if they overlap, they get merged). // 'blockEnd' - $end_time of block - latest $end_time of the events in the block. // 'maxOverlaps' - max number of overlaps for the whole block (highest 'count' in overlapRanges) // 'events' - array of event "pointers" (no index) - each event in the block. // 'time' - $start_time of event in the block // 'key' - $uid of event // 'overlapRanges' - array of time ranges + overlap counts (no index) - the specific overlap info. // Shouldn't be any overlap w/ the overlap ranges in a given overlap_block - if there is overlap, the block should be split. // 'count' - number of overlaps that time range (can be zero if that range has no overlaps). // 'start' - start_time for the overlap block. // 'end' - end_time for the overlap block. $ol_day_array = $overlap_array[$event_date]; // Track if $event has been merged in, so we don't re-add the details to 'event' or 'overlapRanges' multiple times. $already_merged_once = false; // First, check the existing overlap blocks, see if the event overlaps with any. if (isset($ol_day_array)) { foreach ($ol_day_array as $loop_block_key => $loop_ol_block) { // Should $event be in this $ol_block? If so, add it. if ($loop_ol_block['blockStart'] < $drawTimes['draw_end'] && $loop_ol_block['blockEnd'] > $drawTimes['draw_start']) { // ... unless it's already in the $ol_block if (!in_array(array('time' => $drawTimes['draw_start'], 'key' => $uid), $loop_ol_block['events'])) { $loop_ol_block['events'][] = array('time' => $drawTimes['draw_start'], 'key' => $uid); if ($loop_ol_block['blockStart'] > $drawTimes['draw_start']) $loop_ol_block['blockStart'] = $drawTimes['draw_start']; if ($loop_ol_block['blockEnd'] < $drawTimes['draw_end']) $loop_ol_block['blockEnd'] = $drawTimes['draw_end']; // Merge in the new overlap range $loop_ol_block['overlapRanges'] = merge_range($loop_ol_block['overlapRanges'], $drawTimes['draw_start'], $drawTimes['draw_end']); $loop_ol_block['maxOverlaps'] = find_max_overlap($loop_ol_block['overlapRanges']); foreach ($loop_ol_block['events'] as $max_overlap_event) { $master_array[$event_date][$max_overlap_event['time']][$max_overlap_event['key']]['event_overlap'] = $loop_ol_block['maxOverlaps']; } $ol_day_array[$loop_block_key] = $loop_ol_block; $ol_day_array = flatten_ol_blocks($event_date, $ol_day_array, $loop_block_key); $already_merged_once = true; break; // Handle repeat calls to checkOverlap - semi-bogus since the event shouldn't be created more than once, but this makes sure we don't get an invalid event_overlap. } else { $master_array[$event_date][$event_time][$uid]['event_overlap'] = $loop_ol_block['maxOverlaps']; } } } } // Then, check all the events, make sure there isn't a new overlap that we need to create. foreach ($master_array[$event_date] as $time_key => $time) { // Skip all-day events for overlap purposes. if ($time_key != '-1') { foreach ($time as $loop_event_key => $loop_event) { // Make sure we haven't already dealt with the event, and we're not checking against ourself. if ($loop_event['event_overlap'] == 0 && $loop_event_key != $uid) { $loopDrawTimes = drawEventTimes($loop_event['event_start'], $loop_event['event_end']); if ($loopDrawTimes['draw_start'] < $drawTimes['draw_end'] && $loopDrawTimes['draw_end'] > $drawTimes['draw_start']) { if ($loopDrawTimes['draw_start'] < $drawTimes['draw_start']) { $block_start = $loopDrawTimes['draw_start']; } else { $block_start = $drawTimes['draw_start']; } if ($loopDrawTimes['draw_end'] > $drawTimes['draw_end']) { $block_end = $loopDrawTimes['draw_end']; } else { $block_end = $drawTimes['draw_end']; } $events = array(array('time' => $loopDrawTimes['draw_start'], 'key' => $loop_event_key)); $overlap_ranges = array(array('count' => 0, 'start' => $loopDrawTimes['draw_start'], 'end' => $loopDrawTimes['draw_end'])); // Only add $event if we haven't already put it in a block if (!$already_merged_once) { $events[] = array('time' => $drawTimes['draw_start'], 'key' => $uid); $overlap_ranges = merge_range($overlap_ranges, $drawTimes['draw_start'], $drawTimes['draw_end']); $already_merged_once = true; } $ol_day_array[] = array('blockStart' => $block_start, 'blockEnd' => $block_end, 'maxOverlaps' => 1, 'events' => $events, 'overlapRanges' => $overlap_ranges); foreach ($events as $max_overlap_event) { $master_array[$event_date][$max_overlap_event['time']][$max_overlap_event['key']]['event_overlap'] = 1; } // Make sure we pass in the key of the newly added item above. end($ol_day_array); $last_day_key = key($ol_day_array); $ol_day_array = flatten_ol_blocks($event_date, $ol_day_array, $last_day_key); } } } } } $overlap_array[$event_date] = $ol_day_array; //for debugging the checkOverlap function //if ($event_date == '20050506') { //print 'Date: ' . $event_date . ' / Time: ' . $event_time . ' / Key: ' . $uid . "<br />\n"; //print '<pre>'; //print_r($master_array[$event_date]); //print_r($overlap_array[$event_date]); //print '</pre>'; //} } // Remove an event from the overlap data. // This could be completely bogus, since overlap array is empty when this gets called in my tests, but I'm leaving it in anyways. function removeOverlap($ol_start_date, $ol_start_time, $ol_key) { global $master_array, $overlap_array; if (isset($overlap_array[$ol_start_date])) { if (sizeof($overlap_array[$ol_start_date]) > 0) { $ol_end_time = $master_array[$ol_start_date][$ol_start_time][$ol_key]['event_end']; foreach ($overlap_array[$ol_start_date] as $block_key => $block) { if (in_array(array('time' => $ol_start_time, 'key' => $ol_key), $block['events'])) { // Check if this is a 2-event block (i.e., there's no block left when we remove $ol_key // and if so, just unset it and move on. if (count($block['events']) == 2) { foreach ($block['events'] as $event) { $master_array[$ol_start_date][$event['time']][$event['key']]['event_overlap'] = 0; } unset($overlap_array[$ol_start_date][$block_key]); } else { // remove $ol_key from 'events' $event_key = array_search(array('time' => $ol_start_time, 'key' => $ol_key), $block['events']); unset($overlap_array[$ol_start_date][$block_key]['events'][$event_key]); // These may be bogus, since we're not using drawEventTimes. // "clean up" 'overlapRanges' and calc the new maxOverlaps. // use the special "-2" count to tell merge_range we're deleting. $overlap_array[$ol_start_date][$block_key]['overlapRanges'] = merge_range($block['overlapRanges'], $ol_start_time, $ol_end_time, -2); $overlap_array[$ol_start_date][$block_key]['maxOverlaps'] = find_max_overlap($block['overlapRanges']); // recreate blockStart and blockEnd from the other events, and fix maxOverlap while we're at it. $blockStart = $ol_end_time; $blockEnd = $ol_start_time; foreach ($overlap_array[$ol_start_date][$block_key]['events'] as $event) { $blockStart = min($blockStart, $event['time']); $blockEnd = max($blockEnd, $master_array[$ol_start_date][$event['time']][$event['key']]['event_end']); $master_array[$ol_start_date][$event['time']][$event['key']]['event_overlap'] = $overlap_array[$ol_start_date][$block_key]['maxOverlaps']; } $overlap_array[$ol_start_date][$block_key]['blockStart'] = $blockStart; $overlap_array[$ol_start_date][$block_key]['blockEnd'] = $blockEnd; } } } } } } ?> --- NEW FILE: parse_tzs.php --- <?php $ifile = @fopen($filename, "r"); if ($ifile == FALSE) exit(error($lang['l_error_cantopen'], $filename)); $nextline = fgets($ifile, 1024); if (trim($nextline) != 'BEGIN:VCALENDAR') exit(error($lang['l_error_invalidcal'], $filename)); // read file in line by line // XXX end line is skipped because of the 1-line readahead while (!feof($ifile)) { $line = $nextline; $nextline = fgets($ifile, 1024); $nextline = ereg_replace("[\r\n]", "", $nextline); #handle continuation lines that start with either a space or a tab (MS Outlook) while (isset($nextline{0}) && ($nextline{0} == " " || $nextline{0} == "\t")) { $line = $line . substr($nextline, 1); $nextline = fgets($ifile, 1024); $nextline = ereg_replace("[\r\n]", "", $nextline); } $line = trim($line); switch ($line) { case 'BEGIN:VTIMEZONE': unset($tz_name, $offset_from, $offset_to, $tz_id); break; case 'BEGIN:STANDARD': unset ($offset_s); break; case 'END:STANDARD': $offset_s = $offset_to; break; case 'BEGIN:DAYLIGHT': unset ($offset_d); break; case 'END:DAYLIGHT': $offset_d = $offset_to; break; case 'END:VTIMEZONE': $tz_array[$tz_id] = array($offset_s, $offset_d); #echo "<pre>$tz_id"; print_r($tz_array[$tz_id]);echo"</pre>"; break; 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': $tz_id = $data; break; case 'TZOFFSETFROM': $offset_from = $data; break; case 'TZOFFSETTO': $offset_to = $data; break; } } } } ?> |
Update of /cvsroot/phpicalendar/phpicalendar/functions/init In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv11887/functions/init Added Files: configs.php cpaths.php date_range.php sanitize.php set_error_reporting.php Log Message: add new files --- NEW FILE: configs.php --- <?php // 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'); 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' ); } if (isset($_COOKIE[$phpiCal_config->cookie_uri]) && !isset($_POST['unset'])) { $phpicalendar = unserialize(stripslashes($_COOKIE[$cookie_name])); 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']); if (isset($phpicalendar['cookie_view'])) $phpiCal_config->setProperty('default_view', $phpicalendar['cookie_view']); if (isset($phpicalendar['cookie_style']) && is_dir(BASE.'templates/'.$phpicalendar['cookie_style'].'/')){ $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']); } # language support # default to english and overwrite other strings as available unset($lang); include_once(BASE.'languages/english.inc.php'); $language = strtolower($phpiCal_config->language); $lang_file = BASE.'languages/'.$language.'.inc.php'; if (is_file($lang_file)) { include_once($lang_file); } $template = $phpiCal_config->template; $fillTime = $phpiCal_config->day_start; $day_array = array (); while ($fillTime < $phpiCal_config->day_end) { array_push ($day_array, $fillTime); preg_match ('/([0-9]{2})([0-9]{2})/', $fillTime, $dTime); $fill_h = $dTime[1]; $fill_min = $dTime[2]; $fill_min = sprintf('%02d', $fill_min + $phpiCal_config->gridLength); if ($fill_min == 60) { $fill_h = sprintf('%02d', ($fill_h + 1)); $fill_min = '00'; } $fillTime = $fill_h . $fill_min; } /* echo "<pre>xx"; print_r($configs); print_r($phpiCal_config); echo "</pre>"; #die; */ --- NEW FILE: cpaths.php --- <?php #cpath modifies the calendar path based on the url or cookie values. This allows you to run multiple calendar subsets from a single phpicalendar installation. Operations on cpath are largely hidden from the end user. if ($phpiCal_config->calendar_path == '') { $calendar_path = BASE.'calendars'; }else $calendar_path = $phpiCal_config->calendar_path; $cpath = ''; #initialize cpath to prevent later undef warnings. if(isset($_REQUEST['cpath'])&& $_REQUEST['cpath'] !=''){ $cpath = str_replace('..','',$_REQUEST['cpath']); $calendar_path .= "/$cpath"; # $tmp_dir .= "/$cpath"; }elseif(isset($phpiCal_config->default_cpath_check) && $phpiCal_config->default_cpath_check !='' ){ $cpath = str_replace('..','',$default_cpath_check); $calendar_path .= "/$cpath"; # $tmp_dir .= "/$cpath"; } #these need cpath to be set #set up specific template folder for a particular cpath if (isset($user_template["$cpath"])){ $template = $user_template["$cpath"]; } #set up specific webcals for a particular cpath if (isset($phpiCal_config->more_webcals) && is_array($phpiCal_config->more_webcals[$cpath])){ $list_webcals = array_merge($phpiCal_config->list_webcals, $phpiCal_config->more_webcals["$cpath"]); } --- NEW FILE: date_range.php --- <?php if (!isset($getdate)) { if (isset($_GET['getdate']) && ($_GET['getdate'] !== '')) { $getdate = $_GET['getdate']; } else { $getdate = date('Ymd', time() + $second_offset); } } preg_match ("/([0-9]{4})([0-9]{2})([0-9]{2})/", $getdate, $day_array2); $this_day = $day_array2[3]; $this_month = $day_array2[2]; $this_year = $day_array2[1]; # set bounds on master_array # mktime int mktime ( [int $hour [, int $minute [, int $second [, int $month [, int $day [, int $year [, int $is_dst]]]]]]] ) $start_month = $this_month - 1; $start_year = $this_year; $end_month = $this_month + 1; $end_year = $this_year; if ($this_month == 1){ $start_month = 12; $start_year--; } if ($this_month == 12){ $end_month = 1; $end_year++; } switch ($current_view){ case 'month': case 'week': case 'day': $mArray_begin = mktime (0,0,0,$start_month,21,($start_year)); $mArray_end = mktime (0,0,0,$end_month,12,($end_year)); break; default: $mArray_begin = mktime (0,0,0,12,21,($this_year - 1)); $mArray_end = mktime (0,0,0,1,12,($this_year + 1)); } --- NEW FILE: sanitize.php --- <?php /** * Sanitizes variables and arrays in a recursive manner * * This method was created as a result of strip_tags() happening on an array * would destroy the contents of the array. Thus, in order to avoid this from * happening we need checks to see if something is an array and to process * it as such. * * The only sanitizing this method provides is stripping non-allowed tags. * * @author Christopher Weldon <cw...@ta...> * @param mixed $value Value to be sanitized * @return mixed */ function recursiveSanitize($value) { if (is_array($value)) { $valmod = array(); foreach ($value as $key => $subval) { if (is_array($subval)) { $subval = recursiveSanitize($subval); } else { $subval = strip_tags($subval); } $valmod[$key] = $subval; } $value = $valmod; } else { $value = strip_tags($value); } return $value; } if (!isset($_SERVER) && isset($HTTP_SERVER_VARS)) { $_SERVER = &$HTTP_SERVER_VARS; } foreach ($_REQUEST as $key=>$val){ switch ($key){ case 'event_data': # modify this to allow or disallow different HTML tags in event popups $allowed = "<p><br><b><i><em><a><img><div><span><ul><ol><li><h1><h2><h3><h4><h5><h6><hr><em><strong><small><table><tr><td><th>"; $val = strip_tags($val,$allowed); break; default: # cpath $val = recursiveSanitize($val); } $_REQUEST[$key] = $val; } foreach ($_POST as $key=>$val){ switch ($key){ case 'action': $actions = array('login','logout','addupdate','delete'); if (!in_array($val,$actions)) $val = ''; break; case 'date': case 'time': if (!is_numeric($val)) $val = ''; break; default: $val = recursiveSanitize($val); } $_POST[$key] = $val; } foreach ($_GET as $key=>$val){ switch ($key){ case 'cal': if (!is_array($val)){ $val = strip_tags($val); $_GET['cal'] = strip_tags($val); }else{ unset ($_GET['cal']); foreach($val as $cal){ $_GET['cal'][]= strip_tags($cal); } } break; case 'getdate': if (!is_numeric($val)) $val = ''; break; default: $val = recursiveSanitize($val); } if ($key != 'cal') $_GET[$key] = $val; } foreach ($_COOKIE as $key=>$val){ switch ($key){ case 'time': if (!is_numeric($val)) $val = ''; break; default: $val = recursiveSanitize($val); } $_COOKIE[$key] = $val; } ?> --- NEW FILE: set_error_reporting.php --- <?php /* set error reporting config boolean $verbose_errors = false by default */ // uncomment when developing, comment for shipping version error_reporting (E_ERROR | E_WARNING | E_PARSE); #error_reporting(0); // Older versions of PHP do not define $_SERVER. Define it here instead. |
From: <ji...@us...> - 2008-12-11 22:18:17
|
Update of /cvsroot/phpicalendar/phpicalendar/functions/init In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv1624/functions/init Log Message: Directory /cvsroot/phpicalendar/phpicalendar/functions/init added to the repository |
From: <ji...@us...> - 2008-12-11 22:18:13
|
Update of /cvsroot/phpicalendar/phpicalendar/rss In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv1548/rss Modified Files: index.php rss.php rss1.0.php rss2.0.php Log Message: update lots of files Index: index.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/rss/index.php,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** index.php 10 Apr 2006 02:21:07 -0000 1.43 --- index.php 11 Dec 2008 21:54:53 -0000 1.44 *************** *** 8,12 **** require_once(BASE.'functions/calendar_functions.php'); ! if ($enable_rss != 'yes') { exit(error($lang['l_rss_notenabled'], $cal, '../')); } --- 8,12 ---- require_once(BASE.'functions/calendar_functions.php'); ! if ($phpiCal_config->enable_rss != 'yes') { exit(error($lang['l_rss_notenabled'], $cal, '../')); } *************** *** 26,30 **** $xml_icon ="<img src = 'xml.gif' alt='xml'>"; ! $filelist = availableCalendars($username, $password, $ALL_CALENDARS_COMBINED); foreach ($filelist as $file) { // $cal_filename is the filename of the calendar without .ics --- 26,30 ---- $xml_icon ="<img src = 'xml.gif' alt='xml'>"; ! $filelist = availableCalendars($username, $password, $phpiCal_config->ALL_CALENDARS_COMBINED); foreach ($filelist as $file) { // $cal_filename is the filename of the calendar without .ics Index: rss.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/rss/rss.php,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -d -r1.49 -r1.50 *** rss.php 16 Feb 2007 07:54:44 -0000 1.49 --- rss.php 11 Dec 2008 21:54:53 -0000 1.50 *************** *** 2,257 **** /******************************************************************************** ! * Modified from phpicalendar 2.0a distribution by Jim Hu ! * philosophical changes ! * - instead of having separate generators, use a date range for all views (done) ! * - change the rss generation method to conform to standards(not done) ! * PHP note: #@ is error control operator to suppress execution halt on error ! * - used below to deal with undef? ! * ! * using rssview, RSS feeds can be specified to return events for a given day, week, month, or year ! * feeds can be specified for a number of days to or from a given date ! * feeds can be specified for a range of dates ! * ! *********************************************************************************/ ! /* Modified from 2.21 by dyfrin 2006/03/08 19:09:28 ! Changes: ! -RSS changed to 2.0, encoding removed, languages converted to ISO standard for feeds ! -RSS title changed to be set by config.inc.php. Make sure that is added to it. ! Lines modified: 135-165, 208-223 ! Additional mods by J. Hu ! */ define('BASE', '../'); ! require(BASE.'functions/init.inc.php'); ! ! if ($enable_rss != 'yes') { ! die ("RSS feeds are not enabled on this site."); ! } ! ! include_once(BASE.'functions/date_functions.php'); ! //set the range of days to return based on the view chosen ! $rssview = $_GET['rssview']; ! if (isset($_GET['getdate']) && $_GET['getdate'] !=''){ ! $getdate = $_GET['getdate']; ! }else{ ! $getdate = date("Ymd"); } - # for all views, $fromdate is the first day to be shown and $todate should be the last day. - switch ($rssview){ - case 'day': - $fromdate = $getdate; - $todate = $getdate; - $theview = $lang['l_day']; - break; - case 'week': - $fromdate = dateOfWeek($getdate, 'Sunday'); - $todate = date("Ymd", strtotime($fromdate) + 6*24*60*60); - $theview = $lang['l_week']." of ".date('n/d/Y',strtotime($fromdate)); - break; - case 'month': - $parse_month = date ("Ym", strtotime($getdate)); - $fromdate = ($parse_month *100) + 1; - $todate = ($parse_month *100) + date("t",strtotime($getdate)); - $theview = date('M Y',strtotime($fromdate)); - break; - case 'year': - if(isset($_GET['year'])){ - $theyear = $_GET['year']; - }else{ - $theyear = substr($getdate,0,4); - } - $fromdate = ($theyear*10000)+101; - $todate = date("Ymd", strtotime($theyear*10000+1231)); - $theview = $theyear; - break; - case 'daysfrom': - $fromdate = $getdate; - $todate = date("Ymd", strtotime($getdate) + $_GET['days']*60*60*24); - $theview = $_GET['days']." days from ".date('n/d/Y',strtotime($fromdate)); - break; - case 'daysto': - $todate = $getdate; - $fromdate = date("Ymd", strtotime($getdate) - $_GET['days']*60*60*24); - $theview = $_GET['days']." days before ".date('n/d/Y',strtotime($todate)); - break; - case 'range': - if(isset($_GET['from'])){ - $fromdate = $_GET['from']; - }else{ - $fromdate = $getdate; - } - $todate = $_GET['to']; - $theview = date('n/d/Y',strtotime($fromdate)).'-'.date('n/d/Y',strtotime($todate)); - break; - default: - #default to week - $fromdate = dateOfWeek($getdate, 'Sunday'); - $todate = date("Ymd", strtotime($fromdate) + 6*24*60*60); - $theview = ""; } - #need to give ical_parser the most distant date to correctly set up master_array. - $getdate = $todate; - #echo "from:$fromdate to:$todate"; - - #Note that ical_parser supplies cal_displayname. - include(BASE.'functions/ical_parser.php'); ! $events_count = 0; ! ! // calculate a value for Last Modified and ETag ! $cal = implode(",",$cals); ! ! //get filemtime from master array ! $filemod = 0; #default to start of unix era, overwrite with most recent mtime from master array ! foreach ($master_array['-4'] as $calinfo){ ! if ($calinfo['mtime'] > $filemod) $filemod = $calinfo['mtime']; ! } ! $filemodtime = date("r", $filemod); ! ! //send relevant headers ! header ("Last-Modified: $filemodtime"); ! header ("ETag:\"$filemodtime\""); ! ! // checks the user agents headers to see if they kept track of our ! // stuff, if so be nice and send back a 304 and exit. ! ! if ( ($_SERVER['HTTP_IF_MODIFIED_SINCE'] == $filemodtime) || ($_SERVER['HTTP_IF_NONE_MATCH'] == $filemodtime)){ ! header ("HTTP/1.1 304 Not Modified"); ! exit; } ! /* Change languages to ISO 639-1 to validate RSS without changing long version in config.inc.php */ ! $user_language = array ("english", "polish", "german", "french", "dutch", "italian", "japanese", "norwegian", "spanish", "swedish", "portuguese", "catalan", "traditional_chinese", "esperanto", "korean"); ! $iso_language = array ("en", "pl", "de", "fr", "nl", "da", "it", "ja", "no", "es", "sv", "pt", "ca", "zh-tw", "eo", "ko"); ! $rss_language = str_replace($user_language, $iso_language, $language); ! /* End language modification */ ! ! $rss = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"."\n"; ! $rss .= '<!DOCTYPE rss PUBLIC "-//Netscape Communications//DTD RSS 0.91//EN" "http://my.netscape.com/publish/formats/rss-0.91.dtd">'."\n"; ! $rss .= '<rss version="0.91">'."\n"; ! $rss .= '<channel>'."\n"; ! $rss .= '<title>'.$cal_displayname; ! if ($theview !=""){$rss .= ' - '.$theview;} ! $rss .= "</title>\n"; ! ! $rss .= '<link>'.htmlspecialchars("$default_path").'</link>'."\n"; ! if (isset($cpath) && $cpath !='') $rss_link.="?cpath=$cpath"; ! $rss .= "<link>$rss_link</link>\n"; ! ! $rss .= '<description>'.$cal_displayname.' '.$lang['l_calendar'].' - '.$theview.'</description>'."\n"; ! $rss .= '<language>'.$rss_language.'</language>'."\n"; ! $rss .= '<copyright>Copyright '.date(Y).', '.htmlspecialchars ("$default_path").'</copyright>'."\n"; ! ! //generate the items ! $numdays = round((strtotime($todate) - strtotime($fromdate))/(60*60*24))+1; ! $thisdate = $fromdate; # start at beginning of date range, ! # note that usage of $thisdate is different from distribution ! # I use it as a date, dist uses it as a time ! $thistime = strtotime($thisdate); ! $i = 1; #day counter ! $uid_arr = array(); ! do { ! $thisdate=date('Ymd', $thistime); ! # echo "Date: $thisdate\ti:$i\tnumdays:$numdays<br>\n"; ! $dayofweek = localizeDate ("%a %b %e %Y", strtotime($thisdate)); ! if (isset($master_array[($thisdate)]) && sizeof($master_array[($thisdate)]) > 0) { ! foreach ($master_array[("$thisdate")] as $event_times) { ! foreach ($event_times as $uid=>$val) { ! #handle multiday all day events ! if(!$val["event_start"]){ ! if (isset($uid_arr[$uid])){ ! $uid_arr[$uid] .= "+$dayofweek" ; ! continue; ! }else{ ! $uid_arr[$uid] = "$dayofweek" ; ! } ! $event_start = $lang['l_all_day']; ! }else{ ! $event_start = @$val["event_start"]; ! $event_start = date ($timeFormat, @strtotime ("$event_start")); ! } ! $event_text = stripslashes(urldecode($val["event_text"])); ! $event_text = strip_tags($event_text, '<b><i><u>'); ! $event_text = str_replace('&','&',$event_text); ! $event_text = str_replace('&amp;','&',$event_text); ! # $event_text = urlencode($event_text); ! #uncomment for shorter event text with ... ! # $event_text = word_wrap($event_text, 21, $tomorrows_events_lines); ! $description = stripslashes(urldecode($val["description"])); ! $description = strip_tags($description, '<b><i><u>'); ! $description = str_replace('&','&',$description); ! $description = str_replace('&amp;','&',$description); ! ! ! $rss_title = urldecode ("$dayofweek: $event_text"); ! ! $urlcal = rawurlencode ("$cal"); ! if (isset($rss_link_to_event) && $rss_link_to_event == 'yes'){ ! $event_data = urlencode(serialize($val)); ! $rss_link = "$default_path/includes/event.php?getdate=$thisdate&cal=$cal&event_data=$event_data"; ! }else{ ! $rss_link = ("$default_path/day.php?getdate=$thisdate&cal=$urlcal"); ! ! } ! if (isset($cpath) && $cpath !='') $rss_link.="&cpath=$cpath"; ! ! $rss_description = htmlspecialchars ("$dayofweek $event_start: $description"); ! ! $rss .= '<item>'."\n"; ! $rss .= '<uid>'.$uid.'</uid>'."\n"; ! $rss .= '<event_start>'.$event_start.'</event_start>'."\n"; ! $rss .= '<title>'.$rss_title.'</title>'."\n"; ! /* custom stuff for Jim Hu's RSS feeds. Deprecated ! $rss .= '<seminardate>'.$dayofweek.'</seminardate>'."\n"; ! $rss .= '<seminarspeaker>'.$event_text.'</seminarspeaker>'."\n"; ! $rss .= '<seminartitle>'.$description.'</seminartitle>'."\n"; ! $rss .= '<tagged>'.$val["description"].'</tagged>'."\n"; ! $rss .= '<seminarhost>'.$val['attendee'].'</seminarhost>'."\n"; ! $rss .= '<organizer>'.$val['organizer'].'</organizer>'."\n"; ! $rss .= '<status>'.$val['status'].'</status>'."\n"; ! */ ! $rss .= '<link>'.$rss_link.'</link>'."\n"; ! $rss .= '<description>'.$rss_description.'</description>'."\n"; ! if (isset($val['location']) && $val['location'] !=''){ ! $location = str_replace('&','&',$val['location']); ! $location = str_replace('&amp;','&',$location); ! $rss .= '<location>'.$location."</location>\n"; ! } ! $rss .= '</item>'."\n"; ! $events_count++; ! } ! } ! } ! if (($events_count < 1) && ($i == $numdays)) { ! $rss .= '<item>'."\n"; ! $rss .= '<title>No events found</title>'."\n"; ! $rss .= '<link>'.htmlspecialchars ("$default_path").'</link>'."\n"; ! $rss .= '</item>'."\n"; ! } ! $thistime = $thistime+(60*60*24); # echo "$thisdate: ".strtotime($thisdate)."->$thistime<br>\n"; ! $i++; ! } while ($i <= $numdays); ! ! $rss .= '</channel>'."\n"; ! $rss .= '</rss>'."\n"; ! ! foreach ($uid_arr as $uid=>$date_range){ ! #echo "date_range:$date_range<br>"; ! ! if(strpos($date_range,"+")>0){ ! #echo "+ in date_range<br>"; ! $temp = explode("+",$date_range); ! $date_range = $temp[0].'-'.array_pop($temp); ! } ! $rss = str_replace("<uid>$uid</uid>\n<event_start>".$lang['l_all_day']."</event_start>","<uid>$uid</uid>\n<event_start>$date_range</event_start>", $rss); ! } - header ("Content-Type: text/xml"); - - echo "$rss"; ?> --- 2,78 ---- /******************************************************************************** ! Changed to use rss_common for date handling and loop ! *********************************************************************************/ define('BASE', '../'); ! $rss_version = '<rss version="0.91">'."\n"; + require(BASE.'rss/rss_common.php'); ! function rss_top(){ ! global $cal_displayname, $theview, $default_path, $cpath, $lang, $rss_link, $rss_language; ! $rss = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"."\n"; ! $rss .= '<!DOCTYPE rss PUBLIC "-//Netscape Communications//DTD RSS 0.91//EN" "http://my.netscape.com/publish/formats/rss-0.91.dtd">'."\n"; ! $rss .= '<rss version="0.91">'."\n"; ! $rss .= '<channel>'."\n"; ! $rss .= '<title>'.$cal_displayname; ! if ($theview !=""){$rss .= ' - '.$theview;} ! $rss .= "</title>\n"; ! ! $rss .= '<link>'.htmlspecialchars("$default_path").'</link>'."\n"; ! if (isset($cpath) && $cpath !='') $rss_link.="?cpath=$cpath"; ! $rss .= "<link>$rss_link</link>\n"; ! ! $rss .= '<description>'.$cal_displayname.' '.$lang['l_calendar'].' - '.$theview.'</description>'."\n"; ! $rss .= '<language>'.$rss_language.'</language>'."\n"; ! $rss .= '<copyright>Copyright '.date(Y).', '.htmlspecialchars ("$default_path").'</copyright>'."\n"; ! return $rss; } + function rss_li($rss_link, $uid){ + $return = ""; } ! function enclose_items($rss_items){ ! return $rss_items; } ! function rss_item(){ ! global $uid,$event_start,$rss_title,$rss_link, $dayofweek, $event_text, $rss_description, $val; ! $rss .= '<item>'."\n"; ! $rss .= '<uid>'.$uid.'</uid>'."\n"; ! $rss .= '<event_start>'.$event_start.'</event_start>'."\n"; ! $rss .= '<title>'.$rss_title.'</title>'."\n"; ! /* custom stuff for Jim Hu's RSS feeds. Deprecated ! $rss .= '<seminardate>'.$dayofweek.'</seminardate>'."\n"; ! $rss .= '<seminarspeaker>'.$event_text.'</seminarspeaker>'."\n"; ! $rss .= '<seminartitle>'.$description.'</seminartitle>'."\n"; ! $rss .= '<tagged>'.$val["description"].'</tagged>'."\n"; ! $rss .= '<seminarhost>'.$val['attendee'].'</seminarhost>'."\n"; ! $rss .= '<organizer>'.$val['organizer'].'</organizer>'."\n"; ! $rss .= '<status>'.$val['status'].'</status>'."\n"; ! */ ! $rss .= '<link>'.$rss_link.'</link>'."\n"; ! $rss .= '<description>'.$rss_description.'</description>'."\n"; ! if (isset($val['location']) && $val['location'] !=''){ ! $location = str_replace('&','&',$val['location']); ! $location = str_replace('&amp;','&',$location); ! $rss .= '<location>'.$location."</location>\n"; ! } ! $rss .= '</item>'."\n"; ! return $rss; ! } ! function rss_noitems(){ ! global $default_path; ! $rss .= '<item>'."\n"; ! $rss .= '<title>No events found</title>'."\n"; ! $rss .= '<link>'.htmlspecialchars ("$default_path").'</link>'."\n"; ! $rss .= '</item>'."\n"; ! return $rss; } + function rss_close(){ + return "</channel>\n</rss>\n"; + } ?> Index: rss1.0.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/rss/rss1.0.php,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** rss1.0.php 16 Feb 2007 07:54:44 -0000 1.6 --- rss1.0.php 11 Dec 2008 21:54:53 -0000 1.7 *************** *** 2,263 **** /******************************************************************************** ! * Modified from phpicalendar 2.0a distribution by Jim Hu ! * philosophical changes ! * - instead of having separate generators, use a date range for all views (done) ! * - change the rss generation method to conform to standards(not done) ! * PHP note: #@ is error control operator to suppress execution halt on error ! * - used below to deal with undef? ! * ! * using rssview, RSS feeds can be specified to return events for a given day, week, month, or year ! * feeds can be specified for a number of days to or from a given date ! * feeds can be specified for a range of dates ! * *********************************************************************************/ - /* Modified from 2.21 by dyfrin 2006/03/08 19:09:28 - Changes: - -RSS changed to 2.0, encoding removed, languages converted to ISO standard for feeds - -RSS title changed to be set by config.inc.php. Make sure that is added to it. - Lines modified: 135-165, 208-223 - Additional mods by J. Hu - */ define('BASE', '../'); ! require(BASE.'functions/init.inc.php'); ! ! if ($enable_rss != 'yes') { ! die ("RSS feeds are not enabled on this site."); } ! ! include_once(BASE.'functions/date_functions.php'); ! ! ! //set the range of days to return based on the view chosen ! $rssview = $_GET['rssview']; ! if (isset($_GET['getdate']) && $_GET['getdate'] !=''){ ! $getdate = $_GET['getdate']; ! }else{ ! $getdate = date("Ymd"); } - # for all views, $fromdate is the first day to be shown and $todate should be the last day. - switch ($rssview){ - case 'day': - $fromdate = $getdate; - $todate = $getdate; - $theview = $lang['l_day']; - break; - case 'week': - $fromdate = dateOfWeek($getdate, 'Sunday'); - $todate = $fromdate + 6; - $theview = $lang['l_week']." of ".date('n/d/Y',strtotime($fromdate)); - break; - case 'month': - $parse_month = date ("Ym", strtotime($getdate)); - $fromdate = ($parse_month *100) + 1; - $todate = ($parse_month *100) + date("t",strtotime($getdate)); - $theview = date('M Y',strtotime($fromdate)); - break; - case 'year': - if(isset($_GET['year'])){ - $theyear = $_GET['year']; - }else{ - $theyear = substr($getdate,0,4); - } - $fromdate = ($theyear*10000)+101; - $todate = date("Ymd", strtotime($theyear*10000+1231)); - $theview = $theyear; - break; - case 'daysfrom': - $fromdate = $getdate; - $todate = date("Ymd", strtotime($getdate) + $_GET['days']*60*60*24); - $theview = $_GET['days']." days from ".date('n/d/Y',strtotime($fromdate)); - break; - case 'daysto': - $todate = $getdate; - $fromdate = date("Ymd", strtotime($getdate) - $_GET['days']*60*60*24); - $theview = $_GET['days']." days before ".date('n/d/Y',strtotime($todate)); - break; - case 'range': - if(isset($_GET['from'])){ - $fromdate = $_GET['from']; - }else{ - $fromdate = $getdate; - } - $todate = $_GET['to']; - $theview = date('n/d/Y',strtotime($fromdate)).'-'.date('n/d/Y',strtotime($todate)); - break; - default: - #default to week - $fromdate = dateOfWeek($getdate, 'Sunday'); - $todate = $fromdate + 6; - $theview = ""; } - #need to give ical_parser the most distant date to correctly set up master_array. - $getdate = $todate; - #echo "from:$fromdate to:$todate"; - - #Note that ical_parser supplies cal_displayname. - include(BASE.'functions/ical_parser.php'); - - $events_count = 0; ! // calculate a value for Last Modified and ETag ! $cal = implode(",",$cals); ! ! //get filemtime from master array ! $filemod = 0; #default to start of unix era, overwrite with most recent mtime from master array ! foreach ($master_array['-4'] as $calinfo){ ! if ($calinfo['mtime'] > $filemod) $filemod = $calinfo['mtime']; ! } ! $filemodtime = date("r", $filemod); ! ! //send relevant headers ! header ("Last-Modified: $filemodtime"); ! header ("ETag:\"$filemodtime\""); ! // checks the user agents headers to see if they kept track of our ! // stuff, if so be nice and send back a 304 and exit. ! if ( ($_SERVER['HTTP_IF_MODIFIED_SINCE'] == $filemodtime) || ($_SERVER['HTTP_IF_NONE_MATCH'] == $filemodtime)){ ! header ("HTTP/1.1 304 Not Modified"); ! exit; } ! /* Change languages to ISO 639-1 to validate RSS without changing long version in config.inc.php */ ! $user_language = array ("english", "polish", "german", "french", "dutch", "italian", "japanese", "norwegian", "spanish", "swedish", "portuguese", "catalan", "traditional_chinese", "esperanto", "korean"); ! $iso_language = array ("en", "pl", "de", "fr", "nl", "da", "it", "ja", "no", "es", "sv", "pt", "ca", "zh-tw", "eo", "ko"); ! $rss_language = str_replace($user_language, $iso_language, $language); ! /* End language modification */ ! ! $rss = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"."\n"; ! ! /* Use 1.0 and strip encoding, use rss_language */ ! $rss .= '<rdf:RDF ! xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" ! xmlns:ev="http://purl.org/rss/1.0/modules/event/" ! xmlns:dc="http://purl.org/dc/elements/1.1/" ! xmlns="http://purl.org/rss/1.0/">'."\n"; ! ! $rss .= '<channel rdf:about="'.$default_path.'/rss/rss.php/'; ! if (isset($cpath) && $cpath !='') $rss_link.="?cpath=$cpath"; ! $rss .='">'."\n"; ! ! $rss .= '<title>'.$cal_displayname; ! if ($theview !=""){$rss .= ' - '.$theview;} ! $rss .= "</title>\n"; ! ! $rss .= '<link>'.htmlspecialchars("$default_path").'</link>'."\n"; ! $rss .= '<description>'.$cal_displayname.' '.$lang['l_calendar'].' - '.$theview.'</description>'."\n"; ! #$rss .= '<language>'.$rss_language.'</language>'."\n"; ! ! ! //generate the items ! $numdays = round((strtotime($todate) - strtotime($fromdate))/(60*60*24))+1; ! $thisdate = $fromdate; # start at beginning of date range, ! # note that usage of $thisdate is different from distribution ! # I use it as a date, dist uses it as a time ! $i = 1; #day counter ! ! $rss .= "<items>\n<rdf:Seq>\n"; ! $rss_items =''; ! $uid_arr = array(); ! do { ! $thisdate=date('Ymd', strtotime($thisdate)); ! #echo "Date: $thisdate<br>\n"; ! $dayofweek = localizeDate ("%a %b %e %Y", strtotime($thisdate)); ! if (isset($master_array[($thisdate)]) && sizeof($master_array[($thisdate)]) > 0) { ! foreach ($master_array[("$thisdate")] as $event_times) { ! foreach ($event_times as $uid=>$val) { ! #handle multiday all day events ! if(!$val["event_start"]){ ! if (isset($uid_arr[$uid])){ ! $uid_arr[$uid] .= "+$dayofweek" ; ! continue; ! }else{ ! $uid_arr[$uid] = "$dayofweek" ; ! } ! $event_start = $lang['l_all_day']; ! }else{ ! $event_start = @$val["event_start"]; ! $event_start = date ($timeFormat, @strtotime ("$event_start")); ! } ! $event_text = stripslashes(urldecode($val["event_text"])); ! $event_text = strip_tags($event_text, '<b><i><u>'); ! # $event_text = urlencode($event_text); ! #uncomment for shorter event text with ... ! # $event_text = word_wrap($event_text, 21, $tomorrows_events_lines); ! $description = stripslashes(urldecode($val["description"])); ! $description = strip_tags($description, '<b><i><u>'); ! ! $rss_title = htmlspecialchars ("$dayofweek: $event_text"); ! /* original link, not valid url coding ! $rss_link = htmlspecialchars ("$default_path/day.php?getdate=$thisdate&cal=$cal&cpath=$cpath"); ! */ ! /* Add %20's for spaces for the calendar links to make them valid url's */ ! $urlcal = rawurlencode ("$cal"); ! ! if (isset($rss_link_to_event) && $$rss_link_to_event == 'yes'){ ! $event_data = urlencode(serialize($val)); ! $rss_link = "$default_path/includes/event.php?getdate=$thisdate&cal=$cal&event_data=$event_data"; ! }else{ ! $rss_link = ("$default_path/day.php?getdate=$thisdate&cal=$urlcal"); ! ! } ! if (isset($cpath) && $cpath !='') $rss_link.="&cpath=$cpath"; ! /* End link modification */ ! ! $rss_description = htmlspecialchars ("$dayofweek $event_start: $description"); ! ! $rss .= '<rdf:li rdf:resource="'.$rss_link.'&uid='.$uid.'/" />'."\n"; ! $rss_items .= '<item rdf:about="'.$rss_link.'&uid='.$uid.'/">'."\n"; ! ! /* Create guid, and use uid to make link unique */ ! # $rss .= '<guid isPermaLink="false">'.$rss_link.$uid.'</guid>'."\n"; ! /* End guid modification */ ! $rss_items .= '<title>'.$rss_title.'</title>'."\n"; ! $rss_items .= '<ev:startdate>'.date("Y-m-d", strtotime($thisdate)).'T'.date("h:m:s",$val["event_start"]).'</ev:startdate>'."\n"; ! $rss_items .= '<ev:enddate>'.date("Y-m-d", strtotime($thisdate)).'T'.date("h:m:s",$val["event_start"]).'</ev:enddate>'."\n"; ! ! $rss_items .= '<link>'.$rss_link.'</link>'."\n"; ! $rss_items .= '<description>'.$rss_description.'</description>'."\n"; ! if (isset($val['location']) && $val['location'] !=''){ ! $location = str_replace('&','&',$val['location']); ! $location = str_replace('&amp;','&',$location); ! $rss_items .= '<ev:location>'.$location."</ev:location>\n"; ! } ! $rss_items .= '</item>'."\n"; ! $events_count++; ! } ! } ! } ! if (($events_count < 1) && ($i == $numdays)) { ! $rss_items .= '<item rdf:about="'.$default_path."\">\n"; ! $rss_items .= '<title>No events found</title>'."\n"; ! $rss_items .= '<link>'.htmlspecialchars ("$default_path").'</link>'."\n"; ! $rss_items .= '</item>'."\n"; ! } ! $thisdate++; ! $i++; ! } while ($i <= $numdays); ! ! $rss .= "</rdf:Seq>\n</items>\n"; ! $rss .= "</channel>\n"; ! $rss .= $rss_items.'</rdf:RDF>'."\n"; ! ! foreach ($uid_arr as $uid=>$date_range){ ! #echo "date_range:$date_range<br>"; ! ! if(strpos($date_range,"+")>0){ ! #echo "+ in date_range<br>"; ! $temp = explode("+",$date_range); ! $date_range = $temp[0].'-'.array_pop($temp); ! } ! $rss = str_replace("<uid>$uid</uid>\n<event_start>".$lang['l_all_day']."</event_start>","<uid>$uid</uid>\n<event_start>$date_range</event_start>", $rss); ! } - header ("Content-Type: text/xml"); - - echo "$rss"; ?> --- 2,76 ---- /******************************************************************************** ! changed to use rss_common ! J. Hu 12/10/2008 *********************************************************************************/ define('BASE', '../'); ! require(BASE.'rss/rss_common.php'); ! function rss_top(){ ! global $cal_displayname, $theview, $default_path, $cpath, $lang, $rss_link, $rss_language; ! $rss = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"."\n"; ! ! /* Use 1.0 and strip encoding, use rss_language */ ! $rss .= '<rdf:RDF ! xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" ! xmlns:ev="http://purl.org/rss/1.0/modules/event/" ! xmlns:dc="http://purl.org/dc/elements/1.1/" ! xmlns="http://purl.org/rss/1.0/">'."\n"; ! ! $rss .= '<channel rdf:about="'.$default_path.'/rss/rss.php/'; ! if (isset($cpath) && $cpath !='') $rss_link.="?cpath=$cpath"; ! $rss .='">'."\n"; ! ! $rss .= '<title>'.$cal_displayname; ! if ($theview !=""){$rss .= ' - '.$theview;} ! $rss .= "</title>\n"; ! ! $rss .= '<link>'.htmlspecialchars("$default_path").'</link>'."\n"; ! $rss .= '<description>'.$cal_displayname.' '.$lang['l_calendar'].' - '.$theview.'</description>'."\n"; ! #$rss .= '<language>'.$rss_language.'</language>'."\n"; ! return $rss; } ! function rss_li($rss_link, $uid){ ! return '<rdf:li rdf:resource="'.$rss_link.'&uid='.$uid.'/" />'."\n"; } + function enclose_items($rss_items){ + return "<items>\n<rdf:Seq>\n".$rss_items."</rdf:Seq>\n</items>\n</channel>\n"; } ! function rss_item(){ ! global $uid,$event_start,$rss_title,$rss_link, $dayofweek, $event_text, $rss_description, $val; ! $rss_item = '<item rdf:about="'.$rss_link.'&uid='.$uid.'/">'."\n"; ! /* Create guid, and use uid to make link unique */ ! # $rss .= '<guid isPermaLink="false">'.$rss_link.$uid.'</guid>'."\n"; ! /* End guid modification */ ! $rss_item .= '<title>'.$rss_title.'</title>'."\n"; ! $rss_item .= '<ev:startdate>'.date("Y-m-d", strtotime($thisdate)).'T'.date("h:m:s",$val["event_start"]).'</ev:startdate>'."\n"; ! $rss_item .= '<ev:enddate>'.date("Y-m-d", strtotime($thisdate)).'T'.date("h:m:s",$val["event_start"]).'</ev:enddate>'."\n"; ! $rss_item .= '<link>'.$rss_link.'</link>'."\n"; ! $rss_item .= '<description>'.$rss_description.'</description>'."\n"; ! if (isset($val['location']) && $val['location'] !=''){ ! $location = str_replace('&','&',$val['location']); ! $location = str_replace('&amp;','&',$location); ! $rss_item .= '<ev:location>'.$location."</ev:location>\n"; ! } ! $rss_item .= '</item>'."\n"; ! return $rss_item; } ! function rss_noitems(){ ! $rss_item = '<item rdf:about="'.$default_path."\">\n"; ! $rss_item .= '<title>No events found</title>'."\n"; ! $rss_item .= '<link>'.htmlspecialchars ("$default_path").'</link>'."\n"; ! $rss_item .= '</item>'."\n"; ! return $rss_item; } + function rss_close(){ + return "</rdf:RDF>\n"; + } ?> Index: rss2.0.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/rss/rss2.0.php,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** rss2.0.php 16 Feb 2007 07:54:44 -0000 1.5 --- rss2.0.php 11 Dec 2008 21:54:53 -0000 1.6 *************** *** 23,264 **** define('BASE', '../'); ! require(BASE.'functions/init.inc.php'); ! if ($enable_rss != 'yes') { ! die ("RSS feeds are not enabled on this site."); } ! include_once(BASE.'functions/date_functions.php'); ! ! ! //set the range of days to return based on the view chosen ! $rssview = $_GET['rssview']; ! if (isset($_GET['getdate']) && $_GET['getdate'] !=''){ ! $getdate = $_GET['getdate']; ! }else{ ! $getdate = date("Ymd"); } - # for all views, $fromdate is the first day to be shown and $todate should be the last day. - switch ($rssview){ - case 'day': - $fromdate = $getdate; - $todate = $getdate; - $theview = $lang['l_day']; - break; - case 'week': - $fromdate = dateOfWeek($getdate, 'Sunday'); - $todate = $fromdate + 6; - $theview = $lang['l_week']." of ".date('n/d/Y',strtotime($fromdate)); - break; - case 'month': - $parse_month = date ("Ym", strtotime($getdate)); - $fromdate = ($parse_month *100) + 1; - $todate = ($parse_month *100) + date("t",strtotime($getdate)); - $theview = date('M Y',strtotime($fromdate)); - break; - case 'year': - if(isset($_GET['year'])){ - $theyear = $_GET['year']; - }else{ - $theyear = substr($getdate,0,4); - } - $fromdate = ($theyear*10000)+101; - $todate = date("Ymd", strtotime($theyear*10000+1231)); - $theview = $theyear; - break; - case 'daysfrom': - $fromdate = $getdate; - $todate = date("Ymd", strtotime($getdate) + $_GET['days']*60*60*24); - $theview = $_GET['days']." days from ".date('n/d/Y',strtotime($fromdate)); - break; - case 'daysto': - $todate = $getdate; - $fromdate = date("Ymd", strtotime($getdate) - $_GET['days']*60*60*24); - $theview = $_GET['days']." days before ".date('n/d/Y',strtotime($todate)); - break; - case 'range': - if(isset($_GET['from'])){ - $fromdate = $_GET['from']; - }else{ - $fromdate = $getdate; - } - $todate = $_GET['to']; - $theview = date('n/d/Y',strtotime($fromdate)).'-'.date('n/d/Y',strtotime($todate)); - break; - default: - #default to week - $fromdate = dateOfWeek($getdate, 'Sunday'); - $todate = $fromdate + 6; - $theview = ""; } - #need to give ical_parser the most distant date to correctly set up master_array. - $getdate = $todate; - #echo "from:$fromdate to:$todate"; - - #Note that ical_parser supplies cal_displayname. - include(BASE.'functions/ical_parser.php'); - - $events_count = 0; - - // calculate a value for Last Modified and ETag - $cal = implode(",",$cals); - - //get filemtime from master array - $filemod = 0; #default to start of unix era, overwrite with most recent mtime from master array - foreach ($master_array['-4'] as $calinfo){ - if ($calinfo['mtime'] > $filemod) $filemod = $calinfo['mtime']; - } - $filemodtime = date("r", $filemod); - - //send relevant headers - header ("Last-Modified: $filemodtime"); - header ("ETag:\"$filemodtime\""); ! // checks the user agents headers to see if they kept track of our ! // stuff, if so be nice and send back a 304 and exit. ! if ( ($_SERVER['HTTP_IF_MODIFIED_SINCE'] == $filemodtime) || ($_SERVER['HTTP_IF_NONE_MATCH'] == $filemodtime)) ! { ! # header ("HTTP/1.1 304 Not Modified"); ! # exit; } ! /* Change languages to ISO 639-1 to validate RSS without changing long version in config.inc.php */ ! $user_language = array ("english", "polish", "german", "french", "dutch", "italian", "japanese", "norwegian", "spanish", "swedish", "portuguese", "catalan", "traditional_chinese", "esperanto", "korean"); ! $iso_language = array ("en", "pl", "de", "fr", "nl", "da", "it", "ja", "no", "es", "sv", "pt", "ca", "zh-tw", "eo", "ko"); ! $rss_language = str_replace($user_language, $iso_language, $language); ! /* End language modification */ ! ! $rss = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"."\n"; ! #$rss .= '<!DOCTYPE rss PUBLIC "-//Netscape Communications//DTD RSS 2.01//EN" "http://my.netscape.com/publish/formats/rss-0.91.dtd">'."\n"; ! ! /* Use 2.0 and strip encoding, use rss_language */ ! $rss .= '<rss version="2.0"'."\n"; ! $rss .= 'xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" ! xmlns:ev="http://purl.org/rss/1.0/modules/event/" ! xmlns:dc="http://purl.org/dc/elements/1.1/" ! >'."\n"; ! $rss .= '<channel>'."\n"; ! ! ! $rss .= '<title>'.$cal_displayname; ! if ($theview !=""){$rss .= ' - '.$theview;} ! $rss .= "</title>\n"; ! ! $rss .= '<link>'.$default_path.'/rss/rss2.0.php/'; ! if (isset($cpath) && $cpath !='') $rss_link.="?cpath=$cpath"; ! $rss .='</link>'."\n"; ! $rss .= '<description>'.$cal_displayname.' '.$lang['l_calendar'].' - '.$theview.'</description>'."\n"; ! $rss .= '<language>'.$rss_language.'</language>'."\n"; ! ! ! /* End rss 2.0 modification */ ! ! ! //generate the items ! $numdays = round((strtotime($todate) - strtotime($fromdate))/(60*60*24))+1; ! $thisdate = $fromdate; # start at beginning of date range, ! # note that usage of $thisdate is different from distribution ! # I use it as a date, dist uses it as a time ! $i = 1; #day counter ! ! #$rss .= "<items>\n<rdf:Seq>\n"; ! $uid_arr = array(); ! do { ! $thisdate=date('Ymd', strtotime($thisdate)); ! #echo "Date: $thisdate<br>\n"; ! $dayofweek = localizeDate ("%a %b %e %Y", strtotime($thisdate)); ! if (isset($master_array[($thisdate)]) && sizeof($master_array[($thisdate)]) > 0) { ! foreach ($master_array[("$thisdate")] as $event_times) { ! foreach ($event_times as $uid=>$val) { ! #handle multiday all day events ! if(!$val["event_start"]){ ! if (isset($uid_arr[$uid])){ ! $uid_arr[$uid] .= "+$dayofweek" ; ! continue; ! }else{ ! $uid_arr[$uid] = "$dayofweek" ; ! } ! $event_start = $lang['l_all_day']; ! }else{ ! $event_start = @$val["event_start"]; ! $event_start = date ($timeFormat, @strtotime ("$event_start")); ! } ! $event_text = stripslashes(urldecode($val["event_text"])); ! $event_text = strip_tags($event_text, '<b><i><u>'); ! # $event_text = urlencode($event_text); ! #uncomment for shorter event text with ... ! # $event_text = word_wrap($event_text, 21, $tomorrows_events_lines); ! $description = stripslashes(urldecode($val["description"])); ! $description = strip_tags($description, '<b><i><u>'); ! ! $rss_title = htmlspecialchars ("$dayofweek: $event_text"); ! /* original link, not valid url coding ! $rss_link = htmlspecialchars ("$default_path/day.php?getdate=$thisdate&cal=$cal&cpath=$cpath"); ! */ ! /* Add %20's for spaces for the calendar links to make them valid url's */ ! $urlcal = rawurlencode ("$cal"); ! if (isset($rss_link_to_event) && $$rss_link_to_event == 'yes'){ ! $event_data = urlencode(serialize($val)); ! $rss_link = "$default_path/includes/event.php?getdate=$thisdate&cal=$cal&event_data=$event_data"; ! }else{ ! $rss_link = ("$default_path/day.php?getdate=$thisdate&cal=$urlcal"); ! ! } ! if (isset($cpath) && $cpath !='') $rss_link.="&cpath=$cpath"; ! /* End link modification */ ! $rss_description = htmlspecialchars ("$dayofweek $event_start: $description"); ! ! #$rss .= '<rdf:li rdf:resource="'.$rss_link.'&uid='.$uid.'/" />'."\n"; ! $rss .= '<item>'."\n"; ! ! /* Create guid, and use uid to make link unique */ ! $rss .= '<guid isPermaLink="false">'.$rss_link.'&uid='.$uid.'</guid>'."\n"; ! /* End guid modification */ ! $rss .= '<title>'.$rss_title.'</title>'."\n"; ! $rss .= '<ev:startdate>'.date("Y-m-d", strtotime($thisdate)).'T'.date("h:m:s",$val["event_start"]).'</ev:startdate>'."\n"; ! $rss .= '<ev:enddate>'.date("Y-m-d", strtotime($thisdate)).'T'.date("h:m:s",$val["event_start"]).'</ev:enddate>'."\n"; ! ! $rss .= '<link>'.$rss_link.'</link>'."\n"; ! $rss .= '<description>'.$rss_description.'</description>'."\n"; ! if (isset($val['location']) && $val['location'] !=''){ ! $location = str_replace('&','&',$val['location']); ! $location = str_replace('&amp;','&',$location); ! $rss .= '<ev:location>'.$location."</ev:location>\n"; ! } ! $rss .= '</item>'."\n"; ! $events_count++; ! } ! } ! } ! if (($events_count < 1) && ($i == $numdays)) { ! $rss .= '<item>'."\n"; ! $rss .= '<guid isPermaLink="false">'.$default_path.'&uid='.$thisdate.'</guid>'."\n"; ! $rss .= '<title>No events found</title>'."\n"; ! $rss .= '<link>'.htmlspecialchars ("$default_path").'</link>'."\n"; ! $rss .= '</item>'."\n"; ! } ! $thisdate++; ! $i++; ! } while ($i <= $numdays); ! ! #$rss .= "</rdf:Seq>\n</items>\n"; ! $rss .= "\n</channel>\n</rss>\n"; ! ! foreach ($uid_arr as $uid=>$date_range){ ! #echo "date_range:$date_range<br>"; ! ! if(strpos($date_range,"+")>0){ ! #echo "+ in date_range<br>"; ! $temp = explode("+",$date_range); ! $date_range = $temp[0].'-'.array_pop($temp); ! } ! $rss = str_replace("<uid>$uid</uid>\n<event_start>".$lang['l_all_day']."</event_start>","<uid>$uid</uid>\n<event_start>$date_range</event_start>", $rss); ! } - header ("Content-Type: text/xml"); - - echo "$rss"; ?> --- 23,89 ---- define('BASE', '../'); ! require(BASE.'rss/rss_common.php'); ! function rss_top(){ ! global $cal_displayname, $theview, $default_path, $cpath, $lang, $rss_link, $rss_language; ! $rss = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"."\n"; ! /* Use 2.0 and strip encoding, use rss_language */ ! $rss .= '<rss version="2.0"'."\n"; ! $rss .= 'xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" ! xmlns:ev="http://purl.org/rss/1.0/modules/event/" ! xmlns:dc="http://purl.org/dc/elements/1.1/">'."\n"; ! $rss .= '<channel>'."\n"; ! $rss .= '<title>'.$cal_displayname; ! if ($theview !=""){$rss .= ' - '.$theview;} ! $rss .= "</title>\n"; ! ! $rss .= '<link>'.$default_path.'/rss/rss2.0.php/'; ! if (isset($cpath) && $cpath !='') $rss_link.="?cpath=$cpath"; ! $rss .='</link>'."\n"; ! $rss .= '<description>'.$cal_displayname.' '.$lang['l_calendar'].' - '.$theview.'</description>'."\n"; ! $rss .= '<language>'.$rss_language.'</language>'."\n"; ! return $rss; } ! function rss_li($rss_link, $uid){ ! $return = ""; } + function enclose_items($rss_items){ + return $rss_items; } ! function rss_item(){ ! global $uid,$event_start,$rss_title,$rss_link, $dayofweek, $event_text, $rss_description, $val, $thisdate; ! $rss = '<item>'."\n"; ! /* Create guid, and use uid to make link unique */ ! $rss .= '<guid isPermaLink="false">'.$rss_link.'&uid='.$uid.'</guid>'."\n"; ! /* End guid modification */ ! $rss .= '<title>'.$rss_title.'</title>'."\n"; ! $rss .= '<ev:startdate>'.date("Y-m-d", strtotime($thisdate)).'T'.date("h:m:s",$val["event_start"]).'</ev:startdate>'."\n"; ! $rss .= '<ev:enddate>'.date("Y-m-d", strtotime($thisdate)).'T'.date("h:m:s",$val["event_start"]).'</ev:enddate>'."\n"; ! $rss .= '<link>'.$rss_link.'</link>'."\n"; ! $rss .= '<description>'.$rss_description.'</description>'."\n"; ! if (isset($val['location']) && $val['location'] !=''){ ! $location = str_replace('&','&',$val['location']); ! $location = str_replace('&amp;','&',$location); ! $rss .= '<ev:location>'.$location."</ev:location>\n"; ! } ! $rss .= '</item>'."\n"; ! return $rss; } ! function rss_noitems(){ ! $rss = '<item>'."\n"; ! $rss .= '<guid isPermaLink="false">'.$default_path.'&uid='.$thisdate.'</guid>'."\n"; ! $rss .= '<title>No events found</title>'."\n"; ! $rss .= '<link>'.htmlspecialchars ("$default_path").'</link>'."\n"; ! $rss .= '</item>'."\n"; ! return $rss; } + function rss_close(){ + return "\n</channel>\n</rss>\n"; + } ?> |
From: <ji...@us...> - 2008-12-11 22:18:10
|
Update of /cvsroot/phpicalendar/phpicalendar/admin In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv1548/admin Modified Files: index.php Log Message: update lots of files Index: index.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/admin/index.php,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** index.php 23 May 2007 18:30:37 -0000 1.7 --- index.php 11 Dec 2008 21:54:52 -0000 1.8 *************** *** 6,10 **** header("Content-Type: text/html; charset=$charset"); ! if (empty($default_path)) { if (isset($_SERVER['HTTPS']) || strtolower($_SERVER['HTTPS']) == 'on' ) { $default_path = 'https://'.$_SERVER['SERVER_NAME'].':'.$_SERVER['SERVER_PORT'].substr($_SERVER['PHP_SELF'],0,strpos($_SERVER['PHP_SELF'],'/admin/')); --- 6,10 ---- header("Content-Type: text/html; charset=$charset"); ! if (empty($phpiCal_config->default_path)) { if (isset($_SERVER['HTTPS']) || strtolower($_SERVER['HTTPS']) == 'on' ) { $default_path = 'https://'.$_SERVER['SERVER_NAME'].':'.$_SERVER['SERVER_PORT'].substr($_SERVER['PHP_SELF'],0,strpos($_SERVER['PHP_SELF'],'/admin/')); *************** *** 13,17 **** } } ! if ($allow_admin != 'yes') { exit(error('The administration menu has been turned off.', $cal, '../')); } --- 13,17 ---- } } ! if ($phpiCal_config->allow_admin != 'yes') { exit(error('The administration menu has been turned off.', $cal, '../')); } *************** *** 49,87 **** $login_good = ($is_loged_in) ? '' : 'oops'; $login_bad = ((!$is_loged_in) && ($_GET['action'] == 'login')) ? 'oops' : ''; ! ! // Delete a calendar ! // Not at all secure - need to strip out path info if used by users besides admin in the future ! $delete_msg = ''; ! if ($_POST['action'] == 'delete') { ! foreach ($delete_calendar as $filename) { ! if (!delete_cal(urldecode($filename))) { ! $delete_msg = $delete_msg . '<font color="red">' . $lang['l_delete_error'] . ' ' . urldecode(substr($filename,0,-4)) . '</font><br />'; ! } else { ! $delete_msg = $delete_msg . '<font color="green">' . urldecode(substr($filename,0,-4)) . ' ' . $lang['l_delete_success'] . '</font><br />'; } } ! } ! ! // Add or Update a calendar ! $addupdate_msg = ''; ! if ((isset($_POST['action'])) && ($_POST['action'] == 'addupdate')) { ! for ($filenumber = 1; $filenumber < 6; $filenumber++) { ! $file = $_FILES['calfile']; ! $addupdate_success = FALSE; ! ! if (!is_uploaded_file_v4($file['tmp_name'][$filenumber])) { ! $upload_error = get_upload_error($file['error'][$filenumber]); ! } elseif (!is_uploaded_ics($file['name'][$filenumber])) { ! $upload_error = $upload_error_type_lang; ! } elseif (!copy_cal($file['tmp_name'][$filenumber], $file['name'][$filenumber])) { ! $upload_error = $copy_error_lang . " " . $file['tmp_name'][$filenumber] . " - " . $calendar_path . "/" . $file['name'][$filenumber]; ! } else { ! $addupdate_success = TRUE; ! } ! ! if ($addupdate_success == TRUE) { ! $addupdate_msg = $addupdate_msg . '<font color="green">'.$lang['l_cal_file'].' #'.$filenumber.': '.$lang['l_action_success'].'</font><br />'; ! } else { ! $addupdate_msg = $addupdate_msg . '<font color="red">'.$lang['l_cal_file'].' #'.$filenumber.': '.$lang['l_upload_error'].'</font><br />'; } } --- 49,88 ---- $login_good = ($is_loged_in) ? '' : 'oops'; $login_bad = ((!$is_loged_in) && ($_GET['action'] == 'login')) ? 'oops' : ''; ! if(is_loggedin()){ ! // Delete a calendar ! // Not at all secure - need to strip out path info if used by users besides admin in the future ! $delete_msg = ''; ! if ($_POST['action'] == 'delete') { ! foreach ($delete_calendar as $filename) { ! if (!delete_cal(urldecode($filename))) { ! $delete_msg = $delete_msg . '<font color="red">' . $lang['l_delete_error'] . ' ' . urldecode(substr($filename,0,-4)) . '</font><br />'; ! } else { ! $delete_msg = $delete_msg . '<font color="green">' . urldecode(substr($filename,0,-4)) . ' ' . $lang['l_delete_success'] . '</font><br />'; ! } } } ! ! // Add or Update a calendar ! $addupdate_msg = ''; ! if ((isset($_POST['action'])) && ($_POST['action'] == 'addupdate')) { ! for ($filenumber = 1; $filenumber < 6; $filenumber++) { ! $file = $_FILES['calfile']; ! $addupdate_success = FALSE; ! ! if (!is_uploaded_file_v4($file['tmp_name'][$filenumber])) { ! $upload_error = get_upload_error($file['error'][$filenumber]); ! } elseif (!is_uploaded_ics($file['name'][$filenumber])) { ! $upload_error = $upload_error_type_lang; ! } elseif (!copy_cal($file['tmp_name'][$filenumber], $file['name'][$filenumber])) { ! $upload_error = $copy_error_lang . " " . $file['tmp_name'][$filenumber] . " - " . $calendar_path . "/" . $file['name'][$filenumber]; ! } else { ! $addupdate_success = TRUE; ! } ! ! if ($addupdate_success == TRUE) { ! $addupdate_msg = $addupdate_msg . '<font color="green">'.$lang['l_cal_file'].' #'.$filenumber.': '.$lang['l_action_success'].'</font><br />'; ! } else { ! $addupdate_msg = $addupdate_msg . '<font color="red">'.$lang['l_cal_file'].' #'.$filenumber.': '.$lang['l_upload_error'].'</font><br />'; ! } } } *************** *** 90,106 **** $calendar_name = $lang['l_admin_header']; ! $page = new Page(BASE.'templates/'.$template.'/admin.tpl'); $page->replace_files(array( ! 'header' => BASE.'templates/'.$template.'/header.tpl', ! 'footer' => BASE.'templates/'.$template.'/footer.tpl' )); $page->replace_tags(array( ! 'version' => $phpicalendar_version, 'event_js' => '', ! 'charset' => $charset, ! 'default_path' => $default_path.'/', ! 'template' => $template, 'cal' => $cal, 'getdate' => $getdate, --- 91,107 ---- $calendar_name = $lang['l_admin_header']; ! $page = new Page(BASE.'templates/'.$phpiCal_config->template.'/admin.tpl'); $page->replace_files(array( ! 'header' => BASE.'templates/'.$phpiCal_config->template.'/header.tpl', ! 'footer' => BASE.'templates/'.$phpiCal_config->template.'/footer.tpl' )); $page->replace_tags(array( ! 'version' => $phpiCal_config->phpicalendar_version, 'event_js' => '', ! 'charset' => $phpiCal_config->charset, ! 'default_path' => "../".$phpiCal_config->default_path, ! 'template' => $phpiCal_config->template, 'cal' => $cal, 'getdate' => $getdate, *************** *** 109,113 **** 'current_view' => $current_view, 'sidebar_date' => $sidebar_date, ! 'rss_powered' => $rss_powered, 'rss_available' => '', 'rss_valid' => '', --- 110,114 ---- 'current_view' => $current_view, 'sidebar_date' => $sidebar_date, ! 'rss_powered' => $phpiCal_config->rss_powered, 'rss_available' => '', 'rss_valid' => '', *************** *** 116,120 **** 'display_login' => $login_good, 'delete_msg' => $delete_msg, ! 'addupdate_msg' => $addupdate_msg, 'l_day' => $lang['l_day'], 'l_week' => $lang['l_week'], --- 117,121 ---- 'display_login' => $login_good, 'delete_msg' => $delete_msg, ! 'addupdate_msg' => $addupdate_msg, 'l_day' => $lang['l_day'], 'l_week' => $lang['l_week'], |
From: <ji...@us...> - 2008-12-11 22:18:03
|
Update of /cvsroot/phpicalendar/phpicalendar/rss In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv1660/rss Added Files: rss_common.php Log Message: add new files --- NEW FILE: rss_common.php --- <?php /******************************************************************************** * Modified from phpicalendar 2.0a distribution by Jim Hu * philosophical changes * - instead of having separate generators, use a date range for all views (done) * - change the rss generation method to conform to standards(not done) * PHP note: #@ is error control operator to suppress execution halt on error * - used below to deal with undef? * * using rssview, RSS feeds can be specified to return events for a given day, week, month, or year * feeds can be specified for a number of days to or from a given date * feeds can be specified for a range of dates * *********************************************************************************/ /* Modified from 2.21 by dyfrin 2006/03/08 19:09:28 Changes: -RSS changed to 2.0, encoding removed, languages converted to ISO standard for feeds -RSS title changed to be set by config.inc.php. Make sure that is added to it. Lines modified: 135-165, 208-223 Additional mods by J. Hu */ require(BASE.'functions/init.inc.php'); if ($phpiCal_config->enable_rss != 'yes') { die ("RSS feeds are not enabled on this site."); } include_once(BASE.'functions/date_functions.php'); //set the range of days to return based on the view chosen $rssview = $_GET['rssview']; if (isset($_GET['getdate']) && $_GET['getdate'] !=''){ $getdate = $_GET['getdate']; }else{ $getdate = date("Ymd"); } # for all views, $fromdate is the first day to be shown and $todate should be the last day. switch ($rssview){ case 'day': $fromdate = $getdate; $todate = $getdate; $theview = $lang['l_day']; break; case 'week': $fromdate = dateOfWeek($getdate, 'Sunday'); $todate = date("Ymd", strtotime($fromdate) + 6*24*60*60); $theview = $lang['l_week']." of ".date('n/d/Y',strtotime($fromdate)); break; case 'month': $parse_month = date ("Ym", strtotime($getdate)); $fromdate = ($parse_month *100) + 1; $todate = ($parse_month *100) + date("t",strtotime($getdate)); $theview = date('M Y',strtotime($fromdate)); break; case 'year': if(isset($_GET['year'])){ $theyear = $_GET['year']; }else{ $theyear = substr($getdate,0,4); } $fromdate = ($theyear*10000)+101; $todate = date("Ymd", strtotime($theyear*10000+1231)); $theview = $theyear; break; case 'daysfrom': $fromdate = $getdate; $todate = date("Ymd", strtotime($getdate) + $_GET['days']*60*60*24); $theview = $_GET['days']." days from ".date('n/d/Y',strtotime($fromdate)); break; case 'daysto': $todate = $getdate; $fromdate = date("Ymd", strtotime($getdate) - $_GET['days']*60*60*24); $theview = $_GET['days']." days before ".date('n/d/Y',strtotime($todate)); break; case 'range': if(isset($_GET['from'])){ $fromdate = $_GET['from']; }else{ $fromdate = $getdate; } $todate = $_GET['to']; $theview = date('n/d/Y',strtotime($fromdate)).'-'.date('n/d/Y',strtotime($todate)); break; default: #default to week $fromdate = dateOfWeek($getdate, 'Sunday'); $todate = date("Ymd", strtotime($fromdate) + 6*24*60*60); $theview = ""; } #need to give ical_parser the most distant date to correctly set up master_array. $getdate = $todate; #echo "from:$fromdate to:$todate"; #Note that ical_parser supplies cal_displayname. $current_view = 'rss'; $mArray_begin = strtotime($fromdate); $mArray_end = strtotime($todate); include(BASE.'functions/ical_parser.php'); $events_count = 0; // calculate a value for Last Modified and ETag $cal = implode(",",$cals); //get filemtime from master array $filemod = 0; #default to start of unix era, overwrite with most recent mtime from master array foreach ($master_array['-4'] as $calinfo){ if ($calinfo['mtime'] > $filemod) $filemod = $calinfo['mtime']; } $filemodtime = date("r", $filemod); //send relevant headers header ("Last-Modified: $filemodtime"); header ("ETag:\"$filemodtime\""); // checks the user agents headers to see if they kept track of our // stuff, if so be nice and send back a 304 and exit. if ( ($_SERVER['HTTP_IF_MODIFIED_SINCE'] == $filemodtime) || ($_SERVER['HTTP_IF_NONE_MATCH'] == $filemodtime)){ header ("HTTP/1.1 304 Not Modified"); exit; } /* Change languages to ISO 639-1 to validate RSS without changing long version in config.inc.php */ $user_language = array ("english", "polish", "german", "french", "dutch", "italian", "japanese", "norwegian", "spanish", "swedish", "portuguese", "catalan", "traditional_chinese", "esperanto", "korean"); $iso_language = array ("en", "pl", "de", "fr", "nl", "da", "it", "ja", "no", "es", "sv", "pt", "ca", "zh-tw", "eo", "ko"); $rss_language = str_replace($user_language, $iso_language, $language); /* End language modification */ $rss = rss_top(); //generate the items $numdays = round((strtotime($todate) - strtotime($fromdate))/(60*60*24))+1; $thisdate = $fromdate; # start at beginning of date range, # note that usage of $thisdate is different from distribution # I use it as a date, dist uses it as a time $thistime = strtotime($thisdate); $i = 1; #day counter $rss_list = ''; $rss_items = ''; $uid_arr = array(); do { $thisdate=date('Ymd', $thistime); # echo "Date: $thisdate\ti:$i\tnumdays:$numdays<br>\n"; $dayofweek = localizeDate ("%a %b %e %Y", strtotime($thisdate)); if (isset($master_array[($thisdate)]) && sizeof($master_array[($thisdate)]) > 0) { foreach ($master_array[("$thisdate")] as $event_times) { foreach ($event_times as $uid=>$val) { #handle multiday all day events if(!$val["event_start"]){ if (isset($uid_arr[$uid])){ $uid_arr[$uid] .= "+$dayofweek" ; continue; }else{ $uid_arr[$uid] = "$dayofweek" ; } $event_start = $lang['l_all_day']; }else{ $event_start = @$val["event_start"]; $event_start = date ($timeFormat, @strtotime ("$event_start")); } $event_text = stripslashes(urldecode($val["event_text"])); $event_text = strip_tags($event_text, '<b><i><u>'); $event_text = str_replace('&','&',$event_text); $event_text = str_replace('&amp;','&',$event_text); # $event_text = urlencode($event_text); #uncomment for shorter event text with ... # $event_text = word_wrap($event_text, 21, $tomorrows_events_lines); $description = stripslashes(urldecode($val["description"])); $description = strip_tags($description, '<b><i><u>'); $description = str_replace('&','&',$description); $description = str_replace('&amp;','&',$description); $rss_title = urldecode ("$dayofweek: $event_text"); $urlcal = rawurlencode ("$cal"); if (isset($rss_link_to_event) && $rss_link_to_event == 'yes'){ $event_data = urlencode(serialize($val)); $rss_link = "$default_path/includes/event.php?getdate=$thisdate&cal=$cal&event_data=$event_data"; }else{ $rss_link = ("$default_path/day.php?getdate=$thisdate&cal=$urlcal"); } if (isset($cpath) && $cpath !='') $rss_link.="&cpath=$cpath"; $rss_description = htmlspecialchars ("$dayofweek $event_start: $description"); $rss_list .= rss_li($rss_link,$uid); $rss_items .= rss_item(); $events_count++; } } } $thistime = $thistime+(60*60*24); # echo "$thisdate: ".strtotime($thisdate)."->$thistime<br>\n"; $i++; } while ($i <= $numdays); if (($events_count < 1) && ($i == $numdays)) $rss_items = rss_noitems(); $rss_list = enclose_items($rss_list); $rss .= $rss_list.$rss_items.rss_close(); foreach ($uid_arr as $uid=>$date_range){ #echo "date_range:$date_range<br>"; if(strpos($date_range,"+")>0){ #echo "+ in date_range<br>"; $temp = explode("+",$date_range); $date_range = $temp[0].'-'.array_pop($temp); } $rss = str_replace("<uid>$uid</uid>\n<event_start>".$lang['l_all_day']."</event_start>","<uid>$uid</uid>\n<event_start>$date_range</event_start>", $rss); } header ("Content-Type: text/xml"); echo "$rss"; ?> |