]> git.wh0rd.org Git - tt-rss.git/commitdiff
rpc/digest-get-contents: use JSON
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>
Mon, 29 Nov 2010 13:22:08 +0000 (16:22 +0300)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Mon, 29 Nov 2010 13:22:16 +0000 (16:22 +0300)
digest.js
modules/backend-rpc.php

index 729b661411b57823dad6d9d1736ca6432282c6cb..1b62b14183be603948071c4da50a24d829851ed5 100644 (file)
--- a/digest.js
+++ b/digest.js
@@ -134,9 +134,12 @@ function zoom(elem, article_id) {
                        onComplete: function(transport) {
                                fatal_error_check(transport);
 
-                               if (transport.responseXML) {
-                                       var article = transport.responseXML.getElementsByTagName('article')[0];
-                                       elem.innerHTML = article.firstChild.nodeValue;
+                               var reply = JSON.parse(transport.responseText);
+
+                               if (reply) {
+                                       var article = reply['article'];
+
+                                       elem.innerHTML = article.content;
 
                                        new Effect.BlindDown(elem, {duration : 0.5});
 
index 7c26d2ec47aa940aef8dd94870a8fae2b3e3f496..fe4b6d302ad71b7a1d9be7ab84800edbabd78af9 100644 (file)
                } 
 
                if ($subop == "digest-get-contents") {
+                       header("Content-Type: text/plain");
+
                        $article_id = db_escape_string($_REQUEST['article_id']);
 
                        $result = db_query($link, "SELECT content 
                                FROM ttrss_entries, ttrss_user_entries
                                WHERE id = '$article_id' AND ref_id = id AND owner_uid = ".$_SESSION['uid']);
 
-                       print "<rpc-reply>";
-
-                       print "<article id=\"$article_id\"><![CDATA[";
-
                        $content = sanitize_rss($link, db_fetch_result($result, 0, "content"));
 
-                       print $content;
-
-                       print "]]></article>";
-
-                       print "</rpc-reply>";
-
+                       print json_encode(array("article" =>
+                               array("id" => $id, "content" => $content)));
                        return;
                }