mirror of
https://github.com/moodle/moodle.git
synced 2025-01-17 21:49:15 +01:00
MDL-75627 Calendar: Fix calendar imports from Office 365
This commit is contained in:
parent
a7514f231d
commit
32f170c4b2
@ -3091,11 +3091,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 = [];
|
||||
|
Loading…
x
Reference in New Issue
Block a user