Add fix for spam
This commit is contained in:
parent
a12ab8132a
commit
3768576288
@ -115,7 +115,8 @@ class Suspect extends ObjectModel
|
||||
$domain_name = strtolower(substr(strrchr($email, '@'), 1));
|
||||
|
||||
// Exclusion de domains spé
|
||||
$exclude_domains = array('qq.com','sina.com','tom.com','yahoo.cn','yahoo.com.cn','cntv.cn','sohu.com','vip.sohu.com','21cn.com');
|
||||
$exclude_domains = array('qq.com','sina.com','tom.com','yahoo.cn','yahoo.com.cn',
|
||||
'cntv.cn','sohu.com','vip.sohu.com','21cn.com', 'mail.ru', 'list.ru');
|
||||
if (in_array($domain_name, $exclude_domains)) {
|
||||
return true;
|
||||
}
|
||||
|
@ -51,6 +51,7 @@ if (Tools::isSubmit('submitMessage')) {
|
||||
$fileAttachment['name'] = $_FILES['fileUpload']['name'];
|
||||
$fileAttachment['mime'] = $_FILES['fileUpload']['type'];
|
||||
}
|
||||
|
||||
$message = Tools::htmlentitiesUTF8(Tools::getValue('message'));
|
||||
if (Tools::getValue('email2') != '') {
|
||||
$this->errors[] = Tools::displayError('Invalid');
|
||||
@ -94,10 +95,10 @@ if (Tools::isSubmit('submitMessage')) {
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((int)($cookie->id_customer))
|
||||
if ((int)($cookie->id_customer)){
|
||||
$customer = new Customer((int)($cookie->id_customer));
|
||||
else
|
||||
{
|
||||
}
|
||||
else {
|
||||
$customer = new Customer();
|
||||
$customer->getByEmail($from);
|
||||
}
|
||||
|
@ -55,6 +55,7 @@ class ContactController extends ContactControllerCore {
|
||||
$fileAttachment['name'] = $_FILES['fileUpload']['name'];
|
||||
$fileAttachment['mime'] = $_FILES['fileUpload']['type'];
|
||||
}
|
||||
|
||||
$message = Tools::htmlentitiesUTF8(Tools::getValue('message'));
|
||||
if (Tools::getValue('email2') != '') {
|
||||
$this->errors[] = Tools::displayError('Invalid');
|
||||
@ -65,7 +66,7 @@ class ContactController extends ContactControllerCore {
|
||||
elseif (!($from = trim(Tools::getValue('from'))) OR !Validate::isEmail($from)) {
|
||||
$this->errors[] = Tools::displayError('Invalid e-mail address');
|
||||
}
|
||||
elseif ($alert_mode AND Suspect::isBannished($from)){
|
||||
elseif ($alert_mode && Suspect::isBannished($from)) {
|
||||
$this->errors[] = Tools::displayError('Message cannot be sent.');
|
||||
}
|
||||
elseif (!($message = nl2br2($message))) {
|
||||
@ -77,6 +78,19 @@ class ContactController extends ContactControllerCore {
|
||||
elseif (!($id_contact = (int)(Tools::getValue('id_contact'))) OR !(Validate::isLoadedObject($contact = new Contact((int)($id_contact), (int)(self::$cookie->id_lang))))) {
|
||||
$this->errors[] = Tools::displayError('Please select a subject on the list.');
|
||||
}
|
||||
elseif (($id_contact = (int)(Tools::getValue('id_contact'))) && $id_contact == 9 && !Tools::getValue('id_reason')) {
|
||||
$this->errors[] = Tools::displayError('Please select a reason on the list.');
|
||||
}
|
||||
elseif (($id_contact = (int)(Tools::getValue('id_contact'))) && ($id_contact == 9 || $id_contact == 1 || $id_contact == 2) && !Tools::getValue('id_order')) {
|
||||
$this->errors[] = Tools::displayError('Please enter/choose an order ID');
|
||||
}
|
||||
elseif (($id_contact = (int)(Tools::getValue('id_contact'))) && $id_contact == 1 && !Tools::getValue('id_products')) {
|
||||
if((int)(self::$cookie->id_customer)) {
|
||||
$this->errors[] = Tools::displayError('Please choose a product');
|
||||
} else {
|
||||
$this->errors[] = Tools::displayError('You have to be logged');
|
||||
}
|
||||
}
|
||||
elseif (!empty($_FILES['fileUpload']['name']) AND $_FILES['fileUpload']['error'] != 0) {
|
||||
$this->errors[] = Tools::displayError('An error occurred during the file upload');
|
||||
}
|
||||
@ -85,10 +99,10 @@ class ContactController extends ContactControllerCore {
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((int)(self::$cookie->id_customer))
|
||||
if ((int)(self::$cookie->id_customer)) {
|
||||
$customer = new Customer((int)(self::$cookie->id_customer));
|
||||
else
|
||||
{
|
||||
}
|
||||
else {
|
||||
$customer = new Customer();
|
||||
$customer->getByEmail($from);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user