From d9e20f8b1683549b7f04116753c60d95c765aaa6 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Wed, 20 Feb 2019 12:32:52 +0300 Subject: update external subscribe dialog --- classes/handler/public.php | 164 +++++++++++++++++++++++++-------------------- 1 file changed, 92 insertions(+), 72 deletions(-) (limited to 'classes/handler/public.php') diff --git a/classes/handler/public.php b/classes/handler/public.php index 176696580..d190a267d 100755 --- a/classes/handler/public.php +++ b/classes/handler/public.php @@ -737,92 +737,112 @@ class Handler_Public extends Handler { $feed_url = trim(clean($_REQUEST["feed_url"])); header('Content-Type: text/html; charset=utf-8'); - print " - - Tiny Tiny RSS"; - print stylesheet_tag("css/default.css"); - - print " - - - - - -
-

".__("Subscribe to feed...")."

"; - - $rc = Feeds::subscribe_to_feed($feed_url); - - switch ($rc['code']) { - case 0: - print_warning(T_sprintf("Already subscribed to %s.", $feed_url)); - break; - case 1: - print_notice(T_sprintf("Subscribed to %s.", $feed_url)); - break; - case 2: - print_error(T_sprintf("Could not subscribe to %s.", $feed_url)); - break; - case 3: - print_error(T_sprintf("No feeds found in %s.", $feed_url)); - break; - case 4: - print_notice(__("Multiple feed URLs found.")); - $feed_urls = $rc["feeds"]; - break; - case 5: - print_error(T_sprintf("Could not subscribe to %s.
Can't download the Feed URL.", $feed_url)); - break; - } + ?> + + + Tiny Tiny RSS + + + + + + + +
+

+
+ "; - print ""; + $rc = Feeds::subscribe_to_feed($feed_url); + $feed_urls = false; + + switch ($rc['code']) { + case 0: + print_warning(T_sprintf("Already subscribed to %s.", $feed_url)); + break; + case 1: + print_notice(T_sprintf("Subscribed to %s.", $feed_url)); + break; + case 2: + print_error(T_sprintf("Could not subscribe to %s.", $feed_url)); + break; + case 3: + print_error(T_sprintf("No feeds found in %s.", $feed_url)); + break; + case 4: + $feed_urls = $rc["feeds"]; + break; + case 5: + print_error(T_sprintf("Could not subscribe to %s.
Can't download the Feed URL.", $feed_url)); + break; + } - print ""; - print ""; - } + print "
"; + print ""; + print ""; + foreach ($feed_urls as $url => $name) { + $url = htmlspecialchars($url); + $name = htmlspecialchars($name); - print ""; - } + print ""; + } + + print ""; + print ""; + print "
"; + + print ""; + } - $tp_uri = get_self_url_prefix() . "/prefs.php"; - $tt_uri = get_self_url_prefix(); + $tp_uri = get_self_url_prefix() . "/prefs.php"; - if ($rc['code'] <= 2){ - $sth = $this->pdo->prepare("SELECT id FROM ttrss_feeds WHERE + if ($rc['code'] <= 2){ + $sth = $this->pdo->prepare("SELECT id FROM ttrss_feeds WHERE feed_url = ? AND owner_uid = ?"); - $sth->execute([$feed_url, $_SESSION['uid']]); - $row = $sth->fetch(); + $sth->execute([$feed_url, $_SESSION['uid']]); + $row = $sth->fetch(); - $feed_id = $row["id"]; - } else { - $feed_id = 0; - } - print "

"; - - if ($feed_id) { - print "

- - - - + $feed_id = $row["id"]; + } else { + $feed_id = 0; + } + print "

"; + + if ($feed_id) { + print " + + + +

"; + } } - print "
- -

"; + print "
+ +
"; print "
"; -- cgit v1.2.3