diff options
author | arnaudmm <arnaudmm@gmail.com> | 2014-02-14 13:59:27 +0100 |
---|---|---|
committer | arnaudmm <arnaudmm@gmail.com> | 2014-02-20 13:09:27 +0100 |
commit | 926acd7bba2780009eb5abec7bbf71a08b2ef1bf (patch) | |
tree | 2623e68931e68866e4eb710f11f07e534f5bb4ec /inc/poche/Poche.class.php | |
parent | d09a5674e915e79762931a3465461327fb5737ea (diff) | |
download | wallabag-926acd7bba2780009eb5abec7bbf71a08b2ef1bf.tar.gz wallabag-926acd7bba2780009eb5abec7bbf71a08b2ef1bf.tar.zst wallabag-926acd7bba2780009eb5abec7bbf71a08b2ef1bf.zip |
Feature #457 : import from pocket now import tags too
Diffstat (limited to 'inc/poche/Poche.class.php')
-rw-r--r-- | inc/poche/Poche.class.php | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php index 753bd7f0..b6b3b73f 100644 --- a/inc/poche/Poche.class.php +++ b/inc/poche/Poche.class.php | |||
@@ -365,7 +365,7 @@ class Poche | |||
365 | /** | 365 | /** |
366 | * Call action (mark as fav, archive, delete, etc.) | 366 | * Call action (mark as fav, archive, delete, etc.) |
367 | */ | 367 | */ |
368 | public function action($action, Url $url, $id = 0, $import = FALSE, $autoclose = FALSE) | 368 | public function action($action, Url $url, $id = 0, $import = FALSE, $autoclose = FALSE, $tags = null) |
369 | { | 369 | { |
370 | switch ($action) | 370 | switch ($action) |
371 | { | 371 | { |
@@ -461,8 +461,14 @@ class Poche | |||
461 | } | 461 | } |
462 | break; | 462 | break; |
463 | case 'add_tag' : | 463 | case 'add_tag' : |
464 | $tags = explode(',', $_POST['value']); | 464 | if($import){ |
465 | $entry_id = $_POST['entry_id']; | 465 | $entry_id = $id; |
466 | $tags = explode(',', $tags); | ||
467 | } | ||
468 | else{ | ||
469 | $tags = explode(',', $_POST['value']); | ||
470 | $entry_id = $_POST['entry_id']; | ||
471 | } | ||
466 | $entry = $this->store->retrieveOneById($entry_id, $this->user->getId()); | 472 | $entry = $this->store->retrieveOneById($entry_id, $this->user->getId()); |
467 | if (!$entry) { | 473 | if (!$entry) { |
468 | $this->messages->add('e', _('Article not found!')); | 474 | $this->messages->add('e', _('Article not found!')); |
@@ -489,7 +495,9 @@ class Poche | |||
489 | # we assign the tag to the article | 495 | # we assign the tag to the article |
490 | $this->store->setTagToEntry($tag_id, $entry_id); | 496 | $this->store->setTagToEntry($tag_id, $entry_id); |
491 | } | 497 | } |
492 | Tools::redirect(); | 498 | if(!$import) { |
499 | Tools::redirect(); | ||
500 | } | ||
493 | break; | 501 | break; |
494 | case 'remove_tag' : | 502 | case 'remove_tag' : |
495 | $tag_id = $_GET['tag_id']; | 503 | $tag_id = $_GET['tag_id']; |
@@ -852,14 +860,18 @@ class Poche | |||
852 | $a = $li->find('a'); | 860 | $a = $li->find('a'); |
853 | $url = new Url(base64_encode($a[0]->href)); | 861 | $url = new Url(base64_encode($a[0]->href)); |
854 | $this->action('add', $url, 0, TRUE); | 862 | $this->action('add', $url, 0, TRUE); |
863 | $sequence = ''; | ||
864 | if (STORAGE == 'postgres') { | ||
865 | $sequence = 'entries_id_seq'; | ||
866 | } | ||
867 | $last_id = $this->store->getLastId($sequence); | ||
855 | if ($read == '1') { | 868 | if ($read == '1') { |
856 | $sequence = ''; | ||
857 | if (STORAGE == 'postgres') { | ||
858 | $sequence = 'entries_id_seq'; | ||
859 | } | ||
860 | $last_id = $this->store->getLastId($sequence); | ||
861 | $this->action('toggle_archive', $url, $last_id, TRUE); | 869 | $this->action('toggle_archive', $url, $last_id, TRUE); |
862 | } | 870 | } |
871 | $tags = $a[0]->tags; | ||
872 | if(!empty($tags)) { | ||
873 | $this->action('add_tag',$url,$last_id,true,false,$tags); | ||
874 | } | ||
863 | } | 875 | } |
864 | 876 | ||
865 | # the second <ul> is for read links | 877 | # the second <ul> is for read links |