diff --git a/admin/communication.php b/admin/communication.php
index 4a738c2..d9ddefe 100644
--- a/admin/communication.php
+++ b/admin/communication.php
@@ -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'];
diff --git a/common.inc.php b/common.inc.php
index 67b9102..0b22585 100644
--- a/common.inc.php
+++ b/common.inc.php
@@ -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;
diff --git a/register_participants.php b/register_participants.php
index 1ae1bf7..a402d0e 100644
--- a/register_participants.php
+++ b/register_participants.php
@@ -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 %1",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 %1 which contains your new registration number. Please check your email to obtain your registration number and then enter it below:",array($_SESSION['email']),array("email address"));
echo "";