[-] MO : fixed bugs on RSS modules

This commit is contained in:
Damien Metzger committed 2012-12-26 11:32:59 +01:00
1 parent 45bca9a189
commit 9dd5bd4098
5 files changed
+9 -13

No files matched your search

+1 -1
View File
@@ -53,7 +53,7 @@ UPDATE `PREFIX_configuration` SET value = 'CAT2,CAT3,CAT4' WHERE name = 'MOD_BLO
UPDATE `PREFIX_configuration` SET value = '' WHERE name = 'MOD_BLOCKTOPMENU_SEARCH'; UPDATE `PREFIX_configuration` SET value = '' WHERE name = 'MOD_BLOCKTOPMENU_SEARCH';
UPDATE `PREFIX_configuration` SET value = 'http://www.facebook.com/prestashop' WHERE name = 'blocksocial_facebook'; UPDATE `PREFIX_configuration` SET value = 'http://www.facebook.com/prestashop' WHERE name = 'blocksocial_facebook';
UPDATE `PREFIX_configuration` SET value = 'http://www.twitter.com/prestashop' WHERE name = 'blocksocial_twitter'; UPDATE `PREFIX_configuration` SET value = 'http://www.twitter.com/prestashop' WHERE name = 'blocksocial_twitter';
UPDATE `PREFIX_configuration` SET value = 'RSS' WHERE name = 'blocksocial_rss'; UPDATE `PREFIX_configuration` SET value = 'http://www.prestashop.com/blog/en/feed/' WHERE name = 'blocksocial_rss';
UPDATE `PREFIX_configuration` SET value = 'My Company' WHERE name = 'blockcontactinfos_company'; UPDATE `PREFIX_configuration` SET value = 'My Company' WHERE name = 'blockcontactinfos_company';
UPDATE `PREFIX_configuration` SET value = '42 avenue des Champs Elysées\n75000 Paris\nFrance' WHERE name = 'blockcontactinfos_address'; UPDATE `PREFIX_configuration` SET value = '42 avenue des Champs Elysées\n75000 Paris\nFrance' WHERE name = 'blockcontactinfos_address';
UPDATE `PREFIX_configuration` SET value = '+33 (0)1.23.45.67.89' WHERE name = 'blockcontactinfos_phone'; UPDATE `PREFIX_configuration` SET value = '+33 (0)1.23.45.67.89' WHERE name = 'blockcontactinfos_phone';
+1 -1
View File
@@ -633,7 +633,7 @@
<value>http://www.twitter.com/prestashop</value> <value>http://www.twitter.com/prestashop</value>
</configuration> </configuration>
<configuration id="blocksocial_rss" name="blocksocial_rss"> <configuration id="blocksocial_rss" name="blocksocial_rss">
<value>RSS</value> <value>http://www.prestashop.com/blog/en/feed/</value>
</configuration> </configuration>
<configuration id="blockcontactinfos_company" name="blockcontactinfos_company"> <configuration id="blockcontactinfos_company" name="blockcontactinfos_company">
<value>Your company</value> <value>Your company</value>
+2 -2
View File
@@ -69,7 +69,7 @@ class Blockrss extends Module
$title = Tools::getValue('title'); $title = Tools::getValue('title');
$nbr = (int)Tools::getValue('nbr'); $nbr = (int)Tools::getValue('nbr');
if ($urlfeed AND !Validate::isUrl($urlfeed)) if ($urlfeed AND !Validate::isAbsoluteUrl($urlfeed))
$errors[] = $this->l('Invalid feed URL'); $errors[] = $this->l('Invalid feed URL');
elseif (!$title OR empty($title) OR !Validate::isGenericName($title)) elseif (!$title OR empty($title) OR !Validate::isGenericName($title))
$errors[] = $this->l('Invalid title'); $errors[] = $this->l('Invalid title');
@@ -77,7 +77,7 @@ class Blockrss extends Module
$errors[] = $this->l('Invalid number of feeds'); $errors[] = $this->l('Invalid number of feeds');
elseif (stristr($urlfeed, $_SERVER['HTTP_HOST'].__PS_BASE_URI__)) elseif (stristr($urlfeed, $_SERVER['HTTP_HOST'].__PS_BASE_URI__))
$errors[] = $this->l('You have selected a feed URL on your own website. Please choose another URL'); $errors[] = $this->l('You have selected a feed URL on your own website. Please choose another URL');
elseif (!($contents = @file_get_contents($urlfeed))) elseif (!($contents = Tools::file_get_contents($urlfeed)))
$errors[] = $this->l('Feed is unreachable, check your URL'); $errors[] = $this->l('Feed is unreachable, check your URL');
/* Even if the feed was reachable, We need to make sure that the feed is well formated */ /* Even if the feed was reachable, We need to make sure that the feed is well formated */
else else
+1 -1
View File
@@ -2,7 +2,7 @@
<module> <module>
<name>feeder</name> <name>feeder</name>
<displayName><![CDATA[RSS products feed]]></displayName> <displayName><![CDATA[RSS products feed]]></displayName>
<version><![CDATA[0.2]]></version> <version><![CDATA[0.3]]></version>
<description><![CDATA[Generate a RSS products feed]]></description> <description><![CDATA[Generate a RSS products feed]]></description>
<author><![CDATA[PrestaShop]]></author> <author><![CDATA[PrestaShop]]></author>
<tab><![CDATA[front_office_features]]></tab> <tab><![CDATA[front_office_features]]></tab>
+4 -8
View File
@@ -35,7 +35,7 @@ class Feeder extends Module
{ {
$this->name = 'feeder'; $this->name = 'feeder';
$this->tab = 'front_office_features'; $this->tab = 'front_office_features';
$this->version = 0.2; $this->version = 0.3;
$this->author = 'PrestaShop'; $this->author = 'PrestaShop';
$this->need_instance = 0; $this->need_instance = 0;
@@ -48,17 +48,13 @@ class Feeder extends Module
function install() function install()
{ {
if (!parent::install()) return (parent::install() && $this->registerHook('header'));
return false;
if (!$this->registerHook('header'))
return false;
return true;
} }
function hookHeader($params) function hookHeader($params)
{ {
$id_category = (int)(Tools::getValue('id_category'));
if (!$id_category) if (!($id_category = (int)Tools::getValue('id_category')))
{ {
if (isset($_SERVER['HTTP_REFERER']) && preg_match('!^(.*)\/([0-9]+)\-(.*[^\.])|(.*)id_category=([0-9]+)(.*)$!', $_SERVER['HTTP_REFERER'], $regs) && !strstr($_SERVER['HTTP_REFERER'], '.html')) if (isset($_SERVER['HTTP_REFERER']) && preg_match('!^(.*)\/([0-9]+)\-(.*[^\.])|(.*)id_category=([0-9]+)(.*)$!', $_SERVER['HTTP_REFERER'], $regs) && !strstr($_SERVER['HTTP_REFERER'], '.html'))
{ {