diff options
author | jwangen <jwangen> | 2002-10-19 19:54:19 +0000 |
---|---|---|
committer | jwangen <jwangen> | 2002-10-19 19:54:19 +0000 |
commit | 11aef1af4e4f9410084767762f16fc3366132405 (patch) | |
tree | 320776a8cb9b3ca8b466c637639d4178868fb211 | |
parent | 173647337cd3d6dcfd0033f06103b926b6ca98c0 (diff) | |
download | phpicalendar-11aef1af4e4f9410084767762f16fc3366132405.tar.gz phpicalendar-11aef1af4e4f9410084767762f16fc3366132405.tar.bz2 phpicalendar-11aef1af4e4f9410084767762f16fc3366132405.zip |
Can now choose timezone option from config
-rw-r--r-- | TIMEZONES | 506 | ||||
-rw-r--r-- | config.inc.php | 1 | ||||
-rw-r--r-- | functions/date_functions.php | 2 | ||||
-rw-r--r-- | functions/ical_parser.php | 16 | ||||
-rw-r--r-- | functions/timezones.php | 50 |
5 files changed, 520 insertions, 55 deletions
diff --git a/TIMEZONES b/TIMEZONES new file mode 100644 index 0000000..827b0a3 --- /dev/null +++ b/TIMEZONES @@ -0,0 +1,506 @@ +TIMEZONES +--------- +If your timezone is not in this list, it is assumed that the GMT offset +for both regular time and daylight savings time is +0000. If this is +not correct, please use a timezone from this list which will acurrately +represent your GMT offsets. All these are case-sensitive. + +'Same as Server' is also a choice and it also case sensitive. This will +use the server's timezone offset. No entry at all (an empty string) means +to use the timezome of the event or calendar itself. This is default. + +This does not support setting the offset itself (ie '+0500') because the +offset might change depending on if we're looking at events when Daylight +Savings Time is on, or events when it's off. You must choose a timezone +from this list or an empty string. + +List of Timezones +----------------- +Same as Server +Africa/Addis_Ababa +Africa/Algiers +Africa/Asmera +Africa/Bangui +Africa/Blantyre +Africa/Brazzaville +Africa/Bujumbura +Africa/Cairo +Africa/Ceuta +Africa/Dar_es_Salaam +Africa/Djibouti +Africa/Douala +Africa/Gaborone +Africa/Harare +Africa/Johannesburg +Africa/Kampala +Africa/Khartoum +Africa/Kigali +Africa/Kinshasa +Africa/Lagos +Africa/Libreville +Africa/Luanda +Africa/Lubumbashi +Africa/Lusaka +Africa/Malabo +Africa/Maputo +Africa/Maseru +Africa/Mbabane +Africa/Mogadishu +Africa/Nairobi +Africa/Ndjamena +Africa/Niamey +Africa/Porto-Novo +Africa/Tripoli +Africa/Tunis +Africa/Windhoek +America/Adak +America/Anchorage +America/Anguilla +America/Antigua +America/Araguaina +America/Aruba +America/Asuncion +America/Atka +America/Barbados +America/Belem +America/Belize +America/Boa_Vista +America/Bogota +America/Boise +America/Buenos_Aires +America/Cambridge_Bay +America/Cancun +America/Caracas +America/Catamarca +America/Cayenne +America/Cayman +America/Chicago +America/Chihuahua +America/Cordoba +America/Costa_Rica +America/Cuiaba +America/Curacao +America/Dawson +America/Dawson_Creek +America/Denver +America/Detroit +America/Dominica +America/Edmonton +America/Eirunepe +America/El_Salvador +America/Ensenada +America/Fort_Wayne +America/Fortaleza +America/Glace_Bay +America/Godthab +America/Goose_Bay +America/Grand_Turk +America/Grenada +America/Guadeloupe +America/Guatemala +America/Guayaquil +America/Guyana +America/Halifax +America/Havana +America/Hermosillo +America/Indiana/Indianapolis +America/Indiana/Knox +America/Indiana/Marengo +America/Indiana/Vevay +America/Indianapolis +America/Inuvik +America/Iqaluit +America/Jamaica +America/Jujuy +America/Juneau +America/Kentucky/Louisville +America/Kentucky/Monticello +America/Knox_IN +America/La_Paz +America/Lima +America/Los_Angeles +America/Louisville +America/Maceio +America/Managua +America/Manaus +America/Martinique +America/Mazatlan +America/Mendoza +America/Menominee +America/Merida +America/Mexico_City +America/Miquelon +America/Monterrey +America/Montevideo +America/Montreal +America/Montserrat +America/Nassau +America/New_York +America/Nipigon +America/Nome +America/Noronha +America/Panama +America/Pangnirtung +America/Paramaribo +America/Phoenix +America/Port-au-Prince +America/Port_of_Spain +America/Porto_Acre +America/Porto_Velho +America/Puerto_Rico +America/Rainy_River +America/Rankin_Inlet +America/Recife +America/Regina +America/Rio_Branco +America/Rosario +America/Santiago +America/Santo_Domingo +America/Sao_Paulo +America/Scoresbysund +America/Shiprock +America/St_Johns +America/St_Kitts +America/St_Lucia +America/St_Thomas +America/St_Vincent +America/Swift_Current +America/Tegucigalpa +America/Thule +America/Thunder_Bay +America/Tijuana +America/Tortola +America/Vancouver +America/Virgin +America/Whitehorse +America/Winnipeg +America/Yakutat +America/Yellowknife +Antarctica/Casey +Antarctica/Davis +Antarctica/DumontDUrville +Antarctica/Mawson +Antarctica/McMurdo +Antarctica/Palmer +Antarctica/South_Pole +Antarctica/Syowa +Antarctica/Vostok +Arctic/Longyearbyen +Asia/Aden +Asia/Almaty +Asia/Amman +Asia/Anadyr +Asia/Aqtau +Asia/Aqtobe +Asia/Ashgabat +Asia/Ashkhabad +Asia/Baghdad +Asia/Bahrain +Asia/Baku +Asia/Bangkok +Asia/Beirut +Asia/Bishkek +Asia/Brunei +Asia/Calcutta +Asia/Chungking +Asia/Colombo +Asia/Dacca +Asia/Damascus +Asia/Dhaka +Asia/Dili +Asia/Dubai +Asia/Dushanbe +Asia/Gaza +Asia/Harbin +Asia/Hong_Kong +Asia/Hovd +Asia/Irkutsk +Asia/Istanbul +Asia/Jakarta +Asia/Jayapura +Asia/Jerusalem +Asia/Kabul +Asia/Kamchatka +Asia/Karachi +Asia/Kashgar +Asia/Katmandu +Asia/Krasnoyarsk +Asia/Kuala_Lumpur +Asia/Kuching +Asia/Kuwait +Asia/Macao +Asia/Magadan +Asia/Manila +Asia/Muscat +Asia/Nicosia +Asia/Novosibirsk +Asia/Omsk +Asia/Phnom_Penh +Asia/Pyongyang +Asia/Qatar +Asia/Rangoon +Asia/Riyadh +Asia/Riyadh87 +Asia/Riyadh88 +Asia/Riyadh89 +Asia/Saigon +Asia/Samarkand +Asia/Seoul +Asia/Shanghai +Asia/Singapore +Asia/Taipei +Asia/Tashkent +Asia/Tbilisi +Asia/Tehran +Asia/Tel_Aviv +Asia/Thimbu +Asia/Thimphu +Asia/Tokyo +Asia/Ujung_Pandang +Asia/Ulaanbaatar +Asia/Ulan_Bator +Asia/Urumqi +Asia/Vientiane +Asia/Vladivostok +Asia/Yakutsk +Asia/Yekaterinburg +Asia/Yerevan +Atlantic/Azores +Atlantic/Bermuda +Atlantic/Canary +Atlantic/Cape_Verde +Atlantic/Faeroe +Atlantic/Jan_Mayen +Atlantic/Madeira +Atlantic/South_Georgia +Atlantic/Stanley +Australia/ACT +Australia/Adelaide +Australia/Brisbane +Australia/Broken_Hill +Australia/Canberra +Australia/Darwin +Australia/Hobart +Australia/LHI +Australia/Lindeman +Australia/Lord_Howe +Australia/Melbourne +Australia/NSW +Australia/North +Australia/Perth +Australia/Queensland +Australia/South +Australia/Sydney +Australia/Tasmania +Australia/Victoria +Australia/West +Australia/Yancowinna +Brazil/Acre +Brazil/DeNoronha +Brazil/East +Brazil/West +CET +CST6CDT +Canada/Atlantic +Canada/Central +Canada/East-Saskatchewan +Canada/Eastern +Canada/Mountain +Canada/Newfoundland +Canada/Pacific +Canada/Saskatchewan +Canada/Yukon +Chile/Continental +Chile/EasterIsland +Cuba +EET +EST +EST5EDT +Egypt +Eire +Etc/GMT+1 +Etc/GMT+10 +Etc/GMT+11 +Etc/GMT+12 +Etc/GMT+2 +Etc/GMT+3 +Etc/GMT+4 +Etc/GMT+5 +Etc/GMT+6 +Etc/GMT+7 +Etc/GMT+8 +Etc/GMT+9 +Etc/GMT-1 +Etc/GMT-10 +Etc/GMT-11 +Etc/GMT-12 +Etc/GMT-13 +Etc/GMT-14 +Etc/GMT-2 +Etc/GMT-3 +Etc/GMT-4 +Etc/GMT-5 +Etc/GMT-6 +Etc/GMT-7 +Etc/GMT-8 +Etc/GMT-9 +Europe/Amsterdam +Europe/Andorra +Europe/Athens +Europe/Belfast +Europe/Belgrade +Europe/Berlin +Europe/Bratislava +Europe/Brussels +Europe/Bucharest +Europe/Budapest +Europe/Chisinau +Europe/Copenhagen +Europe/Dublin +Europe/Gibraltar +Europe/Helsinki +Europe/Istanbul +Europe/Kaliningrad +Europe/Kiev +Europe/Lisbon +Europe/Ljubljana +Europe/London +Europe/Luxembourg +Europe/Madrid +Europe/Malta +Europe/Minsk +Europe/Monaco +Europe/Moscow +Europe/Nicosia +Europe/Oslo +Europe/Paris +Europe/Prague +Europe/Riga +Europe/Rome +Europe/Samara +Europe/San_Marino +Europe/Sarajevo +Europe/Simferopol +Europe/Skopje +Europe/Sofia +Europe/Stockholm +Europe/Tallinn +Europe/Tirane +Europe/Tiraspol +Europe/Uzhgorod +Europe/Vaduz +Europe/Vatican +Europe/Vienna +Europe/Vilnius +Europe/Warsaw +Europe/Zagreb +Europe/Zaporozhye +Europe/Zurich +GB +GB-Eire +HST +Hongkong +Indian/Antananarivo +Indian/Chagos +Indian/Christmas +Indian/Cocos +Indian/Comoro +Indian/Kerguelen +Indian/Mahe +Indian/Maldives +Indian/Mauritius +Indian/Mayotte +Indian/Reunion +Iran +Israel +Jamaica +Japan +Kwajalein +Libya +MET +MST +MST7MDT +Mexico/BajaNorte +Mexico/BajaSur +Mexico/General +Mideast/Riyadh87 +Mideast/Riyadh88 +Mideast/Riyadh89 +NZ +NZ-CHAT +Navajo +PRC +PST8PDT +Pacific/Apia +Pacific/Auckland +Pacific/Chatham +Pacific/Easter +Pacific/Efate +Pacific/Enderbury +Pacific/Fakaofo +Pacific/Fiji +Pacific/Funafuti +Pacific/Galapagos +Pacific/Gambier +Pacific/Guadalcanal +Pacific/Guam +Pacific/Honolulu +Pacific/Johnston +Pacific/Kiritimati +Pacific/Kosrae +Pacific/Kwajalein +Pacific/Majuro +Pacific/Marquesas +Pacific/Midway +Pacific/Nauru +Pacific/Niue +Pacific/Norfolk +Pacific/Noumea +Pacific/Pago_Pago +Pacific/Palau +Pacific/Pitcairn +Pacific/Ponape +Pacific/Port_Moresby +Pacific/Rarotonga +Pacific/Saipan +Pacific/Samoa +Pacific/Tahiti +Pacific/Tarawa +Pacific/Tongatapu +Pacific/Truk +Pacific/Wake +Pacific/Wallis +Pacific/Yap +Poland +Portugal +ROC +ROK +Singapore +SystemV/AST4 +SystemV/AST4ADT +SystemV/CST6 +SystemV/CST6CDT +SystemV/EST5 +SystemV/EST5EDT +SystemV/HST10 +SystemV/MST7 +SystemV/MST7MDT +SystemV/PST8 +SystemV/PST8PDT +SystemV/YST9 +SystemV/YST9YDT +Turkey +US/Alaska +US/Aleutian +US/Arizona +US/Central +US/East-Indiana +US/Eastern +US/Hawaii +US/Indiana-Starke +US/Michigan +US/Mountain +US/Pacific +US/Samoa +W-SU +WET diff --git a/config.inc.php b/config.inc.php index b71f4a4..4ff59f2 100644 --- a/config.inc.php +++ b/config.inc.php @@ -19,6 +19,7 @@ $month_event_lines = '1'; // Number of lines to wrap each event title in mont $tomorrows_events_lines = '1'; // Number of lines to wrap each event title in the 'Tommorrow's events' box, 0 means display all lines. $allday_week_lines = '1'; // Number of lines to wrap each event title in all-day events in week view, 0 means display all lines. $week_events_lines = '1'; // Number of lines to wrap each event title in the 'Tommorrow's events' box, 0 means display all lines. +$timezone = ''; // Set timezone. Read TIMEZONES file for more information // Yes/No questions --- 'yes' means Yes, anything else means no. 'yes' must be lowercase. $save_parsed_cals = 'no'; // Recommended 'yes'. Saves a copy of the cal in /tmp after it's been parsed. Improves performence. diff --git a/functions/date_functions.php b/functions/date_functions.php index 2f73543..4683caa 100644 --- a/functions/date_functions.php +++ b/functions/date_functions.php @@ -1 +1 @@ -<?php
// date_functions.php
// functions for returning or comparing dates
// takes Apple's 2 character day format and makes it into 3 characters
function two2threeCharDays($day) {
switch($day) {
case 'SU': $day_longer = 'sun'; break;
case 'MO': $day_longer = 'mon'; break;
case 'TU': $day_longer = 'tue'; break;
case 'WE': $day_longer = 'wed'; break;
case 'TH': $day_longer = 'thu'; break;
case 'FR': $day_longer = 'fri'; break;
case 'SA': $day_longer = 'sat'; break;
}
return $day_longer;
}
// 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';
$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);
$ret_unixtime = strtotime($day,$start_day_time);
$ret_unixtime = strtotime('+12 hours', $ret_unixtime);
$ret = date('Ymd',$ret_unixtime);
return $ret;
}
// function to compare to dates in Ymd and return the number of weeks
// that differ between them. requires dateOfWeek()
function weekCompare($now, $then) {
global $week_start_day;
$sun_now = dateOfWeek($now, $week_start_day);
$sun_then = dateOfWeek($then, $week_start_day);
$seconds_now = strtotime($sun_now);
$seconds_then = strtotime($sun_then);
$diff_seconds = $seconds_now - $seconds_then;
$diff_minutes = $diff_seconds/60;
$diff_hours = $diff_minutes/60;
$diff_days = round($diff_hours/24);
$diff_weeks = $diff_days/7;
return $diff_weeks;
}
// function to compare to dates in Ymd and return the number of days
// that differ between them.
function dayCompare($now, $then) {
$seconds_now = strtotime($now);
$seconds_then = strtotime($then);
$diff_seconds = $seconds_now - $seconds_then;
$diff_minutes = $diff_seconds/60;
$diff_hours = $diff_minutes/60;
$diff_days = round($diff_hours/24);
return $diff_days;
}
// function to compare to dates in Ymd and return the number of months
// that differ between them.
function monthCompare($now, $then) {
ereg ("([0-9]{4})([0-9]{2})([0-9]{2})", $now, $date_now);
ereg ("([0-9]{4})([0-9]{2})([0-9]{2})", $then, $date_then);
$diff_years = $date_now[1] - $date_then[1];
$diff_months = $date_now[2] - $date_then[2];
if ($date_now[2] < $date_then[2]) {
$diff_years -= 1;
$diff_months = ($diff_months + 12) % 12;
}
$diff_months = ($diff_years * 12) + $diff_months;
return $diff_months;
}
function yearCompare($now, $then) {
ereg ("([0-9]{4})([0-9]{2})([0-9]{2})", $now, $date_now);
ereg ("([0-9]{4})([0-9]{2})([0-9]{2})", $then, $date_then);
$diff_years = $date_now[1] - $date_then[1];
return $diff_years;
}
// localizeDate() - similar to strftime but uses our preset arrays of localized
// months and week days and only supports %A, %a, %B, %b, %e, and %Y
// more can be added as needed but trying to keep it small while we can
function localizeDate($format, $timestamp) {
global $daysofweek_lang, $daysofweekshort_lang, $daysofweekreallyshort_lang, $monthsofyear_lang, $monthsofyear_lang, $monthsofyearshort_lang;
$year = date("Y", $timestamp);
$month = date("n", $timestamp)-1;
$day = date("j", $timestamp);
$dayofweek = date("w", $timestamp);
$date = str_replace('%Y', $year, $format);
$date = str_replace('%e', $day, $date);
$date = str_replace('%B', $monthsofyear_lang[$month], $date);
$date = str_replace('%b', $monthsofyearshort_lang[$month], $date);
$date = str_replace('%A', $daysofweek_lang[$dayofweek], $date);
$date = str_replace('%a', $daysofweekshort_lang[$dayofweek], $date);
return $date;
}
// calcOffset takes an offset (ie, -0500) and returns it in the number of seconds
function calcOffset($offset_str) {
$sign = substr($offset_str, 0, 1);
$hours = substr($offset_str, 1, 2);
$mins = substr($offset_str, 3, 2);
$secs = ((int)$hours * 3600) + ((int)$mins * 60);
if ($sign == '-') $secs = 0 - $secs;
return $secs;
}
// calcTime calculates the unixtime of a new offset by comparing it to the current offset
// $have is the current offset (ie, '-0500')
// $want is the wanted offset (ie, '-0700')
// $time is the unixtime relative to $have
function calcTime($have, $want, $time) {
$have_secs = calcOffset($have);
$want_secs = calcOffset($want);
$diff = $want_secs - $have_secs;
$time += $diff;
return $time;
}
?>
\ No newline at end of file +<?php
// date_functions.php
// functions for returning or comparing dates
// not a date function, but I didn't know where to put it
// for backwards compatibility
if (phpversion() < '4.1') {
function array_key_exists($key, $arr) {
if (!is_array($arr)) return false;
foreach (array_keys($arr) as $k) {
if ("$k" == "$key") return true;
}
return false;
}
}
// takes Apple's 2 character day format and makes it into 3 characters
function two2threeCharDays($day) {
switch($day) {
case 'SU': $day_longer = 'sun'; break;
case 'MO': $day_longer = 'mon'; break;
case 'TU': $day_longer = 'tue'; break;
case 'WE': $day_longer = 'wed'; break;
case 'TH': $day_longer = 'thu'; break;
case 'FR': $day_longer = 'fri'; break;
case 'SA': $day_longer = 'sat'; break;
}
return $day_longer;
}
// 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';
$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);
$ret_unixtime = strtotime($day,$start_day_time);
$ret_unixtime = strtotime('+12 hours', $ret_unixtime);
$ret = date('Ymd',$ret_unixtime);
return $ret;
}
// function to compare to dates in Ymd and return the number of weeks
// that differ between them. requires dateOfWeek()
function weekCompare($now, $then) {
global $week_start_day;
$sun_now = dateOfWeek($now, $week_start_day);
$sun_then = dateOfWeek($then, $week_start_day);
$seconds_now = strtotime($sun_now);
$seconds_then = strtotime($sun_then);
$diff_seconds = $seconds_now - $seconds_then;
$diff_minutes = $diff_seconds/60;
$diff_hours = $diff_minutes/60;
$diff_days = round($diff_hours/24);
$diff_weeks = $diff_days/7;
return $diff_weeks;
}
// function to compare to dates in Ymd and return the number of days
// that differ between them.
function dayCompare($now, $then) {
$seconds_now = strtotime($now);
$seconds_then = strtotime($then);
$diff_seconds = $seconds_now - $seconds_then;
$diff_minutes = $diff_seconds/60;
$diff_hours = $diff_minutes/60;
$diff_days = round($diff_hours/24);
return $diff_days;
}
// function to compare to dates in Ymd and return the number of months
// that differ between them.
function monthCompare($now, $then) {
ereg ("([0-9]{4})([0-9]{2})([0-9]{2})", $now, $date_now);
ereg ("([0-9]{4})([0-9]{2})([0-9]{2})", $then, $date_then);
$diff_years = $date_now[1] - $date_then[1];
$diff_months = $date_now[2] - $date_then[2];
if ($date_now[2] < $date_then[2]) {
$diff_years -= 1;
$diff_months = ($diff_months + 12) % 12;
}
$diff_months = ($diff_years * 12) + $diff_months;
return $diff_months;
}
function yearCompare($now, $then) {
ereg ("([0-9]{4})([0-9]{2})([0-9]{2})", $now, $date_now);
ereg ("([0-9]{4})([0-9]{2})([0-9]{2})", $then, $date_then);
$diff_years = $date_now[1] - $date_then[1];
return $diff_years;
}
// localizeDate() - similar to strftime but uses our preset arrays of localized
// months and week days and only supports %A, %a, %B, %b, %e, and %Y
// more can be added as needed but trying to keep it small while we can
function localizeDate($format, $timestamp) {
global $daysofweek_lang, $daysofweekshort_lang, $daysofweekreallyshort_lang, $monthsofyear_lang, $monthsofyear_lang, $monthsofyearshort_lang;
$year = date("Y", $timestamp);
$month = date("n", $timestamp)-1;
$day = date("j", $timestamp);
$dayofweek = date("w", $timestamp);
$date = str_replace('%Y', $year, $format);
$date = str_replace('%e', $day, $date);
$date = str_replace('%B', $monthsofyear_lang[$month], $date);
$date = str_replace('%b', $monthsofyearshort_lang[$month], $date);
$date = str_replace('%A', $daysofweek_lang[$dayofweek], $date);
$date = str_replace('%a', $daysofweekshort_lang[$dayofweek], $date);
return $date;
}
// calcOffset takes an offset (ie, -0500) and returns it in the number of seconds
function calcOffset($offset_str) {
$sign = substr($offset_str, 0, 1);
$hours = substr($offset_str, 1, 2);
$mins = substr($offset_str, 3, 2);
$secs = ((int)$hours * 3600) + ((int)$mins * 60);
if ($sign == '-') $secs = 0 - $secs;
return $secs;
}
// calcTime calculates the unixtime of a new offset by comparing it to the current offset
// $have is the current offset (ie, '-0500')
// $want is the wanted offset (ie, '-0700')
// $time is the unixtime relative to $have
function calcTime($have, $want, $time) {
if ($have == 'none' || $want == 'none') return $time;
$have_secs = calcOffset($have);
$want_secs = calcOffset($want);
$diff = $want_secs - $have_secs;
$time += $diff;
return $time;
}
function chooseOffset($time) {
global $timezone, $tz_array;
if (!isset($timezone)) $timezone = '';
switch ($timezone) {
case '':
$offset = 'none';
break;
case 'Same as Server':
$offset = date('O', $time);
break;
default:
if (is_array($tz_array) && array_key_exists($timezone, $tz_array)) {
$dlst = date('I', $time);
$offset = $tz_array[$timezone][$dlst];
} else {
$offset = '+0000';
}
}
return $offset;
}
?>
\ No newline at end of file diff --git a/functions/ical_parser.php b/functions/ical_parser.php index 9362e13..5fdbd26 100644 --- a/functions/ical_parser.php +++ b/functions/ical_parser.php @@ -421,11 +421,19 @@ if ($parse_file) { $start_unixtime = mktime($regs[4], $regs[5], 0, $regs[2], $regs[3], $regs[1]); $dlst = date('I', $start_unixtime); - $server_offset_tmp = date('O', $start_unixtime); + $server_offset_tmp = chooseOffset($start_unixtime); if (isset($tz_dtstart)) { - $offset_tmp = $tz_array[$tz_dtstart][$dlst]; + if (array_key_exists($tz_dtstart, $tz_array)) { + $offset_tmp = $tz_array[$tz_dtstart][$dlst]; + } else { + $offset_tmp = '+0000'; + } } elseif (isset($calendar_tz)) { - $offset_tmp = $tz_array[$calendar_tz][$dlst]; + if (array_key_exists($calendar_tz, $tz_array)) { + $offset_tmp = $tz_array[$calendar_tz][$dlst]; + } else { + $offset_tmp = '+0000'; + } } else { $offset_tmp = $server_offset_tmp; } @@ -452,7 +460,7 @@ if ($parse_file) { $end_unixtime = mktime($regs[4], $regs[5], 0, $regs[2], $regs[3], $regs[1]); $dlst = date('I', $end_unixtime); - $server_offset_tmp = date('O', $start_unixtime); + $server_offset_tmp = chooseOffset($end_unixtime); if (isset($tz_dtend)) { $offset_tmp = $tz_array[$tz_dtend][$dlst]; } elseif (isset($calendar_tz)) { diff --git a/functions/timezones.php b/functions/timezones.php index 53c9364..fa42298 100644 --- a/functions/timezones.php +++ b/functions/timezones.php @@ -1,26 +1,16 @@ <?php -$tz_array['Africa/Abidjan'] = array('+0000', '+0000'); -$tz_array['Africa/Accra'] = array('+0000', '+0000'); $tz_array['Africa/Addis_Ababa'] = array('+0300', '+0300'); $tz_array['Africa/Algiers'] = array('+0100', '+0100'); $tz_array['Africa/Asmera'] = array('+0300', '+0300'); -$tz_array['Africa/Bamako'] = array('+0000', '+0000'); $tz_array['Africa/Bangui'] = array('+0100', '+0100'); -$tz_array['Africa/Banjul'] = array('+0000', '+0000'); -$tz_array['Africa/Bissau'] = array('+0000', '+0000'); $tz_array['Africa/Blantyre'] = array('+0200', '+0200'); $tz_array['Africa/Brazzaville'] = array('+0100', '+0100'); $tz_array['Africa/Bujumbura'] = array('+0200', '+0200'); $tz_array['Africa/Cairo'] = array('+0200', '+0300'); -$tz_array['Africa/Casablanca'] = array('+0000', '+0000'); $tz_array['Africa/Ceuta'] = array('+0100', '+0200'); -$tz_array['Africa/Conakry'] = array('+0000', '+0000'); -$tz_array['Africa/Dakar'] = array('+0000', '+0000'); $tz_array['Africa/Dar_es_Salaam'] = array('+0300', '+0300'); $tz_array['Africa/Djibouti'] = array('+0300', '+0300'); $tz_array['Africa/Douala'] = array('+0100', '+0100'); -$tz_array['Africa/El_Aaiun'] = array('+0000', '+0000'); -$tz_array['Africa/Freetown'] = array('+0000', '+0000'); $tz_array['Africa/Gaborone'] = array('+0200', '+0200'); $tz_array['Africa/Harare'] = array('+0200', '+0200'); $tz_array['Africa/Johannesburg'] = array('+0200', '+0200'); @@ -30,7 +20,6 @@ $tz_array['Africa/Kigali'] = array('+0200', '+0200'); $tz_array['Africa/Kinshasa'] = array('+0100', '+0100'); $tz_array['Africa/Lagos'] = array('+0100', '+0100'); $tz_array['Africa/Libreville'] = array('+0100', '+0100'); -$tz_array['Africa/Lome'] = array('+0000', '+0000'); $tz_array['Africa/Luanda'] = array('+0100', '+0100'); $tz_array['Africa/Lubumbashi'] = array('+0200', '+0200'); $tz_array['Africa/Lusaka'] = array('+0200', '+0200'); @@ -39,15 +28,10 @@ $tz_array['Africa/Maputo'] = array('+0200', '+0200'); $tz_array['Africa/Maseru'] = array('+0200', '+0200'); $tz_array['Africa/Mbabane'] = array('+0200', '+0200'); $tz_array['Africa/Mogadishu'] = array('+0300', '+0300'); -$tz_array['Africa/Monrovia'] = array('+0000', '+0000'); $tz_array['Africa/Nairobi'] = array('+0300', '+0300'); $tz_array['Africa/Ndjamena'] = array('+0100', '+0100'); $tz_array['Africa/Niamey'] = array('+0100', '+0100'); -$tz_array['Africa/Nouakchott'] = array('+0000', '+0000'); -$tz_array['Africa/Ouagadougou'] = array('+0000', '+0000'); $tz_array['Africa/Porto-Novo'] = array('+0100', '+0100'); -$tz_array['Africa/Sao_Tome'] = array('+0000', '+0000'); -$tz_array['Africa/Timbuktu'] = array('+0000', '+0000'); $tz_array['Africa/Tripoli'] = array('+0200', '+0200'); $tz_array['Africa/Tunis'] = array('+0100', '+0100'); $tz_array['Africa/Windhoek'] = array('+0200', '+0100'); @@ -78,7 +62,6 @@ $tz_array['America/Cordoba'] = array('-0300', '-0300'); $tz_array['America/Costa_Rica'] = array('-0600', '-0600'); $tz_array['America/Cuiaba'] = array('-0300', '-0400'); $tz_array['America/Curacao'] = array('-0400', '-0400'); -$tz_array['America/Danmarkshavn'] = array('+0000', '+0000'); $tz_array['America/Dawson'] = array('-0800', '-0700'); $tz_array['America/Dawson_Creek'] = array('-0700', '-0700'); $tz_array['America/Denver'] = array('-0700', '-0600'); @@ -138,7 +121,6 @@ $tz_array['America/New_York'] = array('-0500', '-0400'); $tz_array['America/Nipigon'] = array('-0500', '-0400'); $tz_array['America/Nome'] = array('-0900', '-0800'); $tz_array['America/Noronha'] = array('-0200', '-0200'); -$tz_array['America/North_Dakota/Center'] = array('+0000', '+0000'); $tz_array['America/Panama'] = array('-0500', '-0500'); $tz_array['America/Pangnirtung'] = array('-0500', '-0400'); $tz_array['America/Paramaribo'] = array('-0300', '-0300'); @@ -202,8 +184,6 @@ $tz_array['Asia/Beirut'] = array('+0200', '+0300'); $tz_array['Asia/Bishkek'] = array('+0500', '+0600'); $tz_array['Asia/Brunei'] = array('+0800', '+0800'); $tz_array['Asia/Calcutta'] = array('+051800', '+051800'); -$tz_array['Asia/Choibalsan'] = array('+0000', '+0000'); -$tz_array['Asia/Chongqing'] = array('+0000', '+0000'); $tz_array['Asia/Chungking'] = array('+0800', '+0800'); $tz_array['Asia/Colombo'] = array('+0600', '+0600'); $tz_array['Asia/Dacca'] = array('+0600', '+0600'); @@ -217,7 +197,6 @@ $tz_array['Asia/Harbin'] = array('+0800', '+0800'); $tz_array['Asia/Hong_Kong'] = array('+0800', '+0800'); $tz_array['Asia/Hovd'] = array('+0700', '+0700'); $tz_array['Asia/Irkutsk'] = array('+0800', '+0900'); -$tz_array['Asia/Ishigaki'] = array('+0000', '+0000'); $tz_array['Asia/Istanbul'] = array('+0200', '+0300'); $tz_array['Asia/Jakarta'] = array('+0700', '+0700'); $tz_array['Asia/Jayapura'] = array('+0900', '+0900'); @@ -232,26 +211,21 @@ $tz_array['Asia/Kuala_Lumpur'] = array('+0800', '+0800'); $tz_array['Asia/Kuching'] = array('+0800', '+0800'); $tz_array['Asia/Kuwait'] = array('+0300', '+0300'); $tz_array['Asia/Macao'] = array('+0800', '+0800'); -$tz_array['Asia/Macau'] = array('+0000', '+0000'); $tz_array['Asia/Magadan'] = array('+1100', '+1200'); $tz_array['Asia/Manila'] = array('+0800', '+0800'); $tz_array['Asia/Muscat'] = array('+0400', '+0400'); $tz_array['Asia/Nicosia'] = array('+0200', '+0300'); $tz_array['Asia/Novosibirsk'] = array('+0600', '+0700'); $tz_array['Asia/Omsk'] = array('+0600', '+0700'); -$tz_array['Asia/Oral'] = array('+0000', '+0000'); $tz_array['Asia/Phnom_Penh'] = array('+0700', '+0700'); -$tz_array['Asia/Pontianak'] = array('+0000', '+0000'); $tz_array['Asia/Pyongyang'] = array('+0900', '+0900'); $tz_array['Asia/Qatar'] = array('+0300', '+0300'); -$tz_array['Asia/Qyzylorda'] = array('+0000', '+0000'); $tz_array['Asia/Rangoon'] = array('+061800', '+061800'); $tz_array['Asia/Riyadh'] = array('+0300', '+0300'); $tz_array['Asia/Riyadh87'] = array('+03424', '+03424'); $tz_array['Asia/Riyadh88'] = array('+03424', '+03424'); $tz_array['Asia/Riyadh89'] = array('+03424', '+03424'); $tz_array['Asia/Saigon'] = array('+0700', '+0700'); -$tz_array['Asia/Sakhalin'] = array('+0000', '+0000'); $tz_array['Asia/Samarkand'] = array('+0500', '+0500'); $tz_array['Asia/Seoul'] = array('+0900', '+0900'); $tz_array['Asia/Shanghai'] = array('+0800', '+0800'); @@ -280,9 +254,7 @@ $tz_array['Atlantic/Cape_Verde'] = array('-0100', '-0100'); $tz_array['Atlantic/Faeroe'] = array('+0000', '+0100'); $tz_array['Atlantic/Jan_Mayen'] = array('-0100', '-0100'); $tz_array['Atlantic/Madeira'] = array('+0000', '+0100'); -$tz_array['Atlantic/Reykjavik'] = array('+0000', '+0000'); $tz_array['Atlantic/South_Georgia'] = array('-0200', '-0200'); -$tz_array['Atlantic/St_Helena'] = array('+0000', '+0000'); $tz_array['Atlantic/Stanley'] = array('-0300', '-0400'); $tz_array['Australia/ACT'] = array('+1100', '+1000'); $tz_array['Australia/Adelaide'] = array('+101800', '+091800'); @@ -322,16 +294,12 @@ $tz_array['Canada/Saskatchewan'] = array('-0600', '-0600'); $tz_array['Canada/Yukon'] = array('-0800', '-0700'); $tz_array['Chile/Continental'] = array('-0300', '-0400'); $tz_array['Chile/EasterIsland'] = array('-0500', '-0600'); -$tz_array['China/Beijing'] = array('+0000', '+0000'); -$tz_array['China/Shanghai'] = array('+0000', '+0000'); $tz_array['Cuba'] = array('-0500', '-0400'); $tz_array['EET'] = array('+0200', '+0300'); $tz_array['EST'] = array('-0500', '-0500'); $tz_array['EST5EDT'] = array('-0500', '-0400'); $tz_array['Egypt'] = array('+0200', '+0300'); $tz_array['Eire'] = array('+0000', '+0100'); -$tz_array['Etc/GMT'] = array('+0000', '+0000'); -$tz_array['Etc/GMT+0'] = array('+0000', '+0000'); $tz_array['Etc/GMT+1'] = array('-0100', '-0100'); $tz_array['Etc/GMT+10'] = array('-1000', '-1000'); $tz_array['Etc/GMT+11'] = array('-1100', '-1100'); @@ -344,7 +312,6 @@ $tz_array['Etc/GMT+6'] = array('-0600', '-0600'); $tz_array['Etc/GMT+7'] = array('-0700', '-0700'); $tz_array['Etc/GMT+8'] = array('-0800', '-0800'); $tz_array['Etc/GMT+9'] = array('-0900', '-0900'); -$tz_array['Etc/GMT-0'] = array('+0000', '+0000'); $tz_array['Etc/GMT-1'] = array('+0100', '+0100'); $tz_array['Etc/GMT-10'] = array('+1000', '+1000'); $tz_array['Etc/GMT-11'] = array('+1100', '+1100'); @@ -359,12 +326,6 @@ $tz_array['Etc/GMT-6'] = array('+0600', '+0600'); $tz_array['Etc/GMT-7'] = array('+0700', '+0700'); $tz_array['Etc/GMT-8'] = array('+0800', '+0800'); $tz_array['Etc/GMT-9'] = array('+0900', '+0900'); -$tz_array['Etc/GMT0'] = array('+0000', '+0000'); -$tz_array['Etc/Greenwich'] = array('+0000', '+0000'); -$tz_array['Etc/UCT'] = array('+0000', '+0000'); -$tz_array['Etc/UTC'] = array('+0000', '+0000'); -$tz_array['Etc/Universal'] = array('+0000', '+0000'); -$tz_array['Etc/Zulu'] = array('+0000', '+0000'); $tz_array['Europe/Amsterdam'] = array('+0100', '+0200'); $tz_array['Europe/Andorra'] = array('+0100', '+0200'); $tz_array['Europe/Athens'] = array('+0200', '+0300'); @@ -417,17 +378,10 @@ $tz_array['Europe/Warsaw'] = array('+0100', '+0200'); $tz_array['Europe/Zagreb'] = array('+0100', '+0200'); $tz_array['Europe/Zaporozhye'] = array('+0200', '+0300'); $tz_array['Europe/Zurich'] = array('+0100', '+0200'); -$tz_array['Factory'] = array('+0000', '+0000'); $tz_array['GB'] = array('+0000', '+0100'); $tz_array['GB-Eire'] = array('+0000', '+0100'); -$tz_array['GMT'] = array('+0000', '+0000'); -$tz_array['GMT+0'] = array('+0000', '+0000'); -$tz_array['GMT-0'] = array('+0000', '+0000'); -$tz_array['GMT0'] = array('+0000', '+0000'); -$tz_array['Greenwich'] = array('+0000', '+0000'); $tz_array['HST'] = array('-1000', '-1000'); $tz_array['Hongkong'] = array('+0800', '+0800'); -$tz_array['Iceland'] = array('+0000', '+0000'); $tz_array['Indian/Antananarivo'] = array('+0300', '+0300'); $tz_array['Indian/Chagos'] = array('+0500', '+0500'); $tz_array['Indian/Christmas'] = array('+0700', '+0700'); @@ -518,7 +472,6 @@ $tz_array['SystemV/PST8PDT'] = array('-0800', '-0700'); $tz_array['SystemV/YST9'] = array('-0900', '-0900'); $tz_array['SystemV/YST9YDT'] = array('-0900', '-0800'); $tz_array['Turkey'] = array('+0200', '+0300'); -$tz_array['UCT'] = array('+0000', '+0000'); $tz_array['US/Alaska'] = array('-0900', '-0800'); $tz_array['US/Aleutian'] = array('-1000', '-0900'); $tz_array['US/Arizona'] = array('-0700', '-0700'); @@ -531,9 +484,6 @@ $tz_array['US/Michigan'] = array('-0500', '-0400'); $tz_array['US/Mountain'] = array('-0700', '-0600'); $tz_array['US/Pacific'] = array('-0800', '-0700'); $tz_array['US/Samoa'] = array('-1100', '-1100'); -$tz_array['UTC'] = array('+0000', '+0000'); -$tz_array['Universal'] = array('+0000', '+0000'); $tz_array['W-SU'] = array('+0300', '+0400'); $tz_array['WET'] = array('+0000', '+0100'); -$tz_array['Zulu'] = array('+0000', '+0000'); ?>
\ No newline at end of file |