]> git.wh0rd.org Git - tt-rss.git/commitdiff
api/getHeadlines: add include_attachments parameter
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>
Thu, 14 Apr 2011 17:00:36 +0000 (21:00 +0400)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Thu, 14 Apr 2011 17:00:36 +0000 (21:00 +0400)
api/index.php
functions.php

index ea267ca8eee03130af910221eb0b84f7456c3dfe..01328b9a70f0ddafc34b3498b3c3aee261c62c0c 100644 (file)
                        $show_content = (bool)db_escape_string($_REQUEST["show_content"]);
                        /* all_articles, unread, adaptive, marked, updated */
                        $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,
-                               $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);
 
index e427339e56f00ceb4b035adfe8d5527256a0228e..0a2345ff6b699315c319231cbc3e4eeac6882b8d 100644 (file)
        }
 
        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 */
 
                                                "tags" => get_article_tags($link, $line["id"]),
                                        );
 
+                                       if ($include_attachments)
+                                               $headline_row['attachments'] = get_article_enclosures($link,
+                                                       $line['id']);
+
                                if ($show_excerpt) {
                                        $excerpt = truncate_string(strip_tags($line["content_preview"]), 100);
                                        $headline_row["excerpt"] = $excerpt;