diff --git a/backend.php b/backend.php
index 14e911449..3f0fad13e 100644
--- a/backend.php
+++ b/backend.php
@@ -1535,10 +1535,20 @@
GROUP BY feed_url ORDER BY subscribers DESC LIMIT 50");
print "
";
+
+ $feedctr = 0;
while ($line = db_fetch_assoc($result)) {
$feed_url = $line["feed_url"];
$subscribers = $line["subscribers"];
+
+ $sub_result = db_query($link, "SELECT id
+ FROM ttrss_feeds WHERE feed_url = '$feed_url' AND owner_uid =" .
+ $_SESSION["uid"]);
+
+ if (db_num_rows($sub_result) > 0) {
+ continue; // already subscribed
+ }
$det_result = db_query($link, "SELECT site_url,title,id
FROM ttrss_feeds WHERE feed_url = '$feed_url' LIMIT 1");
@@ -1560,7 +1570,13 @@
print "- $check_box $feed_icon" .
$details["title"] .
" ($subscribers)
";
- }
+
+ ++$feedctr;
+ }
+
+ if ($feedctr == 0) {
+ print "- No feeds found to subscribe.
";
+ }
print "
";