[-] MO : fixed backslashes in homeslider #PSCFV-5664
This commit is contained in:
@@ -31,6 +31,7 @@ abstract class ModuleCore
|
|||||||
|
|
||||||
/** @var float Version */
|
/** @var float Version */
|
||||||
public $version;
|
public $version;
|
||||||
|
public $database_version;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @since 1.5.0.1
|
* @since 1.5.0.1
|
||||||
@@ -175,6 +176,8 @@ abstract class ModuleCore
|
|||||||
}
|
}
|
||||||
$this->local_path = _PS_MODULE_DIR_.$this->name.'/';
|
$this->local_path = _PS_MODULE_DIR_.$this->name.'/';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->database_version = $this->version;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
<module>
|
<module>
|
||||||
<name>homeslider</name>
|
<name>homeslider</name>
|
||||||
<displayName><![CDATA[Image slider for your homepage]]></displayName>
|
<displayName><![CDATA[Carrousel d'image (slider) pour votre page d'accueil]]></displayName>
|
||||||
<version><![CDATA[1.2]]></version>
|
<version><![CDATA[1.2.1]]></version>
|
||||||
<description><![CDATA[Adds an image slider to your homepage.]]></description>
|
<description><![CDATA[Ajouter un carrousel d'images à votre page d'accueil]]></description>
|
||||||
<author><![CDATA[PrestaShop]]></author>
|
<author><![CDATA[PrestaShop]]></author>
|
||||||
<tab><![CDATA[front_office_features]]></tab>
|
<tab><![CDATA[front_office_features]]></tab>
|
||||||
<is_configurable>1</is_configurable>
|
<is_configurable>1</is_configurable>
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ class HomeSlider extends Module
|
|||||||
{
|
{
|
||||||
$this->name = 'homeslider';
|
$this->name = 'homeslider';
|
||||||
$this->tab = 'front_office_features';
|
$this->tab = 'front_office_features';
|
||||||
$this->version = '1.2';
|
$this->version = '1.2.1';
|
||||||
$this->author = 'PrestaShop';
|
$this->author = 'PrestaShop';
|
||||||
$this->need_instance = 0;
|
$this->need_instance = 0;
|
||||||
$this->secure_key = Tools::encrypt($this->name);
|
$this->secure_key = Tools::encrypt($this->name);
|
||||||
@@ -558,13 +558,13 @@ class HomeSlider extends Module
|
|||||||
foreach ($languages as $language)
|
foreach ($languages as $language)
|
||||||
{
|
{
|
||||||
if (Tools::getValue('title_'.$language['id_lang']) != '')
|
if (Tools::getValue('title_'.$language['id_lang']) != '')
|
||||||
$slide->title[$language['id_lang']] = pSQL(Tools::getValue('title_'.$language['id_lang']));
|
$slide->title[$language['id_lang']] = Tools::getValue('title_'.$language['id_lang']);
|
||||||
if (Tools::getValue('url_'.$language['id_lang']) != '')
|
if (Tools::getValue('url_'.$language['id_lang']) != '')
|
||||||
$slide->url[$language['id_lang']] = pSQL(Tools::getValue('url_'.$language['id_lang']));
|
$slide->url[$language['id_lang']] = Tools::getValue('url_'.$language['id_lang']);
|
||||||
if (Tools::getValue('legend_'.$language['id_lang']) != '')
|
if (Tools::getValue('legend_'.$language['id_lang']) != '')
|
||||||
$slide->legend[$language['id_lang']] = pSQL(Tools::getValue('legend_'.$language['id_lang']));
|
$slide->legend[$language['id_lang']] = Tools::getValue('legend_'.$language['id_lang']);
|
||||||
if (Tools::getValue('description_'.$language['id_lang']) != '')
|
if (Tools::getValue('description_'.$language['id_lang']) != '')
|
||||||
$slide->description[$language['id_lang']] = pSQL(Tools::getValue('description_'.$language['id_lang']));
|
$slide->description[$language['id_lang']] = Tools::getValue('description_'.$language['id_lang']);
|
||||||
/* Uploads image and sets slide */
|
/* Uploads image and sets slide */
|
||||||
$type = strtolower(substr(strrchr($_FILES['image_'.$language['id_lang']]['name'], '.'), 1));
|
$type = strtolower(substr(strrchr($_FILES['image_'.$language['id_lang']]['name'], '.'), 1));
|
||||||
$imagesize = array();
|
$imagesize = array();
|
||||||
@@ -586,10 +586,10 @@ class HomeSlider extends Module
|
|||||||
$errors[] = $this->displayError($this->l('An error occurred during the image upload.'));
|
$errors[] = $this->displayError($this->l('An error occurred during the image upload.'));
|
||||||
if (isset($temp_name))
|
if (isset($temp_name))
|
||||||
@unlink($temp_name);
|
@unlink($temp_name);
|
||||||
$slide->image[$language['id_lang']] = pSQL(Tools::encrypt($_FILES['image_'.($language['id_lang'])]['name'].$salt).'.'.$type);
|
$slide->image[$language['id_lang']] = Tools::encrypt($_FILES['image_'.($language['id_lang'])]['name'].$salt).'.'.$type;
|
||||||
}
|
}
|
||||||
elseif (Tools::getValue('image_old_'.$language['id_lang']) != '')
|
elseif (Tools::getValue('image_old_'.$language['id_lang']) != '')
|
||||||
$slide->image[$language['id_lang']] = pSQL(Tools::getValue('image_old_'.$language['id_lang']));
|
$slide->image[$language['id_lang']] = Tools::getValue('image_old_'.$language['id_lang']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Processes if no errors */
|
/* Processes if no errors */
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ var homeslider_pause = {$homeslider.pause};
|
|||||||
<ul id="homeslider">
|
<ul id="homeslider">
|
||||||
{foreach from=$homeslider_slides item=slide}
|
{foreach from=$homeslider_slides item=slide}
|
||||||
{if $slide.active}
|
{if $slide.active}
|
||||||
<li><a href="{$slide.url}" title="{$slide.description}"><img src="{$smarty.const._MODULE_DIR_}/homeslider/images/{$slide.image}" alt="{$slide.legend}" title="{$slide.description}" height="{$homeslider.height}" width="{$homeslider.width}" /></a></li>
|
<li><a href="{$slide.url|escape:'htmlall':'UTF-8'}" title="{$slide.description|escape:'htmlall':'UTF-8'}"><img src="{$smarty.const._MODULE_DIR_}/homeslider/images/{$slide.image|escape:'htmlall':'UTF-8'}" alt="{$slide.legend|escape:'htmlall':'UTF-8'}" legend="{$slide.description}" height="{$homeslider.height|intval}" width="{$homeslider.width|intval}" /></a></li>
|
||||||
{/if}
|
{/if}
|
||||||
{/foreach}
|
{/foreach}
|
||||||
</ul>
|
</ul>
|
||||||
|
|||||||
@@ -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].')';
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user