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 ++++++++++--------------------------------------------- 1 file changed, 16 insertions(+), 79 deletions(-) (limited to 'classes/feeds.php') 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 "
"; + 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) * -- cgit v1.2.3-54-g00ecf