diff options
author | Chad Little <clittle@users.sourceforge.net> | 2002-09-26 04:17:51 +0000 |
---|---|---|
committer | Chad Little <clittle@users.sourceforge.net> | 2002-09-26 04:17:51 +0000 |
commit | d547caf72456b27a2898590b7e8398661fdf1b8b (patch) | |
tree | 3db14eb31562f35ded1cb5452c65bdd788fd1352 /ical_parser.php | |
parent | a45d54a3f479740b88a319070942bcef31362d15 (diff) | |
download | phpicalendar-d547caf72456b27a2898590b7e8398661fdf1b8b.tar.gz phpicalendar-d547caf72456b27a2898590b7e8398661fdf1b8b.tar.bz2 phpicalendar-d547caf72456b27a2898590b7e8398661fdf1b8b.zip |
fixed duration for alarms
Diffstat (limited to 'ical_parser.php')
-rw-r--r-- | ical_parser.php | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/ical_parser.php b/ical_parser.php index f6cc7ba..b1036e8 100644 --- a/ical_parser.php +++ b/ical_parser.php @@ -61,6 +61,7 @@ foreach($contents as $line) { $number = ""; $except_dates = array(); $except_times = array(); + $the_duration = TRUE; } elseif (strstr($line, "END:VEVENT")) { // Clean out \n's and other slashes @@ -399,21 +400,21 @@ foreach($contents as $line) { $allday_end = $data; } elseif (strstr($field, "DURATION")) { - ereg ("^P([0-9]{1,2})?([W,D]{0,1})?(T)?([0-9]{1,2})?(H)?([0-9]{1,2})?(M)?([0-9]{1,2})?(S)?", $data, $duration); - - if ($duration[2] = "W") { - $weeks = $duration[1]; - } else { - $days = $duration[1]; - } - - $hours = $duration[4]; - $minutes = $duration[6]; - $seconds = $duration[8]; - - $the_duration = ($weeks * 60 * 60 * 24 * 7) + ($days * 60 * 60 * 24) + ($hours * 60 * 60) + ($minutes * 60) + ($seconds); - $beginning = (strtotime($start_time) + $the_duration); - $end_time = date ("Hi", $beginning); + if ($first_duration = TRUE) { + ereg ("^P([0-9]{1,2})?([W,D]{0,1})?(T)?([0-9]{1,2})?(H)?([0-9]{1,2})?(M)?([0-9]{1,2})?(S)?", $data, $duration); + if ($duration[2] = "W") { + $weeks = $duration[1]; + } else { + $days = $duration[1]; + } + $hours = $duration[4]; + $minutes = $duration[6]; + $seconds = $duration[8]; + $the_duration = ($weeks * 60 * 60 * 24 * 7) + ($days * 60 * 60 * 24) + ($hours * 60 * 60) + ($minutes * 60) + ($seconds); + $beginning = (strtotime($start_time) + $the_duration); + $end_time = date ("Hi", $beginning); + $first_duration = FALSE; + } } elseif (strstr($field, "RRULE")) { // $data = "RRULE:FREQ=YEARLY;INTERVAL=2;BYMONTH=1;BYDAY=SU;BYHOUR=8,9;BYMINUTE=30"; |