email_send should send html version of the email if we have it

This commit is contained in:
james 2011-02-17 16:35:44 +00:00
parent 0b57eb2edd
commit 31f29b7f84

View File

@ -106,7 +106,6 @@ if(!mysql_select_db($DBNAME))
echo "</body></html>";
exit;
}
//this will silently fail on mysql 4.x, but is needed on mysql5.x to ensure we're only using iso-8859-1 (/latin1) encodings
@mysql_query("SET NAMES latin1");
@ -519,6 +518,7 @@ if(is_array($nav)) {
<?
echo "<li><a href=\"{$config['SFIABDIRECTORY']}/index.php\">".i18n("Home Page").'</a></li>';
echo "<li><a href=\"{$config['SFIABDIRECTORY']}/important_dates.php\">".i18n("Important Dates").'</a></li>';
echo $registrationconfirmationlink;
/*
echo "<li><a href=\"{$config['SFIABDIRECTORY']}/register_participants.php\">".i18n("Participant Registration").'</a></li>';
@ -969,8 +969,10 @@ function email_send($val,$to,$sub_subject=array(),$sub_body=array())
$q=mysql_query("SELECT * FROM emails WHERE val='$val'");
if($r=mysql_fetch_object($q)) {
$subject=i18n($r->subject);
$body=i18n($r->body);
//we dont want to translate these, the messages themselves shoudl contain whatever languages they need
$subject=$r->subject;
$body=$r->body;
$bodyhtml=$r->bodyhtml;
/* Eventually we should just do this with communication_replace_vars() */
if(count($sub_subject)) {
@ -984,6 +986,12 @@ function email_send($val,$to,$sub_subject=array(),$sub_body=array())
}
}
if(count($sub_body)) {
foreach($sub_body AS $sub_k=>$sub_v) {
$bodyhtml=ereg_replace("\[$sub_k\]","$sub_v",$bodyhtml);
}
}
if($r->from)
$fr=$r->from;
else if ($config['fairmanageremail'])
@ -994,7 +1002,7 @@ function email_send($val,$to,$sub_subject=array(),$sub_body=array())
//only send the email if we have a from
if($fr) {
//send using RMail
email_send_new($to,$fr,$subject,$body);
email_send_new($to,$fr,$subject,$body,$bodyhtml);
}
else
echo error(i18n("CRITICAL ERROR: email '%1' does not have a 'From' and the Fair Manager Email is not configured",array($val),array("email key name")));