From 54e61a6809a6f0e249ff12207b19b6ad3203089f Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Tue, 6 Oct 2009 14:15:29 +0400 Subject: [PATCH] add option to force display attachments in feeds (implementation) --- functions.php | 17 ++++++++++++----- modules/pref-feeds.php | 18 ++++++++++++++++++ sanity_check.php | 2 +- 3 files changed, 31 insertions(+), 6 deletions(-) diff --git a/functions.php b/functions.php index b67ff957..effd2000 100644 --- a/functions.php +++ b/functions.php @@ -4568,13 +4568,15 @@ if (!$zoom_mode) { print "
"; - if (!preg_match("/"; - print sanitize_rss($link, $line["content_preview"]); - print "
"; if ($line['note']) { print format_article_note($id, $line['note']); } print "
"; + 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 "

 "; + + $always_display_enclosures = sql_bool_to_bool(db_fetch_result($result, 0, "always_display_enclosures")); + + if ($always_display_enclosures) { + $checked = "checked"; + } else { + $checked = ""; + } + + print "
 "; + + $cache_images = sql_bool_to_bool(db_fetch_result($result, 0, "cache_images")); if ($cache_images) { @@ -560,6 +574,9 @@ db_escape_string($_POST["cache_images"])); $update_method = (int) db_escape_string($_POST["update_method"]); + $always_display_enclosures = checkbox_to_sql_bool( + db_escape_string($_POST["always_display_enclosures"])); + if (get_pref($link, 'ENABLE_FEED_CATS')) { if ($cat_id && $cat_id != 0) { $category_qpart = "cat_id = '$cat_id',"; @@ -599,6 +616,7 @@ hidden = $hidden, $cache_images_qpart include_in_digest = $include_in_digest, + always_display_enclosures = $always_display_enclosures, update_method = '$update_method' WHERE id = '$feed_id' AND owner_uid = " . $_SESSION["uid"]); diff --git a/sanity_check.php b/sanity_check.php index ab4e29b3..600f8d9f 100644 --- a/sanity_check.php +++ b/sanity_check.php @@ -2,7 +2,7 @@ require_once "functions.php"; define('EXPECTED_CONFIG_VERSION', 18); - define('SCHEMA_VERSION', 56); + define('SCHEMA_VERSION', 57); if (!file_exists("config.php")) { print "Fatal Error: You forgot to copy -- 2.39.5