summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2017-12-03 10:50:40 +0300
committerAndrew Dolgov <[email protected]>2017-12-03 10:50:40 +0300
commit2eda9d9be40c783ae16c169c133e72c7196a6639 (patch)
tree1a923805ab76af136f020d769488bf77f6e233fc /plugins
parentd8a924d9307926f16d68c4e52862039ef5d34876 (diff)
plugins/vf_shared: use PDO
Diffstat (limited to 'plugins')
-rw-r--r--plugins/vf_shared/init.php21
1 files changed, 17 insertions, 4 deletions
diff --git a/plugins/vf_shared/init.php b/plugins/vf_shared/init.php
index ce18f92d5..a3b0daeb6 100644
--- a/plugins/vf_shared/init.php
+++ b/plugins/vf_shared/init.php
@@ -1,6 +1,7 @@
<?php
class VF_Shared extends Plugin {
+ /* @var PluginHost $host */
private $host;
function about() {
@@ -24,18 +25,30 @@ class VF_Shared extends Plugin {
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
function get_unread($feed_id) {
- $result = db_query("select count(int_id) AS count from ttrss_user_entries where owner_uid = ".$_SESSION["uid"]." and unread = true and uuid != ''");
+ $sth = $this->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;
}
/**