aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--calendars/US Holidays.ics2
-rw-r--r--calendars/test.ics45
-rw-r--r--config.inc.php3
-rw-r--r--functions/date_functions.php9
-rw-r--r--functions/ical_parser.php5
-rw-r--r--functions/is_daylight.php538
-rw-r--r--functions/parse/end_vevent.php6
-rw-r--r--functions/parse/parse_tzs.php25
-rw-r--r--functions/parse/recur_functions.php42
9 files changed, 332 insertions, 343 deletions
diff --git a/calendars/US Holidays.ics b/calendars/US Holidays.ics
index 5422f5a..96d6684 100644
--- a/calendars/US Holidays.ics
+++ b/calendars/US Holidays.ics
@@ -602,7 +602,7 @@ BEGIN:VEVENT
SEQUENCE:1
TRANSP:OPAQUE
UID:6ED833DC-879C-41C0-9E1D-4C83FD7DDB72
-DTSTART;VALUE=DATE:1970901
+DTSTART;VALUE=DATE:19970901
DTSTAMP:20050930T224817Z
SUMMARY:Labor Day
CREATED:20081223T190054Z
diff --git a/calendars/test.ics b/calendars/test.ics
index 9a9ce53..ea16a99 100644
--- a/calendars/test.ics
+++ b/calendars/test.ics
@@ -24,44 +24,19 @@ TZNAME:PDT
END:DAYLIGHT
END:VTIMEZONE
-BEGIN:VEVENT
-UID:20081128T075152Z-3660-100-1-5@sietchtabr
-DTSTAMP:20081128T075151Z
-LAST-MODIFIED:20081128T075152
-SUMMARY:Witchcraft Paris
-CATEGORIES:jdr
-DTSTART;TZID=/softwarestudio.org/Tzfile/Europe/Paris:20081213T210000
-DTEND;TZID=/softwarestudio.org/Tzfile/Europe/Paris:20081213T230000
-CLASS:PUBLIC
-SEQUENCE:1
-CREATED:20081128T075152
-END:VEVENT
-
-BEGIN:VEVENT
-UID:20081128T075152Z-3660-100-1-6@sietchtabr2
-DTSTAMP:20081128T075151Z
-LAST-MODIFIED:20081128T075152
-SUMMARY:Witchcraft PST
-CATEGORIES:jdr
-DTSTART;TZID=US/Pacific:20081213T210000
-DTEND;TZID=US/Pacific:20081213T230000
-CLASS:PUBLIC
-SEQUENCE:1
-CREATED:20081128T075152
-END:VEVENT
BEGIN:VEVENT
-UID:20081128T075152Z-3660-100-1-7@sietchtabr2
-DTSTAMP:20081128T075151Z
-LAST-MODIFIED:20081128T075152
-SUMMARY:daylight test PST
-CATEGORIES:jdr
-DTSTART;TZID=US/Pacific:20060331T010000
-DTEND;TZID=US/Pacific:20060331T020000
-RRULE:FREQ=DAILY;
+DTSTAMP:20070616T185152Z
+UID:{e5d8825e-4189-5341-80c7-4ec2c9f54404}
+SUMMARY:Futsal
+LOCATION:Jockvale E S\, 101 Malvern Dr\, Nepean\, K2J 2S8
+DESCRIPTION: (613) 825-1224\, (613) 825-1219\nhttp://maps.google.com/maps?f=q&hl=en&q=101+Malvern+Dr\,+Nepean\,+K2J+2S8+canada&sll=45.460733\,-75.610657&sspn=0.062007\,0.144196&ie=UTF8&ll=45.285969\,-75.763178&spn=0.01555\,0.036049&z=15&om=1
+CATEGORIES:Competition
CLASS:PUBLIC
-SEQUENCE:1
-CREATED:20081128T075152
+LAST-MODIFIED:20070626T152159Z
+RRULE:FREQ=WEEKLY;COUNT=4;BYDAY=TH
+DTSTART:20070621T003000Z
+DTEND:20070621T013000Z
END:VEVENT
END:VCALENDAR
diff --git a/config.inc.php b/config.inc.php
index 506d7ba..c4a80ca 100644
--- a/config.inc.php
+++ b/config.inc.php
@@ -13,7 +13,8 @@ $configs = array(
'allow_preferences' => 'yes',
# 'show_search' => 'yes',
# 'show_todos' => 'no',
- 'timezone' => 'US/Central',
+# 'timezone' => 'US/Central',
+ 'timezone' => 'America/Bogota',
# 'second_offset' => $secs,
# 'cookie_uri' => ''
);
diff --git a/functions/date_functions.php b/functions/date_functions.php
index 07745c1..5239279 100644
--- a/functions/date_functions.php
+++ b/functions/date_functions.php
@@ -209,7 +209,7 @@ $return = "
}
/* Returns an array of the date and time extracted from the data
- passed in. This array contains (unixtime, date, time, allday).
+ passed in. This array contains (unixtime, date, time, allday, tzid).
$data = A string representing a date-time per RFC2445.
$property = The property being examined, e.g. DTSTART, DTEND.
@@ -219,7 +219,6 @@ See:http://phpicalendar.org/documentation/index.php/Property_Value_Data_Types#4.
*/
function extractDateTime($data, $property, $field) {
global $tz_array, $phpiCal_config, $calendar_tz;
-
$allday =''; #suppress error on returning undef.
// Check for zulu time.
$zulu_time = false;
@@ -258,9 +257,11 @@ function extractDateTime($data, $property, $field) {
if (isset($tz_dt)) {
$offset_tmp = chooseOffset($unixtime, $tz_dt);
} elseif (isset($calendar_tz)) {
- $offset_tmp = chooseOffset($unixtime, $calendar_tz);
+ $offset_tmp = chooseOffset($unixtime, $calendar_tz);
+ $tz_dt = $calendar_tz;
} else {
$offset_tmp = $server_offset_tmp;
+ $tz_dt = $phpiCal_config->timezone;
}
// Set the values.
$unixtime = calcTime($offset_tmp, $server_offset_tmp, $unixtime);
@@ -269,7 +270,7 @@ function extractDateTime($data, $property, $field) {
if ($allday == '') $time = date('Hi', $unixtime);
// Return the results.
- return array($unixtime, $date, $time, $allday);
+ return array($unixtime, $date, $time, $allday, $tz_dt);
}
/* TZIDs in calendars often contain leading information that should be stripped
diff --git a/functions/ical_parser.php b/functions/ical_parser.php
index 87a3cf0..e3995a3 100644
--- a/functions/ical_parser.php
+++ b/functions/ical_parser.php
@@ -279,6 +279,11 @@ foreach ($cal_filelist as $cal_key=>$filename) {
$start_date = $datetime[1];
$start_time = $datetime[2];
$allday_start = $datetime[3];
+ $start_tz = $datetime[4];
+ preg_match ('/([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{0,2})([0-9]{0,2})/', $data, $regs);
+ $vevent_start_date = $regs[1] . $regs[2] . $regs[3];
+ $day_offset = dayCompare($start_date, $vevent_start_date);
+ #echo date("Ymd Hi", $start_unixtime)." $start_date $start_time $vevent_start_date $day_offset<br>";
break;
case 'DTEND':
diff --git a/functions/is_daylight.php b/functions/is_daylight.php
index c6f79ef..60910ff 100644
--- a/functions/is_daylight.php
+++ b/functions/is_daylight.php
@@ -12,279 +12,283 @@ function is_daylight($time, $timezone){
$month = date("m",$time);
$day = date("d",$time);
$hour = date("H",$time);
- switch ($timezone){
- case 'US/Samoa': # array('-1100', '-1100');
- case 'America/Adak': # array('-1000', '-0900');
- case 'America/Atka':
- case 'US/Aleutian':
- case 'America/Anchorage': # array('-0900', '-0800');
- case 'America/Nome':
- case 'US/Alaska':
- case 'America/Juneau':
- case 'America/Yakutat':
- case 'America/Dawson': # array('-0800', '-0700');
- case 'America/Los_Angeles':
- case 'America/Vancouver':
- case 'America/Whitehorse':
- case 'Canada/Pacific':
- case 'Canada/Yukon':
- case 'PST8PDT':
- case 'US/Pacific':
- case 'America/Boise': # array('-0700', '-0600');
- case 'America/Cambridge_Bay':
- case 'America/Denver':
- case 'America/Edmonton':
- case 'America/Inuvik':
- case 'America/Shiprock':
- case 'America/Yellowknife':
- case 'Canada/Mountain':
- case 'MST7MDT':
- case 'Navajo':
- case 'US/Mountain':
- case 'America/Chicago': # array('-0600', '-0500');
- case 'America/Menominee':
- case 'America/Merida':
- case 'America/Rainy_River':
- case 'America/Rankin_Inlet':
- case 'America/Winnipeg':
- case 'Canada/Central':
- case 'CST6CDT':
- case 'US/Central':
- case 'America/Detroit': # array('-0500', '-0400');
- case 'America/Grand_Turk':
- case 'America/Iqaluit':
- case 'America/Kentucky/Louisville':
- case 'America/Kentucky/Monticello':
- case 'America/Louisville':
- case 'America/Montreal':
- case 'America/Nassau':
- case 'America/New_York':
- case 'America/Nipigon':
- case 'America/Pangnirtung':
- case 'America/Thunder_Bay':
- case 'Canada/Eastern':
- case 'EST5EDT':
- case 'US/Eastern':
- case 'US/Michigan':
- case 'America/Glace_Bay': # array('-0400', '-0300');
- case 'America/Goose_Bay':
- case 'America/Halifax':
- case 'America/Thule':
- case 'Canada/Atlantic':
- case 'America/St_Johns': # array('-0330', '-0230');
- case 'Canada/Newfoundland':
- case 'America/Godthab': # array('-0300', '-0200');
- case 'America/Miquelon':
- if ($year < 2007){
+
+ if(isset($tz_array[$timezone]['dt_start'][$year]) && isset($tz_array[$timezone]['st_start'][$year])){
+ $start = $tz_array[$timezone]['dt_start'][$year];
+ $end = $tz_array[$timezone]['st_start'][$year];
+ }else{
+ switch ($timezone){
+ case 'US/Samoa': # array('-1100', '-1100');
+ case 'America/Adak': # array('-1000', '-0900');
+ case 'America/Atka':
+ case 'US/Aleutian':
+ case 'America/Anchorage': # array('-0900', '-0800');
+ case 'America/Nome':
+ case 'US/Alaska':
+ case 'America/Juneau':
+ case 'America/Yakutat':
+ case 'America/Dawson': # array('-0800', '-0700');
+ case 'America/Los_Angeles':
+ case 'America/Vancouver':
+ case 'America/Whitehorse':
+ case 'Canada/Pacific':
+ case 'Canada/Yukon':
+ case 'PST8PDT':
+ case 'US/Pacific':
+ case 'America/Boise': # array('-0700', '-0600');
+ case 'America/Cambridge_Bay':
+ case 'America/Denver':
+ case 'America/Edmonton':
+ case 'America/Inuvik':
+ case 'America/Shiprock':
+ case 'America/Yellowknife':
+ case 'Canada/Mountain':
+ case 'MST7MDT':
+ case 'Navajo':
+ case 'US/Mountain':
+ case 'America/Chicago': # array('-0600', '-0500');
+ case 'America/Menominee':
+ case 'America/Merida':
+ case 'America/Rainy_River':
+ case 'America/Rankin_Inlet':
+ case 'America/Winnipeg':
+ case 'Canada/Central':
+ case 'CST6CDT':
+ case 'US/Central':
+ case 'America/Detroit': # array('-0500', '-0400');
+ case 'America/Grand_Turk':
+ case 'America/Iqaluit':
+ case 'America/Kentucky/Louisville':
+ case 'America/Kentucky/Monticello':
+ case 'America/Louisville':
+ case 'America/Montreal':
+ case 'America/Nassau':
+ case 'America/New_York':
+ case 'America/Nipigon':
+ case 'America/Pangnirtung':
+ case 'America/Thunder_Bay':
+ case 'Canada/Eastern':
+ case 'EST5EDT':
+ case 'US/Eastern':
+ case 'US/Michigan':
+ case 'America/Glace_Bay': # array('-0400', '-0300');
+ case 'America/Goose_Bay':
+ case 'America/Halifax':
+ case 'America/Thule':
+ case 'Canada/Atlantic':
+ case 'America/St_Johns': # array('-0330', '-0230');
+ case 'Canada/Newfoundland':
+ case 'America/Godthab': # array('-0300', '-0200');
+ case 'America/Miquelon':
+ if ($year < 2007){
+ $start = strtotime("+1 Sun",strtotime($year."0331"));
+ $end = strtotime("-1 Sun",strtotime($year."1101"));
+ }else{
+ $start = strtotime("+2 Sun",strtotime($year."0300"));
+ $end = strtotime("+1 Sun",strtotime($year."1031"));
+ }
+ break;
+ case 'America/Havana':
+ case 'Cuba':
+ $start = strtotime("+3 Sun",strtotime($year."0300"));
+ $end = strtotime("-1 Sun",strtotime($year."1101"));
+ break;
+ case 'America/Cancun':
+ case 'America/Chihuahua':
+ case 'America/Ensenada':
+ case 'America/Tijuana':
+ case 'America/Mexico_City':
+ case 'America/Monterrey':
+ case 'Atlantic/Bermuda':
+ case 'Mexico/BajaSur':
+ case 'Mexico/BajaNorte':
+ case 'Mexico/General':
+ case 'America/Mazatlan':
$start = strtotime("+1 Sun",strtotime($year."0331"));
$end = strtotime("-1 Sun",strtotime($year."1101"));
- }else{
- $start = strtotime("+2 Sun",strtotime($year."0300"));
- $end = strtotime("+1 Sun",strtotime($year."1031"));
- }
- break;
- case 'America/Havana':
- case 'Cuba':
- $start = strtotime("+3 Sun",strtotime($year."0300"));
- $end = strtotime("-1 Sun",strtotime($year."1101"));
- break;
- case 'America/Cancun':
- case 'America/Chihuahua':
- case 'America/Ensenada':
- case 'America/Tijuana':
- case 'America/Mexico_City':
- case 'America/Monterrey':
- case 'Atlantic/Bermuda':
- case 'Mexico/BajaSur':
- case 'Mexico/BajaNorte':
- case 'Mexico/General':
- case 'America/Mazatlan':
- $start = strtotime("+1 Sun",strtotime($year."0331"));
- $end = strtotime("-1 Sun",strtotime($year."1101"));
- break;
- case 'Chile/EasterIsland': # array('-0500', '-0600');
- case 'Pacific/Easter':
-
- break;
- case 'America/Asuncion': # array('-0300', '-0400');
- case 'America/Cuiaba':
- case 'America/Santiago':
- case 'Antarctica/Palmer':
- case 'Atlantic/Stanley':
- case 'Chile/Continental':
-
- break;
- case 'America/Araguaina': # array('-0200', '-0300');
- case 'America/Sao_Paulo':
- case 'Brazil/East':
-
- break;
- case 'America/Scoresbysund': # array('-0100', '+0000');
- case 'Atlantic/Azores':
-
- break;
- case 'Atlantic/Canary': # array('+0000', '+0100');
- case 'Atlantic/Faeroe':
- case 'Atlantic/Madeira':
- case 'Eire':
- case 'Europe/Belfast':
- case 'Europe/Dublin':
- case 'Europe/Lisbon':
- case 'Europe/London':
- case 'GB-Eire':
- case 'GB':
- case 'Portugal':
- case 'WET':
-
- break;
- case 'Africa/Ceuta': # array('+0100', '+0200');
- case 'Arctic/Longyearbyen':
- case 'CET':
- case 'Europe/Amsterdam':
- case 'Europe/Andorra':
- case 'Europe/Belgrade':
- case 'Europe/Berlin':
- case 'Europe/Bratislava':
- case 'Europe/Brussels':
- case 'Europe/Budapest':
- case 'Europe/Copenhagen':
- case 'Europe/Gibraltar':
- case 'Europe/Ljubljana':
- case 'Europe/Luxembourg':
- case 'Europe/Madrid':
- case 'Europe/Malta':
- case 'Europe/Monaco':
- case 'Europe/Oslo':
- case 'Europe/Paris':
- case 'Europe/Prague':
- case 'Europe/Rome':
- case 'Europe/San_Marino':
- case 'Europe/Sarajevo':
- case 'Europe/Skopje':
- case 'Europe/Stockholm':
- case 'Europe/Tirane':
- case 'Europe/Vaduz':
- case 'Europe/Vatican':
- case 'Europe/Vienna':
- case 'Europe/Warsaw':
- case 'Europe/Zagreb':
- case 'Europe/Zurich':
- case 'MET':
- case 'Poland':
- $start = strtotime("-1 Sun",strtotime($year."0401"));
- $end = strtotime("-1 Sun",strtotime($year."1101"));
- break;
- case 'Africa/Windhoek': # array('+0200', '+0100');
-
- break;
- case 'Asia/Amman': # array('+0200', '+0300');
- case 'Asia/Beirut':
- case 'Asia/Damascus':
- case 'Asia/Gaza':
- case 'Asia/Istanbul':
- case 'Asia/Jerusalem':
- case 'Asia/Nicosia':
- case 'Asia/Tel_Aviv':
- case 'EET':
- case 'Egypt':
- case 'Europe/Athens':
- case 'Europe/Bucharest':
- case 'Europe/Chisinau':
- case 'Europe/Helsinki':
- case 'Europe/Istanbul':
- case 'Europe/Kaliningrad':
- case 'Europe/Kiev':
- case 'Europe/Minsk':
- case 'Europe/Nicosia':
- case 'Europe/Riga':
- case 'Europe/Simferopol':
- case 'Europe/Sofia':
- case 'Europe/Tiraspol':
- case 'Europe/Uzhgorod':
- case 'Europe/Zaporozhye':
- case 'Israel':
- case 'Turkey':
-
- break;
- case 'Asia/Baghdad': # array('+0300', '+0400');
- case 'Europe/Moscow':
- case 'W-SU':
-
- break;
- case 'Asia/Tehran': # array('+0330', '+0430');
- case 'Iran':
-
- break;
- case 'Asia/Aqtau': # array('+0400', '+0500');
- case 'Asia/Baku':
- case 'Asia/Tbilisi':
- case 'Asia/Yerevan':
- case 'Europe/Samara':
-
- break;
- case 'Asia/Aqtobe': # array('+0500', '+0600');
- case 'Asia/Bishkek':
- case 'Asia/Yekaterinburg':
-
- break;
- case 'Asia/Almaty': # array('+0600', '+0700');
- case 'Asia/Novosibirsk':
- case 'Asia/Omsk':
-
- break;
- case 'Asia/Krasnoyarsk': # array('+0700', '+0800');
-
- break;
- case 'Asia/Irkutsk': # array('+0800', '+0900');
-
- break;
- case 'Asia/Yakutsk': # array('+0900', '+1000');
+ break;
+ case 'Chile/EasterIsland': # array('-0500', '-0600');
+ case 'Pacific/Easter':
+ break;
+ case 'America/Asuncion': # array('-0300', '-0400');
+ case 'America/Cuiaba':
+ case 'America/Santiago':
+ case 'Antarctica/Palmer':
+ case 'Atlantic/Stanley':
+ case 'Chile/Continental':
- break;
- case 'Asia/Vladivostok': # array('+1000', '+1100');
- case 'Australia/ACT':
- case 'Australia/Melbourne':
- case 'Australia/NSW':
- case 'Australia/Sydney':
- case 'Australia/Tasmania':
- case 'Australia/Victoria':
-
- break;
- case 'Australia/Adelaide': # array('+1030', '+0930');
- case 'Australia/Broken_Hill':
- case 'Australia/South':
- case 'Australia/Yancowinna':
-
- break;
- case 'Asia/Magadan': # array('+1100', '+1200');
-
- break;
- case 'Australia/LHI': # array('+1100', '+1030');
- case 'Australia/Lord_Howe':
-
- break;
- case 'Australia/Canberra': # array('+1100', '+1000');
- case 'Australia/Hobart':
-
- break;
- case 'Asia/Anadyr': # array('+1200', '+1300');
- case 'Asia/Kamchatka':
-
- break;
- case 'Antarctica/McMurdo':
- case 'Antarctica/South_Pole':
- case 'NZ': # array('+1300', '+1200');
- case 'Pacific/Auckland':
- break;
- case 'NZ-CHAT':
- case 'Pacific/Chatham': # array('+1345', '+1245');
- break;
- default:
- $dlst = date('I', $time);
+ break;
+ case 'America/Araguaina': # array('-0200', '-0300');
+ case 'America/Sao_Paulo':
+ case 'Brazil/East':
+
+ break;
+ case 'America/Scoresbysund': # array('-0100', '+0000');
+ case 'Atlantic/Azores':
+
+ break;
+ case 'Atlantic/Canary': # array('+0000', '+0100');
+ case 'Atlantic/Faeroe':
+ case 'Atlantic/Madeira':
+ case 'Eire':
+ case 'Europe/Belfast':
+ case 'Europe/Dublin':
+ case 'Europe/Lisbon':
+ case 'Europe/London':
+ case 'GB-Eire':
+ case 'GB':
+ case 'Portugal':
+ case 'WET':
+ case 'Africa/Ceuta': # array('+0100', '+0200');
+ case 'Arctic/Longyearbyen':
+ case 'CET':
+ case 'Europe/Amsterdam':
+ case 'Europe/Andorra':
+ case 'Europe/Belgrade':
+ case 'Europe/Berlin':
+ case 'Europe/Bratislava':
+ case 'Europe/Brussels':
+ case 'Europe/Budapest':
+ case 'Europe/Copenhagen':
+ case 'Europe/Gibraltar':
+ case 'Europe/Ljubljana':
+ case 'Europe/Luxembourg':
+ case 'Europe/Madrid':
+ case 'Europe/Malta':
+ case 'Europe/Monaco':
+ case 'Europe/Oslo':
+ case 'Europe/Paris':
+ case 'Europe/Prague':
+ case 'Europe/Rome':
+ case 'Europe/San_Marino':
+ case 'Europe/Sarajevo':
+ case 'Europe/Skopje':
+ case 'Europe/Stockholm':
+ case 'Europe/Tirane':
+ case 'Europe/Vaduz':
+ case 'Europe/Vatican':
+ case 'Europe/Vienna':
+ case 'Europe/Warsaw':
+ case 'Europe/Zagreb':
+ case 'Europe/Zurich':
+ case 'MET':
+ case 'Poland':
+ case 'Europe/Athens':
+ case 'Europe/Bucharest':
+ case 'Europe/Chisinau':
+ case 'Europe/Helsinki':
+ case 'Europe/Istanbul':
+ case 'Europe/Kaliningrad':
+ case 'Europe/Kiev':
+ case 'Europe/Minsk':
+ case 'Europe/Nicosia':
+ case 'Europe/Riga':
+ case 'Europe/Simferopol':
+ case 'Europe/Sofia':
+ case 'Europe/Tiraspol':
+ case 'Europe/Uzhgorod':
+ case 'Europe/Zaporozhye':
+ case 'EET':
+ $start = strtotime("-1 Sun",strtotime($year."0401"));
+ $end = strtotime("-1 Sun",strtotime($year."1101"));
+ break;
+ case 'Africa/Windhoek': # array('+0200', '+0100');
+
+ break;
+ case 'Asia/Amman': # array('+0200', '+0300');
+ case 'Asia/Beirut':
+ case 'Asia/Damascus':
+ case 'Asia/Gaza':
+ case 'Asia/Istanbul':
+ case 'Asia/Jerusalem':
+ case 'Asia/Nicosia':
+ case 'Asia/Tel_Aviv':
+ case 'Egypt':
+ case 'Israel':
+ case 'Turkey':
+
+ break;
+ case 'Asia/Baghdad': # array('+0300', '+0400');
+ case 'Europe/Moscow':
+ case 'W-SU':
+
+ break;
+ case 'Asia/Tehran': # array('+0330', '+0430');
+ case 'Iran':
+
+ break;
+ case 'Asia/Aqtau': # array('+0400', '+0500');
+ case 'Asia/Baku':
+ case 'Asia/Tbilisi':
+ case 'Asia/Yerevan':
+ case 'Europe/Samara':
+
+ break;
+ case 'Asia/Aqtobe': # array('+0500', '+0600');
+ case 'Asia/Bishkek':
+ case 'Asia/Yekaterinburg':
+
+ break;
+ case 'Asia/Almaty': # array('+0600', '+0700');
+ case 'Asia/Novosibirsk':
+ case 'Asia/Omsk':
+
+ break;
+ case 'Asia/Krasnoyarsk': # array('+0700', '+0800');
+
+ break;
+ case 'Asia/Irkutsk': # array('+0800', '+0900');
+
+ break;
+ case 'Asia/Yakutsk': # array('+0900', '+1000');
+
+
+ break;
+ case 'Asia/Vladivostok': # array('+1000', '+1100');
+ case 'Australia/ACT':
+ case 'Australia/Melbourne':
+ case 'Australia/NSW':
+ case 'Australia/Sydney':
+ case 'Australia/Tasmania':
+ case 'Australia/Victoria':
+
+ break;
+ case 'Australia/Adelaide': # array('+1030', '+0930');
+ case 'Australia/Broken_Hill':
+ case 'Australia/South':
+ case 'Australia/Yancowinna':
+
+ break;
+ case 'Asia/Magadan': # array('+1100', '+1200');
+
+ break;
+ case 'Australia/LHI': # array('+1100', '+1030');
+ case 'Australia/Lord_Howe':
+
+ break;
+ case 'Australia/Canberra': # array('+1100', '+1000');
+ case 'Australia/Hobart':
+
+ break;
+ case 'Asia/Anadyr': # array('+1200', '+1300');
+ case 'Asia/Kamchatka':
+
+ break;
+ case 'Antarctica/McMurdo':
+ case 'Antarctica/South_Pole':
+ case 'NZ': # array('+1300', '+1200');
+ case 'Pacific/Auckland':
+ break;
+ case 'NZ-CHAT':
+ case 'Pacific/Chatham': # array('+1345', '+1245');
+ break;
+ default:
+ $dlst = date('I', $time);
+ }
}
if (isset($start,$end) && $time >= $start && $time < $end) $dlst = 1;
- echo "$summary $dlst <br>";
+ #echo "$summary $dlst <br>";
return $dlst;
diff --git a/functions/parse/end_vevent.php b/functions/parse/end_vevent.php
index 5970e65..80e1ce9 100644
--- a/functions/parse/end_vevent.php
+++ b/functions/parse/end_vevent.php
@@ -292,12 +292,18 @@ sort($recur_data);
// This used to use 5 different blocks to write the array... can it be reduced further?
$recur_data_hour = @substr($start_time,0,2);
$recur_data_minute = @substr($start_time,2,2);
+if (isset($allday_start) && $allday_start != ''){
+ $recur_data_hour = '00';
+ $recur_data_minute = '00';
+}
foreach($recur_data as $recur_data_unixtime) {
$recur_data_year = date('Y', $recur_data_unixtime);
$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;
+ /* at this point the recur data year, month, day, hour, and minute are in the default timezone for the phpicalendar installation, if that is set. We need to compare whether both the event timezone and the the phpicaledar timezone are in the same state wrt std vs daylight time. */
+
if (isset($allday_start) && $allday_start != '') {
$start_time2 = $recur_data_unixtime;
$end_time2 = strtotime('+'.$diff_allday_days.' days', $recur_data_unixtime);
diff --git a/functions/parse/parse_tzs.php b/functions/parse/parse_tzs.php
index c431d29..734851e 100644
--- a/functions/parse/parse_tzs.php
+++ b/functions/parse/parse_tzs.php
@@ -6,6 +6,9 @@ if (trim($nextline) != 'BEGIN:VCALENDAR') exit(error($lang['l_error_invalidcal']
// read file in line by line
// XXX end line is skipped because of the 1-line readahead
+$is_daylight = false;
+$is_std = false;
+
while (!feof($ifile)) {
$line = $nextline;
$nextline = fgets($ifile, 1024);
@@ -16,10 +19,7 @@ while (!feof($ifile)) {
$nextline = fgets($ifile, 1024);
$nextline = ereg_replace("[\r\n]", "", $nextline);
}
- $line = trim($line);
- $is_daylight = false;
- $is_std = false;
-
+ $line = trim($line);
switch ($line) {
case 'BEGIN:VTIMEZONE':
unset($tz_name, $offset_from, $offset_to, $tz_id);
@@ -55,13 +55,12 @@ while (!feof($ifile)) {
break;
default:
unset ( $data, $prop_pos, $property);
- if (ereg ("([^:]+):(.*)", $line, $line)){
- $property = $line[1];
- $data = $line[2];
+ if (ereg ("([^:]+):(.*)", $line, $arr)){
+ $property = $arr[1];
+ $data = $arr[2];
$prop_pos = strpos($property,';');
if ($prop_pos !== false) $property = substr($property,0,$prop_pos);
$property = strtoupper($property);
-
switch ($property) {
case 'TZID':
$tz_id = $data;
@@ -73,8 +72,14 @@ while (!feof($ifile)) {
$offset_to = $data;
break;
case 'DTSTART':
- if($is_std) $begin_std = $data;
- if($is_daylight) $begin_daylight = $data;
+ if($is_std || $is_daylight){
+ $datetime = extractDateTime($data, $property, $field);
+ $start_unixtime = $datetime[0];
+ $start_date = $datetime[1];
+ $year = substr($start_date,0,4);
+ if($is_std) $begin_std[$year] = $data;
+ if($is_daylight) $begin_daylight[$year] = $data;
+ }
break;
case 'TZNAME':
if($is_std) $st_name = $data;
diff --git a/functions/parse/recur_functions.php b/functions/parse/recur_functions.php
index 6a58d2d..2328e4b 100644
--- a/functions/parse/recur_functions.php
+++ b/functions/parse/recur_functions.php
@@ -1,33 +1,18 @@
<?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.
+"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
+If multiple BYxxx rule parts are specified, then after evaluating the specified FREQ and INTERVAL rule parts, the BYxxx rule parts are applied to the current set of evaluated occurrences in the following order: BYMONTH, BYWEEKNO, BYYEARDAY, BYMONTHDAY, BYDAY, BYHOUR, BYMINUTE, BYSECOND and BYSETPOS; then COUNT and UNTIL are evaluated."
+We will use two kinds of functions - those that restrict the date to allowed values and those that expand allowed values
*/
function add_recur($times,$freq=''){
global $recur_data;
- global $count, $mArray_begin, $mArray_end, $except_dates, $start_date_unixtime,$end_range_unixtime;
+ global $count, $mArray_begin, $mArray_end, $except_dates, $start_date, $start_date_unixtime,$end_range_unixtime, $day_offset;
if (!is_array($times)) $times = array($times);
- /*BYMONTH, BYWEEKNO, BYYEARDAY, BYMONTHDAY, BYDAY, BYHOUR,
- BYMINUTE, BYSECOND and BYSETPOS*/
+ /* BYMONTH, BYWEEKNO, BYYEARDAY, BYMONTHDAY, BYDAY, BYHOUR, BYMINUTE, BYSECOND and BYSETPOS */
#dump_times($times);
$times = restrict_bymonth($times,$freq);
# $times = restrict_byweekno($times,$freq);
@@ -43,12 +28,19 @@ function add_recur($times,$freq=''){
#echo "time:". date("Ymd",$time)."\n";
$date = date("Ymd",$time);
$time = strtotime("$date 12:00:00");
- if(isset($time) && !in_array($time, $recur_data) &&
- !in_array($date, $except_dates) && $time >= $start_date_unixtime && $date <= $until_date){
+ # day offset fixes shifts across day boundaries due to time diffs.
+ # These are already fixed for the initial instance, but need to be fixed for recurrences
+ if (date("Ymd", $time) != $start_date) $time = $time + $day_offset * (24*60*60);
+ if(isset($time)
+ && !in_array($time, $recur_data)
+ && !in_array($date, $except_dates)
+ && $time >= $start_date_unixtime
+ && $date <= $until_date
+ ){
$count--; #echo "\n.$count\n";
- if($time >= $mArray_begin &&
- $time <= $mArray_end
- && $count >= 0
+ if($time >= $mArray_begin
+ && $time <= $mArray_end
+ && $count >= 0
) $recur_data[] = $time;
}
}

© 2014-2024 Faster IT GmbH | imprint | privacy policy