Add support for URLMAIN and URLLOGIN replacement in communications

This commit is contained in:
dave 2010-01-27 20:24:16 +00:00
parent 29b95e97ac
commit 7fc721b96f
3 changed files with 31 additions and 5 deletions

View File

@ -652,6 +652,9 @@ case "email_get_list":
$emailqueueid=mysql_insert_id();
echo mysql_error();
$urlproto = $_SERVER['SERVER_PORT'] == 443 ? "https://" : "http://";
$urlmain = "$urlproto{$_SERVER['HTTP_HOST']}{$config['SFIABDIRECTORY']}";
$urllogin = "$urlmain/login.php";
while($r=mysql_fetch_object($recipq)) {
$u=user_load_by_uid($r->users_uid);
$replacements=array(
@ -661,7 +664,9 @@ case "email_get_list":
"LASTNAME"=>$u['lastname'],
"NAME"=>$u['name'],
"EMAIL"=>$u['email'],
"ORGANIZATION"=>$u['sponsor']['organization']
"ORGANIZATION"=>$u['sponsor']['organization'],
"URLMAIN"=>$urlmain,
"URLLOGIN"=>$urllogin,
);
if($u['email']) {
@ -781,6 +786,10 @@ case "email_get_list":
$emailqueueid=mysql_insert_id();
echo mysql_error();
$urlproto = $_SERVER['SERVER_PORT'] == 443 ? "https://" : "http://";
$urlmain = "$urlproto{$_SERVER['HTTP_HOST']}{$config['SFIABDIRECTORY']}";
$urllogin = "$urlmain/login.php";
while($r=mysql_fetch_object($recipq)) {
if($r->uid)
$u=user_load_by_uid($r->uid);
@ -796,7 +805,9 @@ case "email_get_list":
"LASTNAME"=>$r->lastname,
"NAME"=>$r->firstname." ".$r->lastname,
"EMAIL"=>$r->email,
"ORGANIZATION"=>$r->organization
"ORGANIZATION"=>$r->organization,
"URLMAIN"=>$urlmain,
"URLLOGIN"=>$urllogin,
);
}
if($u) {
@ -807,7 +818,9 @@ case "email_get_list":
"LASTNAME"=>$u['lastname'],
"NAME"=>$u['name'],
"EMAIL"=>$u['email'],
"ORGANIZATION"=>$u['sponsor']['organization']
"ORGANIZATION"=>$u['sponsor']['organization'],
"URLMAIN"=>$urlmain,
"URLLOGIN"=>$urllogin,
);
$toname=$u['name'];

View File

@ -907,6 +907,19 @@ function email_send($val,$to,$sub_subject=array(),$sub_body=array())
{
global $config;
/* Standard substitutions that are constant no matter who
* the $to is */
$urlproto = $_SERVER['SERVER_PORT'] == 443 ? "https://" : "http://";
$urlmain = "$urlproto{$_SERVER['HTTP_HOST']}{$config['SFIABDIRECTORY']}";
$urllogin = "$urlmain/login.php";
$stdsub = array("FAIRNAME"=>i18n($config['fairname']),
"URLMAIN"=>$urlmain,
"URLLOGIN"=>$urllogin,
);
/* Add standard subs to existing sub arrays */
$sub_subject = array_merge($sub_subject, $stdsub);
$sub_body = array_merge($sub_body, $stdsub);
//if our "to" doesnt look like a valid email, then forget about sending it.
if(!isEmailAddress($to))
return false;

View File

@ -108,7 +108,7 @@
if($r)
{
email_send("register_participants_resend_regnum",$_SESSION['email'],array("FAIRNAME"=>i18n($config['fairname'])),array("REGNUM"=>$r->num,"FAIRNAME"=>i18n($config['fairname'])));
email_send("register_participants_resend_regnum",$_SESSION['email'],array(),array("REGNUM"=>$r->num));
send_header("Participant Registration");
echo notice(i18n("Your registration number has been resent to your email address <b>%1</b>",array($_SESSION['email']),array("email address")));
}
@ -345,7 +345,7 @@
$config['FAIRYEAR'].
")");
email_send("new_participant",$_SESSION['email'],array("FAIRNAME"=>i18n($config['fairname'])),array("REGNUM"=>$regnum, "FAIRNAME"=>i18n($config['fairname']),"EMAIL"=>$_SESSION['email']));
email_send("new_participant",$_SESSION['email'],array(),array("REGNUM"=>$regnum,"EMAIL"=>$_SESSION['email']));
echo i18n("You have been identified as a new registrant. An email has been sent to <b>%1</b> which contains your new <b>registration number</b>. Please check your email to obtain your <b>registration number</b> and then enter it below:",array($_SESSION['email']),array("email address"));
echo "<input type=\"hidden\" name=\"action\" value=\"new\">";