diff options
author | Andrew Dolgov <[email protected]> | 2017-12-01 22:17:04 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2017-12-01 22:17:04 +0300 |
commit | ecf6baaa1c1856be15016c70cf5bb6165735c8df (patch) | |
tree | 0126d35e044063d3b3a035b7321bec7eec45d1e9 /include/functions.php | |
parent | dd90eefae18d75db703bc3d2ebd21501f12d3213 (diff) |
fix add_feed_category
Diffstat (limited to 'include/functions.php')
-rw-r--r-- | include/functions.php | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/include/functions.php b/include/functions.php index c28460dff..4154d8d5e 100644 --- a/include/functions.php +++ b/include/functions.php @@ -1952,16 +1952,17 @@ if (!$feed_cat) return false; $feed_cat = mb_substr($feed_cat, 0, 250); + if (!$parent_cat_id) $parent_cat_id = null; $pdo = Db::pdo(); $pdo->beginTransaction(); $sth = $pdo->prepare("SELECT id FROM ttrss_feed_categories WHERE (parent_cat = :parent OR (:parent IS NULL AND parent_cat IS NULL)) - AND title = :cat AND owner_uid = :uid"); + AND title = :title AND owner_uid = :uid"); $sth->execute([':parent' => $parent_cat_id, ':title' => $feed_cat, ':uid' => $_SESSION['uid']]); - if ($sth->fetch()) { + if (!$sth->fetch()) { $sth = $pdo->prepare("INSERT INTO ttrss_feed_categories (owner_uid,title,parent_cat) VALUES (?, ?, ?)"); |