]>
git.wh0rd.org - tt-rss.git/blob - modules/pref-feed-browser.php
725389362130aa0e38c2b4ecbc7c77781b6338d6
2 function module_pref_feed_browser($link) {
4 if (!ENABLE_FEED_BROWSER
) {
5 print "Feed browser is administratively disabled.";
9 $subop = $_REQUEST["subop"];
11 if ($subop == "details") {
12 $id = db_escape_string($_GET["id"]);
14 print "<div class=\"browserFeedInfo\">";
15 print "<b>Feed information:</b>";
16 print "<div class=\"detailsPart\">";
18 $result = db_query($link, "SELECT
20 SUBSTRING(last_updated,1,19) AS last_updated
21 FROM ttrss_feeds WHERE id = '$id'");
23 $feed_url = db_fetch_result($result, 0, "feed_url");
24 $site_url = db_fetch_result($result, 0, "site_url");
25 $last_updated = db_fetch_result($result, 0, "last_updated");
27 if (get_pref($link, 'HEADLINES_SMART_DATE')) {
28 $last_updated = smart_date_time(strtotime($last_updated));
30 $short_date = get_pref($link, 'SHORT_DATE_FORMAT');
31 $last_updated = date($short_date, strtotime($last_updated));
34 print "Site: <a target=\"_new\" href='$site_url'>$site_url</a> ".
35 "(<a target=\"_new\" href='$feed_url'>feed</a>), ".
36 "Last updated: $last_updated";
40 $result = db_query($link, "SELECT
43 substring(date_entered,1,19) as date_entered,
44 substring(updated,1,19) as updated
45 FROM ttrss_entries,ttrss_user_entries
46 WHERE ttrss_entries.id = ref_id AND feed_id = '$id'
47 ORDER BY updated DESC LIMIT 5");
49 if (db_num_rows($result) > 0) {
51 print "<b>Last headlines:</b><br>";
53 print "<div class=\"detailsPart\">";
54 print "<ul class=\"compact\">";
55 while ($line = db_fetch_assoc($result)) {
57 if (get_pref($link, 'HEADLINES_SMART_DATE')) {
58 $entry_dt = smart_date_time(strtotime($line["updated"]));
60 $short_date = get_pref($link, 'SHORT_DATE_FORMAT');
61 $entry_dt = date($short_date, strtotime($line["updated"]));
64 print "<li><a target=\"_new\" href=\"" . $line["link"] . "\">" . $line["title"] . "</a>" .
65 " <span class=\"insensitive\">($entry_dt)</span></li>";
75 print "<div>".__('This panel shows feeds subscribed by other users of this system, just in case you are interested in them too.')."</div>";
77 $limit = db_escape_string($_GET["limit"]);
79 if (!$limit) $limit = 25;
81 $owner_uid = $_SESSION["uid"];
83 $result = db_query($link, "SELECT feed_url,COUNT(id) AS subscribers
84 FROM ttrss_feeds WHERE (SELECT COUNT(id) = 0 FROM ttrss_feeds AS tf
85 WHERE tf.feed_url = ttrss_feeds.feed_url
86 AND owner_uid = '$owner_uid') GROUP BY feed_url
87 ORDER BY subscribers DESC LIMIT $limit");
90 print "<div style=\"float : right\">
91 ".__('Top')." <select id=\"feedBrowserLimit\">";
93 foreach (array(25, 50, 100) as $l) {
94 $issel = ($l == $limit) ?
"selected" : "";
95 print "<option $issel>$l</option>";
99 <input type=\"submit\" class=\"button\"
100 onclick=\"updateBigFeedBrowser()\" value=\"".__('Show')."\">
103 print "<p id=\"fbrOpToolbar\">
104 <input type='submit' class='button' onclick=\"feedBrowserSubscribe()\"
105 disabled=\"true\" value=\"".__('Subscribe')."\">";
107 print "<ul class='nomarks' id='browseBigFeedList'>";
111 while ($line = db_fetch_assoc($result)) {
112 $feed_url = $line["feed_url"];
113 $subscribers = $line["subscribers"];
115 $det_result = db_query($link, "SELECT site_url,title,id
116 FROM ttrss_feeds WHERE feed_url = '$feed_url' LIMIT 1");
118 $details = db_fetch_assoc($det_result);
120 $icon_file = ICONS_DIR
. "/" . $details["id"] . ".ico";
122 if (file_exists($icon_file) && filesize($icon_file) > 0) {
123 $feed_icon = "<img class=\"tinyFeedIcon\" src=\"" . ICONS_URL
.
124 "/".$details["id"].".ico\">";
126 $feed_icon = "<img class=\"tinyFeedIcon\" src=\"images/blank_icon.gif\">";
129 $check_box = "<input onclick='toggleSelectFBListRow(this)' class='feedBrowseCB'
130 type=\"checkbox\" id=\"FBCHK-" . $details["id"] . "\">";
132 $class = ($feedctr %
2) ?
"even" : "odd";
134 print "<li class='$class' id=\"FBROW-".$details["id"]."\">$check_box".
137 print "<a href=\"javascript:browserToggleExpand('".$details["id"]."')\">" .
138 $details["title"] ."</a> " .
139 "<span class='subscribers'>($subscribers)</span>";
141 print "<div class=\"browserDetails\" id=\"BRDET-" . $details["id"] . "\">";
150 print "<li>No feeds found to subscribe.</li>";