diff options
author | kaffeeringe <kontakt@kaffeeringe.de> | 2015-01-18 21:49:05 +0100 |
---|---|---|
committer | kaffeeringe <kontakt@kaffeeringe.de> | 2015-01-18 21:49:05 +0100 |
commit | 3052cfb7cab3b37e7258f31d18624a9335c0680f (patch) | |
tree | 13bcfc75baab10c794eafd14245a42629221989d | |
parent | 5537bb321626d0c28b48aa8fed050c21d7d00f1f (diff) | |
download | wallabag-3052cfb7cab3b37e7258f31d18624a9335c0680f.tar.gz wallabag-3052cfb7cab3b37e7258f31d18624a9335c0680f.tar.zst wallabag-3052cfb7cab3b37e7258f31d18624a9335c0680f.zip |
Add Tags on Import
I fixed it! And it works for me.
But: I am not too good with programming. So better check the code ;-)
-rwxr-xr-x | inc/poche/Poche.class.php | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php index 16235474..01f919d9 100755 --- a/inc/poche/Poche.class.php +++ b/inc/poche/Poche.class.php | |||
@@ -192,6 +192,7 @@ class Poche | |||
192 | } else { | 192 | } else { |
193 | Tools::redirect('?view=home&closewin=true'); | 193 | Tools::redirect('?view=home&closewin=true'); |
194 | } | 194 | } |
195 | return $last_id; | ||
195 | break; | 196 | break; |
196 | case 'delete': | 197 | case 'delete': |
197 | $msg = 'delete link #' . $id; | 198 | $msg = 'delete link #' . $id; |
@@ -625,7 +626,18 @@ class Poche | |||
625 | $urlsInserted[] = $url; //add | 626 | $urlsInserted[] = $url; //add |
626 | if (isset($record['tags']) && trim($record['tags'])) { | 627 | if (isset($record['tags']) && trim($record['tags'])) { |
627 | 628 | ||
628 | // @TODO: set tags | 629 | $tags = explode(' ', $record['tags']); |
630 | foreach($tags as $tag) { | ||
631 | $entry_id = $id; | ||
632 | $tag_id = $this->store->retrieveTagByValue($tag); | ||
633 | if ($tag_id) { | ||
634 | $this->store->setTagToEntry($tag_id['id'], $entry_id); | ||
635 | } else { | ||
636 | $this->store->createTag($tag); | ||
637 | $tag_id = $this->store->retrieveTagByValue($tag); | ||
638 | $this->store->setTagToEntry($tag_id['id'], $entry_id); | ||
639 | } | ||
640 | } | ||
629 | 641 | ||
630 | } | 642 | } |
631 | } | 643 | } |