api/getHeadlines: add include_attachments parameter

This commit is contained in:
Andrew Dolgov 2011-04-14 21:00:36 +04:00
parent 133ab8c713
commit a0e580b0ca
2 changed files with 9 additions and 2 deletions

View File

@ -184,9 +184,11 @@
$show_content = (bool)db_escape_string($_REQUEST["show_content"]); $show_content = (bool)db_escape_string($_REQUEST["show_content"]);
/* all_articles, unread, adaptive, marked, updated */ /* all_articles, unread, adaptive, marked, updated */
$view_mode = db_escape_string($_REQUEST["view_mode"]); $view_mode = db_escape_string($_REQUEST["view_mode"]);
$include_attachments = (bool)db_escape_string($_REQUEST["include_attachments"]);
$headlines = api_get_headlines($link, $feed_id, $limit, $offset, $headlines = api_get_headlines($link, $feed_id, $limit, $offset,
$filter, $is_cat, $show_excerpt, $show_content, $view_mode, false); $filter, $is_cat, $show_excerpt, $show_content, $view_mode, false,
$include_attachments);
print api_wrap_reply(API_STATUS_OK, $seq, $headlines); print api_wrap_reply(API_STATUS_OK, $seq, $headlines);

View File

@ -6694,7 +6694,8 @@
} }
function api_get_headlines($link, $feed_id, $limit, $offset, function api_get_headlines($link, $feed_id, $limit, $offset,
$filter, $is_cat, $show_excerpt, $show_content, $view_mode, $order) { $filter, $is_cat, $show_excerpt, $show_content, $view_mode, $order,
$include_attachments) {
/* do not rely on params below */ /* do not rely on params below */
@ -6728,6 +6729,10 @@
"tags" => get_article_tags($link, $line["id"]), "tags" => get_article_tags($link, $line["id"]),
); );
if ($include_attachments)
$headline_row['attachments'] = get_article_enclosures($link,
$line['id']);
if ($show_excerpt) { if ($show_excerpt) {
$excerpt = truncate_string(strip_tags($line["content_preview"]), 100); $excerpt = truncate_string(strip_tags($line["content_preview"]), 100);
$headline_row["excerpt"] = $excerpt; $headline_row["excerpt"] = $excerpt;