summaryrefslogtreecommitdiff
path: root/classes/article.php
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2020-12-08 13:55:11 +0300
committerAndrew Dolgov <[email protected]>2020-12-08 13:55:11 +0300
commit7608f3d7b0c1185cc6b756a22dc5ab5540a0c7b2 (patch)
tree7085c88bfdf23b0d7629d70a683bb9329741e324 /classes/article.php
parent2edfcbbd85ab4109cd7d80766577584af973c9e9 (diff)
parent85b788709a9f7a93645f7aab1675b99d57874d0b (diff)
Merge branch 'master' of git.fakecake.org:tt-rss
Diffstat (limited to 'classes/article.php')
-rwxr-xr-xclasses/article.php21
1 files changed, 13 insertions, 8 deletions
diff --git a/classes/article.php b/classes/article.php
index b600adff2..f6a4462d6 100755
--- a/classes/article.php
+++ b/classes/article.php
@@ -179,7 +179,7 @@ class Article extends Handler_Protected {
print "<footer>";
print "<button dojoType='dijit.form.Button'
- type='submit' class='alt-primary' onclick=\"dijit.byId('editTagsDlg').execute()\">".__('Save')."</button> ";
+ type='submit' class='alt-primary'>".__('Save')."</button> ";
print "<button dojoType='dijit.form.Button'
onclick=\"dijit.byId('editTagsDlg').hide()\">".__('Cancel')."</button>";
print "</footer>";
@@ -232,19 +232,24 @@ class Article extends Handler_Protected {
$int_id = $row['int_id'];
- $sth = $this->pdo->prepare("DELETE FROM ttrss_tags WHERE
+ $dsth = $this->pdo->prepare("DELETE FROM ttrss_tags WHERE
post_int_id = ? AND owner_uid = ?");
- $sth->execute([$int_id, $_SESSION['uid']]);
+ $dsth->execute([$int_id, $_SESSION['uid']]);
+
+ $csth = $this->pdo->prepare("SELECT post_int_id FROM ttrss_tags
+ WHERE post_int_id = ? AND owner_uid = ? AND tag_name = ?");
+
+ $usth = $this->pdo->prepare("INSERT INTO ttrss_tags
+ (post_int_id, owner_uid, tag_name)
+ VALUES (?, ?, ?)");
$tags = FeedItem_Common::normalize_categories($tags);
foreach ($tags as $tag) {
- if ($tag != '') {
- $sth = $this->pdo->prepare("INSERT INTO ttrss_tags
- (post_int_id, owner_uid, tag_name)
- VALUES (?, ?, ?)");
+ $csth->execute([$int_id, $_SESSION['uid'], $tag]);
- $sth->execute([$int_id, $_SESSION['uid'], $tag]);
+ if (!$csth->fetch()) {
+ $usth->execute([$int_id, $_SESSION['uid'], $tag]);
}
array_push($tags_to_cache, $tag);