aboutsummaryrefslogtreecommitdiffhomepage
path: root/inc/poche/Poche.class.php
diff options
context:
space:
mode:
Diffstat (limited to 'inc/poche/Poche.class.php')
-rwxr-xr-xinc/poche/Poche.class.php30
1 files changed, 21 insertions, 9 deletions
diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php
index fc9a455a..d92fbf08 100755
--- a/inc/poche/Poche.class.php
+++ b/inc/poche/Poche.class.php
@@ -403,7 +403,7 @@ class Poche
403 /** 403 /**
404 * Call action (mark as fav, archive, delete, etc.) 404 * Call action (mark as fav, archive, delete, etc.)
405 */ 405 */
406 public function action($action, Url $url, $id = 0, $import = FALSE, $autoclose = FALSE) 406 public function action($action, Url $url, $id = 0, $import = FALSE, $autoclose = FALSE, $tags = null)
407 { 407 {
408 switch ($action) 408 switch ($action)
409 { 409 {
@@ -499,8 +499,14 @@ class Poche
499 } 499 }
500 break; 500 break;
501 case 'add_tag' : 501 case 'add_tag' :
502 $tags = explode(',', $_POST['value']); 502 if($import){
503 $entry_id = $_POST['entry_id']; 503 $entry_id = $id;
504 $tags = explode(',', $tags);
505 }
506 else{
507 $tags = explode(',', $_POST['value']);
508 $entry_id = $_POST['entry_id'];
509 }
504 $entry = $this->store->retrieveOneById($entry_id, $this->user->getId()); 510 $entry = $this->store->retrieveOneById($entry_id, $this->user->getId());
505 if (!$entry) { 511 if (!$entry) {
506 $this->messages->add('e', _('Article not found!')); 512 $this->messages->add('e', _('Article not found!'));
@@ -527,7 +533,9 @@ class Poche
527 # we assign the tag to the article 533 # we assign the tag to the article
528 $this->store->setTagToEntry($tag_id, $entry_id); 534 $this->store->setTagToEntry($tag_id, $entry_id);
529 } 535 }
530 Tools::redirect(); 536 if(!$import) {
537 Tools::redirect();
538 }
531 break; 539 break;
532 case 'remove_tag' : 540 case 'remove_tag' :
533 $tag_id = $_GET['tag_id']; 541 $tag_id = $_GET['tag_id'];
@@ -890,14 +898,18 @@ class Poche
890 $a = $li->find('a'); 898 $a = $li->find('a');
891 $url = new Url(base64_encode($a[0]->href)); 899 $url = new Url(base64_encode($a[0]->href));
892 $this->action('add', $url, 0, TRUE); 900 $this->action('add', $url, 0, TRUE);
901 $sequence = '';
902 if (STORAGE == 'postgres') {
903 $sequence = 'entries_id_seq';
904 }
905 $last_id = $this->store->getLastId($sequence);
893 if ($read == '1') { 906 if ($read == '1') {
894 $sequence = '';
895 if (STORAGE == 'postgres') {
896 $sequence = 'entries_id_seq';
897 }
898 $last_id = $this->store->getLastId($sequence);
899 $this->action('toggle_archive', $url, $last_id, TRUE); 907 $this->action('toggle_archive', $url, $last_id, TRUE);
900 } 908 }
909 $tags = $a[0]->tags;
910 if(!empty($tags)) {
911 $this->action('add_tag',$url,$last_id,true,false,$tags);
912 }
901 } 913 }
902 914
903 # the second <ul> is for read links 915 # the second <ul> is for read links