From 126cb7657f1f407d9cef828ad0c95614194ad9f7 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Thu, 25 Nov 2010 14:21:20 +0300 Subject: digest: use pure JSON --- modules/backend-rpc.php | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'modules/backend-rpc.php') diff --git a/modules/backend-rpc.php b/modules/backend-rpc.php index 510a9fd36..59faee7b3 100644 --- a/modules/backend-rpc.php +++ b/modules/backend-rpc.php @@ -695,15 +695,18 @@ } if ($subop == "digest-update") { + header("Content-Type: text/plain"); + $feed_id = db_escape_string($_REQUEST['feed_id']); $offset = db_escape_string($_REQUEST['offset']); $seq = db_escape_string($_REQUEST['seq']); if (!$feed_id) $feed_id = -4; if (!$offset) $offset = 0; - print ""; - print "$seq"; + $reply = array(); + + $reply['seq'] = $seq; $headlines = api_get_headlines($link, $feed_id, 10, $offset, '', ($feed_id == -4), true, false, "unread", "updated DESC"); @@ -711,18 +714,17 @@ //function api_get_headlines($link, $feed_id, $limit, $offset, // $filter, $is_cat, $show_excerpt, $show_content, $view_mode) { - print ""; - - print ""; + $reply['headlines'] = array(); + $reply['headlines']['title'] = getFeedTitle($link, $feed_id); + $reply['headlines']['content'] = $headlines; - print ""; + print json_encode($reply); return; } if ($subop == "digest-init") { - print ""; - + header("Content-Type: text/plain"); + $tmp_feeds = api_get_feeds($link, -3, true, false, 0); $feeds = array(); @@ -731,9 +733,8 @@ if ($f['id'] > 0 || $f['id'] == -4) array_push($feeds, $f); } - print ""; + print json_encode(array("feeds" => $feeds)); - print ""; return; } -- cgit v1.2.3