From: Andrew Dolgov Date: Sun, 11 Dec 2005 07:42:49 +0000 (+0100) Subject: feed details enabled for several selected feeds X-Git-Tag: schema_freeze_for_1.1.1~63 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=df268d47ec09845c4c0e65b48ff019e3286081bd;p=tt-rss.git feed details enabled for several selected feeds --- diff --git a/backend.php b/backend.php index 9e206c93..4831c201 100644 --- a/backend.php +++ b/backend.php @@ -3302,103 +3302,109 @@ if ($op == "feed-details") { - $feed_id = $_GET["id"]; - - $result = db_query($link, - "SELECT - title,feed_url, - SUBSTRING(last_updated,1,16) as last_updated, - icon_url,site_url, - (SELECT COUNT(int_id) FROM ttrss_user_entries - WHERE feed_id = id) AS total, - (SELECT COUNT(int_id) FROM ttrss_user_entries - WHERE feed_id = id AND unread = true) AS unread, - (SELECT COUNT(int_id) FROM ttrss_user_entries - WHERE feed_id = id AND marked = true) AS marked - FROM ttrss_feeds - WHERE id = '$feed_id' AND owner_uid = ".$_SESSION["uid"]); - - if (db_num_rows($result) == 0) return; - - $title = db_unescape_string(db_fetch_result($result, 0, "title")); - $last_updated = date(get_pref($link, 'LONG_DATE_FORMAT'), - strtotime(db_fetch_result($result, 0, "last_updated"))); - $feed_url = db_fetch_result($result, 0, "feed_url"); - $icon_url = db_fetch_result($result, 0, "icon_url"); - $total = db_fetch_result($result, 0, "total"); - $unread = db_fetch_result($result, 0, "unread"); - $marked = db_fetch_result($result, 0, "marked"); - $site_url = db_fetch_result($result, 0, "site_url"); - - $result = db_query($link, "SELECT COUNT(id) AS subscribed - FROM ttrss_feeds WHERE feed_url = '$feed_url'"); - - $subscribed = db_fetch_result($result, 0, "subscribed"); +// $feed_id = $_GET["id"]; - print "
"; - - $icon_file = ICONS_DIR . "/$feed_id.ico"; - - if (file_exists($icon_file) && filesize($icon_file) > 0) { - $feed_icon = ""; - } else { - $feed_icon = ""; - } - - print "

$feed_icon $title

"; - - print ""; + $feed_ids = split(",", db_escape_string($_GET["id"])); - if ($site_url) { - print " - - "; - } else { - print " - "; - } - print ""; - print ""; - print ""; - print ""; - print ""; - - print "
Link$site_url - (feed)
Feed URL$feed_url
Last updated$last_updated
Total articles$total
Unread articles$unread
Starred articles$marked
Subscribed users$subscribed
"; - - $result = db_query($link, "SELECT title, - SUBSTRING(updated,1,16) AS updated,unread - FROM ttrss_entries,ttrss_user_entries - WHERE ref_id = id AND feed_id = '$feed_id' - ORDER BY date_entered DESC LIMIT 5"); - - if (db_num_rows($result) > 0) { + print "
"; - print "

Latest headlines

"; + foreach ($feed_ids as $feed_id) { - print "
    "; + $result = db_query($link, + "SELECT + title,feed_url, + SUBSTRING(last_updated,1,16) as last_updated, + icon_url,site_url, + (SELECT COUNT(int_id) FROM ttrss_user_entries + WHERE feed_id = id) AS total, + (SELECT COUNT(int_id) FROM ttrss_user_entries + WHERE feed_id = id AND unread = true) AS unread, + (SELECT COUNT(int_id) FROM ttrss_user_entries + WHERE feed_id = id AND marked = true) AS marked + FROM ttrss_feeds + WHERE id = '$feed_id' AND owner_uid = ".$_SESSION["uid"]); + + if (db_num_rows($result) == 0) return; + + $title = db_unescape_string(db_fetch_result($result, 0, "title")); + $last_updated = date(get_pref($link, 'LONG_DATE_FORMAT'), + strtotime(db_fetch_result($result, 0, "last_updated"))); + $feed_url = db_fetch_result($result, 0, "feed_url"); + $icon_url = db_fetch_result($result, 0, "icon_url"); + $total = db_fetch_result($result, 0, "total"); + $unread = db_fetch_result($result, 0, "unread"); + $marked = db_fetch_result($result, 0, "marked"); + $site_url = db_fetch_result($result, 0, "site_url"); - while ($line = db_fetch_assoc($result)) { - if ($line["unread"] == "t" || $line["unread"] == "1") { - $line["title"] = "" . $line["title"] . ""; - } - print "
  • " . $line["title"]. - " (" . - date(get_pref($link, 'SHORT_DATE_FORMAT'), - strtotime($line["updated"])). - ")
  • "; + $result = db_query($link, "SELECT COUNT(id) AS subscribed + FROM ttrss_feeds WHERE feed_url = '$feed_url'"); + + $subscribed = db_fetch_result($result, 0, "subscribed"); + + $icon_file = ICONS_DIR . "/$feed_id.ico"; + + if (file_exists($icon_file) && filesize($icon_file) > 0) { + $feed_icon = ""; + } else { + $feed_icon = ""; } - print "
"; + print "

$feed_icon $title

"; - print "
"; + print ""; - print "
-
"; + if ($site_url) { + print " + + "; + } else { + print " + "; + } + print ""; + print ""; + print ""; + print ""; + print ""; + + print "
Link$site_url + (feed)
Feed URL$feed_url
Last updated$last_updated
Total articles$total
Unread articles$unread
Starred articles$marked
Subscribed users$subscribed
"; + +/* $result = db_query($link, "SELECT title, + SUBSTRING(updated,1,16) AS updated,unread + FROM ttrss_entries,ttrss_user_entries + WHERE ref_id = id AND feed_id = '$feed_id' + ORDER BY date_entered DESC LIMIT 5"); + + if (db_num_rows($result) > 0) { + + print "

Latest headlines

"; + + print ""; + + } */ } - } + + print "
"; + + print "
+
"; + } db_close($link); ?> diff --git a/prefs.js b/prefs.js index b2c15a23..244a2886 100644 --- a/prefs.js +++ b/prefs.js @@ -1000,16 +1000,17 @@ function selectedFeedDetails() { return; } - if (rows.length > 1) { - notify("Please select one feed."); - return; - } +// if (rows.length > 1) { +// notify("Please select one feed."); +// return; +// } - var id = rows[0]; +// var id = rows[0]; notify(""); - xmlhttp.open("GET", "backend.php?op=feed-details&id=" + id, true); + xmlhttp.open("GET", "backend.php?op=feed-details&id=" + + param_escape(rows.toString()), true); xmlhttp.onreadystatechange=infobox_callback; xmlhttp.send(null);