make sure rendering image enclosures respect hide_image setting

This commit is contained in:
Andrew Dolgov 2013-03-21 15:37:08 +04:00
parent b3092a2a43
commit 33de3d37af
2 changed files with 13 additions and 7 deletions

View File

@ -637,8 +637,7 @@ class Feeds extends Handler_Protected {
$always_display_enclosures = sql_bool_to_bool($line["always_display_enclosures"]); $always_display_enclosures = sql_bool_to_bool($line["always_display_enclosures"]);
$reply['content'] .= format_article_enclosures($this->link, $id, $always_display_enclosures, $reply['content'] .= format_article_enclosures($this->link, $id, $always_display_enclosures, $line["content"], sql_bool_to_bool($line["hide_images"]));
$line["content"]);
$reply['content'] .= "</div>"; $reply['content'] .= "</div>";

View File

@ -2952,6 +2952,7 @@
$result = db_query($link, "SELECT id,title,link,content,feed_id,comments,int_id, $result = db_query($link, "SELECT id,title,link,content,feed_id,comments,int_id,
".SUBSTRING_FOR_DATE."(updated,1,16) as updated, ".SUBSTRING_FOR_DATE."(updated,1,16) as updated,
(SELECT site_url FROM ttrss_feeds WHERE id = feed_id) as site_url, (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, num_comments,
tag_cache, tag_cache,
author, author,
@ -3133,7 +3134,7 @@
$rv['content'] .= $line["content"]; $rv['content'] .= $line["content"];
$rv['content'] .= format_article_enclosures($link, $id, $rv['content'] .= format_article_enclosures($link, $id,
$always_display_enclosures, $line["content"]); $always_display_enclosures, $line["content"], $line["hide_images"]);
$rv['content'] .= "</div>"; $rv['content'] .= "</div>";
@ -3596,7 +3597,7 @@
} }
function format_article_enclosures($link, $id, $always_display_enclosures, function format_article_enclosures($link, $id, $always_display_enclosures,
$article_content) { $article_content, $hide_images = false) {
$result = get_article_enclosures($link, $id); $result = get_article_enclosures($link, $id);
$rv = ''; $rv = '';
@ -3646,10 +3647,16 @@
if (preg_match("/image/", $entry["type"]) || if (preg_match("/image/", $entry["type"]) ||
preg_match("/\.(jpg|png|gif|bmp)/i", $entry["filename"])) { preg_match("/\.(jpg|png|gif|bmp)/i", $entry["filename"])) {
$rv .= "<p><img if (!$hide_images) {
alt=\"".htmlspecialchars($entry["filename"])."\" $rv .= "<p><img
src=\"" .htmlspecialchars($entry["url"]) . "\"/></p>"; alt=\"".htmlspecialchars($entry["filename"])."\"
src=\"" .htmlspecialchars($entry["url"]) . "\"/></p>";
} else {
$rv .= "<p><a target=\"_blank\"
href=\"".htmlspecialchars($entry["url"])."\"
>" .htmlspecialchars($entry["url"]) . "</a></p>";
}
} }
} }
} }