aboutsummaryrefslogtreecommitdiffstats
path: root/functions
diff options
context:
space:
mode:
authorJim Hu <jimhu@users.sourceforge.net>2006-11-12 07:34:34 +0000
committerJim Hu <jimhu@users.sourceforge.net>2006-11-12 07:34:34 +0000
commitc243d4aafdaea7617b2be768fa34bfb7e50714eb (patch)
tree9b0ba71361ce75e75df1785b5384557e1a75bef9 /functions
parent487b3910ebb1feed890ce8dd52217304eed37435 (diff)
downloadphpicalendar-c243d4aafdaea7617b2be768fa34bfb7e50714eb.tar.gz
phpicalendar-c243d4aafdaea7617b2be768fa34bfb7e50714eb.tar.bz2
phpicalendar-c243d4aafdaea7617b2be768fa34bfb7e50714eb.zip
create new date function parse_tz to deal with mozilla and other tzids. Apply to ical_parser
Diffstat (limited to 'functions')
-rw-r--r--functions/date_functions.php13
-rw-r--r--functions/ical_parser.php4
2 files changed, 15 insertions, 2 deletions
diff --git a/functions/date_functions.php b/functions/date_functions.php
index c6901d0..9c9bc30 100644
--- a/functions/date_functions.php
+++ b/functions/date_functions.php
@@ -287,4 +287,17 @@ function extractDateTime($data, $property, $field) {
// 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;
+}
+
+
?>
diff --git a/functions/ical_parser.php b/functions/ical_parser.php
index b754d75..56475b2 100644
--- a/functions/ical_parser.php
+++ b/functions/ical_parser.php
@@ -1073,7 +1073,7 @@ foreach ($cal_filelist as $cal_key=>$filename) {
if ($eachval[0] == 'RECURRENCE-ID') {
// do nothing
} elseif ($eachval[0] == 'TZID') {
- $recurrence_id['tzid'] = $eachval[1];
+ $recurrence_id['tzid'] = parse_tz($eachval[1]);
} elseif ($eachval[0] == 'RANGE') {
$recurrence_id['range'] = $eachval[1];
} elseif ($eachval[0] == 'VALUE') {
@@ -1119,7 +1119,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 = $data;
+ $calendar_tz = parse_tz($data);
$master_array['calendar_tz'] = $calendar_tz;
break;
case 'DURATION':

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