forked from science-ation/science-ation
FCKEditor always does UTF8, so force the Rmail encoding into that
Also calculate the email TEXT from the email HTML, its not perfect but pretty darn good. TODO: need to do an update script that converts the encoding of ALL existing emails in the databse from ISO-8859-1 to UTF-8 DO NOT UPDATE TO THIS VERSION UNTIL I CAN ADD THAT CONVERSION SCRIPT
This commit is contained in:
parent
148bc61320
commit
c0f6031904
@ -158,15 +158,7 @@ case 'email_save':
|
|||||||
/* Allow the fundraising campaigns id to be NULL, it'll never be 0 */
|
/* Allow the fundraising campaigns id to be NULL, it'll never be 0 */
|
||||||
$fcstr = ($fcid == 0) ? 'NULL' : "'$fcid'";
|
$fcstr = ($fcid == 0) ? 'NULL' : "'$fcid'";
|
||||||
|
|
||||||
//first, replace an </p> with </p><br />
|
$body=getTextFromHtml($bodyhtml);
|
||||||
$body=str_replace("</p>","</p><br />",$bodyhtml);
|
|
||||||
//now replace any <br /> with newlines
|
|
||||||
$body=eregi_replace('<br[[:space:]]*/?[[:space:]]*>',chr(13).chr(10),$body);
|
|
||||||
//and strip the rest of the tags
|
|
||||||
$body=strip_tags($body);
|
|
||||||
//and replace
|
|
||||||
$body=str_replace(" "," ",$body);
|
|
||||||
|
|
||||||
mysql_query("UPDATE emails SET
|
mysql_query("UPDATE emails SET
|
||||||
name='$name',
|
name='$name',
|
||||||
description='$description',
|
description='$description',
|
||||||
@ -583,7 +575,8 @@ case 'dialog_sender':
|
|||||||
exit;
|
exit;
|
||||||
|
|
||||||
case "email_send":
|
case "email_send":
|
||||||
email_send_new($_POST['to'],$_POST['from'],$_POST['subject'],$_POST['body'],$_POST['bodyhtml']);
|
$body=getTextFromHtml($_POST['bodyhtml']);
|
||||||
|
email_send_new($_POST['to'],$_POST['from'],$_POST['subject'],$body,$_POST['bodyhtml']);
|
||||||
happy_("Email Successfully Sent");
|
happy_("Email Successfully Sent");
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
|
@ -956,6 +956,8 @@ function email_send_new($to,$from,$subject,$body,$bodyhtml="") {
|
|||||||
$mail->setFrom($from);
|
$mail->setFrom($from);
|
||||||
$mail->setSubject($subject);
|
$mail->setSubject($subject);
|
||||||
$mail->setText($body);
|
$mail->setText($body);
|
||||||
|
$mail->setTextCharset("utf-8");
|
||||||
|
$mail->setHTMLCharset("utf-8");
|
||||||
|
|
||||||
//only add the html if we have it
|
//only add the html if we have it
|
||||||
if($bodyhtml) {
|
if($bodyhtml) {
|
||||||
@ -1265,5 +1267,17 @@ function format_duration($seconds, $granularity = 2)
|
|||||||
return $output ? $output : '0 sec';
|
return $output ? $output : '0 sec';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getTextFromHtml($html) {
|
||||||
|
//first, replace an </p> with </p><br />
|
||||||
|
$text=str_replace("</p>","</p><br />",$html);
|
||||||
|
//now replace any <br /> with newlines
|
||||||
|
$text=eregi_replace('<br[[:space:]]*/?[[:space:]]*>',chr(13).chr(10),$text);
|
||||||
|
//and strip the rest of the tags
|
||||||
|
$text=strip_tags($text);
|
||||||
|
//and replace
|
||||||
|
$text=str_replace(" "," ",$text);
|
||||||
|
return $text;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
Loading…
Reference in New Issue
Block a user