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'];
$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);
+ }
}
}
}
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']);