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