From 99cfde6479207ba9349d8c4a093ef14a1026154d Mon Sep 17 00:00:00 2001 From: Jim Hu Date: Sat, 13 Dec 2008 23:42:30 +0000 Subject: debug rrules; fix cookie injection vuln --- calendars/US Holidays.ics | 555 ++++++++----------------------- functions/date_functions.php | 56 +--- functions/ical_parser.php | 24 +- functions/init/configs.php | 9 +- functions/list_functions.php | 6 +- functions/parse/end_vevent.php | 732 +++++++++++++++++++---------------------- functions/parse/parse_tzs.php | 24 +- languages/german.inc.php | 18 +- languages/portuguese.inc.php | 160 ++++----- month.php | 2 +- preferences.php | 3 +- week.php | 4 +- 12 files changed, 623 insertions(+), 970 deletions(-) diff --git a/calendars/US Holidays.ics b/calendars/US Holidays.ics index 8c4fc81..8d3f758 100644 --- a/calendars/US Holidays.ics +++ b/calendars/US Holidays.ics @@ -1,575 +1,282 @@ 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:holiday0017@icaldates.com - -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:holiday0013@icaldates.com - -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:holiday0000@icaldates.com - -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:holiday0001@icaldates.com - -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:holiday0008@icaldates.com - -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:holiday0009@icaldates.com - -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:holiday0010@icaldates.com - -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 - +SUMMARY:New Year's Day +DESCRIPTION:January 1 DTSTAMP:20030701T000000Z - -UID:holiday0014@icaldates.com - +UID:holiday0027@icaldates.com CATEGORIES:Holiday - US - -DTSTART;VALUE=DATE:17530617 - -RRULE:FREQ=MONTHLY;BYMONTH=6;BYDAY=3SU - +DTSTART;VALUE=DATE:17530101 +RRULE:FREQ=YEARLY END:VEVENT - - BEGIN:VEVENT - -SUMMARY:Flag Day - -DESCRIPTION:June 14 - +SUMMARY:Martin Luther King Jr. +DESCRIPTION:3rd Monday of January DTSTAMP:20030701T000000Z - -UID:holiday0015@icaldates.com - +UID:holiday0024@icaldates.com CATEGORIES:Holiday - US - -DTSTART;VALUE=DATE:17530614 - -RRULE:FREQ=YEARLY - +DTSTART;VALUE=DATE:17530115 +RRULE:FREQ=MONTHLY;BYMONTH=1;BYDAY=3MO END:VEVENT - - BEGIN:VEVENT - SUMMARY:Groundhog Day - DESCRIPTION:February 2 - DTSTAMP:20030701T000000Z - UID:holiday0018@icaldates.com - CATEGORIES:Holiday - US - DTSTART;VALUE=DATE:17530202 - RRULE:FREQ=YEARLY - END:VEVENT - - BEGIN:VEVENT - -SUMMARY:Halloween - -DESCRIPTION:October 31 - +SUMMARY:Lincoln's Birthday +DESCRIPTION:February 12 DTSTAMP:20030701T000000Z - -UID:holiday0019@icaldates.com - +UID:holiday0022@icaldates.com CATEGORIES:Holiday - US - -DTSTART;VALUE=DATE:17531031 - +DTSTART;VALUE=DATE:17530212 RRULE:FREQ=YEARLY - END:VEVENT - - BEGIN:VEVENT - -SUMMARY:Independence Day - -DESCRIPTION:July 4 - +SUMMARY:Valentine's Day +DESCRIPTION:February 14 DTSTAMP:20030701T000000Z - -UID:holiday0020@icaldates.com - +UID:holiday0035@icaldates.com CATEGORIES:Holiday - US - -DTSTART;VALUE=DATE:17530704 - +DTSTART;VALUE=DATE:17530214 RRULE:FREQ=YEARLY - END:VEVENT - - BEGIN:VEVENT - -SUMMARY:Labor Day - -DESCRIPTION:1st Monday of September - +SUMMARY:Washington's Birthday +DESCRIPTION:February 22 DTSTAMP:20030701T000000Z - -UID:holiday0021@icaldates.com - +UID:holiday0038@icaldates.com CATEGORIES:Holiday - US - -DTSTART;VALUE=DATE:17530903 - -RRULE:FREQ=MONTHLY;BYMONTH=9;BYDAY=1MO - +DTSTART;VALUE=DATE:17530222 +RRULE:FREQ=YEARLY END:VEVENT - - BEGIN:VEVENT - -SUMMARY:Lincoln's Birthday - -DESCRIPTION:February 12 - +SUMMARY:President's Day +DESCRIPTION:3rd Monday of February DTSTAMP:20030701T000000Z - -UID:holiday0022@icaldates.com - +UID:holiday0030@icaldates.com CATEGORIES:Holiday - US +DTSTART;VALUE=DATE:17530219 +RRULE:FREQ=MONTHLY;BYMONTH=2;BYDAY=3MO +END:VEVENT -DTSTART;VALUE=DATE:17530212 - -RRULE:FREQ=YEARLY - +BEGIN:VEVENT +SUMMARY:Secretaries Day +DESCRIPTION:Wednesday of last full week in April +DTSTAMP:20030701T000000Z +UID:holiday0032@icaldates.com +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:holiday0023@icaldates.com - 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 - +SUMMARY:St. Patrick's Day +DESCRIPTION:March 17 DTSTAMP:20030701T000000Z - -UID:holiday0024@icaldates.com - +UID:holiday0033@icaldates.com CATEGORIES:Holiday - US - -DTSTART;VALUE=DATE:17530115 - -RRULE:FREQ=MONTHLY;BYMONTH=1;BYDAY=3MO - +DTSTART;VALUE=DATE:17530317 +RRULE:FREQ=YEARLY END:VEVENT +BEGIN:VEVENT +SUMMARY:April Fools Day +DESCRIPTION:April 1 +DTSTAMP:20030701T000000Z +UID:holiday0000@icaldates.com +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:holiday0009@icaldates.com +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:holiday0001@icaldates.com +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:holiday0025@icaldates.com - 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:holiday0026@icaldates.com - 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 - +SUMMARY:Father's Day +DESCRIPTION:3rd Sunday of June DTSTAMP:20030701T000000Z - -UID:holiday0027@icaldates.com - +UID:holiday0014@icaldates.com CATEGORIES:Holiday - US +DTSTART;VALUE=DATE:17530617 +RRULE:FREQ=MONTHLY;BYMONTH=6;BYDAY=3SU +END:VEVENT -DTSTART;VALUE=DATE:17530101 - +BEGIN:VEVENT +SUMMARY:Flag Day +DESCRIPTION:June 14 +DTSTAMP:20030701T000000Z +UID:holiday0015@icaldates.com +CATEGORIES:Holiday - US +DTSTART;VALUE=DATE:17530614 RRULE:FREQ=YEARLY - END:VEVENT - - BEGIN:VEVENT - -SUMMARY:New Year's Eve - -DESCRIPTION:December 31 - +SUMMARY:Independence Day +DESCRIPTION:July 4 DTSTAMP:20030701T000000Z - -UID:holiday0028@icaldates.com - +UID:holiday0020@icaldates.com CATEGORIES:Holiday - US - -DTSTART;VALUE=DATE:17531231 - +DTSTART;VALUE=DATE:17530704 RRULE:FREQ=YEARLY - END:VEVENT - - BEGIN:VEVENT - -SUMMARY:President's Day - -DESCRIPTION:3rd Monday of February - +SUMMARY:Labor Day +DESCRIPTION:1st Monday of September DTSTAMP:20030701T000000Z - -UID:holiday0030@icaldates.com - +UID:holiday0021@icaldates.com CATEGORIES:Holiday - US - -DTSTART;VALUE=DATE:17530219 - -RRULE:FREQ=MONTHLY;BYMONTH=2;BYDAY=3MO - +DTSTART;VALUE=DATE:17530903 +RRULE:FREQ=MONTHLY;BYMONTH=9;BYDAY=1MO END:VEVENT - - BEGIN:VEVENT - -SUMMARY:Secretaries Day - -DESCRIPTION:Wednesday of last full week in April - +SUMMARY:Grandparent's Day +DESCRIPTION:First Sunday after Labor Day DTSTAMP:20030701T000000Z - -UID:holiday0032@icaldates.com - +UID:holiday0017@icaldates.com CATEGORIES:Holiday - US - -DTSTART;VALUE=DATE:19520423 - - -RRULE:FREQ=MONTHLY;INTERVAL=1;BYDAY=WE;BYMONTHDAY=25,26,27,21,22,23,24;BYMONTH=4 - - +DTSTART;VALUE=DATE:19780910 +RRULE:FREQ=YEARLY;BYDAY=SU;BYMONTHDAY=13,7,8,9,10,11,12;BYMONTH=9 END:VEVENT - - BEGIN:VEVENT - -SUMMARY:St. Patrick's Day - -DESCRIPTION:March 17 - +SUMMARY:Columbus Day +DESCRIPTION:2nd Monday of October DTSTAMP:20030701T000000Z - -UID:holiday0033@icaldates.com - +UID:holiday0008@icaldates.com CATEGORIES:Holiday - US +DTSTART;VALUE=DATE:17531008 +RRULE:FREQ=MONTHLY;BYMONTH=10;BYDAY=2MO +END:VEVENT -DTSTART;VALUE=DATE:17530317 - +BEGIN:VEVENT +SUMMARY:Halloween +DESCRIPTION:October 31 +DTSTAMP:20030701T000000Z +UID:holiday0019@icaldates.com +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:holiday0010@icaldates.com +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:holiday0013@icaldates.com +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:holiday0034@icaldates.com - 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:holiday0035@icaldates.com - -CATEGORIES:Holiday - US - -DTSTART;VALUE=DATE:17530214 - -RRULE:FREQ=YEARLY - END:VEVENT - - BEGIN:VEVENT - SUMMARY:Veteran's Day - DESCRIPTION:November 11 - DTSTAMP:20030701T000000Z - UID:holiday0037@icaldates.com - CATEGORIES:Holiday - US - DTSTART;VALUE=DATE:17531111 - RRULE:FREQ=YEARLY - END:VEVENT - - BEGIN:VEVENT - -SUMMARY:Washington's Birthday - -DESCRIPTION:February 22 - +SUMMARY:New Year's Eve +DESCRIPTION:December 31 DTSTAMP:20030701T000000Z - -UID:holiday0038@icaldates.com - +UID:holiday0028@icaldates.com CATEGORIES:Holiday - US - -DTSTART;VALUE=DATE:17530222 - +DTSTART;VALUE=DATE:17531231 RRULE:FREQ=YEARLY - END:VEVENT - END:VCALENDAR diff --git a/functions/date_functions.php b/functions/date_functions.php index 0e2dca4..568a767 100644 --- a/functions/date_functions.php +++ b/functions/date_functions.php @@ -32,8 +32,9 @@ function two2threeCharDays($day, $txt=true) { // dateOfWeek() takes a date in Ymd and a day of week in 3 letters or more // 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'; + 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)); $start_day_time = strtotime((date('w',$timestamp)==$num ? "$week_start_day" : "last $week_start_day"), $timestamp); @@ -136,9 +137,8 @@ function calcTime($have, $want, $time) { return $time; } -function chooseOffset($time) { - global $timezone, $tz_array; - if (!isset($timezone)) $timezone = ''; +function chooseOffset($time, $timezone = '') { + global $tz_array; switch ($timezone) { case '': $offset = 'none'; @@ -148,7 +148,7 @@ function chooseOffset($time) { break; default: if (is_array($tz_array) && array_key_exists($timezone, $tz_array)) { - $dlst = date('I', $time); + $dlst = date('I', $time); $offset = $tz_array[$timezone][$dlst]; } else { $offset = '+0000'; @@ -210,7 +210,7 @@ $return = " // $property = The property being examined, e.g. DTSTART, DTEND. // $field = The full field being examined, e.g. DTSTART;TZID=US/Pacific function extractDateTime($data, $property, $field) { - global $tz_array; + global $tz_array, $phpiCal_config; // Initialize values. unset($unixtime, $date, $time, $allday); @@ -238,14 +238,12 @@ function extractDateTime($data, $property, $field) { $date = date('Ymd', $unixtime); $time = ''; $allday = $data; - } - - // Extract date-time values. - else { + }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 = parse_tz($tz_tmp[1]); + $tz_dt = $tz_tmp[1]; unset($tz_tmp); } elseif ($zulu_time) { $tz_dt = 'GMT'; @@ -259,46 +257,22 @@ function extractDateTime($data, $property, $field) { $date = $regs[1] . $regs[2] . $regs[3]; $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); + $server_offset_tmp = chooseOffset($unixtime, $phpiCal_config->timezone); if (isset($tz_dt)) { - if (array_key_exists($tz_dt, $tz_array)) { - $offset_tmp = $tz_array[$tz_dt][$dlst]; - } else { - $offset_tmp = '+0000'; - } + $offset_tmp = chooseOffset($unixtime, $tz_dt); } elseif (isset($calendar_tz)) { - if (array_key_exists($calendar_tz, $tz_array)) { - $offset_tmp = $tz_array[$calendar_tz][$dlst]; - } else { - $offset_tmp = '+0000'; - } + $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); } - -//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; -} - - -?> +?> \ No newline at end of file diff --git a/functions/ical_parser.php b/functions/ical_parser.php index f64d4c8..ed80006 100644 --- a/functions/ical_parser.php +++ b/functions/ical_parser.php @@ -5,6 +5,7 @@ include_once(BASE.'functions/date_functions.php'); include_once(BASE.'functions/draw_functions.php'); 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 $parse_file = true; @@ -18,13 +19,13 @@ if ($save_parsed_cals == 'yes') { $master_array = unserialize($contents); $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) { $mtime = $master_array['-4'][$z]['mtime']; $fname = $master_array['-4'][$z]['filename']; $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++; } elseif (($wcalc == 'yes') && ($mtime > $webcal_mtime)) { @@ -142,8 +143,10 @@ foreach ($cal_filelist as $cal_key=>$filename) { $except_dates = array(); $except_times = array(); + $byday = array(); $bymonth = array(); $bymonthday = array(); + $bysetpos = array(); $first_duration = TRUE; $count = 1000000; $valarm_set = FALSE; @@ -304,7 +307,7 @@ foreach ($cal_filelist as $cal_key=>$filename) { if ($eachval[0] == 'RECURRENCE-ID') { // do nothing } elseif ($eachval[0] == 'TZID') { - $recurrence_id['tzid'] = parse_tz($eachval[1]); + $recurrence_id['tzid'] = $eachval[1]; } elseif ($eachval[0] == 'RANGE') { $recurrence_id['range'] = $eachval[1]; } elseif ($eachval[0] == 'VALUE') { @@ -323,15 +326,12 @@ foreach ($cal_filelist as $cal_key=>$filename) { $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]; + $offset_tmp = chooseOffset($recur_unixtime, $recurrence_id['tzid']); } elseif (isset($calendar_tz)) { - $offset_tmp = $tz_array[$calendar_tz][$dlst]; + $offset_tmp = chooseOffset($recur_unixtime, $tz_array[$calendar_tz]); } else { - $offset_tmp = $server_offset_tmp; + $offset_tmp = $chooseOffset($recur_unixtime); } $recur_unixtime = calcTime($offset_tmp, $server_offset_tmp, $recur_unixtime); $recurrence_id['date'] = date('Ymd', $recur_unixtime); @@ -350,7 +350,7 @@ foreach ($cal_filelist as $cal_key=>$filename) { $cal_displaynames[$cal_key] = $actual_calname; #correct the default calname based on filename break; case 'X-WR-TIMEZONE': - $calendar_tz = parse_tz($data); + $calendar_tz = $data; $master_array['calendar_tz'] = $calendar_tz; break; case 'DURATION': @@ -441,13 +441,15 @@ $template_started = getmicrotime(); //If you want to see the values in the arrays, uncomment below. -#print '
';
+//print '
';
 //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 '
'; +//print_r($tz_array); +//print '
'; ?> diff --git a/functions/init/configs.php b/functions/init/configs.php index 8c47324..68106d8 100644 --- a/functions/init/configs.php +++ b/functions/init/configs.php @@ -6,21 +6,22 @@ if (is_file(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'], '/')); + $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); 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']); - if (isset($phpicalendar['cookie_cpath'])) $phpiCal_config->setProperty('default_cpath_check', $phpicalendar['cookie_cpath']); + 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'].'/')){ $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']); - echo "cookie!"; } # language support @@ -50,7 +51,7 @@ while ($fillTime < $phpiCal_config->day_end) { $fillTime = $fill_h . $fill_min; } - +$tz_array=array(); /*echo "
xx";
 print_r($configs);
 print_r($phpiCal_config);
diff --git a/functions/list_functions.php b/functions/list_functions.php
index 7f6d817..8a6344d 100644
--- a/functions/list_functions.php
+++ b/functions/list_functions.php
@@ -13,14 +13,14 @@ function list_jumps() {
 }
 
 function list_calcolors() {
-	global $template, $master_array, $unique_colors;
+	global $phpiCal_config, $master_array;
 	$return = '';
 	$i = 1;
 	if (is_array($master_array['-3'])) {
 		foreach ($master_array['-3'] as $key => $val) {
-			if ($i > $unique_colors) $i = 1;
+			if ($i > $phpiCal_config->unique_colors) $i = 1;
 			$val = str_replace ("\,", ",", $val);
-			$return .= ' '.$val.'
'; + $return .= ' '.$val.'
'; $i++; } } diff --git a/functions/parse/end_vevent.php b/functions/parse/end_vevent.php index 95bdd94..33175cf 100644 --- a/functions/parse/end_vevent.php +++ b/functions/parse/end_vevent.php @@ -2,7 +2,7 @@ /* end_vevent.php What happens in this file: -1. Initialization +1. Initialization: add information not present by default 2. */ @@ -89,7 +89,7 @@ if (!isset($rrule_array) && $start_unixtime < $mArray_end && $end_unixtime > $mA $rrule_array['FREQ'] = 'YEARLY'; $rrule_array['START_DATE'] = $start_date; $rrule_array['UNTIL'] = $start_date; - $rrule_array['END'] = 'end'; +# $rrule_array['END'] = 'end'; } @@ -98,7 +98,7 @@ if (isset($allday_start) && $allday_start != '') { $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'; +# $rrule_array['END'] = 'end'; $recur_start = $allday_start; $start_date = $allday_start; if (isset($allday_end)) { @@ -110,7 +110,7 @@ if (isset($allday_start) && $allday_start != '') { $rrule_array['START_DATE'] = $start_date; $rrule_array['START_TIME'] = $start_time; $rrule_array['END_TIME'] = $end_time; - $rrule_array['END'] = 'end'; +# $rrule_array['END'] = 'end'; } $start_date_time = strtotime($start_date); @@ -129,7 +129,10 @@ if (!isset($fromdate)){ $end_range_time = strtotime($todate)+60*60*24; } + $freq_type = 'year'; +$interval = 1; +# Load $rrule_array foreach ($rrule_array as $key => $val) { switch($key) { case 'FREQ': @@ -159,8 +162,8 @@ foreach ($rrule_array as $key => $val) { break; case 'INTERVAL': if ($val > 0){ - $number = $val; - $recur_array[($start_date)][($hour.$minute)][$uid]['recur'][$key] = $number; + $interval = $val; + $recur_array[($start_date)][($hour.$minute)][$uid]['recur'][$key] = $interval; } break; case 'BYSECOND': @@ -211,407 +214,354 @@ foreach ($rrule_array as $key => $val) { $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); - } + } +} +/* +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 (!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 $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_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); +// 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) { - # 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)); + // 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; - } 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"); - } + // 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); - 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.'
'; - } - 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; + # 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 "

$summary
next range time:".date("Ymd his",$next_range_time)."
start range time ".date("Ymd his",$start_range_time)."
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 "
$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 { - $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; + 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 (($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 (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; } - 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); } + } + } + } # 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 { - 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); - } + $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.'
'; + } + 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 "
".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); } - } #end while loop - } # end if time compare - unset($recur_data); - } # end switch $key (rrule type) -} # end foreach rrule + } 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); // This should remove any exdates that were missed. diff --git a/functions/parse/parse_tzs.php b/functions/parse/parse_tzs.php index 85ab929..93f24d5 100644 --- a/functions/parse/parse_tzs.php +++ b/functions/parse/parse_tzs.php @@ -1,7 +1,7 @@ $tz_id"; print_r($tz_array[$tz_id]);echo"
"; + $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 "
$tz_id"; print_r($tz_array[$tz_id]);echo"
"; break; default: unset ( $data, $prop_pos, $property); @@ -56,6 +68,14 @@ while (!feof($ifile)) { case 'TZOFFSETTO': $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; } } } diff --git a/languages/german.inc.php b/languages/german.inc.php index b79a17c..5e95514 100644 --- a/languages/german.inc.php +++ b/languages/german.inc.php @@ -7,7 +7,7 @@ // Corrected by whippersnapper slomo (mail@slomo.de) // Revised for version 2.0 by Holger Schleicher (holger@vc4.de) // -// Submit new translations to chad@chadsdomain.com +// Submit new translations to phpicalendar@gmail.com $lang['l_day'] = 'Tag'; $lang['l_week'] = 'Woche'; @@ -66,12 +66,12 @@ $lang['l_exception'] = 'Ausnahme'; $lang['l_no_query'] = 'Kein Suchbegriff'; $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_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'; $lang['l_completed'] = 'Erledigt'; @@ -162,8 +162,8 @@ $format_recur_lang['byday'] = 'An den Tagen: %list%'; // ie, 'On days: Mon, // --------------------------------- $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'); +$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'); diff --git a/languages/portuguese.inc.php b/languages/portuguese.inc.php index f4dbd60..66b4faf 100644 --- a/languages/portuguese.inc.php +++ b/languages/portuguese.inc.php @@ -2,8 +2,8 @@ // Portuguese language include // For version 2.0 PHP iCalendar -// Translation by David Morgado (dcrmorgado@yahoo.com) -// Based on Translation by Wilton, Bennet (suporte@bennetworks.com.br) +// Translation by Luciano Antonio Costa (bits.e.bytes@gmail.com) +// Based on Translation by Wilton, Bennet (suporte@bennetworks.com.br) and David Morgado (dcrmorgado@yahoo.com) // 21-sep-2004 13:06 PM GMT // Submit new translations to chad@chadsdomain.com @@ -43,7 +43,7 @@ $lang['l_gomonth'] = 'Ir para este Mês'; $lang['l_goyear'] = 'Ir para este Ano'; $lang['l_search'] = 'Buscar'; // the verb $lang['l_results'] = 'Buscar Resultados'; -$lang['l_pick_multiple'] = 'Pick multiple'; +$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'; $lang['l_goprint'] = 'Versão para imprimir'; @@ -58,110 +58,110 @@ $lang['l_rss_day_date'] = 'g:i A'; // Lists just the time $lang['l_rss_week_date'] = '%b %e'; // Lists just the day $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_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'] = '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_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'] = 'Created:'; +$lang['l_created'] = 'Criado:'; $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_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'] = 'PHP iCalendar Administration'; -$lang['l_username'] = 'Username'; -$lang['l_password'] = 'Password'; +$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'] = '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_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'] = '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_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'; $all_cal_comb_lang = 'Todos Juntos'; // 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'; +$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'] = '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'; +$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'; // --------------------------------- // $format_recur, items enclosed in % will be substituted with variables $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['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'] = '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['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'] = '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' +$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'); +$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'); +$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'); // For time formatting, check out: http://www.php.net/manual/en/function.date.php @@ -198,7 +198,7 @@ $lang['l_error_title'] = 'Erro!'; $lang['l_error_window'] = 'Aconteceu um erro!'; $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_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.'; $lang['l_error_invalidcal'] = 'Arquivo de calendário inválido. Por favor tente usar outro calendário.'; diff --git a/month.php b/month.php index 8498db8..6c38848 100644 --- a/month.php +++ b/month.php @@ -66,7 +66,7 @@ $page->replace_tags(array( 'cpath' => $cpath, 'calendar_name' => $cal_displayname, 'display_date' => $display_date, - 'rss_powered' => $phpiCal_config->rss_powered, + 'rss_powered' => $rss_powered, 'default_path' => '', 'rss_available' => '', 'rss_valid' => '', diff --git a/preferences.php b/preferences.php index 2016c40..5d1b114 100644 --- a/preferences.php +++ b/preferences.php @@ -99,7 +99,7 @@ closedir($dir_handle); // select for calendars $calendar_select = display_ical_list(availableCalendars($username, $password, $ALL_CALENDARS_COMBINED),TRUE); -$calendar_select .=""; +$calendar_select .=""; $calendar_select = str_replace("' : ''; @@ -193,5 +193,4 @@ $page->replace_tags(array( )); $page->output(); -print_r($_COOKIE[$cookie_name]); ?> diff --git a/week.php b/week.php index 8767b21..c0a9d70 100644 --- a/week.php +++ b/week.php @@ -66,10 +66,10 @@ $page->replace_tags(array( 'display_date' => $display_date, 'current_view' => $current_view, 'sidebar_date' => $sidebar_date, - 'rss_powered' => $phpiCal_config->rss_powered, + 'rss_powered' => $rss_powered, 'rss_available' => '', 'rss_valid' => '', - 'show_search' => $show_search, + 'show_search' => $phpiCal_config->show_search, 'next_day' => $next_day, 'next_week' => $next_week, 'prev_day' => $prev_day, -- cgit v1.2.3