mirror of
https://git.tt-rss.org/git/tt-rss.git
synced 2025-12-13 07:25:54 +00:00
remove feedbrowser (other feeds)
This commit is contained in:
@@ -6,7 +6,7 @@ class Feeds extends Handler_Protected {
|
||||
private $params;
|
||||
|
||||
function csrf_ignore($method) {
|
||||
$csrf_ignored = array("index", "feedbrowser", "quickaddfeed", "search");
|
||||
$csrf_ignored = array("index", "quickaddfeed", "search");
|
||||
|
||||
return array_search($method, $csrf_ignored) !== false;
|
||||
}
|
||||
@@ -707,65 +707,12 @@ class Feeds extends Handler_Protected {
|
||||
print "<button dojoType='dijit.form.Button' class='alt-primary' type='submit'
|
||||
onclick=\"return dijit.byId('feedAddDlg').execute()\">".__('Subscribe')."</button>";
|
||||
|
||||
if (!(defined('_DISABLE_FEED_BROWSER') && _DISABLE_FEED_BROWSER)) {
|
||||
print "<button dojoType='dijit.form.Button' onclick=\"return CommonDialogs.feedBrowser()\">".__('More feeds')."</button>";
|
||||
}
|
||||
|
||||
print "<button dojoType='dijit.form.Button' onclick=\"return dijit.byId('feedAddDlg').hide()\">".__('Cancel')."</button>";
|
||||
print "</footer>";
|
||||
|
||||
print "</form>";
|
||||
}
|
||||
|
||||
function feedBrowser() {
|
||||
if (defined('_DISABLE_FEED_BROWSER') && _DISABLE_FEED_BROWSER) return;
|
||||
|
||||
$browser_search = $_REQUEST["search"];
|
||||
|
||||
print_hidden("op", "rpc");
|
||||
print_hidden("method", "updateFeedBrowser");
|
||||
|
||||
print "<div dojoType=\"dijit.Toolbar\">
|
||||
<div style='float : right'>
|
||||
<img style='display : none'
|
||||
id='feed_browser_spinner' src='images/indicator_white.gif'>
|
||||
<input name='search' dojoType='dijit.form.TextBox' size='20' type='search'
|
||||
onchange=\"dijit.byId('feedBrowserDlg').update()\" value=\"$browser_search\">
|
||||
<button dojoType='dijit.form.Button' onclick=\"dijit.byId('feedBrowserDlg').update()\">".__('Search')."</button>
|
||||
</div>";
|
||||
|
||||
print " <select name='mode' dojoType='dijit.form.Select' onchange=\"dijit.byId('feedBrowserDlg').update()\">
|
||||
<option value='1'>" . __('Popular feeds') . "</option>
|
||||
<option value='2'>" . __('Feed archive') . "</option>
|
||||
</select> ";
|
||||
|
||||
print __("limit:");
|
||||
|
||||
print " <select dojoType='dijit.form.Select' name='limit' onchange=\"dijit.byId('feedBrowserDlg').update()\">";
|
||||
|
||||
foreach (array(25, 50, 100, 200) as $l) {
|
||||
//$issel = ($l == $limit) ? "selected=\"1\"" : "";
|
||||
print "<option value=\"$l\">$l</option>";
|
||||
}
|
||||
|
||||
print "</select> ";
|
||||
|
||||
print "</div>";
|
||||
|
||||
require_once "feedbrowser.php";
|
||||
|
||||
print "<ul class='browseFeedList' id='browseFeedList'>";
|
||||
print make_feed_browser("", 25);
|
||||
print "</ul>";
|
||||
|
||||
print "<footer class='text-center'>
|
||||
<button dojoType='dijit.form.Button' type='submit' class='alt-primary' onclick=\"dijit.byId('feedBrowserDlg').execute()\">".__('Subscribe')."</button>
|
||||
<button dojoType='dijit.form.Button' style='display : none' id='feed_archive_remove' onclick=\"dijit.byId('feedBrowserDlg').removeFromArchive()\">".__('Remove')."</button>
|
||||
<button dojoType='dijit.form.Button' onclick=\"dijit.byId('feedBrowserDlg').hide()\" >".__('Cancel')."</button>
|
||||
</footer>";
|
||||
|
||||
}
|
||||
|
||||
function search() {
|
||||
$this->params = explode(":", $_REQUEST["param"], 2);
|
||||
|
||||
|
||||
@@ -347,20 +347,6 @@ class RPC extends Handler_Protected {
|
||||
print "</ul>";
|
||||
}
|
||||
|
||||
function updateFeedBrowser() {
|
||||
if (defined('_DISABLE_FEED_BROWSER') && _DISABLE_FEED_BROWSER) return;
|
||||
|
||||
$search = clean($_REQUEST["search"]);
|
||||
$limit = clean($_REQUEST["limit"]);
|
||||
$mode = (int) clean($_REQUEST["mode"]);
|
||||
|
||||
require_once "feedbrowser.php";
|
||||
|
||||
print json_encode(array("content" =>
|
||||
make_feed_browser($search, $limit, $mode),
|
||||
"mode" => $mode));
|
||||
}
|
||||
|
||||
// Silent
|
||||
function massSubscribe() {
|
||||
|
||||
|
||||
@@ -19,53 +19,6 @@ class RSSUtils {
|
||||
return preg_replace('/[\x{10000}-\x{10FFFF}]/u', "\xEF\xBF\xBD", $str);
|
||||
}
|
||||
|
||||
static function update_feedbrowser_cache() {
|
||||
|
||||
$pdo = Db::pdo();
|
||||
|
||||
$sth = $pdo->query("SELECT feed_url, site_url, title, COUNT(id) AS subscribers
|
||||
FROM ttrss_feeds WHERE feed_url NOT IN (SELECT feed_url FROM ttrss_feeds
|
||||
WHERE private IS true OR auth_login != '' OR auth_pass != '' OR feed_url LIKE '%:%@%/%')
|
||||
GROUP BY feed_url, site_url, title ORDER BY subscribers DESC LIMIT 1000");
|
||||
|
||||
$pdo->beginTransaction();
|
||||
|
||||
$pdo->query("DELETE FROM ttrss_feedbrowser_cache");
|
||||
|
||||
$count = 0;
|
||||
|
||||
while ($line = $sth->fetch()) {
|
||||
|
||||
$subscribers = $line["subscribers"];
|
||||
$feed_url = $line["feed_url"];
|
||||
$title = $line["title"];
|
||||
$site_url = $line["site_url"];
|
||||
|
||||
$tmph = $pdo->prepare("SELECT subscribers FROM
|
||||
ttrss_feedbrowser_cache WHERE feed_url = ?");
|
||||
$tmph->execute([$feed_url]);
|
||||
|
||||
if (!$tmph->fetch()) {
|
||||
|
||||
$tmph = $pdo->prepare("INSERT INTO ttrss_feedbrowser_cache
|
||||
(feed_url, site_url, title, subscribers)
|
||||
VALUES
|
||||
(?, ?, ?, ?)");
|
||||
|
||||
$tmph->execute([$feed_url, $site_url, $title, $subscribers]);
|
||||
|
||||
++$count;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$pdo->commit();
|
||||
|
||||
return $count;
|
||||
|
||||
}
|
||||
|
||||
static function update_daemon_common($limit = DAEMON_FEED_LIMIT) {
|
||||
$schema_version = get_schema_version();
|
||||
|
||||
@@ -1542,9 +1495,6 @@ class RSSUtils {
|
||||
RSSUtils::expire_error_log();
|
||||
RSSUtils::expire_feed_archive();
|
||||
|
||||
$count = RSSUtils::update_feedbrowser_cache();
|
||||
Debug::log("Feedbrowser updated, $count feeds processed.");
|
||||
|
||||
Article::purge_orphans();
|
||||
RSSUtils::cleanup_counters_cache();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user