From 6b006a18e7efef814fa7a59102c85299acb0a0a4 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Mon, 15 Feb 2021 15:21:25 +0300 Subject: subscribe to feed: use client dialog --- classes/feeds.php | 95 +++++++++----------------------------------------- classes/pref/feeds.php | 2 +- classes/rpc.php | 12 ------- 3 files changed, 17 insertions(+), 92 deletions(-) (limited to 'classes') diff --git a/classes/feeds.php b/classes/feeds.php index d49fe7698..4cc76bd62 100755 --- a/classes/feeds.php +++ b/classes/feeds.php @@ -581,85 +581,10 @@ class Feeds extends Handler_Protected { return $reply; } - function quickAddFeed() { - print "
"; - - print_hidden("op", "rpc"); - print_hidden("method", "addfeed"); - - print ""; - - print ""; - - print "
"; - - print "
"; - print "
"; - print ""; - - print "
"; - - print "
"; - - if (get_pref('ENABLE_FEED_CATS')) { - print " "; - print_feed_cat_select("cat", false, 'dojoType="fox.form.Select"'); - } - - print "
"; - - print "
"; - - print ''; - - print ""; - - print "
"; - print "
"; - - print "
"; - print ""; - - print ""; - print "
"; - - print "
"; + function subscribeToFeed() { + print json_encode([ + "cat_select" => format_feed_cat_select("cat", false, 'dojoType="fox.form.Select"') + ]); } function search() { @@ -1077,6 +1002,18 @@ class Feeds extends Handler_Protected { } } + function add() { + $feed = clean($_REQUEST['feed']); + $cat = clean($_REQUEST['cat']); + $need_auth = isset($_REQUEST['need_auth']); + $login = $need_auth ? clean($_REQUEST['login']) : ''; + $pass = $need_auth ? clean($_REQUEST['pass']) : ''; + + $rc = Feeds::subscribe_to_feed($feed, $cat, $login, $pass); + + print json_encode(array("result" => $rc)); + } + /** * @return array (code => Status code, message => error message if available) * diff --git a/classes/pref/feeds.php b/classes/pref/feeds.php index e225949f2..af3877159 100755 --- a/classes/pref/feeds.php +++ b/classes/pref/feeds.php @@ -1241,7 +1241,7 @@ class Pref_Feeds extends Handler_Protected {
-
diff --git a/classes/rpc.php b/classes/rpc.php index e0753a08e..2bbaf4135 100755 --- a/classes/rpc.php +++ b/classes/rpc.php @@ -80,18 +80,6 @@ class RPC extends Handler_Protected { } } - function addfeed() { - $feed = clean($_REQUEST['feed']); - $cat = clean($_REQUEST['cat']); - $need_auth = isset($_REQUEST['need_auth']); - $login = $need_auth ? clean($_REQUEST['login']) : ''; - $pass = $need_auth ? clean($_REQUEST['pass']) : ''; - - $rc = Feeds::subscribe_to_feed($feed, $cat, $login, $pass); - - print json_encode(array("result" => $rc)); - } - function togglepref() { $key = clean($_REQUEST["key"]); set_pref($key, !get_pref($key)); -- cgit v1.2.3-54-g00ecf