diff options
-rwxr-xr-x | inc/poche/Database.class.php | 4 | ||||
-rwxr-xr-x | inc/poche/Poche.class.php | 28 |
2 files changed, 19 insertions, 13 deletions
diff --git a/inc/poche/Database.class.php b/inc/poche/Database.class.php index f6ba4708..6bac0f5d 100755 --- a/inc/poche/Database.class.php +++ b/inc/poche/Database.class.php | |||
@@ -293,7 +293,7 @@ class Database { | |||
293 | $sql_limit = "LIMIT ".$limit." OFFSET 0"; | 293 | $sql_limit = "LIMIT ".$limit." OFFSET 0"; |
294 | } | 294 | } |
295 | 295 | ||
296 | $sql = "SELECT * FROM entries WHERE (content = '' OR content IS NULL) AND title LIKE 'Untitled - Import%' AND user_id=? ORDER BY id " . $sql_limit; | 296 | $sql = "SELECT * FROM entries WHERE (content = '' OR content IS NULL) AND title LIKE '%Import%' AND user_id=? ORDER BY id " . $sql_limit; |
297 | $query = $this->executeQuery($sql, array($user_id)); | 297 | $query = $this->executeQuery($sql, array($user_id)); |
298 | $entries = $query->fetchAll(); | 298 | $entries = $query->fetchAll(); |
299 | 299 | ||
@@ -302,7 +302,7 @@ class Database { | |||
302 | 302 | ||
303 | public function retrieveUnfetchedEntriesCount($user_id) | 303 | public function retrieveUnfetchedEntriesCount($user_id) |
304 | { | 304 | { |
305 | $sql = "SELECT count(*) FROM entries WHERE (content = '' OR content IS NULL) AND title LIKE 'Untitled - Import%' AND user_id=?"; | 305 | $sql = "SELECT count(*) FROM entries WHERE (content = '' OR content IS NULL) AND title LIKE '%Import%' AND user_id=?"; |
306 | $query = $this->executeQuery($sql, array($user_id)); | 306 | $query = $this->executeQuery($sql, array($user_id)); |
307 | list($count) = $query->fetch(); | 307 | list($count) = $query->fetch(); |
308 | 308 | ||
diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php index a601f0a8..d096de91 100755 --- a/inc/poche/Poche.class.php +++ b/inc/poche/Poche.class.php | |||
@@ -740,17 +740,23 @@ class Poche | |||
740 | $purifier = $this->_getPurifier(); | 740 | $purifier = $this->_getPurifier(); |
741 | foreach($items as $item) { | 741 | foreach($items as $item) { |
742 | $url = new Url(base64_encode($item['url'])); | 742 | $url = new Url(base64_encode($item['url'])); |
743 | Tools::logm('Fetching article ' . $item['id']); | 743 | if( $url->isCorrect() ) |
744 | $content = Tools::getPageContent($url); | 744 | { |
745 | $title = (($content['rss']['channel']['item']['title'] != '') ? $content['rss']['channel']['item']['title'] : _('Untitled')); | 745 | Tools::logm('Fetching article ' . $item['id']); |
746 | $body = (($content['rss']['channel']['item']['description'] != '') ? $content['rss']['channel']['item']['description'] : _('Undefined')); | 746 | $content = Tools::getPageContent($url); |
747 | 747 | $title = (($content['rss']['channel']['item']['title'] != '') ? $content['rss']['channel']['item']['title'] : _('Untitled')); | |
748 | // clean content to prevent xss attack | 748 | $body = (($content['rss']['channel']['item']['description'] != '') ? $content['rss']['channel']['item']['description'] : _('Undefined')); |
749 | 749 | ||
750 | $title = $purifier->purify($title); | 750 | // clean content to prevent xss attack |
751 | $body = $purifier->purify($body); | 751 | |
752 | $this->store->updateContentAndTitle($item['id'], $title, $body, $this->user->getId()); | 752 | $title = $purifier->purify($title); |
753 | Tools::logm('Article ' . $item['id'] . ' updated.'); | 753 | $body = $purifier->purify($body); |
754 | $this->store->updateContentAndTitle($item['id'], $title, $body, $this->user->getId()); | ||
755 | Tools::logm('Article ' . $item['id'] . ' updated.'); | ||
756 | } else | ||
757 | { | ||
758 | Tools::logm('Unvalid URL (' . $item['url'] .') to fetch for article ' . $item['id']); | ||
759 | } | ||
754 | } | 760 | } |
755 | } | 761 | } |
756 | } | 762 | } |