From c76af96415fc79dff26c97f1fee246da34bc606e Mon Sep 17 00:00:00 2001 From: Vincent Augagneur Date: Mon, 26 Nov 2012 10:45:32 +0100 Subject: [PATCH] [-] BO : fixed bug #PSCFV-5838 Advanced Parameters - E-mail - Custom SMTP does not work if the password contains symbols '<' or '>' --- classes/Tools.php | 1 - controllers/admin/AdminEmailsController.php | 10 ++++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/classes/Tools.php b/classes/Tools.php index 10c5479e9..84f47beaf 100644 --- a/classes/Tools.php +++ b/classes/Tools.php @@ -643,7 +643,6 @@ class ToolsCore public static function htmlentitiesUTF8($string, $type = ENT_QUOTES) { if (is_array($string)) - return array_map(array('Tools', 'htmlentitiesUTF8'), $string); return htmlentities($string, $type, 'utf-8'); } diff --git a/controllers/admin/AdminEmailsController.php b/controllers/admin/AdminEmailsController.php index e63b76d9d..8fcbbaddf 100644 --- a/controllers/admin/AdminEmailsController.php +++ b/controllers/admin/AdminEmailsController.php @@ -225,10 +225,16 @@ class AdminEmailsControllerCore extends AdminController $smtpLogin = Tools::getValue('smtpLogin'); $smtpPassword = Tools::getValue('smtpPassword'); $smtpPassword = (!empty($smtpPassword)) ? urldecode($smtpPassword) : Configuration::get('PS_MAIL_PASSWD'); + $smtpPassword = str_replace( + array('<', '>', '"', '&'), + array('<', '>', '"', '&'), + Tools::htmlentitiesUTF8($smtpPassword) + ); + $smtpPort = Tools::getValue('smtpPort'); $smtpEncryption = Tools::getValue('smtpEnc'); - - $result = Mail::sendMailTest(Tools::htmlentitiesUTF8($smtpChecked), Tools::htmlentitiesUTF8($smtpServer), Tools::htmlentitiesUTF8($content), Tools::htmlentitiesUTF8($subject), Tools::htmlentitiesUTF8($type), Tools::htmlentitiesUTF8($to), Tools::htmlentitiesUTF8($from), Tools::htmlentitiesUTF8($smtpLogin), Tools::htmlentitiesUTF8($smtpPassword), Tools::htmlentitiesUTF8($smtpPort), Tools::htmlentitiesUTF8($smtpEncryption)); + + $result = Mail::sendMailTest(Tools::htmlentitiesUTF8($smtpChecked), Tools::htmlentitiesUTF8($smtpServer), Tools::htmlentitiesUTF8($content), Tools::htmlentitiesUTF8($subject), Tools::htmlentitiesUTF8($type), Tools::htmlentitiesUTF8($to), Tools::htmlentitiesUTF8($from), Tools::htmlentitiesUTF8($smtpLogin), $smtpPassword, Tools::htmlentitiesUTF8($smtpPort), Tools::htmlentitiesUTF8($smtpEncryption)); die($result === true ? 'ok' : $result); } }