aboutsummaryrefslogtreecommitdiffstats
path: root/functions/parse/parse_tzs.php
diff options
context:
space:
mode:
authorJim Hu <jimhu@users.sourceforge.net>2008-12-26 05:54:46 +0000
committerJim Hu <jimhu@users.sourceforge.net>2008-12-26 05:54:46 +0000
commit7d565474b41400bfce2d665da96d39631458eda3 (patch)
treea0e7a345fb2caeb0eac189b10f2a101a515a2083 /functions/parse/parse_tzs.php
parent52ba3b8146dd01c1c7d057359f4485aae5813124 (diff)
downloadphpicalendar-7d565474b41400bfce2d665da96d39631458eda3.tar.gz
phpicalendar-7d565474b41400bfce2d665da96d39631458eda3.tar.bz2
phpicalendar-7d565474b41400bfce2d665da96d39631458eda3.zip
fix US holidays; fix 1743686 where byday set and timezone pushes event to different day
Diffstat (limited to 'functions/parse/parse_tzs.php')
-rw-r--r--functions/parse/parse_tzs.php25
1 files changed, 15 insertions, 10 deletions
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;

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