X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=inc%2Fpoche%2FPoche.class.php;h=76a73be2b88e188500c3ad7affd11468e2a7dead;hb=b4b22940dfbb8b56422e244272d22b7741e6ce7c;hp=4f70afb755c2a0188af55973ca7dd4ab5b7a4ee6;hpb=60fc4f4b1ab37fbfe9021f3fa1395d66a4424ed2;p=github%2Fwallabag%2Fwallabag.git diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php index 4f70afb7..76a73be2 100644 --- a/inc/poche/Poche.class.php +++ b/inc/poche/Poche.class.php @@ -333,7 +333,9 @@ class Poche switch ($action) { case 'add': - $json = file_get_contents(Tools::getPocheUrl() . '/inc/3rdparty/makefulltextfeed.php?url='.urlencode($url->getUrl()).'&max=5&links=preserve&exc=&format=json&submit=Create+Feed'); + $options = array('http' => array('user_agent' => 'poche')); + $context = stream_context_create($options); + $json = file_get_contents(Tools::getPocheUrl() . '/inc/3rdparty/makefulltextfeed.php?url='.urlencode($url->getUrl()).'&max=5&links=preserve&exc=&format=json&submit=Create+Feed', false, $context); $content = json_decode($json, true); $title = $content['rss']['channel']['item']['title']; $body = $content['rss']['channel']['item']['description']; @@ -806,34 +808,37 @@ class Poche $url = NULL; $favorite = FALSE; $archive = FALSE; - foreach ($value as $attr => $attr_value) { - if ($attr == 'article__url') { - $url = new Url(base64_encode($attr_value)); - } - $sequence = ''; - if (STORAGE == 'postgres') { - $sequence = 'entries_id_seq'; - } - if ($attr_value == 'true') { - if ($attr == 'favorite') { - $favorite = TRUE; + foreach ($value as $item) { + foreach ($item as $attr => $value) { + if ($attr == 'article__url') { + $url = new Url(base64_encode($value)); } - if ($attr == 'archive') { - $archive = TRUE; + $sequence = ''; + if (STORAGE == 'postgres') { + $sequence = 'entries_id_seq'; + } + if ($value == 'true') { + if ($attr == 'favorite') { + $favorite = TRUE; + } + if ($attr == 'archive') { + $archive = TRUE; + } } } - } - # we can add the url - if (!is_null($url) && $url->isCorrect()) { - $this->action('add', $url, 0, TRUE); - $count++; - if ($favorite) { - $last_id = $this->store->getLastId($sequence); - $this->action('toggle_fav', $url, $last_id, TRUE); - } - if ($archive) { - $last_id = $this->store->getLastId($sequence); - $this->action('toggle_archive', $url, $last_id, TRUE); + + # we can add the url + if (!is_null($url) && $url->isCorrect()) { + $this->action('add', $url, 0, TRUE); + $count++; + if ($favorite) { + $last_id = $this->store->getLastId($sequence); + $this->action('toggle_fav', $url, $last_id, TRUE); + } + if ($archive) { + $last_id = $this->store->getLastId($sequence); + $this->action('toggle_archive', $url, $last_id, TRUE); + } } } } @@ -951,7 +956,7 @@ class Poche if (count($entries) > 0) { foreach ($entries as $entry) { $newItem = $feed->createNewItem(); - $newItem->setTitle(htmlentities($entry['title'])); + $newItem->setTitle($entry['title']); $newItem->setLink(Tools::getPocheUrl() . '?view=view&id=' . $entry['id']); $newItem->setDate(time()); $newItem->setDescription($entry['content']);