]> git.wh0rd.org - tt-rss.git/blobdiff - modules/backend-rpc.php
remove xml from getAllCounters rpc call, use pure JSON
[tt-rss.git] / modules / backend-rpc.php
index e93571207c50423635a7b4303d7e84b21fbc9977..93d8f074b5d7203db3ece4f8a67caf5bf20ed76d 100644 (file)
 
                if ($subop == "updateAllFeeds" || $subop == "getAllCounters") {
 
+                       header("Content-Type: text/plain");
+
                        $last_article_id = (int) $_REQUEST["last_article_id"];  
 
-                       print "<rpc-reply>";
+                       $reply = array();
 
-                       if ($seq)
-                               print "<seq>$seq</seq>";
+                       if ($seq) $reply['seq'] = $seq;
 
                        if ($last_article_id != getLastArticleId($link)) {
-                               print "<counters><![CDATA[";
                                $omode = $_REQUEST["omode"];
 
                                if ($omode != "T") 
-                                       print json_encode(getAllCounters($link, $omode));
+                                       $reply['counters'] = getAllCounters($link, $omode);
                                else
-                                       print json_encode(getGlobalCounters($link));
-
-                               print "]]></counters>";
+                                       $reply['counters'] = getGlobalCounters($link);
                        }
  
-                       print_runtime_info($link);
+                       $reply['runtime-info'] = make_runtime_info($link);
 
-                       print "</rpc-reply>";
 
+                       print json_encode($reply);
                        return;
                }
 
                }
 
                if ($subop == "getTweetInfo") {
-                       header("Content-Type: text/html");
+                       header("Content-Type: text/plain");
                        $id = db_escape_string($_REQUEST['id']);
 
                        $result = db_query($link, "SELECT title, link