Merge pull request #72 from Milow/development

// Fix mail error, make a little more robust
This commit is contained in:
Rémi Gaillard
2012-12-06 01:48:46 -08:00
+6 -1
View File
@@ -204,11 +204,16 @@ class MailCore
$template_path = $theme_path.'mails/'; $template_path = $theme_path.'mails/';
$override_mail = true; $override_mail = true;
} }
else if (!file_exists($template_path.$template.'.txt') || !file_exists($template_path.$template.'.html')) else if (!file_exists($template_path.$template.'.txt') && ($configuration['PS_MAIL_TYPE'] == Mail::TYPE_BOTH || $configuration['PS_MAIL_TYPE'] == Mail::TYPE_TEXT))
{ {
Tools::dieOrLog(Tools::displayError('Error - The following e-mail template is missing:').' '.$template_path.$template.'.txt', $die); Tools::dieOrLog(Tools::displayError('Error - The following e-mail template is missing:').' '.$template_path.$template.'.txt', $die);
return false; return false;
} }
else if (!file_exists($template_path.$template.'.html') && ($configuration['PS_MAIL_TYPE'] == Mail::TYPE_BOTH || $configuration['PS_MAIL_TYPE'] == Mail::TYPE_HTML))
{
Tools::dieOrLog(Tools::displayError('Error - The following e-mail template is missing:').' '.$template_path.$template.'.html', $die);
return false;
}
$template_html = file_get_contents($template_path.$template.'.html'); $template_html = file_get_contents($template_path.$template.'.html');
$template_txt = strip_tags(html_entity_decode(file_get_contents($template_path.$template.'.txt'), null, 'utf-8')); $template_txt = strip_tags(html_entity_decode(file_get_contents($template_path.$template.'.txt'), null, 'utf-8'));