diff --git a/functions.js b/functions.js index a3330206..c99bfae6 100644 --- a/functions.js +++ b/functions.js @@ -615,24 +615,16 @@ function parse_counters(reply, scheduled_call) { var feeds_found = 0; - if (reply.firstChild && reply.firstChild.firstChild) { - debug("wrong element passed to parse_counters, adjusting."); - reply = reply.firstChild; - } + var elems = reply.getElementsByTagName("counter"); - for (var l = 0; l < reply.childNodes.length; l++) { - if (!reply.childNodes[l] || - typeof(reply.childNodes[l].getAttribute) == "undefined") { - // where did this come from? - continue; - } + for (var l = 0; l < elems.length; l++) { - var id = reply.childNodes[l].getAttribute("id"); - var t = reply.childNodes[l].getAttribute("type"); - var ctr = reply.childNodes[l].getAttribute("counter"); - var error = reply.childNodes[l].getAttribute("error"); - var has_img = reply.childNodes[l].getAttribute("hi"); - var updated = reply.childNodes[l].getAttribute("updated"); + var id = elems[l].getAttribute("id"); + var t = elems[l].getAttribute("type"); + var ctr = elems[l].getAttribute("counter"); + var error = elems[l].getAttribute("error"); + var has_img = elems[l].getAttribute("hi"); + var updated = elems[l].getAttribute("updated"); if (id == "global-unread") { global_unread = ctr; diff --git a/modules/backend-rpc.php b/modules/backend-rpc.php index 3a30543d..6d3ceedf 100644 --- a/modules/backend-rpc.php +++ b/modules/backend-rpc.php @@ -19,6 +19,7 @@ print ""; + return; } if ($subop == "getLabelCounters") { @@ -31,6 +32,8 @@ } print ""; print ""; + + return; } if ($subop == "getFeedCounters") { @@ -39,6 +42,8 @@ getFeedCounters($link); print ""; print ""; + + return; } if ($subop == "getAllCounters") { @@ -51,6 +56,8 @@ print ""; print_runtime_info($link); print ""; + + return; } if ($subop == "mark") { @@ -76,6 +83,7 @@ } print ""; + return; } if ($subop == "publ") { @@ -101,6 +109,7 @@ } print ""; + return; } if ($subop == "updateFeed") { @@ -180,6 +189,7 @@ print ""; + return; } /* GET["cmode"] = 0 - mark as read, 1 - as unread, 2 - toggle */ @@ -196,6 +206,8 @@ print ""; print_runtime_info($link); print ""; + + return; } if ($subop == "markSelected") { @@ -211,6 +223,8 @@ print ""; print_runtime_info($link); print ""; + + return; } if ($subop == "publishSelected") { @@ -226,6 +240,8 @@ print ""; print_runtime_info($link); print ""; + + return; } if ($subop == "sanityCheck") { @@ -240,6 +256,8 @@ } print ""; + + return; } if ($subop == "globalPurge") { @@ -248,6 +266,7 @@ global_purge_old_posts($link, true); print ""; + return; } if ($subop == "getArticleLink") { @@ -263,6 +282,8 @@ } else { print "Article not found"; } + + return; } if ($subop == "setArticleTags") { @@ -311,6 +332,7 @@ $id "; + return; } if ($subop == "regenPubKey") { @@ -325,11 +347,13 @@ print ""; + return; } if ($subop == "logout") { logout_user(); print_error_xml(6); + return; } if ($subop == "completeTags") { @@ -347,7 +371,9 @@ } print ""; + return; } + print "Unknown method: $subop"; } ?>