From ec3972361d95f6f5956df77f7a76105b5ae6af72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Sun, 25 Aug 2013 20:10:23 +0200 Subject: poche now uses Full Text RSS to fetch content --- inc/poche/Poche.class.php | 42 ++++++++++++++++++------------------------ 1 file changed, 18 insertions(+), 24 deletions(-) (limited to 'inc/poche/Poche.class.php') diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php index cb338766..646193f7 100644 --- a/inc/poche/Poche.class.php +++ b/inc/poche/Poche.class.php @@ -156,36 +156,31 @@ class Poche switch ($action) { case 'add': - if($parametres_url = $url->fetchContent()) { - if ($this->store->add($url->getUrl(), $parametres_url['title'], $parametres_url['content'], $this->user->getId())) { - Tools::logm('add link ' . $url->getUrl()); - $sequence = ''; - if (STORAGE == 'postgres') { - $sequence = 'entries_id_seq'; - } - $last_id = $this->store->getLastId($sequence); - if (DOWNLOAD_PICTURES) { - $content = filtre_picture($parametres_url['content'], $url->getUrl(), $last_id); - Tools::logm('updating content article'); - $this->store->updateContent($last_id, $content, $this->user->getId()); - } - if (!$import) { - $this->messages->add('s', _('the link has been added successfully')); - } + $content = $url->extract(); + + if ($this->store->add($url->getUrl(), $content['title'], $content['body'], $this->user->getId())) { + Tools::logm('add link ' . $url->getUrl()); + $sequence = ''; + if (STORAGE == 'postgres') { + $sequence = 'entries_id_seq'; } - else { - if (!$import) { - $this->messages->add('e', _('error during insertion : the link wasn\'t added')); - Tools::logm('error during insertion : the link wasn\'t added ' . $url->getUrl()); - } + $last_id = $this->store->getLastId($sequence); + if (DOWNLOAD_PICTURES) { + $content = filtre_picture($parametres_url['body'], $url->getUrl(), $last_id); + Tools::logm('updating content article'); + $this->store->updateContent($last_id, $content, $this->user->getId()); + } + if (!$import) { + $this->messages->add('s', _('the link has been added successfully')); } } else { if (!$import) { - $this->messages->add('e', _('error during fetching content : the link wasn\'t added')); - Tools::logm('error during content fetch ' . $url->getUrl()); + $this->messages->add('e', _('error during insertion : the link wasn\'t added')); + Tools::logm('error during insertion : the link wasn\'t added ' . $url->getUrl()); } } + if (!$import) { Tools::redirect(); } @@ -220,7 +215,6 @@ class Poche } break; default: - Tools::logm('action ' . $action . 'doesn\'t exist'); break; } } -- cgit v1.2.3