MDL-75627 Calendar: Fix calendar imports from Office 365
This commit is contained in:
+12
-2
@@ -3072,11 +3072,21 @@ function calendar_import_events_from_ical(iCalendar $ical, int $subscriptionid =
|
||||
\core_php_time_limit::raise(300);
|
||||
}
|
||||
|
||||
// Start with a safe default timezone.
|
||||
$timezone = 'UTC';
|
||||
|
||||
// Grab the timezone from the iCalendar file to be used later.
|
||||
if (isset($ical->properties['X-WR-TIMEZONE'][0]->value)) {
|
||||
$timezone = $ical->properties['X-WR-TIMEZONE'][0]->value;
|
||||
} else {
|
||||
$timezone = 'UTC';
|
||||
|
||||
} else if (isset($ical->properties['PRODID'][0]->value)) {
|
||||
// If the timezone was not found, check to se if this is MS exchange / Office 365 which uses Windows timezones.
|
||||
if (strncmp($ical->properties['PRODID'][0]->value, 'Microsoft', 9) == 0) {
|
||||
if (isset($ical->components['VTIMEZONE'][0]->properties['TZID'][0]->value)) {
|
||||
$tzname = $ical->components['VTIMEZONE'][0]->properties['TZID'][0]->value;
|
||||
$timezone = IntlTimeZone::getIDForWindowsID($tzname);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$icaluuids = [];
|
||||
|
||||
Reference in New Issue
Block a user