From: kaffeeringe Date: Sun, 18 Jan 2015 20:49:05 +0000 (+0100) Subject: Add Tags on Import X-Git-Tag: 1.9beta~30^2~1^2 X-Git-Url: https://git.immae.eu/?a=commitdiff_plain;h=3052cfb7cab3b37e7258f31d18624a9335c0680f;p=github%2Fwallabag%2Fwallabag.git 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 ;-) --- 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 } else { Tools::redirect('?view=home&closewin=true'); } + return $last_id; break; case 'delete': $msg = 'delete link #' . $id; @@ -625,7 +626,18 @@ class Poche $urlsInserted[] = $url; //add if (isset($record['tags']) && trim($record['tags'])) { - // @TODO: set tags + $tags = explode(' ', $record['tags']); + foreach($tags as $tag) { + $entry_id = $id; + $tag_id = $this->store->retrieveTagByValue($tag); + if ($tag_id) { + $this->store->setTagToEntry($tag_id['id'], $entry_id); + } else { + $this->store->createTag($tag); + $tag_id = $this->store->retrieveTagByValue($tag); + $this->store->setTagToEntry($tag_id['id'], $entry_id); + } + } } }