summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Weiske <[email protected]>2010-11-09 08:09:10 +0100
committerAndrew Dolgov <[email protected]>2010-11-10 07:16:10 +0300
commit9a8ce9561dafe155f282ddb2e78d6a6730b8863a (patch)
tree536adb140dc6b5b1f8a3960d7809ed74718c5877
parentf6d8345b0139ac4e86ea11f2183903a387a2a9fe (diff)
add another status code to subscribe_to_feed to prevent the frontend to do double work (refs #276)
-rw-r--r--functions.js1
-rw-r--r--functions.php9
2 files changed, 8 insertions, 2 deletions
diff --git a/functions.js b/functions.js
index ae7ecee35..62ecd135d 100644
--- a/functions.js
+++ b/functions.js
@@ -1322,6 +1322,7 @@ function subscribeToFeed() {
break;
case 2:
case 3:
+ case 4:
alert(__("Can't subscribe to the specified URL."));
break;
case 0:
diff --git a/functions.php b/functions.php
index fa97d04f9..3e8cb8205 100644
--- a/functions.php
+++ b/functions.php
@@ -2990,7 +2990,10 @@
* 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 = '') {
@@ -3000,8 +3003,10 @@
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);