diff options
author | Andrew Dolgov <[email protected]> | 2010-10-18 18:32:57 +0400 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2010-10-18 18:32:57 +0400 |
commit | 9c57be20a28074bc13e924931106f2543ca478b5 (patch) | |
tree | 819eed091840ab25c0997329fb25f79946ea5883 /modules/backend-rpc.php | |
parent | 7b20c977802b3ec33f05dd66814ebc9d995bc4a3 (diff) | |
parent | f95ac2755a918ddaec4937d441b893a53467ed88 (diff) |
Merge branch 'master' of madoka.volgo-balt.ru:public_html/testbox/tt-rss
Diffstat (limited to 'modules/backend-rpc.php')
-rw-r--r-- | modules/backend-rpc.php | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/modules/backend-rpc.php b/modules/backend-rpc.php index b21e161e4..aa05e8e8e 100644 --- a/modules/backend-rpc.php +++ b/modules/backend-rpc.php @@ -978,6 +978,84 @@ return; } + if ($subop == "digest-get-contents") { + $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>"; + + return; + } + + if ($subop == "digest-update") { + $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 "<rpc-reply>"; + + print "<seq>$seq</seq>"; + + $headlines = api_get_headlines($link, $feed_id, 10, $offset, + '', ($feed_id == -4), true, false, "unread", "updated DESC"); + + //function api_get_headlines($link, $feed_id, $limit, $offset, + // $filter, $is_cat, $show_excerpt, $show_content, $view_mode) { + + print "<headlines-title><![CDATA[" . getFeedTitle($link, $feed_id) . + "]]></headlines-title>"; + + print "<headlines><![CDATA[" . json_encode($headlines) . "]]></headlines>"; + + print "</rpc-reply>"; + return; + } + + if ($subop == "digest-init") { + print "<rpc-reply>"; + + $tmp_feeds = api_get_feeds($link, false, true, false, 0); + $feeds = array(); + + foreach ($tmp_feeds as $f) { + if ($f['id'] > 0 || $f['id'] == -4) array_push($feeds, $f); + } + + print "<feeds><![CDATA[" . json_encode($feeds) . "]]></feeds>"; + + print "</rpc-reply>"; + return; + } + + if ($subop == "catchupFeed") { + + $feed_id = db_escape_string($_REQUEST['feed_id']); + $is_cat = db_escape_string($_REQUEST['is_cat']); + + print "<rpc-reply>"; + + catchup_feed($link, $feed_id, $is_cat); + + print "</rpc-reply>"; + + return; + } + print "<rpc-reply><error>Unknown method: $subop</error></rpc-reply>"; } ?> |