[-] BO : #PSCFV-3146 - Customer Thread, fix encoding chars bugs

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@16345 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
mDeflotte
2012-07-11 14:17:03 +00:00
parent b0f363bcc3
commit 511cfac95a
+4 -3
View File
@@ -47,7 +47,7 @@ class ContactControllerCore extends FrontController
$fileAttachment['name'] = $_FILES['fileUpload']['name']; $fileAttachment['name'] = $_FILES['fileUpload']['name'];
$fileAttachment['mime'] = $_FILES['fileUpload']['type']; $fileAttachment['mime'] = $_FILES['fileUpload']['type'];
} }
$message = Tools::htmlentitiesUTF8(Tools::getValue('message')); $message = Tools::getValue('message'); // Html entities is not usefull, iscleanHtml check there is no bad html tags.
if (!($from = trim(Tools::getValue('from'))) || !Validate::isEmail($from)) if (!($from = trim(Tools::getValue('from'))) || !Validate::isEmail($from))
$this->errors[] = Tools::displayError('Invalid e-mail address'); $this->errors[] = Tools::displayError('Invalid e-mail address');
else if (!$message) else if (!$message)
@@ -109,7 +109,7 @@ class ContactControllerCore extends FrontController
LEFT JOIN '._DB_PREFIX_.'customer_thread cc on (cm.id_customer_thread = cc.id_customer_thread) LEFT JOIN '._DB_PREFIX_.'customer_thread cc on (cm.id_customer_thread = cc.id_customer_thread)
WHERE cc.id_customer_thread = '.(int)($id_customer_thread).' AND cc.id_shop = '.(int)$this->context->shop->id.' WHERE cc.id_customer_thread = '.(int)($id_customer_thread).' AND cc.id_shop = '.(int)$this->context->shop->id.'
ORDER BY cm.date_add DESC'); ORDER BY cm.date_add DESC');
if ($old_message == htmlentities($message, ENT_COMPAT, 'UTF-8')) if ($old_message == $message)
{ {
$this->context->smarty->assign('alreadySent', 1); $this->context->smarty->assign('alreadySent', 1);
$contact->email = ''; $contact->email = '';
@@ -172,7 +172,8 @@ class ContactControllerCore extends FrontController
{ {
$cm = new CustomerMessage(); $cm = new CustomerMessage();
$cm->id_customer_thread = $ct->id; $cm->id_customer_thread = $ct->id;
$cm->message = htmlentities($message, ENT_COMPAT, 'UTF-8'); elog($message);
$cm->message = Tools::htmlentitiesUTF8($message);
if (isset($filename) && rename($_FILES['fileUpload']['tmp_name'], _PS_MODULE_DIR_.'../upload/'.$filename)) if (isset($filename) && rename($_FILES['fileUpload']['tmp_name'], _PS_MODULE_DIR_.'../upload/'.$filename))
$cm->file_name = $filename; $cm->file_name = $filename;
$cm->ip_address = ip2long($_SERVER['REMOTE_ADDR']); $cm->ip_address = ip2long($_SERVER['REMOTE_ADDR']);