mirror of
https://github.com/wallabag/wallabag.git
synced 2025-02-04 13:02:22 +00:00
Fix fetched entries when localized
This commit is contained in:
parent
5e26c91024
commit
fde4cf0616
2 changed files with 17 additions and 11 deletions
|
@ -293,7 +293,7 @@ class Database {
|
||||||
$sql_limit = "LIMIT ".$limit." OFFSET 0";
|
$sql_limit = "LIMIT ".$limit." OFFSET 0";
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = "SELECT * FROM entries WHERE (content = '' OR content IS NULL) AND title LIKE 'Untitled - Import%' AND user_id=? ORDER BY id " . $sql_limit;
|
$sql = "SELECT * FROM entries WHERE (content = '' OR content IS NULL) AND title LIKE '%Import%' AND user_id=? ORDER BY id " . $sql_limit;
|
||||||
$query = $this->executeQuery($sql, array($user_id));
|
$query = $this->executeQuery($sql, array($user_id));
|
||||||
$entries = $query->fetchAll();
|
$entries = $query->fetchAll();
|
||||||
|
|
||||||
|
@ -302,7 +302,7 @@ class Database {
|
||||||
|
|
||||||
public function retrieveUnfetchedEntriesCount($user_id)
|
public function retrieveUnfetchedEntriesCount($user_id)
|
||||||
{
|
{
|
||||||
$sql = "SELECT count(*) FROM entries WHERE (content = '' OR content IS NULL) AND title LIKE 'Untitled - Import%' AND user_id=?";
|
$sql = "SELECT count(*) FROM entries WHERE (content = '' OR content IS NULL) AND title LIKE '%Import%' AND user_id=?";
|
||||||
$query = $this->executeQuery($sql, array($user_id));
|
$query = $this->executeQuery($sql, array($user_id));
|
||||||
list($count) = $query->fetch();
|
list($count) = $query->fetch();
|
||||||
|
|
||||||
|
|
|
@ -740,17 +740,23 @@ class Poche
|
||||||
$purifier = $this->_getPurifier();
|
$purifier = $this->_getPurifier();
|
||||||
foreach($items as $item) {
|
foreach($items as $item) {
|
||||||
$url = new Url(base64_encode($item['url']));
|
$url = new Url(base64_encode($item['url']));
|
||||||
Tools::logm('Fetching article ' . $item['id']);
|
if( $url->isCorrect() )
|
||||||
$content = Tools::getPageContent($url);
|
{
|
||||||
$title = (($content['rss']['channel']['item']['title'] != '') ? $content['rss']['channel']['item']['title'] : _('Untitled'));
|
Tools::logm('Fetching article ' . $item['id']);
|
||||||
$body = (($content['rss']['channel']['item']['description'] != '') ? $content['rss']['channel']['item']['description'] : _('Undefined'));
|
$content = Tools::getPageContent($url);
|
||||||
|
$title = (($content['rss']['channel']['item']['title'] != '') ? $content['rss']['channel']['item']['title'] : _('Untitled'));
|
||||||
|
$body = (($content['rss']['channel']['item']['description'] != '') ? $content['rss']['channel']['item']['description'] : _('Undefined'));
|
||||||
|
|
||||||
// clean content to prevent xss attack
|
// clean content to prevent xss attack
|
||||||
|
|
||||||
$title = $purifier->purify($title);
|
$title = $purifier->purify($title);
|
||||||
$body = $purifier->purify($body);
|
$body = $purifier->purify($body);
|
||||||
$this->store->updateContentAndTitle($item['id'], $title, $body, $this->user->getId());
|
$this->store->updateContentAndTitle($item['id'], $title, $body, $this->user->getId());
|
||||||
Tools::logm('Article ' . $item['id'] . ' updated.');
|
Tools::logm('Article ' . $item['id'] . ' updated.');
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
Tools::logm('Unvalid URL (' . $item['url'] .') to fetch for article ' . $item['id']);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue