diff options
Diffstat (limited to 'modules')
-rw-r--r-- | modules/backend-rpc.php | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/modules/backend-rpc.php b/modules/backend-rpc.php index b21e161e4..80eda7c3f 100644 --- a/modules/backend-rpc.php +++ b/modules/backend-rpc.php @@ -978,6 +978,57 @@ return; } + if ($subop == "digest-update") { + $feed_id = db_escape_string($_REQUEST['feed_id']); + $offset = db_escape_string($_REQUEST['offset']); + + if (!$feed_id) $feed_id = -4; + if (!$offset) $offset = 0; + + + print "<rpc-reply>"; + + $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><![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); + } + + function feeds_sort_by_unread_rev($a, $b) { + $a = $a['unread']; + $b = $b['unread']; + + if ($a == $b) { + return 0; + } + return ($a < $b) ? 1 : -1; + } + + //uasort($feeds, 'feeds_sort_by_unread_rev'); + //$feeds = array_slice($feeds, 0, 10); + + print "<feeds><![CDATA[" . json_encode($feeds) . "]]></feeds>"; + + print "</rpc-reply>"; + return; + } + print "<rpc-reply><error>Unknown method: $subop</error></rpc-reply>"; } ?> |