summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/db.php2
-rw-r--r--include/functions.php136
2 files changed, 125 insertions, 13 deletions
diff --git a/include/db.php b/include/db.php
index 0682b58f8..7a858ca70 100644
--- a/include/db.php
+++ b/include/db.php
@@ -53,7 +53,7 @@ function db_escape_string($s, $strip_tags = true) {
function db_query($link, $query, $die_on_error = true) {
//if ($_REQUEST["qlog"])
- // error_log($_SESSION["uid"] . ":" . $_REQUEST["op"] . "/" . $_REQUEST["subop"] .
+ // error_log($_SESSION["uid"] . ":" . $_REQUEST["op"] . "/" . $_REQUEST["method"] .
// " $query\n", 3, "/tmp/ttrss-query.log");
if (DB_TYPE == "pgsql") {
diff --git a/include/functions.php b/include/functions.php
index 8f46c295c..89a1d7847 100644
--- a/include/functions.php
+++ b/include/functions.php
@@ -4884,7 +4884,7 @@
}
- function format_headlines_list($link, $feed, $subop, $view_mode, $limit, $cat_view,
+ function format_headlines_list($link, $feed, $method, $view_mode, $limit, $cat_view,
$next_unread_feed, $offset, $vgr_last_feed = false,
$override_order = false) {
@@ -4897,22 +4897,22 @@
$topmost_article_ids = array();
if (!$offset) $offset = 0;
- if ($subop == "undefined") $subop = "";
+ if ($method == "undefined") $method = "";
- $subop_split = explode(":", $subop);
+ $method_split = explode(":", $method);
-/* if ($subop == "CatchupSelected") {
+/* if ($method == "CatchupSelected") {
$ids = explode(",", db_escape_string($_REQUEST["ids"]));
$cmode = sprintf("%d", $_REQUEST["cmode"]);
catchupArticlesById($link, $ids, $cmode);
} */
- if ($subop == "ForceUpdate" && $feed && is_numeric($feed) > 0) {
+ if ($method == "ForceUpdate" && $feed && is_numeric($feed) > 0) {
update_rss_feed($link, $feed, true);
}
- if ($subop == "MarkAllRead") {
+ if ($method == "MarkAllRead") {
catchup_feed($link, $feed, $cat_view);
if (get_pref($link, 'ON_CATCHUP_SHOW_NEXT_FEED')) {
@@ -4922,8 +4922,8 @@
}
}
- if ($subop_split[0] == "MarkAllReadGR") {
- catchup_feed($link, $subop_split[1], false);
+ if ($method_split[0] == "MarkAllReadGR") {
+ catchup_feed($link, $method_split[1], false);
}
// FIXME: might break tag display?
@@ -4973,9 +4973,9 @@
if ($_REQUEST["debug"]) $timing_info = print_checkpoint("H0", $timing_info);
-// error_log("format_headlines_list: [" . $feed . "] subop [" . $subop . "]");
- if( $search_mode == '' && $subop != '' ){
- $search_mode = $subop;
+// error_log("format_headlines_list: [" . $feed . "] method [" . $method . "]");
+ if( $search_mode == '' && $method != '' ){
+ $search_mode = $method;
}
// error_log("search_mode: " . $search_mode);
$qfh_ret = queryFeedHeadlines($link, $feed, $limit, $view_mode, $cat_view,
@@ -5638,7 +5638,7 @@
//$url_path = ($_SERVER['HTTPS'] != "on" ? 'http://' : 'https://') . $_SERVER["HTTP_HOST"] . parse_url($_SERVER["REQUEST_URI"], PHP_URL_PATH);
$url_path = get_self_url_prefix() .
- "/backend.php?op=pref-feeds&quiet=1&subop=add&feed_url=%s";
+ "/backend.php?op=pref-feeds&quiet=1&method=add&feed_url=%s";
return $url_path;
} // function add_feed_url
@@ -7644,4 +7644,116 @@
}
}
+
+ function make_feed_browser($link, $search, $limit, $mode = 1) {
+
+ $owner_uid = $_SESSION["uid"];
+ $rv = '';
+
+ if ($search) {
+ $search_qpart = "AND (UPPER(feed_url) LIKE UPPER('%$search%') OR
+ UPPER(title) LIKE UPPER('%$search%'))";
+ } else {
+ $search_qpart = "";
+ }
+
+ if ($mode == 1) {
+ /* $result = db_query($link, "SELECT feed_url, subscribers FROM
+ ttrss_feedbrowser_cache WHERE (SELECT COUNT(id) = 0 FROM ttrss_feeds AS tf
+ WHERE tf.feed_url = ttrss_feedbrowser_cache.feed_url
+ AND owner_uid = '$owner_uid') $search_qpart
+ ORDER BY subscribers DESC LIMIT $limit"); */
+
+ $result = db_query($link, "SELECT feed_url, site_url, title, SUM(subscribers) AS subscribers FROM
+ (SELECT feed_url, site_url, title, subscribers FROM ttrss_feedbrowser_cache UNION ALL
+ SELECT feed_url, site_url, title, subscribers FROM ttrss_linked_feeds) AS qqq
+ WHERE
+ (SELECT COUNT(id) = 0 FROM ttrss_feeds AS tf
+ WHERE tf.feed_url = qqq.feed_url
+ AND owner_uid = '$owner_uid') $search_qpart
+ GROUP BY feed_url, site_url, title ORDER BY subscribers DESC LIMIT $limit");
+
+ } else if ($mode == 2) {
+ $result = db_query($link, "SELECT *,
+ (SELECT COUNT(*) FROM ttrss_user_entries WHERE
+ orig_feed_id = ttrss_archived_feeds.id) AS articles_archived
+ FROM
+ ttrss_archived_feeds
+ WHERE
+ (SELECT COUNT(*) FROM ttrss_feeds
+ WHERE ttrss_feeds.feed_url = ttrss_archived_feeds.feed_url AND
+ owner_uid = '$owner_uid') = 0 AND
+ owner_uid = '$owner_uid' $search_qpart
+ ORDER BY id DESC LIMIT $limit");
+ }
+
+ $feedctr = 0;
+
+ while ($line = db_fetch_assoc($result)) {
+
+ if ($mode == 1) {
+
+ $feed_url = htmlspecialchars($line["feed_url"]);
+ $site_url = htmlspecialchars($line["site_url"]);
+ $subscribers = $line["subscribers"];
+
+ $check_box = "<input onclick='toggleSelectListRow2(this)'
+ dojoType=\"dijit.form.CheckBox\"
+ type=\"checkbox\" \">";
+
+ $class = ($feedctr % 2) ? "even" : "odd";
+
+ $site_url = "<a target=\"_blank\"
+ href=\"$site_url\">
+ <span class=\"fb_feedTitle\">".
+ htmlspecialchars($line["title"])."</span></a>";
+
+ $feed_url = "<a target=\"_blank\" class=\"fb_feedUrl\"
+ href=\"$feed_url\"><img src='images/feed-icon-12x12.png'
+ style='vertical-align : middle'></a>";
+
+ $rv .= "<li>$check_box $feed_url $site_url".
+ "&nbsp;<span class='subscribers'>($subscribers)</span></li>";
+
+ } else if ($mode == 2) {
+ $feed_url = htmlspecialchars($line["feed_url"]);
+ $site_url = htmlspecialchars($line["site_url"]);
+ $title = htmlspecialchars($line["title"]);
+
+ $check_box = "<input onclick='toggleSelectListRow2(this)' dojoType=\"dijit.form.CheckBox\"
+ type=\"checkbox\">";
+
+ $class = ($feedctr % 2) ? "even" : "odd";
+
+ if ($line['articles_archived'] > 0) {
+ $archived = sprintf(__("%d archived articles"), $line['articles_archived']);
+ $archived = "&nbsp;<span class='subscribers'>($archived)</span>";
+ } else {
+ $archived = '';
+ }
+
+ $site_url = "<a target=\"_blank\"
+ href=\"$site_url\">
+ <span class=\"fb_feedTitle\">".
+ htmlspecialchars($line["title"])."</span></a>";
+
+ $feed_url = "<a target=\"_blank\" class=\"fb_feedUrl\"
+ href=\"$feed_url\"><img src='images/feed-icon-12x12.png'
+ style='vertical-align : middle'></a>";
+
+
+ $rv .= "<li id=\"FBROW-".$line["id"]."\">".
+ "$check_box $feed_url $site_url $archived</li>";
+ }
+
+ ++$feedctr;
+ }
+
+ if ($feedctr == 0) {
+ $rv .= "<li style=\"text-align : center\"><p>".__('No feeds found.')."</p></li>";
+ }
+
+ return $rv;
+
+ }
?>