]> git.wh0rd.org Git - tt-rss.git/commitdiff
make sure rendering image enclosures respect hide_image setting
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>
Thu, 21 Mar 2013 11:37:08 +0000 (15:37 +0400)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Thu, 21 Mar 2013 11:37:08 +0000 (15:37 +0400)
classes/feeds.php
include/functions.php

index 79aaa8e55dff0cc8c029375b28aec1b376f6c9b6..b8ef1f54453b52f812de292ea8ca7c8d00f5d4f9 100644 (file)
@@ -637,8 +637,7 @@ class Feeds extends Handler_Protected {
 
                                        $always_display_enclosures = sql_bool_to_bool($line["always_display_enclosures"]);
 
-                                       $reply['content'] .= format_article_enclosures($this->link, $id, $always_display_enclosures,
-                                               $line["content"]);
+                                       $reply['content'] .= format_article_enclosures($this->link, $id, $always_display_enclosures, $line["content"], sql_bool_to_bool($line["hide_images"]));
 
                                        $reply['content'] .= "</div>";
 
index 7071765ba199c927543c38c7bde289e5f40c8227..72cca500e89f7b32632d295351ae1aed58a1433a 100644 (file)
                $result = db_query($link, "SELECT id,title,link,content,feed_id,comments,int_id,
                        ".SUBSTRING_FOR_DATE."(updated,1,16) as updated,
                        (SELECT site_url FROM ttrss_feeds WHERE id = feed_id) as site_url,
+                       (SELECT hide_images FROM ttrss_feeds WHERE id = feed_id) as hide_images,
                        num_comments,
                        tag_cache,
                        author,
                        $rv['content'] .= $line["content"];
 
                        $rv['content'] .= format_article_enclosures($link, $id,
-                               $always_display_enclosures, $line["content"]);
+                               $always_display_enclosures, $line["content"], $line["hide_images"]);
 
                        $rv['content'] .= "</div>";
 
        }
 
        function format_article_enclosures($link, $id, $always_display_enclosures,
-                                       $article_content) {
+                                       $article_content, $hide_images = false) {
 
                $result = get_article_enclosures($link, $id);
                $rv = '';
                                                if (preg_match("/image/", $entry["type"]) ||
                                                                preg_match("/\.(jpg|png|gif|bmp)/i", $entry["filename"])) {
 
-                                                               $rv .= "<p><img
-                                                               alt=\"".htmlspecialchars($entry["filename"])."\"
-                                                               src=\"" .htmlspecialchars($entry["url"]) . "\"/></p>";
+                                                               if (!$hide_images) {
+                                                                       $rv .= "<p><img
+                                                                       alt=\"".htmlspecialchars($entry["filename"])."\"
+                                                                       src=\"" .htmlspecialchars($entry["url"]) . "\"/></p>";
+                                                               } else {
+                                                                       $rv .= "<p><a target=\"_blank\"
+                                                                       href=\"".htmlspecialchars($entry["url"])."\"
+                                                                       >" .htmlspecialchars($entry["url"]) . "</a></p>";
 
+                                                               }
                                                }
                                        }
                                }