]>
git.wh0rd.org - tt-rss.git/blob - modules/pref-feed-browser.php
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 set_pref($link, "_PREFS_ACTIVE_TAB", "feedBrowser");
77 print "<div>".__('This panel shows feeds subscribed by other users of this system, just in case you are interested in them too.')."</div>";
79 $limit = db_escape_string($_GET["limit"]);
81 if (!$limit) $limit = 25;
83 $owner_uid = $_SESSION["uid"];
85 $result = db_query($link, "SELECT feed_url,COUNT(id) AS subscribers
86 FROM ttrss_feeds WHERE (SELECT COUNT(id) = 0 FROM ttrss_feeds AS tf
87 WHERE tf.feed_url = ttrss_feeds.feed_url
88 AND owner_uid = '$owner_uid') GROUP BY feed_url
89 ORDER BY subscribers DESC LIMIT $limit");
92 print "<div style=\"float : right\">
93 ".__('Top')." <select id=\"feedBrowserLimit\">";
95 foreach (array(25, 50, 100) as $l) {
96 $issel = ($l == $limit) ?
"selected" : "";
97 print "<option $issel>$l</option>";
101 <input type=\"submit\" class=\"button\"
102 onclick=\"updateBigFeedBrowser()\" value=\"".__('Show')."\">
105 print "<p id=\"fbrOpToolbar\">
106 <input type='submit' class='button' onclick=\"feedBrowserSubscribe()\"
107 disabled=\"true\" value=\"".__('Subscribe')."\">";
109 print "<ul class='nomarks' id='browseBigFeedList'>";
113 while ($line = db_fetch_assoc($result)) {
114 $feed_url = $line["feed_url"];
115 $subscribers = $line["subscribers"];
117 $det_result = db_query($link, "SELECT site_url,title,id
118 FROM ttrss_feeds WHERE feed_url = '$feed_url' LIMIT 1");
120 $details = db_fetch_assoc($det_result);
122 $icon_file = ICONS_DIR
. "/" . $details["id"] . ".ico";
124 if (file_exists($icon_file) && filesize($icon_file) > 0) {
125 $feed_icon = "<img class=\"tinyFeedIcon\" src=\"" . ICONS_URL
.
126 "/".$details["id"].".ico\">";
128 $feed_icon = "<img class=\"tinyFeedIcon\" src=\"images/blank_icon.gif\">";
131 $check_box = "<input onclick='toggleSelectFBListRow(this)' class='feedBrowseCB'
132 type=\"checkbox\" id=\"FBCHK-" . $details["id"] . "\">";
134 $class = ($feedctr %
2) ?
"even" : "odd";
136 print "<li class='$class' id=\"FBROW-".$details["id"]."\">$check_box".
139 print "<a href=\"javascript:browserToggleExpand('".$details["id"]."')\">" .
140 $details["title"] ."</a> " .
141 "<span class='subscribers'>($subscribers)</span>";
143 print "<div class=\"browserDetails\" id=\"BRDET-" . $details["id"] . "\">";
152 print "<li>".__('No feeds found to subscribe.')."</li>";