Re: Email Archive Manager
Instead of removing it, the following fix might work:
The admin side can stores html in some other tables (e.g. product description), and the reason is, the admin side zen_db_prepare_input does NOT include a zen_sanitize_string.
If we added an HTML safe zen_db_prepare_input to catalog side, and used that when preparing $email_html in zen_mail_archive_write, it would fix this problem.
I am just uncertain if it would introduce a security issue. I suspect not, but I am not certain.
Re: Email Archive Manager
If the forms within our sites are sanitizing input from users, shouldn't that be safe to store/read? Email created within admin should be safe I would hope.
This walk has made me notice my email templates are antiquated and in desperate need for a responsive update. Something else to work on..
I modified some of the following section of code to make the view html button work for me.. I'm sure this will change as I modify my templates.
Code:
if ($action=='prev_html') {
$html_content = $this_email->fields['email_html'];
$html_content = str_replace('_html_','<html>',$html_content);
$html_content = str_replace('_/html_','</html>',$html_content);
$html_content = str_replace('_head_','<head>',$html_content);
$html_content = str_replace('_/head_','</head>',$html_content);
$html_content = str_replace('_meta ','<meta ',$html_content);
$html_content = str_replace('_base','<base',$html_content);
$html_content = str_replace('_/style_','</style>',$html_content);
$html_content = str_replace('_style','<style',$html_content);
$html_content = str_replace('_body ','<body ',$html_content);
$html_content = str_replace('_/body_','</body> ',$html_content);
$html_content = str_replace('/_','/>',$html_content);
$html_content = str_replace('_table_','<table>',$html_content);
$html_content = str_replace('_table ','<table ',$html_content);
$html_content = str_replace('_/table','</table',$html_content);
$html_content = str_replace(array('_tr_','_tr>'),'<tr>',$html_content);
$html_content = str_replace(array('_/tr_','_/tr>'),'</tr>',$html_content);
$html_content = str_replace(array('_td_','<td_'),'<td>',$html_content);
$html_content = str_replace('_td ','<td ',$html_content);
$html_content = str_replace(array('_/td_','_/td>','</td_'),'</td>',$html_content);
$html_content = str_replace('"_','">',$html_content);
$html_content = str_replace('_ ','> ',$html_content);
$html_content = str_replace('_li>','<li>',$html_content);
$html_content = str_replace('_div ','<div ',$html_content);
$html_content = str_replace('_/div_','</div>',$html_content);
$html_content = str_replace('_/div','</div',$html_content);
$html_content = str_replace('_strong_','<strong>',$html_content);
$html_content = str_replace('_/strong_','</strong>',$html_content);
$html_content = str_replace('strong_','strong>',$html_content);
$html_content = str_replace('_/strong','</strong',$html_content);
$html_content = str_replace('_!','<!',$html_content);
$html_content = str_replace('--_','-->',$html_content);
$html_content = str_replace(array('_br_','_br /_','_br />'),'<br />',$html_content);
$html_content = str_replace('em_','em>',$html_content);
$html_content = str_replace('_/em','</em',$html_content);
$html_content = str_replace('_img ','<img ',$html_content);
$html_content = str_replace('_a href','<a href',$html_content);
$html_content = str_replace(array('_/a_','_/a>'),'</a>',$html_content);
$html_content = str_replace('"_','">',$html_content);
$html_content = str_replace('_nobr','<nobr',$html_content);
$html_content = str_replace(';nbsp;',' ',$html_content);
$html_content = str_replace('&','&',$html_content);
$html_content = str_replace('&&','&&',$html_content);
$html_content = str_replace('& ',' ',$html_content);
$html_content = str_replace('"','"',$html_content);
}
Re: Email Archive Manager
Quote:
Originally Posted by
davewest
... This walk has made me notice my email templates are antiquated and in desperate need for a responsive update. Something else to work on..
Just a note that Zen Cart 1.5.5 has incorporated the Common Email Styling plugin that provides those responsive email templates.
Re: Email Archive Manager
Just wanted to chime my two cents. I'm actually sitting on an upgrade to upgrade to HTML email on my site because of this plugin and how zen cart stores HTML emails.
I was going to look into re-coding zen cart to actually store the emails properly, rather then go live without HTML previews. Still haven't gotten round to it though.
Re: Email Archive Manager
Quote:
Originally Posted by
lat9
Just a note that Zen Cart 1.5.5 has incorporated the
Common Email Styling plugin that provides those responsive email templates.
I notice that.. but the layout needs work. Currently it's just a html version of the text. With html format, you can run a fine line between useful and spam.. I like how Amaz0n did their layout, while some others are in the spam side.
But that's another subject...
If you send yourself a copy of everything your shop sends out, than is storing email really needed? It's nice to have that switch, but if it creates a problem by admin going to the spam side.. than maybe we shouldn't store them.
Maybe the whole archiving table and all should be a mod and not built into ZC or was that the patch you was suggesting @swguy
Re: Email Archive Manager
Updated the contribution to add notes about my fix for catalog side HTML emails.
Also changed the display order of To and From fields to match most email programs, which put From first.
Also changed subject display so that ellipsis would only be shown if the subject was actually trimmed.
Re: Email Archive Manager
There was an error in the instructions I added to the module's readme file - I just made a fix to provide better instructions.
Re: Email Archive Manager
New Version - Email Archive Manager 1.8b for 1.55f
I've submitted an update that corrects an error in the admin extra_datafiles define that prevented admin profile restrictions from working correctly.
Tested and working on 1.55e & 1.55f.
Re: Email Archive Manager
Hi all,
I've installed this mod and been having issues with it. I'm on 1.5.5a and using the latest copy downloaded from this site.
Once installed the mod causes an internal server 500 error when zen cart is sending the email, so an email is never received. The debug logs look like this:
Code:
[22-Aug-2018 15:58:17 Europe/London] PHP Fatal error: Uncaught Error: Call to undefined function zen_db_prepare_input_html_safe() in /public_html/shop/includes/functions/functions_email.php:405
Stack trace:
#0 /public_html/shop/includes/functions/functions_email.php(369): zen_mail_archive_write('Joe Bloggs', '[email protected]', 'Example Email...', '[email protected]', 'Order Confirmat...', '<html>\n <head>\n...', 'Order Confirmat...', 'checkout', '')
#1 /public_html/shop/includes/classes/order.php(1086): zen_mail('Joe Bloggs', '[email protected]', 'Order Confirmat...', 'Order Confirmat...', 'Company...', 'enquiries@example...', Array, 'checkout', Array)
#2 /public_html/shop/includes/modules/checkout_process.php(96): order->send_order_email(4441, 2)
#3 /public_html/shop/includes/modules/pages/checkout_process/header_php.php(14): require('/...')
#4 /public_html/shop/index.php(36): require('/...')
#5 {main}
thrown in /public_html/shop/includes/functions/functions_email.php on line 405
What I've noticed is that the replacement 'functions_email.php' file in the module's installation folder includes a reference to a function that doesn't exist. 'zen_db_prepare_input_html_safe'
Line 405:
Code:
$email_html = (EMAIL_USE_HTML=='true') ? zen_db_prepare_input_html_safe($email_html) : zen_db_prepare_input('HTML disabled in admin');
In the original functions_email file, the function is referred to as zen_db_prepare_input_html.
Is this correct? Would it affect anything adversely if I amended that line to the old function name? Or is there something wrong with my setup and that the _safe function should exist?
Any pointers would be appreciated!
Re: Email Archive Manager
You didn't install ./includes/functions/functions_email.php from the mod. This file includes the function zen_db_prepare_input_html_safe.