mirror of
https://github.com/moodle/moodle.git
synced 2025-04-26 02:44:13 +02:00
MDL-72988 mod_lti: improved handling of missing tool endpoint.
This commit is contained in:
parent
eab63d2cfe
commit
9a56e2ba1f
@ -445,10 +445,15 @@ class OAuthRequest {
|
||||
}
|
||||
|
||||
/**
|
||||
* parses the url and rebuilds it to be
|
||||
* scheme://host/path
|
||||
* Parses {@see http_url} and returns normalized scheme://host/path if non-empty, otherwise return empty string
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function get_normalized_http_url() {
|
||||
if ($this->http_url === '') {
|
||||
return '';
|
||||
}
|
||||
|
||||
$parts = parse_url($this->http_url);
|
||||
|
||||
$port = @$parts['port'];
|
||||
|
@ -593,11 +593,11 @@ function lti_get_launch_data($instance, $nonce = '') {
|
||||
$endpoint = trim($instance->securetoolurl);
|
||||
}
|
||||
|
||||
$endpoint = lti_ensure_url_is_https($endpoint);
|
||||
} else {
|
||||
if (!strstr($endpoint, '://')) {
|
||||
$endpoint = 'http://' . $endpoint;
|
||||
if ($endpoint !== '') {
|
||||
$endpoint = lti_ensure_url_is_https($endpoint);
|
||||
}
|
||||
} else if ($endpoint !== '' && !strstr($endpoint, '://')) {
|
||||
$endpoint = 'http://' . $endpoint;
|
||||
}
|
||||
|
||||
$orgid = lti_get_organizationid($typeconfig);
|
||||
@ -3455,7 +3455,8 @@ function lti_post_launch_html($newparms, $endpoint, $debug=false) {
|
||||
}
|
||||
$r .= "</form>\n";
|
||||
|
||||
if ( ! $debug ) {
|
||||
// Auto-submit the form if endpoint is set.
|
||||
if ($endpoint !== '' && !$debug) {
|
||||
$r .= " <script type=\"text/javascript\"> \n" .
|
||||
" //<![CDATA[ \n" .
|
||||
" document.ltiLaunchForm.submit(); \n" .
|
||||
|
Loading…
x
Reference in New Issue
Block a user