From: Andrew Dolgov Date: Tue, 20 Jan 2009 09:43:45 +0000 (+0100) Subject: feed browser: search X-Git-Tag: 1.3.0~35 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=76e9a473d1d2152ef8a3b1ebe905f6f36a73c887;p=tt-rss.git feed browser: search --- diff --git a/modules/pref-feed-browser.php b/modules/pref-feed-browser.php index 91df4264..b73516ef 100644 --- a/modules/pref-feed-browser.php +++ b/modules/pref-feed-browser.php @@ -84,6 +84,14 @@ $limit = db_escape_string($_GET["limit"]); + $browser_search = db_escape_string($_GET["search"]); + + if (array_key_exists("search", $_GET)) { + $_SESSION["prefs_browser_search"] = $browser_search; + } else { + $browser_search = $_SESSION["prefs_browser_search"]; + } + if (!$limit) $limit = 25; $owner_uid = $_SESSION["uid"]; @@ -108,12 +116,36 @@ print "
".__('This panel shows feeds subscribed by other users of this system, just in case you are interested in them too.')."
"; - - $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') ORDER BY subscribers DESC LIMIT $limit"); - + print "

+ + +

"; + + if ($browser_search) { + $search_qpart = " AND ( + UPPER(ttrss_feedbrowser_cache.feed_url) LIKE UPPER('%$browser_search%') OR + UPPER(title) LIKE UPPER('%$browser_search%'))"; + } else { + $search_qpart = ""; + } + + $result = db_query($link, "SELECT ttrss_feedbrowser_cache.feed_url, + subscribers, + title + FROM + ttrss_feedbrowser_cache LEFT JOIN ttrss_feeds + ON (ttrss_feedbrowser_cache.feed_url = ttrss_feeds.feed_url) + 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"); + print "
"; print "
diff --git a/prefs.js b/prefs.js index dc2fda13..cc3733a6 100644 --- a/prefs.js +++ b/prefs.js @@ -1515,6 +1515,12 @@ function updateBigFeedBrowser(limit, from_button) { query = query + "&limit=" + param_escape(limit); } + var search = document.getElementById("feed_browser_search"); + + if (search) { + query = query + "&search=" + param_escape(search.value); + } + xmlhttp.open("GET", query, true); xmlhttp.onreadystatechange=feed_browser_callback; xmlhttp.send(null);