Merge branch 'master_mdl-73498' of https://github.com/daniil-berg/moodle

This commit is contained in:
Jake Dallimore 2022-07-05 12:00:43 +08:00
commit 8e5a19b6cb

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.
@ -145,11 +147,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.