summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2013-03-21 15:37:08 +0400
committerAndrew Dolgov <[email protected]>2013-03-21 15:37:08 +0400
commit33de3d37af24f870fe2477d5b358e6f4167077b6 (patch)
tree570b9898a1ee82b6d5da5e4aa4777dc442138fa1 /include
parentb3092a2a4324cfe5e7b6e8528093a3eea133112a (diff)
make sure rendering image enclosures respect hide_image setting
Diffstat (limited to 'include')
-rw-r--r--include/functions.php17
1 files changed, 12 insertions, 5 deletions
diff --git a/include/functions.php b/include/functions.php
index 7071765ba..72cca500e 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'] .= "</div>";
@@ -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 .= "<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>";
+ }
}
}
}