mirror of
https://git.friendi.ca/friendica/friendica-addons.git
synced 2025-07-08 17:38:49 +00:00
Heavily refactored, including multiple calendars per user and recurring events. Not in an installable state yet, though
This commit is contained in:
parent
4a5e30ec84
commit
fefee23e90
78 changed files with 8026 additions and 1205 deletions
52
dav/SabreDAV/lib/Sabre/VObject/Property/DateTime.php
Executable file → Normal file
52
dav/SabreDAV/lib/Sabre/VObject/Property/DateTime.php
Executable file → Normal file
|
@ -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);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue