]> git.wh0rd.org - tt-rss.git/commitdiff
add another status code to subscribe_to_feed to prevent the frontend to do double...
authorChristian Weiske <cweiske@cweiske.de>
Tue, 9 Nov 2010 07:09:10 +0000 (08:09 +0100)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Wed, 10 Nov 2010 04:16:10 +0000 (07:16 +0300)
functions.js
functions.php

index ae7ecee35e311d38ac875b5bd603a87739cfaeb1..62ecd135d62ced57e29b499f01f6ba5430301f4b 100644 (file)
@@ -1322,6 +1322,7 @@ function subscribeToFeed() {
                                break;
                        case 2:
                        case 3:
+                       case 4:
                                alert(__("Can't subscribe to the specified URL."));
                                break;
                        case 0:
index fa97d04f9bbe3cab314fee7abc362d4bbc158f54..3e8cb8205c0745ec9498e1d9d7572876879754b5 100644 (file)
         *                 0 - OK, Feed already exists
         *                 1 - OK, Feed added
         *                 2 - Invalid URL
-        *                 3 - URL content is HTML, not a feed
+        *                 3 - URL content is HTML, no feeds available
+        *                 4 - URL content is HTML which contains multiple feeds.
+        *                     Here you should call extractfeedurls in rpc-backend
+        *                     to get all possible feeds.
         */
        function subscribe_to_feed($link, $url, $cat_id = 0, 
                        $auth_login = '', $auth_pass = '') {
 
                if (url_is_html($url)) {
                        $feedUrls = get_feeds_from_html($url);
-                       if (count($feedUrls) != 1) {
+                       if (count($feedUrls) == 0) {
                                return 3;
+                       } else if (count($feedUrls) > 1) {
+                               return 4;
                        }
                        //use feed url as new URL
                        $url = key($feedUrls);