From a6a61a8cb14a17a4767c4564b531d9a6595b9124 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Thu, 11 Jul 2013 13:48:39 +0400 Subject: [PATCH] add plugin to show all shared articles --- include/functions.php | 21 +++++++++++-- plugins/vf_shared/init.php | 60 ++++++++++++++++++++++++++++++++++++ plugins/vf_shared/share.png | Bin 0 -> 343 bytes 3 files changed, 79 insertions(+), 2 deletions(-) create mode 100644 plugins/vf_shared/init.php create mode 100644 plugins/vf_shared/share.png diff --git a/include/functions.php b/include/functions.php index 8a8f7b5d..35edd8d1 100644 --- a/include/functions.php +++ b/include/functions.php @@ -1501,7 +1501,11 @@ foreach ($feeds as $feed) { $cv = array("id" => PluginHost::pfeed_to_feed_id($feed['id']), "counter" => $feed['sender']->get_unread($feed['id'])); - array_push($ret_arr, $cv); + + if (method_exists($feed['sender'], 'get_total')) + $cv["auxcounter"] = $feed['sender']->get_total($feed['id']); + + array_push($ret_arr, $cv); } } @@ -2313,7 +2317,7 @@ return $rv; } - 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) { + 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) { if (!$owner_uid) $owner_uid = $_SESSION["uid"]; @@ -2515,6 +2519,11 @@ $allow_archived = true; if (!$override_order) $override_order = "last_read DESC"; + +/* } else if ($feed == -7) { // shared + $query_strategy_part = "uuid != ''"; + $vfeed_query_part = "ttrss_feeds.title AS feed_title,"; + $allow_archived = true; */ } else if ($feed == -3) { // fresh virtual feed $query_strategy_part = "unread = true AND score >= 0"; @@ -2556,6 +2565,14 @@ $order_by = $override_order; } + if ($override_strategy) { + $query_strategy_part = $override_strategy; + } + + if ($override_vfeed) { + $vfeed_query_part = $override_vfeed; + } + $feed_title = ""; if ($search) { diff --git a/plugins/vf_shared/init.php b/plugins/vf_shared/init.php new file mode 100644 index 00000000..00d288c0 --- /dev/null +++ b/plugins/vf_shared/init.php @@ -0,0 +1,60 @@ +host = $host; + + $host->add_feed(-1, __("Shared articles"), 'plugins/vf_shared/share.png', $this); + } + + function api_version() { + return 2; + } + + 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 != ''"); + + return db_fetch_result($result, 0, "count"); + } + + 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 != ''"); + + return db_fetch_result($result, 0, "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) { + + function get_headlines($feed_id, $options) { + $qfh_ret = queryFeedHeadlines(-4, + $options['limit'], + $this->get_unread() > 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,"); + + $qfh_ret[1] = __("Shared articles"); + + return $qfh_ret; + } + +} +?> diff --git a/plugins/vf_shared/share.png b/plugins/vf_shared/share.png new file mode 100644 index 0000000000000000000000000000000000000000..25eacb7c2524142262d68bf729c5e2b61adfd6d4 GIT binary patch literal 343 zcmV-d0jU0oP)$`dXYaZs9=SbAto%g@>T~?_bH&lTUn@`uo|1bXE{eSR(AO)ESb=V4`uk}mK|39Px&03WLbv~pzk+s7D@lK^ zn+aB+sp)&Y_x-B3>;6ywU--WQNUr<8>TU0P-|L#1U&;A)67w(+> pDf@fM7q9#F25QXo3rUI;002ro52U44e~JJA002ovPDHLkV1l;_q@Mr) literal 0 HcmV?d00001 -- 2.39.5