X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=dav%2FSabreDAV%2Flib%2FSabre%2FVObject%2FProperty%2FDateTime.php;fp=dav%2FSabreDAV%2Flib%2FSabre%2FVObject%2FProperty%2FDateTime.php;h=ff2c867a3618e09cd1fdd8f40bb866165dc8c2c9;hb=fefee23e903a4d82944dcaf75b8953c5181a6ebf;hp=fe2372caa81cade8eb1aa149ea923e7fd62206dc;hpb=4a5e30ec845bcb756543f14c4d8e0b5a3138f2fc;p=friendica-addons.git diff --git a/dav/SabreDAV/lib/Sabre/VObject/Property/DateTime.php b/dav/SabreDAV/lib/Sabre/VObject/Property/DateTime.php old mode 100755 new mode 100644 index fe2372ca..ff2c867a --- a/dav/SabreDAV/lib/Sabre/VObject/Property/DateTime.php +++ b/dav/SabreDAV/lib/Sabre/VObject/Property/DateTime.php @@ -204,49 +204,17 @@ class Sabre_VObject_Property_DateTime extends Sabre_VObject_Property { ); } - try { - // tzid an Olson identifier? - $tz = new DateTimeZone($tzid->value); - } catch (Exception $e) { - - // Not an Olson id, we're going to try to find the information - // through the time zone name map. - $newtzid = Sabre_VObject_WindowsTimezoneMap::lookup($tzid->value); - if (is_null($newtzid)) { - - // Not a well known time zone name either, we're going to try - // to find the information through the VTIMEZONE object. - - // First we find the root object - $root = $property; - while($root->parent) { - $root = $root->parent; - } - - if (isset($root->VTIMEZONE)) { - foreach($root->VTIMEZONE as $vtimezone) { - if (((string)$vtimezone->TZID) == $tzid) { - if (isset($vtimezone->{'X-LIC-LOCATION'})) { - $newtzid = (string)$vtimezone->{'X-LIC-LOCATION'}; - } else { - // No libical location specified. As a last resort we could - // try matching $vtimezone's DST rules against all known - // time zones returned by DateTimeZone::list* - - // TODO - } - } - } - } - } - - try { - $tz = new DateTimeZone($newtzid); - } catch (Exception $e) { - // If all else fails, we use the default PHP timezone - $tz = new DateTimeZone(date_default_timezone_get()); - } + // To look up the timezone, we must first find the VCALENDAR component. + $root = $property; + while($root->parent) { + $root = $root->parent; } + if ($root->name === 'VCALENDAR') { + $tz = Sabre_VObject_TimeZoneUtil::getTimeZone((string)$tzid, $root); + } else { + $tz = Sabre_VObject_TimeZoneUtil::getTimeZone((string)$tzid); + } + $dt = new DateTime($dateStr, $tz); $dt->setTimeZone($tz);