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); } }