Merge branch '311_mdl-73498' of https://github.com/daniil-berg/moodle into MOODLE_311_STABLE

This commit is contained in:
Jake Dallimore
2022-07-05 12:01:20 +08:00
+6 -4
View File
@@ -72,8 +72,10 @@ if (empty($typeid) && ($tool = lti_get_tool_by_url_match($lti->toolurl))) {
}
if ($typeid) {
$toolconfig = lti_get_type_config($typeid);
$toolurl = $toolconfig['toolurl'];
} else {
$toolconfig = array();
$toolurl = $lti->toolurl;
}
$PAGE->set_cm($cm, $course); // Set's up global $COURSE.
@@ -151,11 +153,11 @@ if (($launchcontainer == LTI_LAUNCH_CONTAINER_WINDOW) &&
$content = lti_initiate_login($cm->course, $id, $lti, $config);
}
// Build the allowed URL, since we know what it will be from $lti->toolurl,
// If the specified toolurl is invalid the iframe won't load, but we still want to avoid parse related errors here.
// So we set an empty default allowed url, and only build a real one if the parse is successful.
// Build the allowed URL, since we know what it will be from $toolurl.
// If the specified URL is invalid, the iframe won't load, but we still want to avoid parse related errors here.
// So we set an empty default allowed URL, and only build a real one if the parse is successful.
$ltiallow = '';
$urlparts = parse_url($lti->toolurl);
$urlparts = parse_url($toolurl);
if ($urlparts && array_key_exists('scheme', $urlparts) && array_key_exists('host', $urlparts)) {
$ltiallow = $urlparts['scheme'] . '://' . $urlparts['host'];
// If a port has been specified we append that too.