From 33de3d37af24f870fe2477d5b358e6f4167077b6 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Thu, 21 Mar 2013 15:37:08 +0400 Subject: [PATCH] make sure rendering image enclosures respect hide_image setting --- classes/feeds.php | 3 +-- include/functions.php | 17 ++++++++++++----- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/classes/feeds.php b/classes/feeds.php index 79aaa8e5..b8ef1f54 100644 --- a/classes/feeds.php +++ b/classes/feeds.php @@ -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'] .= ""; diff --git a/include/functions.php b/include/functions.php index 7071765b..72cca500 100644 --- a/include/functions.php +++ b/include/functions.php @@ -2952,6 +2952,7 @@ $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, @@ -3133,7 +3134,7 @@ $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'] .= ""; @@ -3596,7 +3597,7 @@ } function format_article_enclosures($link, $id, $always_display_enclosures, - $article_content) { + $article_content, $hide_images = false) { $result = get_article_enclosures($link, $id); $rv = ''; @@ -3646,10 +3647,16 @@ if (preg_match("/image/", $entry["type"]) || preg_match("/\.(jpg|png|gif|bmp)/i", $entry["filename"])) { - $rv .= "

\"".htmlspecialchars($entry["filename"])."\"

"; + if (!$hide_images) { + $rv .= "

\"".htmlspecialchars($entry["filename"])."\"

"; + } else { + $rv .= "

" .htmlspecialchars($entry["url"]) . "

"; + } } } } -- 2.39.5