[-] MO : fixed backslashes in homeslider #PSCFV-5664

This commit is contained in:
Damien Metzger
2012-12-11 11:16:56 +01:00
parent 68236c6a6d
commit 27eaed42bd
5 changed files with 38 additions and 11 deletions
@@ -0,0 +1,24 @@
<?php
if (!defined('_PS_VERSION_'))
exit;
function upgrade_module_1_2_1($object)
{
Db::getInstance()->execute('
UPDATE '._DB_PREFIX_.'homeslider_slides_lang SET
'.homeslider_stripslashes_field('title').',
'.homeslider_stripslashes_field('description').',
'.homeslider_stripslashes_field('legend').',
'.homeslider_stripslashes_field('url')
);
}
function homeslider_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].')';
}