diff --git a/modules/mailalerts/upgrade/install-2.5.php b/modules/mailalerts/upgrade/install-2.5.php new file mode 100644 index 000000000..8696a4a2b --- /dev/null +++ b/modules/mailalerts/upgrade/install-2.5.php @@ -0,0 +1,29 @@ +execute(' + ALTER TABLE '._DB_PREFIX_.'mailalert_customer_oos + ADD '.mailalerts_stripslashes_field('id_lang').' INT( 10 ) UNSIGNED NOT NULL , + DROP PRIMARY KEY , + ADD PRIMARY KEY ( + '.mailalerts_stripslashes_field('id_customer').' , + '.mailalerts_stripslashes_field('customer_email').' , + '.mailalerts_stripslashes_field('id_product').' , + '.mailalerts_stripslashes_field('id_product_attribute').' , + '.mailalerts_stripslashes_field('id_shop').' + )' + ); +} + +function mailalerts_stripslashes_field($field) +{ + $quotes = array('"\\\'"', '"\'"'); + $dquotes = array('\'\\\\"\'', '\'"\''); + $backslashes = array('"\\\\\\\\"', '"\\\\"'); + + return '`'.bqSQL($field).'` = replace(replace(replace(`'.bqSQL($field).'`, '.$quotes[0].', '.$quotes[1].'), '.$dquotes[0].', '.$dquotes[1].'), '.$backslashes[0].', '.$backslashes[1].')'; +} \ No newline at end of file