]> git.wh0rd.org - tt-rss.git/blobdiff - plugins/vf_shared/init.php
php: remove trailing whitespaces
[tt-rss.git] / plugins / vf_shared / init.php
index 9caf1093e875badcaa0031b267d162244b4e15a4..941d3c8ade24816b0676180f7894360fb17fa922 100644 (file)
@@ -1,6 +1,7 @@
 <?php
 class VF_Shared extends Plugin {
 
+       /* @var PluginHost $host */
        private $host;
 
        function about() {
@@ -24,42 +25,36 @@ 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']]);
 
-               return db_fetch_result($result, 0, "count");
-       }
+               if ($row = $sth->fetch()) {
+                       return $row['count'];
+               }
 
-       //function queryFeedHeadlines($feed, $limit, $view_mode, $cat_view, $search, $search_mode, $override_order = false, $offset = 0, $owner_uid = 0, $filter = false, $since_id = 0, $include_children = false, $ignore_vfeed_group = false, $override_strategy = false, $override_vfeed = false) {
+               return 0;
+       }
 
        /**
         * @SuppressWarnings(PHPMD.UnusedFormalParameter)
         */
        function get_headlines($feed_id, $options) {
-               /*$qfh_ret = queryFeedHeadlines(-4,
-                       $options['limit'],
-                       $this->get_unread(-1) > 0 ? "adaptive" : "all_articles",
-                       false,
-                       $options['search'],
-                       $options['search_mode'],
-                       $options['override_order'],
-                       $options['offset'],
-                       $options['owner_uid'],
-                       $options['filter'],
-                       $options['since_id'],
-                       $options['include_children'],
-                       false,
-                       "uuid != ''",
-                       "ttrss_feeds.title AS feed_title,"); */
-
                $params = array(
                        "feed" => -4,
                        "limit" => $options["limit"],
@@ -74,7 +69,7 @@ class VF_Shared extends Plugin {
                        "override_vfeed" => "ttrss_feeds.title AS feed_title,"
                );
 
-               $qfh_ret = queryFeedHeadlines($params);
+               $qfh_ret = Feeds::queryFeedHeadlines($params);
                $qfh_ret[1] = __("Shared articles");
 
                return $qfh_ret;