[-] MO : #PSCFV-2868 - Fix addslashes

This commit is contained in:
mDeflotte
2012-06-25 12:26:07 +00:00
parent ed9b10e221
commit d0ffa9d9f2
2 changed files with 22 additions and 22 deletions
+8 -8
View File
@@ -44,18 +44,18 @@ class MailAlert extends ObjectModel
'table' => 'mailalert_customer_oos', 'table' => 'mailalert_customer_oos',
'primary' => 'id_customer', 'primary' => 'id_customer',
'fields' => array( 'fields' => array(
'id_customer' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt', 'required' => true), 'id_customer' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt', 'required' => true),
'customer_email' => array('type' => self::TYPE_STRING, 'validate' => 'isEmail', 'required' => true), 'customer_email' => array('type' => self::TYPE_STRING, 'validate' => 'isEmail', 'required' => true),
'id_product' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt', 'required' => true), 'id_product' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt', 'required' => true),
'id_product_attribute' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt', 'required' => true), 'id_product_attribute' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt', 'required' => true),
'id_shop' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt', 'required' => true) 'id_shop' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt', 'required' => true)
), ),
); );
public static function customerHasNotification($id_customer, $id_product, $id_product_attribute, $id_shop = null) public static function customerHasNotification($id_customer, $id_product, $id_product_attribute, $id_shop = null)
{ {
if ($id_shop == null) if ($id_shop == null)
$id_shop = Context::getContext()->shop->id; $id_shop = Context::getContext()->shop->id;
$customer = new Customer($id_customer); $customer = new Customer($id_customer);
$customer_email = $customer->email; $customer_email = $customer->email;
@@ -109,7 +109,7 @@ class MailAlert extends ObjectModel
continue; continue;
if (isset($products[$i]['id_product_attribute']) && if (isset($products[$i]['id_product_attribute']) &&
Validate::isUnsignedInt($products[$i]['id_product_attribute'])) Validate::isUnsignedInt($products[$i]['id_product_attribute']))
{ {
$attributes = self::getProductAttributeCombination($products[$i]['id_product_attribute'], $id_lang); $attributes = self::getProductAttributeCombination($products[$i]['id_product_attribute'], $id_lang);
$products[$i]['attributes_small'] = ''; $products[$i]['attributes_small'] = '';
@@ -187,7 +187,7 @@ class MailAlert extends ObjectModel
$iso = Language::getIsoById($id_lang); $iso = Language::getIsoById($id_lang);
if (file_exists(dirname(__FILE__).'/mails/'.$iso.'/customer_qty.txt') && if (file_exists(dirname(__FILE__).'/mails/'.$iso.'/customer_qty.txt') &&
file_exists(dirname(__FILE__).'/mails/'.$iso.'/customer_qty.html')) file_exists(dirname(__FILE__).'/mails/'.$iso.'/customer_qty.html'))
Mail::Send((int)Configuration::get('PS_LANG_DEFAULT'), 'customer_qty', Mail::l('Product available', $id_lang), $templateVars, strval($customer_email), NULL, strval(Configuration::get('PS_SHOP_EMAIL')), strval(Configuration::get('PS_SHOP_NAME')), NULL, NULL, dirname(__FILE__).'/mails/'); Mail::Send((int)Configuration::get('PS_LANG_DEFAULT'), 'customer_qty', Mail::l('Product available', $id_lang), $templateVars, strval($customer_email), NULL, strval(Configuration::get('PS_SHOP_EMAIL')), strval(Configuration::get('PS_SHOP_NAME')), NULL, NULL, dirname(__FILE__).'/mails/');
Hook::exec('actionModuleMailAlertSendCustomer', array('product' => (is_array($product->name) ? $product->name[$id_lang] : $product->name), 'link' => $link->getProductLink($product))); Hook::exec('actionModuleMailAlertSendCustomer', array('product' => (is_array($product->name) ? $product->name[$id_lang] : $product->name), 'link' => $link->getProductLink($product)));
+14 -14
View File
@@ -49,7 +49,7 @@ class MailAlerts extends Module
$this->tab = 'administration'; $this->tab = 'administration';
$this->version = '2.4'; $this->version = '2.4';
$this->author = 'PrestaShop'; $this->author = 'PrestaShop';
$this->need_instance = 0; $this->need_instance = 0;
parent::__construct(); parent::__construct();
@@ -264,7 +264,7 @@ class MailAlerts extends Module
// Getting differents vars // Getting differents vars
$id_lang = (int)Context::getContext()->language->id; $id_lang = (int)Context::getContext()->language->id;
$currency = $params['currency']; $currency = $params['currency'];
$configuration = Configuration::getMultiple(array('PS_SHOP_EMAIL', 'PS_MAIL_METHOD', 'PS_MAIL_SERVER', 'PS_MAIL_USER', 'PS_MAIL_PASSWD', 'PS_SHOP_NAME')); $configuration = Configuration::getMultiple(array('PS_SHOP_EMAIL', 'PS_MAIL_METHOD', 'PS_MAIL_SERVER', 'PS_MAIL_USER', 'PS_MAIL_PASSWD', 'PS_SHOP_NAME'));
$order = $params['order']; $order = $params['order'];
$customer = $params['customer']; $customer = $params['customer'];
@@ -311,7 +311,7 @@ class MailAlerts extends Module
<td style="padding:0.6em 0.4em;"> <td style="padding:0.6em 0.4em;">
<strong>' <strong>'
.$product['product_name'].(isset($product['attributes_small']) ? ' '.$product['attributes_small'] : '').(!empty($customization_text) ? '<br />'.$customization_text : ''). .$product['product_name'].(isset($product['attributes_small']) ? ' '.$product['attributes_small'] : '').(!empty($customization_text) ? '<br />'.$customization_text : '').
'</strong> '</strong>
</td> </td>
<td style="padding:0.6em 0.4em; text-align:right;">'.Tools::displayPrice($unit_price, $currency, false).'</td> <td style="padding:0.6em 0.4em; text-align:right;">'.Tools::displayPrice($unit_price, $currency, false).'</td>
<td style="padding:0.6em 0.4em; text-align:center;">'.(int)$product['product_quantity'].'</td> <td style="padding:0.6em 0.4em; text-align:center;">'.(int)$product['product_quantity'].'</td>
@@ -340,11 +340,11 @@ class MailAlerts extends Module
'{delivery_block_txt}' => MailAlert::getFormatedAddress($delivery, "\n"), '{delivery_block_txt}' => MailAlert::getFormatedAddress($delivery, "\n"),
'{invoice_block_txt}' => MailAlert::getFormatedAddress($invoice, "\n"), '{invoice_block_txt}' => MailAlert::getFormatedAddress($invoice, "\n"),
'{delivery_block_html}' => MailAlert::getFormatedAddress($delivery, '<br />', array( '{delivery_block_html}' => MailAlert::getFormatedAddress($delivery, '<br />', array(
'firstname' => '<span style="color:#DB3484; font-weight:bold;">%s</span>', 'firstname' => '<span style="color:#DB3484; font-weight:bold;">%s</span>',
'lastname' => '<span style="color:#DB3484; font-weight:bold;">%s</span>')), 'lastname' => '<span style="color:#DB3484; font-weight:bold;">%s</span>')),
'{invoice_block_html}' => MailAlert::getFormatedAddress($invoice, '<br />', array( '{invoice_block_html}' => MailAlert::getFormatedAddress($invoice, '<br />', array(
'firstname' => '<span style="color:#DB3484; font-weight:bold;">%s</span>', 'firstname' => '<span style="color:#DB3484; font-weight:bold;">%s</span>',
'lastname' => '<span style="color:#DB3484; font-weight:bold;">%s</span>')), 'lastname' => '<span style="color:#DB3484; font-weight:bold;">%s</span>')),
'{delivery_company}' => $delivery->company, '{delivery_company}' => $delivery->company,
'{delivery_firstname}' => $delivery->firstname, '{delivery_firstname}' => $delivery->firstname,
'{delivery_lastname}' => $delivery->lastname, '{delivery_lastname}' => $delivery->lastname,
@@ -438,13 +438,13 @@ class MailAlerts extends Module
$product_name = Product::getProductName($id_product, $id_product_attribute, $id_lang); $product_name = Product::getProductName($id_product, $id_product_attribute, $id_lang);
$template_vars = array( $template_vars = array(
'{qty}' => $quantity, '{qty}' => $quantity,
'{last_qty}' => $ma_last_qties, '{last_qty}' => $ma_last_qties,
'{product}' => pSQL($product_name)); '{product}' => $product_name);
if (file_exists(dirname(__FILE__).'/mails/'.$iso.'/productoutofstock.txt') && if (file_exists(dirname(__FILE__).'/mails/'.$iso.'/productoutofstock.txt') &&
file_exists(dirname(__FILE__).'/mails/'.$iso.'/productoutofstock.html')) file_exists(dirname(__FILE__).'/mails/'.$iso.'/productoutofstock.html'))
Mail::Send($id_lang, Mail::Send($id_lang,
'productoutofstock', 'productoutofstock',
Mail::l('Product out of stock', $id_lang), Mail::l('Product out of stock', $id_lang),
$template_vars, $template_vars,
explode(self::__MA_MAIL_DELIMITOR__, $this->_merchant_mails), explode(self::__MA_MAIL_DELIMITOR__, $this->_merchant_mails),
@@ -546,14 +546,14 @@ class MailAlerts extends Module
$product_name = Product::getProductName($id_product, $id_product_attribute, $id_lang); $product_name = Product::getProductName($id_product, $id_product_attribute, $id_lang);
$template_vars = array( $template_vars = array(
'{current_coverage}' => $coverage, '{current_coverage}' => $coverage,
'{warning_coverage}' => $warning_coverage, '{warning_coverage}' => $warning_coverage,
'{product}' => pSQL($product_name)); '{product}' => pSQL($product_name));
if (file_exists(dirname(__FILE__).'/mails/'.$iso.'/productcoverage.txt') && if (file_exists(dirname(__FILE__).'/mails/'.$iso.'/productcoverage.txt') &&
file_exists(dirname(__FILE__).'/mails/'.$iso.'/productcoverage.html')) file_exists(dirname(__FILE__).'/mails/'.$iso.'/productcoverage.html'))
{ {
Mail::Send($id_lang, Mail::Send($id_lang,
'productcoverage', 'productcoverage',
Mail::l('Stock coverage', $id_lang), Mail::l('Stock coverage', $id_lang),
$template_vars, $template_vars,
explode(self::__MA_MAIL_DELIMITOR__, $this->_merchant_mails), explode(self::__MA_MAIL_DELIMITOR__, $this->_merchant_mails),
@@ -569,6 +569,6 @@ class MailAlerts extends Module
public function hookDisplayHeader($params) public function hookDisplayHeader($params)
{ {
$this->context->controller->addCSS($this->_path.'mailalerts.css', 'all'); $this->context->controller->addCSS($this->_path.'mailalerts.css', 'all');
} }
} }