diff options
author | Andrew Dolgov <[email protected]> | 2009-10-06 14:15:29 +0400 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2009-10-06 14:15:29 +0400 |
commit | 54e61a6809a6f0e249ff12207b19b6ad3203089f (patch) | |
tree | a5fa0c228265c4a1043f56d0b9972da289f3a1af /functions.php | |
parent | e0382fd6df411b40d0ea3dfd55c06ca2cfeb40c1 (diff) |
add option to force display attachments in feeds (implementation)
Diffstat (limited to 'functions.php')
-rw-r--r-- | functions.php | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/functions.php b/functions.php index b67ff9570..effd20005 100644 --- a/functions.php +++ b/functions.php @@ -4568,13 +4568,15 @@ if (!$zoom_mode) { print "<article id='$id'><![CDATA["; }; - $result = db_query($link, "SELECT rtl_content FROM ttrss_feeds + $result = db_query($link, "SELECT rtl_content, always_display_enclosures FROM ttrss_feeds WHERE id = '$feed_id' AND owner_uid = " . $_SESSION["uid"]); if (db_num_rows($result) == 1) { $rtl_content = sql_bool_to_bool(db_fetch_result($result, 0, "rtl_content")); + $always_display_enclosures = sql_bool_to_bool(db_fetch_result($result, 0, "always_display_enclosures")); } else { $rtl_content = false; + $always_display_enclosures = false; } if ($rtl_content) { @@ -4760,7 +4762,7 @@ print "<div class=\"postEnclosures\">"; - if (!preg_match("/<img/i", $article_content)) { + if ($always_display_enclosures || !preg_match("/<img/i", $article_content)) { foreach ($entries as $entry) { if (preg_match("/image/", $entry["type"])) { print "<p><img @@ -5268,14 +5270,14 @@ // print "<div class=\"cdmInnerContent\" id=\"CICD-$id\" $cdm_cstyle>"; - print sanitize_rss($link, $line["content_preview"]); - print "<div id=\"POSTNOTE-$id\">"; if ($line['note']) { print format_article_note($id, $line['note']); } print "</div>"; + print sanitize_rss($link, $line["content_preview"]); + $article_content = $line["content_preview"]; $e_result = db_query($link, "SELECT * FROM ttrss_enclosures WHERE @@ -5310,7 +5312,12 @@ array_push($entries, $entry); } - if (!preg_match("/img/i", $article_content)) { + $tmp_result = db_query($link, "SELECT always_display_enclosures FROM + ttrss_feeds WHERE id = ".$line['feed_id']." AND owner_uid = ".$_SESSION["uid"]); + + $always_display_enclosures = db_fetch_result($tmp_result, 0, "always_display_enclosures"); + + if ($always_display_enclosures || !preg_match("/img/i", $article_content)) { foreach ($entries as $entry) { if (preg_match("/image/", $entry["type"])) { print "<p><img |