MDL-17548 MNET: Fix email links for sites with path component in wwwroot
Where Moodle sites have a path in their wwwroot, the MNET function that forced remote users to go via their identity provider (to make sure they were logged in) previously directed the user back to a URL like contentprovider.com/moodle/moodle/mod/forum/view.php?f=7 where there should only be one /moodle in the middle of the URL. Slightly tweaked from HEAD to support PHP4
This commit is contained in:
+9
-1
@@ -564,12 +564,20 @@ function mnet_get_peer_host ($mnethostid) {
|
||||
*/
|
||||
function mnet_sso_apply_indirection ($url) {
|
||||
global $MNETIDPJUMPURL;
|
||||
global $CFG;
|
||||
|
||||
$localpart='';
|
||||
$urlparts = parse_url($url[1]);
|
||||
if($urlparts) {
|
||||
if (isset($urlparts['path'])) {
|
||||
$localpart .= $urlparts['path'];
|
||||
$path = $urlparts['path'];
|
||||
// if our wwwroot has a path component, need to strip that path from beginning of the
|
||||
// 'localpart' to make it relative to moodle's wwwroot
|
||||
$wwwrootparts = parse_url($CFG->wwwroot);
|
||||
if (!empty($wwwrootparts['path']) and strpos($path, $wwwrootparts['path']) === 0) {
|
||||
$path = substr($path, strlen($wwwrootparts['path']));
|
||||
}
|
||||
$localpart .= $path;
|
||||
}
|
||||
if (isset($urlparts['query'])) {
|
||||
$localpart .= '?'.$urlparts['query'];
|
||||
|
||||
Reference in New Issue
Block a user