aboutsummaryrefslogtreecommitdiffhomepage
path: root/inc/poche/Poche.class.php
diff options
context:
space:
mode:
authorNicolas LÅ“uillet <nicolas.loeuillet@gmail.com>2014-01-07 04:20:23 -0800
committerNicolas LÅ“uillet <nicolas.loeuillet@gmail.com>2014-01-07 04:20:23 -0800
commitb4b22940dfbb8b56422e244272d22b7741e6ce7c (patch)
tree4ab486d3f7dc77a3fab521faff8e72da8dd3de0b /inc/poche/Poche.class.php
parent60fc4f4b1ab37fbfe9021f3fa1395d66a4424ed2 (diff)
parente1cf0fda27df031e478e55d6df08823d42fe2220 (diff)
downloadwallabag-b4b22940dfbb8b56422e244272d22b7741e6ce7c.tar.gz
wallabag-b4b22940dfbb8b56422e244272d22b7741e6ce7c.tar.zst
wallabag-b4b22940dfbb8b56422e244272d22b7741e6ce7c.zip
Merge pull request #387 from inthepoche/dev1.3.1
poche 1.3.1
Diffstat (limited to 'inc/poche/Poche.class.php')
-rw-r--r--inc/poche/Poche.class.php59
1 files changed, 32 insertions, 27 deletions
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
333 switch ($action) 333 switch ($action)
334 { 334 {
335 case 'add': 335 case 'add':
336 $json = file_get_contents(Tools::getPocheUrl() . '/inc/3rdparty/makefulltextfeed.php?url='.urlencode($url->getUrl()).'&max=5&links=preserve&exc=&format=json&submit=Create+Feed'); 336 $options = array('http' => array('user_agent' => 'poche'));
337 $context = stream_context_create($options);
338 $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);
337 $content = json_decode($json, true); 339 $content = json_decode($json, true);
338 $title = $content['rss']['channel']['item']['title']; 340 $title = $content['rss']['channel']['item']['title'];
339 $body = $content['rss']['channel']['item']['description']; 341 $body = $content['rss']['channel']['item']['description'];
@@ -806,34 +808,37 @@ class Poche
806 $url = NULL; 808 $url = NULL;
807 $favorite = FALSE; 809 $favorite = FALSE;
808 $archive = FALSE; 810 $archive = FALSE;
809 foreach ($value as $attr => $attr_value) { 811 foreach ($value as $item) {
810 if ($attr == 'article__url') { 812 foreach ($item as $attr => $value) {
811 $url = new Url(base64_encode($attr_value)); 813 if ($attr == 'article__url') {
812 } 814 $url = new Url(base64_encode($value));
813 $sequence = '';
814 if (STORAGE == 'postgres') {
815 $sequence = 'entries_id_seq';
816 }
817 if ($attr_value == 'true') {
818 if ($attr == 'favorite') {
819 $favorite = TRUE;
820 } 815 }
821 if ($attr == 'archive') { 816 $sequence = '';
822 $archive = TRUE; 817 if (STORAGE == 'postgres') {
818 $sequence = 'entries_id_seq';
819 }
820 if ($value == 'true') {
821 if ($attr == 'favorite') {
822 $favorite = TRUE;
823 }
824 if ($attr == 'archive') {
825 $archive = TRUE;
826 }
823 } 827 }
824 } 828 }
825 } 829
826 # we can add the url 830 # we can add the url
827 if (!is_null($url) && $url->isCorrect()) { 831 if (!is_null($url) && $url->isCorrect()) {
828 $this->action('add', $url, 0, TRUE); 832 $this->action('add', $url, 0, TRUE);
829 $count++; 833 $count++;
830 if ($favorite) { 834 if ($favorite) {
831 $last_id = $this->store->getLastId($sequence); 835 $last_id = $this->store->getLastId($sequence);
832 $this->action('toggle_fav', $url, $last_id, TRUE); 836 $this->action('toggle_fav', $url, $last_id, TRUE);
833 } 837 }
834 if ($archive) { 838 if ($archive) {
835 $last_id = $this->store->getLastId($sequence); 839 $last_id = $this->store->getLastId($sequence);
836 $this->action('toggle_archive', $url, $last_id, TRUE); 840 $this->action('toggle_archive', $url, $last_id, TRUE);
841 }
837 } 842 }
838 } 843 }
839 } 844 }
@@ -951,7 +956,7 @@ class Poche
951 if (count($entries) > 0) { 956 if (count($entries) > 0) {
952 foreach ($entries as $entry) { 957 foreach ($entries as $entry) {
953 $newItem = $feed->createNewItem(); 958 $newItem = $feed->createNewItem();
954 $newItem->setTitle(htmlentities($entry['title'])); 959 $newItem->setTitle($entry['title']);
955 $newItem->setLink(Tools::getPocheUrl() . '?view=view&amp;id=' . $entry['id']); 960 $newItem->setLink(Tools::getPocheUrl() . '?view=view&amp;id=' . $entry['id']);
956 $newItem->setDate(time()); 961 $newItem->setDate(time());
957 $newItem->setDescription($entry['content']); 962 $newItem->setDescription($entry['content']);