diff --git a/admin/communication.php b/admin/communication.php
index 434899b..2155e08 100644
--- a/admin/communication.php
+++ b/admin/communication.php
@@ -219,12 +219,12 @@ case 'dialog_edit':
@@ -233,10 +233,13 @@ case 'dialog_edit':
|
|
diff --git a/admin/reports_appeal_letters.php b/admin/reports_appeal_letters.php
index ea04de9..5c181a9 100644
--- a/admin/reports_appeal_letters.php
+++ b/admin/reports_appeal_letters.php
@@ -81,9 +81,8 @@ $q = mysql_query("SELECT * FROM emails WHERE fundraising_campaigns_id='$fcid' AN
while($e = mysql_fetch_assoc($q)) {
foreach($users as $uid=>&$u) {
- /* FIXME: do substitutions */
- $subject = $e['subject'];
- $body = $e['bodyhtml'];
+ $subject = communication_replace_vars($e['subject'], $u);
+ $body = communication_replace_vars($e['bodyhtml'], $u);
/* these dont' need substitutions */
$to = $u['name'];
$date = date("F j, Y");
diff --git a/common.inc.php b/common.inc.php
index a5732e8..6573bfb 100644
--- a/common.inc.php
+++ b/common.inc.php
@@ -873,6 +873,23 @@ function isEmailAddress($str) {
return false;
}
+function communication_replace_vars($text, &$u)
+{
+ global $config;
+ $rep = array('FAIRNAME' => $config['fairname'],
+ 'NAME' => $u['name'],
+ 'EMAIL' => $u['email'],
+ 'PASSWORD' => $u['password'],
+ 'SALUTATION' => $u['salutation'],
+ 'FIRSTNAME' => $u['firstname'],
+ 'LASTNAME' => $u['lastname'],
+ );
+ foreach($rep AS $k=>$v) {
+ $text=ereg_replace("\[$k\]",$v,$text);
+ }
+ return $text;
+}
+
function email_send($val,$to,$sub_subject=array(),$sub_body=array())
{
global $config;
@@ -886,7 +903,8 @@ function email_send($val,$to,$sub_subject=array(),$sub_body=array())
{
$subject=i18n($r->subject);
$body=i18n($r->body);
-
+
+ /* Eventually we should just do this with communication_replace_vars() */
if(count($sub_subject))
{
foreach($sub_subject AS $sub_k=>$sub_v)
|