Fix timezone detection in iCalendar parser
This commit is contained in:
parent
5ac6bc06fd
commit
e9825fa24e
3 changed files with 34 additions and 4 deletions
|
@ -1874,7 +1874,17 @@ class Horde_iCalendar {
|
|||
{
|
||||
$vtimezone = $this->_container->findComponentByAttribute('vtimezone', 'TZID', $tzid);
|
||||
if (!$vtimezone) {
|
||||
return false;
|
||||
// use PHP's standard timezone db to determine tzoffset
|
||||
try {
|
||||
$tz = new DateTimeZone($tzid);
|
||||
$dt = new DateTime('now', $tz);
|
||||
$dt->setDate($date['year'], $date['month'], $date['mday']);
|
||||
$dt->setTime($time['hour'], $time['minute'], $date['recond']);
|
||||
return $tz->getOffset($dt);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
$change_times = array();
|
||||
|
|
23
plugins/calendar/lib/Horde_iCalendar_timezone.diff
Normal file
23
plugins/calendar/lib/Horde_iCalendar_timezone.diff
Normal file
|
@ -0,0 +1,23 @@
|
|||
diff --git a/plugins/calendar/lib/Horde_iCalendar.php b/plugins/calendar/lib/Horde_iCalendar.php
|
||||
index a3ff79d..6d75d27 100644
|
||||
--- a/plugins/calendar/lib/Horde_iCalendar.php
|
||||
+++ b/plugins/calendar/lib/Horde_iCalendar.php
|
||||
@@ -1874,7 +1874,17 @@ class Horde_iCalendar {
|
||||
{
|
||||
$vtimezone = $this->_container->findComponentByAttribute('vtimezone', 'TZID', $tzid);
|
||||
if (!$vtimezone) {
|
||||
- return false;
|
||||
+ // use PHP's standard timezone db to determine tzoffset
|
||||
+ try {
|
||||
+ $tz = new DateTimeZone($tzid);
|
||||
+ $dt = new DateTime('now', $tz);
|
||||
+ $dt->setDate($date['year'], $date['month'], $date['mday']);
|
||||
+ $dt->setTime($time['hour'], $time['minute'], $date['recond']);
|
||||
+ return $tz->getOffset($dt);
|
||||
+ }
|
||||
+ catch (Exception $e) {
|
||||
+ return false;
|
||||
+ }
|
||||
}
|
||||
|
||||
$change_times = array();
|
|
@ -123,9 +123,6 @@ class calendar_ical
|
|||
*/
|
||||
public function get_parser()
|
||||
{
|
||||
// use Horde:iCalendar to parse vcalendar file format
|
||||
@include_once('Horde/Icalendar.php');
|
||||
|
||||
if (!class_exists('Horde_iCalendar'))
|
||||
require_once($this->cal->home . '/lib/Horde_iCalendar.php');
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue