mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
MNET-12558 Additional commenting and variable name change
This commit is contained in:
parent
a347291c30
commit
baed22bb1c
2 changed files with 16 additions and 7 deletions
|
@ -3978,6 +3978,7 @@ function &get_mailer($action='get') {
|
|||
*
|
||||
* @uses $CFG
|
||||
* @uses $FULLME
|
||||
* @uses $MNETIDPJUMPURL IdentityProvider(IDP) URL user hits to jump to mnet peer.
|
||||
* @uses SITEID
|
||||
* @param user $user A {@link $USER} object
|
||||
* @param user $from A {@link $USER} object
|
||||
|
@ -3994,7 +3995,7 @@ function &get_mailer($action='get') {
|
|||
*/
|
||||
function email_to_user($user, $from, $subject, $messagetext, $messagehtml='', $attachment='', $attachname='', $usetrueaddress=true, $replyto='', $replytoname='', $wordwrapwidth=79) {
|
||||
|
||||
global $CFG, $FULLME, $IDPJUMPURL;
|
||||
global $CFG, $FULLME, $MNETIDPJUMPURL;
|
||||
static $mnetjumps = array();
|
||||
|
||||
if (empty($user)) {
|
||||
|
@ -4027,12 +4028,12 @@ function email_to_user($user, $from, $subject, $messagetext, $messagehtml='', $a
|
|||
require_once($CFG->dirroot.'/mnet/lib.php');
|
||||
// Form the request url to hit the idp's jump.php
|
||||
if (isset($mnetjumps[$user->mnethostid])) {
|
||||
$IDPJUMPURL = $mnetjumps[$user->mnethostid];
|
||||
$MNETIDPJUMPURL = $mnetjumps[$user->mnethostid];
|
||||
} else {
|
||||
$idp = mnet_get_peer_host($user->mnethostid);
|
||||
$idpjumppath = mnet_get_app_jumppath($idp->applicationid);
|
||||
$IDPJUMPURL = $idp->wwwroot . $idpjumppath . '?hostwwwroot=' . $CFG->wwwroot . '&wantsurl=';
|
||||
$mnetjumps[$user->mnethostid] = $IDPJUMPURL;
|
||||
$MNETIDPJUMPURL = $idp->wwwroot . $idpjumppath . '?hostwwwroot=' . $CFG->wwwroot . '&wantsurl=';
|
||||
$mnetjumps[$user->mnethostid] = $MNETIDPJUMPURL;
|
||||
}
|
||||
|
||||
$messagetext = preg_replace_callback("%($CFG->wwwroot[^[:space:]]*)%",
|
||||
|
|
14
mnet/lib.php
14
mnet/lib.php
|
@ -584,14 +584,22 @@ function mnet_get_peer_host ($mnethostid) {
|
|||
* log in at their mnet identity provider (if they are not already logged in)
|
||||
* before ultimately being directed to the original url.
|
||||
*
|
||||
* uses global IDPJUMPURL - the url which user should initially be directed to
|
||||
* uses global MNETIDPJUMPURL the url which user should initially be directed to
|
||||
* MNETIDPJUMPURL is a URL associated with a moodle networking peer when it
|
||||
* is fulfiling a role as an identity provider (IDP). Different urls for
|
||||
* different peers, the jumpurl is formed partly from the IDP's webroot, and
|
||||
* partly from a predefined local path within that webwroot.
|
||||
* The result of the user hitting MNETIDPJUMPURL is that they will be asked
|
||||
* to login (at their identity provider (if they aren't already)), mnet
|
||||
* will prepare the necessary authentication information, then redirect
|
||||
* them back to somewhere at the content provider(CP) moodle (this moodle)
|
||||
* @param array $url array with 2 elements
|
||||
* 0 - context the url was taken from, possibly just the url, possibly href="url"
|
||||
* 1 - the destination url
|
||||
* @return string the url the remote user should be supplied with.
|
||||
*/
|
||||
function mnet_sso_apply_indirection ($url) {
|
||||
global $IDPJUMPURL;
|
||||
global $MNETIDPJUMPURL;
|
||||
|
||||
$localpart='';
|
||||
$urlparts = parse_url($url[1]);
|
||||
|
@ -606,7 +614,7 @@ function mnet_sso_apply_indirection ($url) {
|
|||
$localpart .= '#'.$urlparts['fragment'];
|
||||
}
|
||||
}
|
||||
$indirecturl = $IDPJUMPURL . urlencode($localpart);
|
||||
$indirecturl = $MNETIDPJUMPURL . urlencode($localpart);
|
||||
//If we matched on more than just a url (ie an html link), return the url to an href format
|
||||
if ($url[0] != $url[1]) {
|
||||
$indirecturl = 'href="'.$indirecturl.'"';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue