diff options
author | Andrew Dolgov <[email protected]> | 2005-12-30 06:17:23 +0100 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2005-12-30 06:17:23 +0100 |
commit | c6232e43333ff070cc16d3346369a1712966f68f (patch) | |
tree | 89fddac678107b82cc081f3b4039d922e81c2619 /backend.php | |
parent | 88d9259a4e9ddda474f448df66f73ef8a1dc4a7d (diff) |
initial work on big feed browser
Diffstat (limited to 'backend.php')
-rw-r--r-- | backend.php | 84 |
1 files changed, 83 insertions, 1 deletions
diff --git a/backend.php b/backend.php index 20b2740b1..e9783902d 100644 --- a/backend.php +++ b/backend.php @@ -2015,7 +2015,7 @@ <input type=\"submit\" class=\"button\" onclick=\"javascript:addFeed()\" value=\"Add feed\"> - (<a href='javascript:browseFeeds()'>Browse feeds</a>) + (<a href='javascript:browseFeeds()'>Top 50</a>) </td><td align='right'> <input id=\"feed_search\" size=\"20\" onchange=\"javascript:updateFeedList()\" @@ -3928,6 +3928,88 @@ onclick=\"closeInfoBox()\" value=\"Close this window\"></div>"; } + if ($op == "pref-feed-browser") { + + $subop = $_REQUEST["subop"]; + + if ($subop == "details") { + $id = db_escape_string($_GET["id"]); + print "-- nasty details about feed $id --"; + return; + } + + print "<div class=\"warning\">Under construction</div>"; + + print "<h1>Feed browser</h1>"; + + $result = db_query($link, "SELECT feed_url,count(id) AS subscribers + FROM ttrss_feeds + WHERE auth_login = '' AND auth_pass = '' AND private = false + GROUP BY feed_url ORDER BY subscribers DESC LIMIT 50"); + + print "<ul class='nomarks' id='browseFeedList'>"; + + $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"); + + $details = db_fetch_assoc($det_result); + + $icon_file = ICONS_DIR . "/" . $details["id"] . ".ico"; + + if (file_exists($icon_file) && filesize($icon_file) > 0) { + $feed_icon = "<img class=\"tinyFeedIcon\" src=\"" . ICONS_URL . + "/".$details["id"].".ico\">"; + } else { + $feed_icon = "<img class=\"tinyFeedIcon\" src=\"images/blank_icon.gif\">"; + } + + $check_box = "<input onclick='toggleSelectListRow(this)' class='feedBrowseCB' + type=\"checkbox\" id=\"FBCHK-" . $details["id"] . "\">"; + + $class = ($feedctr % 2) ? "even" : "odd"; + + print "<li class='$class' id=\"FBROW-".$details["id"]."\">$check_box". + "$feed_icon "; + + print "<a href=\"javascript:browserExpand('".$details["id"]."')\">" . + $details["title"] ."</a> " . + "<span class='subscribers'>($subscribers)</span>"; + + print "<div class=\"browserDetails\" id=\"BRDET-" . $details["id"] . "\">"; + print "</div>"; + + print "</li>"; + + ++$feedctr; + } + + if ($feedctr == 0) { + print "<li>No feeds found to subscribe.</li>"; + } + + print "</ul>"; + + print "<input type='submit' class='button' onclick=\"feedBrowserSubscribe()\" + value=\"Subscribe\">"; + + print "</div>"; + + } + db_close($link); ?> |