X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=inc%2Fpoche%2FPoche.class.php;h=adec9b288714c4424d59bf1d1289c0349a578c59;hb=a0aa150418b628b32b18c70436d6be495129ee38;hp=68f56d623999c5f1c2ed7a6143f4ebc39e1d4b9f;hpb=f778e47283c9691d2992045e0fbcdfc6685f157f;p=github%2Fwallabag%2Fwallabag.git diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php index 68f56d62..adec9b28 100644 --- a/inc/poche/Poche.class.php +++ b/inc/poche/Poche.class.php @@ -397,6 +397,36 @@ class Poche Tools::redirect(); } break; + case 'add_tag' : + $tags = explode(',', $_POST['value']); + $entry_id = $_POST['entry_id']; + foreach($tags as $key => $tag_value) { + $value = trim($tag_value); + $tag = $this->store->retrieveTagByValue($value); + + if (is_null($tag)) { + # we create the tag + $tag = $this->store->createTag($value); + $sequence = ''; + if (STORAGE == 'postgres') { + $sequence = 'tags_id_seq'; + } + $tag_id = $this->store->getLastId($sequence); + } + else { + $tag_id = $tag['id']; + } + + # we assign the tag to the article + $this->store->setTagToEntry($tag_id, $entry_id); + } + Tools::redirect(); + break; + case 'remove_tag' : + $tag_id = $_GET['tag_id']; + $this->store->removeTagForEntry($id, $tag_id); + Tools::redirect(); + break; default: break; } @@ -434,6 +464,7 @@ class Poche # tags $tags = $this->store->retrieveTagsByEntry($id); $tpl_vars = array( + 'entry_id' => $id, 'tags' => $tags, ); break; @@ -647,7 +678,8 @@ class Poche $user = $this->store->login($login, Tools::encodeString($password . $login)); if ($user != array()) { # Save login into Session - Session::login($user['username'], $user['password'], $login, Tools::encodeString($password . $login), array('poche_user' => new User($user))); + $longlastingsession = isset($_POST['longlastingsession']); + Session::login($user['username'], $user['password'], $login, Tools::encodeString($password . $login), $longlastingsession, array('poche_user' => new User($user))); $this->messages->add('s', _('welcome to your poche')); Tools::logm('login successful'); Tools::redirect($referer);