本文整理汇总了PHP中mnet_get_app_jumppath函数的典型用法代码示例。如果您正苦于以下问题:PHP mnet_get_app_jumppath函数的具体用法?PHP mnet_get_app_jumppath怎么用?PHP mnet_get_app_jumppath使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了mnet_get_app_jumppath函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: mnet_get_idp_jump_url
/**
* return the jump url for a given remote user
* this is used for rewriting forum post links in emails, etc
*
* @param stdclass $user the user to get the idp url for
*/
function mnet_get_idp_jump_url($user)
{
global $CFG;
static $mnetjumps = array();
if (!array_key_exists($user->mnethostid, $mnetjumps)) {
$idp = mnet_get_peer_host($user->mnethostid);
$idpjumppath = mnet_get_app_jumppath($idp->applicationid);
$mnetjumps[$user->mnethostid] = $idp->wwwroot . $idpjumppath . '?hostwwwroot=' . $CFG->wwwroot . '&wantsurl=';
}
return $mnetjumps[$user->mnethostid];
}
示例2: email_to_user
/**
* Send an email to a specified user
*
* @global object
* @global string
* @global string 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
* @param string $subject plain text subject line of the email
* @param string $messagetext plain text version of the message
* @param string $messagehtml complete html version of the message (optional)
* @param string $attachment a file on the filesystem, relative to $CFG->dataroot
* @param string $attachname the name of the file (extension indicates MIME)
* @param bool $usetrueaddress determines whether $from email address should
* be sent out. Will be overruled by user profile setting for maildisplay
* @param string $replyto Email address to reply to
* @param string $replytoname Name of reply to recipient
* @param int $wordwrapwidth custom word wrap width, default 79
* @return bool|string Returns "true" if mail was sent OK, "emailstop" if email
* was blocked by user and "false" if there was another sort of error.
*/
function email_to_user($user, $from, $subject, $messagetext, $messagehtml = '', $attachment = '', $attachname = '', $usetrueaddress = true, $replyto = '', $replytoname = '', $wordwrapwidth = 79)
{
global $CFG, $FULLME, $MNETIDPJUMPURL;
static $mnetjumps = array();
if (empty($user) || empty($user->email)) {
return false;
}
if (!empty($user->deleted)) {
// do not mail delted users
return false;
}
if (!empty($CFG->noemailever)) {
// hidden setting for development sites, set in config.php if needed
return true;
}
// skip mail to suspended users
if (isset($user->auth) && $user->auth == 'nologin') {
return true;
}
if (!empty($user->emailstop)) {
return 'emailstop';
}
if (over_bounce_threshold($user)) {
error_log("User {$user->id} (" . fullname($user) . ") is over bounce threshold! Not sending.");
return false;
}
// If the user is a remote mnet user, parse the email text for URL to the
// wwwroot and modify the url to direct the user's browser to login at their
// home site (identity provider - idp) before hitting the link itself
if (is_mnet_remote_user($user)) {
require_once $CFG->dirroot . '/mnet/lib.php';
// Form the request url to hit the idp's jump.php
if (isset($mnetjumps[$user->mnethostid])) {
$MNETIDPJUMPURL = $mnetjumps[$user->mnethostid];
} else {
$idp = mnet_get_peer_host($user->mnethostid);
$idpjumppath = mnet_get_app_jumppath($idp->applicationid);
$MNETIDPJUMPURL = $idp->wwwroot . $idpjumppath . '?hostwwwroot=' . $CFG->wwwroot . '&wantsurl=';
$mnetjumps[$user->mnethostid] = $MNETIDPJUMPURL;
}
$messagetext = preg_replace_callback("%({$CFG->wwwroot}[^[:space:]]*)%", 'mnet_sso_apply_indirection', $messagetext);
$messagehtml = preg_replace_callback("%href=[\"'`]({$CFG->wwwroot}[\\w_:\\?=#&@/;.~-]*)[\"'`]%", 'mnet_sso_apply_indirection', $messagehtml);
}
$mail =& get_mailer();
if (!empty($mail->SMTPDebug)) {
echo '<pre>' . "\n";
}
/// We are going to use textlib services here
$textlib = textlib_get_instance();
$supportuser = generate_email_supportuser();
// make up an email address for handling bounces
if (!empty($CFG->handlebounces)) {
$modargs = 'B' . base64_encode(pack('V', $user->id)) . substr(md5($user->email), 0, 16);
$mail->Sender = generate_email_processing_address(0, $modargs);
} else {
$mail->Sender = $supportuser->email;
}
if (is_string($from)) {
// So we can pass whatever we want if there is need
$mail->From = $CFG->noreplyaddress;
$mail->FromName = $from;
} else {
if ($usetrueaddress and $from->maildisplay) {
$mail->From = $from->email;
$mail->FromName = fullname($from);
} else {
$mail->From = $CFG->noreplyaddress;
$mail->FromName = fullname($from);
if (empty($replyto)) {
$mail->AddReplyTo($CFG->noreplyaddress, get_string('noreplyname'));
}
}
}
if (!empty($replyto)) {
$mail->AddReplyTo($replyto, $replytoname);
}
$mail->Subject = substr($subject, 0, 900);
$mail->AddAddress($user->email, fullname($user));
//.........这里部分代码省略.........