Merge branch 'MDL-64152-master' of https://github.com/snake/moodle

This commit is contained in:
Andrew Nicols 2023-07-05 21:17:28 +08:00
commit 7929267880
No known key found for this signature in database
GPG Key ID: 6D1E3157C8CFBF14
2 changed files with 6 additions and 9 deletions

View File

@ -19,6 +19,9 @@ LTI-Tool-Provider-Library-PHP repo has been archived so it doesn't accept pull r
* MDL-71920: Migrated from curl_exec and friends to use our Moodle curl wrapper,
so we can better handle site security settings
This local change has been made without the accompanying pull request as the upstream library is archived:
* $FULLME is used as the URL for OAuth, to fix reverse proxy support (see MDL-64152)
It is recommended by upstream to install depdencies via composer - but the composer installation is bundled
with an autoloader so it's better to do it manually.
@ -72,4 +75,4 @@ enrol/lti/db/upgrade.php
```
cd lib/ltiprovider/src
for file in `find . -name '*.php' `; do sed -i '/^class /i #[\\AllowDynamicProperties]' $file; done
```
```

View File

@ -35,14 +35,8 @@ class OAuthRequest {
*/
public static function from_request($http_method = null, $http_url = null, $parameters = null) {
$scheme = (!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] != "on")
? 'http'
: 'https';
$http_url = ($http_url) ? $http_url : $scheme .
'://' . $_SERVER['SERVER_NAME'] .
':' .
$_SERVER['SERVER_PORT'] .
$_SERVER['REQUEST_URI'];
global $FULLME;
$http_url = $http_url ?: $FULLME;
$http_method = ($http_method) ? $http_method : $_SERVER['REQUEST_METHOD'];
// We weren't handed any parameters, so let's find the ones relevant to