mirror of
https://github.com/e107inc/e107.git
synced 2025-08-04 21:57:51 +02:00
Fix for images in mail preview.
This commit is contained in:
@@ -591,13 +591,14 @@ class mailout_main_ui extends e_admin_ui
|
|||||||
function previewPage()
|
function previewPage()
|
||||||
{
|
{
|
||||||
$mailData = e107::getDb()->retrieve('mail_content','*','mail_source_id='.intval($_GET['id'])." LIMIT 1");
|
$mailData = e107::getDb()->retrieve('mail_content','*','mail_source_id='.intval($_GET['id'])." LIMIT 1");
|
||||||
|
|
||||||
|
|
||||||
$data = $this->mailAdmin->dbToMail($mailData);
|
$data = $this->mailAdmin->dbToMail($mailData);
|
||||||
|
|
||||||
$eml = array(
|
$eml = array(
|
||||||
'body' => $data['mail_body'],
|
'subject' => $data['mail_subject'],
|
||||||
'template' => $data['mail_send_style']
|
'body' => $data['mail_body'],
|
||||||
|
'template' => $data['mail_send_style'],
|
||||||
|
'shortcodes' => array('USERNAME'=>'John Example', 'DISPLAYNAME'=> 'John Example', 'USERID'=>'555', 'UNSUBSCRIBE'=>SITEURL."unsubscribe/?id=example1234567")
|
||||||
);
|
);
|
||||||
|
|
||||||
return e107::getEmail()->preview($eml);
|
return e107::getEmail()->preview($eml);
|
||||||
@@ -1284,9 +1285,10 @@ class mailout_admin_form_ui extends e_admin_form_ui
|
|||||||
{
|
{
|
||||||
$text = "";
|
$text = "";
|
||||||
|
|
||||||
|
|
||||||
$link = e_SELF."?mode=main&action=send&id=".$id;
|
$link = e_SELF."?mode=main&action=send&id=".$id;
|
||||||
|
$preview = e_SELF."?mode=main&action=preview&id=".$id;
|
||||||
$text .= "<a href='".$link."' class='btn' title='Send Mail'>".E_32_MAIL."</a>";
|
$text .= "<a href='".$link."' class='btn' title='Send Mail'>".E_32_MAIL."</a>";
|
||||||
|
$text .= "<a rel='external' class='btn e-modal' data-modal-caption='Email preview' href='".$preview."' class='btn' title='Preview'>".E_32_SEARCH."</a>";
|
||||||
$text .= $this->renderValue('options',$value,$att,$id);
|
$text .= $this->renderValue('options',$value,$att,$id);
|
||||||
|
|
||||||
return $text;
|
return $text;
|
||||||
|
@@ -156,7 +156,7 @@ class e107Email extends PHPMailer
|
|||||||
public $legacyBody = false; // TRUE enables legacy conversion of plain text body to HTML in HTML emails
|
public $legacyBody = false; // TRUE enables legacy conversion of plain text body to HTML in HTML emails
|
||||||
private $debug = false; // echos various debug info when set to true.
|
private $debug = false; // echos various debug info when set to true.
|
||||||
private $pref = array(); // Store code prefs.
|
private $pref = array(); // Store code prefs.
|
||||||
|
private $previewMode = false;
|
||||||
/**
|
/**
|
||||||
* Constructor sets up all the global options, and sensible defaults - it should be the only place the prefs are accessed
|
* Constructor sets up all the global options, and sensible defaults - it should be the only place the prefs are accessed
|
||||||
*
|
*
|
||||||
@@ -525,7 +525,10 @@ class e107Email extends PHPMailer
|
|||||||
$message = str_replace("\r","\n",$message); // Handle alternative newline characters
|
$message = str_replace("\r","\n",$message); // Handle alternative newline characters
|
||||||
$message = str_replace("\n", "<br />\n", $message);
|
$message = str_replace("\n", "<br />\n", $message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$this->MsgHTML($message); // Theoretically this should do everything, including handling of inline images.
|
$this->MsgHTML($message); // Theoretically this should do everything, including handling of inline images.
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ // generate the plain text as the sole part of the email
|
{ // generate the plain text as the sole part of the email
|
||||||
@@ -600,6 +603,8 @@ class e107Email extends PHPMailer
|
|||||||
*/
|
*/
|
||||||
public function preview($eml)
|
public function preview($eml)
|
||||||
{
|
{
|
||||||
|
$this->previewMode = true;
|
||||||
|
|
||||||
if (count($eml))
|
if (count($eml))
|
||||||
{
|
{
|
||||||
if($error = $this->arraySet($eml)) // Set parameters from list
|
if($error = $this->arraySet($eml)) // Set parameters from list
|
||||||
@@ -888,7 +893,7 @@ class e107Email extends PHPMailer
|
|||||||
|
|
||||||
|
|
||||||
preg_match_all("/(src|background)=([\"\'])(.*)\\2/Ui", $message, $images); // Modified to accept single quotes as well
|
preg_match_all("/(src|background)=([\"\'])(.*)\\2/Ui", $message, $images); // Modified to accept single quotes as well
|
||||||
if(isset($images[3]))
|
if(isset($images[3]) && ($this->previewMode === false))
|
||||||
{
|
{
|
||||||
|
|
||||||
if($this->debug)
|
if($this->debug)
|
||||||
|
Reference in New Issue
Block a user