Merge branch 'MDL-75627_master_v2' of https://github.com/sbourget/moodle

This commit is contained in:
Sara Arjona
2022-11-17 17:22:23 +01:00
+12 -2
View File
@@ -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 = [];