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"); + ?> + + + Tiny Tiny RSS + + + + + + + +
+

+
+ - - + if (!$feed_url) { + print_error("No feed to subscribe to."); + } else { - - -
-

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

"; + $rc = Feeds::subscribe_to_feed($feed_url); + $feed_urls = false; - $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; - } - - if ($feed_urls) { - - print "
"; - print ""; - - print ""; + if ($feed_urls) { - print "
"; - } + print "
"; + print ""; - $tp_uri = get_self_url_prefix() . "/prefs.php"; - $tt_uri = get_self_url_prefix(); + print "
"; + print ""; + print ""; + print ""; + print "
"; + + print "
"; + } + + $tp_uri = get_self_url_prefix() . "/prefs.php"; + + 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 "

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

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

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

"; + print "
+ +
"; print "
";