From 31f29b7f844e1a9acb2ccc9857cbedb66d396009 Mon Sep 17 00:00:00 2001 From: james Date: Thu, 17 Feb 2011 16:35:44 +0000 Subject: [PATCH] email_send should send html version of the email if we have it --- common.inc.php | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/common.inc.php b/common.inc.php index d3ae75e..cb8150a 100644 --- a/common.inc.php +++ b/common.inc.php @@ -106,7 +106,6 @@ if(!mysql_select_db($DBNAME)) echo ""; 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)) { ".i18n("Home Page").''; echo "
  • ".i18n("Important Dates").'
  • '; + echo $registrationconfirmationlink; /* echo "
  • ".i18n("Participant Registration").'
  • '; @@ -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")));