From: Andrew Dolgov Date: Sun, 3 Dec 2017 07:50:40 +0000 (+0300) Subject: plugins/vf_shared: use PDO X-Git-Tag: 17.12~15 X-Git-Url: https://git.wh0rd.org/?p=tt-rss.git;a=commitdiff_plain;h=2eda9d9be40c783ae16c169c133e72c7196a6639 plugins/vf_shared: use PDO --- diff --git a/plugins/vf_shared/init.php b/plugins/vf_shared/init.php index ce18f92d..a3b0daeb 100644 --- a/plugins/vf_shared/init.php +++ b/plugins/vf_shared/init.php @@ -1,6 +1,7 @@ pdo->prepare("select count(int_id) AS count + from ttrss_user_entries where owner_uid = ? and unread = true and uuid != ''"); + $sth->execute([$_SESSION['uid']]); - return db_fetch_result($result, 0, "count"); + if ($row = $sth->fetch()) { + return $row['count']; + } + + return 0; } /** * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ function get_total($feed_id) { - $result = db_query("select count(int_id) AS count from ttrss_user_entries where owner_uid = ".$_SESSION["uid"]." and uuid != ''"); + $sth = $this->pdo->prepare("select count(int_id) AS count + from ttrss_user_entries where owner_uid = ? and uuid != ''"); + $sth->execute([$_SESSION['uid']]); + + if ($row = $sth->fetch()) { + return $row['count']; + } - return db_fetch_result($result, 0, "count"); + return 0; } /**