From e442785fe7246951dd99880a5021c317173df198 Mon Sep 17 00:00:00 2001 From: Damien Metzger Date: Wed, 26 Dec 2012 11:32:59 +0100 Subject: [PATCH] [-] MO : fixed bugs on RSS modules --- install-dev/data/theme.sql | 2 +- install-dev/data/xml/configuration.xml | 2 +- modules/blockrss/blockrss.php | 4 ++-- modules/feeder/config.xml | 2 +- modules/feeder/feeder.php | 12 ++++-------- 5 files changed, 9 insertions(+), 13 deletions(-) diff --git a/install-dev/data/theme.sql b/install-dev/data/theme.sql index 077ce035d..4a7fd363a 100644 --- a/install-dev/data/theme.sql +++ b/install-dev/data/theme.sql @@ -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 = '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 = '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 = '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'; diff --git a/install-dev/data/xml/configuration.xml b/install-dev/data/xml/configuration.xml index df19e2a62..515f0762a 100644 --- a/install-dev/data/xml/configuration.xml +++ b/install-dev/data/xml/configuration.xml @@ -633,7 +633,7 @@ http://www.twitter.com/prestashop - RSS + http://www.prestashop.com/blog/en/feed/ Your company diff --git a/modules/blockrss/blockrss.php b/modules/blockrss/blockrss.php index 28c83cf78..496efebfc 100644 --- a/modules/blockrss/blockrss.php +++ b/modules/blockrss/blockrss.php @@ -69,7 +69,7 @@ class Blockrss extends Module $title = Tools::getValue('title'); $nbr = (int)Tools::getValue('nbr'); - if ($urlfeed AND !Validate::isUrl($urlfeed)) + if ($urlfeed AND !Validate::isAbsoluteUrl($urlfeed)) $errors[] = $this->l('Invalid feed URL'); elseif (!$title OR empty($title) OR !Validate::isGenericName($title)) $errors[] = $this->l('Invalid title'); @@ -77,7 +77,7 @@ class Blockrss extends Module $errors[] = $this->l('Invalid number of feeds'); 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'); - elseif (!($contents = @file_get_contents($urlfeed))) + elseif (!($contents = Tools::file_get_contents($urlfeed))) $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 */ else diff --git a/modules/feeder/config.xml b/modules/feeder/config.xml index bde525a23..8fc1ff767 100755 --- a/modules/feeder/config.xml +++ b/modules/feeder/config.xml @@ -2,7 +2,7 @@ feeder - + diff --git a/modules/feeder/feeder.php b/modules/feeder/feeder.php index bdcdd4523..bf1b37930 100644 --- a/modules/feeder/feeder.php +++ b/modules/feeder/feeder.php @@ -35,7 +35,7 @@ class Feeder extends Module { $this->name = 'feeder'; $this->tab = 'front_office_features'; - $this->version = 0.2; + $this->version = 0.3; $this->author = 'PrestaShop'; $this->need_instance = 0; @@ -48,17 +48,13 @@ class Feeder extends Module function install() { - if (!parent::install()) - return false; - if (!$this->registerHook('header')) - return false; - return true; + return (parent::install() && $this->registerHook('header')); } 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')) {