diff options
-rw-r--r-- | inc/poche/Poche.class.php | 53 |
1 files changed, 28 insertions, 25 deletions
diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php index d3eb71d2..e9ff7b46 100644 --- a/inc/poche/Poche.class.php +++ b/inc/poche/Poche.class.php | |||
@@ -806,34 +806,37 @@ class Poche | |||
806 | $url = NULL; | 806 | $url = NULL; |
807 | $favorite = FALSE; | 807 | $favorite = FALSE; |
808 | $archive = FALSE; | 808 | $archive = FALSE; |
809 | foreach ($value as $attr => $attr_value) { | 809 | foreach ($value as $item) { |
810 | if ($attr == 'article__url') { | 810 | foreach ($item as $attr => $value) { |
811 | $url = new Url(base64_encode($attr_value)); | 811 | if ($attr == 'article__url') { |
812 | } | 812 | $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 | } | 813 | } |
821 | if ($attr == 'archive') { | 814 | $sequence = ''; |
822 | $archive = TRUE; | 815 | if (STORAGE == 'postgres') { |
816 | $sequence = 'entries_id_seq'; | ||
817 | } | ||
818 | if ($value == 'true') { | ||
819 | if ($attr == 'favorite') { | ||
820 | $favorite = TRUE; | ||
821 | } | ||
822 | if ($attr == 'archive') { | ||
823 | $archive = TRUE; | ||
824 | } | ||
823 | } | 825 | } |
824 | } | 826 | } |
825 | } | 827 | |
826 | # we can add the url | 828 | # we can add the url |
827 | if (!is_null($url) && $url->isCorrect()) { | 829 | if (!is_null($url) && $url->isCorrect()) { |
828 | $this->action('add', $url, 0, TRUE); | 830 | $this->action('add', $url, 0, TRUE); |
829 | $count++; | 831 | $count++; |
830 | if ($favorite) { | 832 | if ($favorite) { |
831 | $last_id = $this->store->getLastId($sequence); | 833 | $last_id = $this->store->getLastId($sequence); |
832 | $this->action('toggle_fav', $url, $last_id, TRUE); | 834 | $this->action('toggle_fav', $url, $last_id, TRUE); |
833 | } | 835 | } |
834 | if ($archive) { | 836 | if ($archive) { |
835 | $last_id = $this->store->getLastId($sequence); | 837 | $last_id = $this->store->getLastId($sequence); |
836 | $this->action('toggle_archive', $url, $last_id, TRUE); | 838 | $this->action('toggle_archive', $url, $last_id, TRUE); |
839 | } | ||
837 | } | 840 | } |
838 | } | 841 | } |
839 | } | 842 | } |