- Replacement for PDF generation.

This commit is contained in:
dave 2009-10-16 06:16:48 +00:00
parent 345729523e
commit 52b7580dcb
3 changed files with 30 additions and 10 deletions

View File

@ -219,12 +219,12 @@ case 'dialog_edit':
<td class="input"><input type="text" name="description" size="60" value="<?=$description?>" /></td>
</tr><tr>
<tr><td colspan="2"><hr /></td>
</tr><tr>
<td class="label"><?=i18n("Email Subject")?>:</td>
<td class="input"><input type="text" name="subject" size="60" value="<?=$subject?>" /></td>
</tr><tr>
<td class="label"><?=i18n("From Address")?>:</td>
<td class="input"><input type="text" name="from" size="60" value="<?=$from?>" /></td>
</tr><tr>
<td class="label"><?=i18n("Email Subject")?>:</td>
<td class="input"><input type="text" name="subject" size="60" value="<?=$subject?>" /></td>
</tr><tr>
<td colspan="2" class="input">
<table width="100%"><tr><td width="85%">
@ -233,10 +233,13 @@ case 'dialog_edit':
</div>
</td><td width="15%">
<select name="insert_field" size="20" style="height:300" >
<option value="FAIRNAME">[EMAIL]</option>
<option value="EMAIL">[EMAIL]</option>
<option value="FAIRNAME">[FAIRNAME]</option>
<option value="FAIRNAME">[NAME]</option>
<option value="FAIRNAME">[PASSWORD]</option>
<option value="FIRSTNAME">[FIRSTNAME]</option>
<option value="LASTNAME">[LASTNAME]</option>
<option value="NAME">[NAME]</option>
<option value="PASSWORD">[PASSWORD]</option>
<option value="SALUTATION">[LASTNAME]</option>
</select>
</td></tr></table>

View File

@ -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");

View File

@ -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)