summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2017-12-02 01:08:30 +0300
committerAndrew Dolgov <[email protected]>2017-12-02 01:08:30 +0300
commitc949a9282e1102e82cca5bb158e84f742e8f1456 (patch)
tree2f9ad4bd1cd8ed3c365aa3e2b449a9fec036ca62 /include
parent4102eb843ff11a4aae0cc890cf700b7e3b4e72e2 (diff)
OPML: use PDO; minor fixes
Diffstat (limited to 'include')
-rw-r--r--include/functions.php11
1 files changed, 9 insertions, 2 deletions
diff --git a/include/functions.php b/include/functions.php
index f09d72cd0..31a0300d7 100644
--- a/include/functions.php
+++ b/include/functions.php
@@ -1823,6 +1823,7 @@
function load_filters($feed_id, $owner_uid) {
$filters = array();
+ $feed_id = (int) $feed_id;
$cat_id = (int)Feeds::getFeedCategory($feed_id);
if ($cat_id == 0)
@@ -1960,7 +1961,13 @@
if (!$parent_cat_id) $parent_cat_id = null;
$pdo = Db::pdo();
- $pdo->beginTransaction();
+ $tr_in_progress = false;
+
+ try {
+ $pdo->beginTransaction();
+ } catch (Exception $e) {
+ $tr_in_progress = true;
+ }
$sth = $pdo->prepare("SELECT id FROM ttrss_feed_categories
WHERE (parent_cat = :parent OR (:parent IS NULL AND parent_cat IS NULL))
@@ -1973,7 +1980,7 @@
VALUES (?, ?, ?)");
$sth->execute([$_SESSION['uid'], $feed_cat, $parent_cat_id]);
- $pdo->commit();
+ if (!$tr_in_progress) $pdo->commit();
return true;
}