From 81fc862e370a1dfbd3941206fd00076e3cbf0551 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Mon, 20 May 2013 14:47:57 -0400 Subject: [PATCH] support disabling of e-mail digests entirely On servers w/out any support for sending e-mail, the digest functionality is useless overhead and confusing for users. Overload the existing digest knob so people can turn it off. --- classes/pref/feeds.php | 2 ++ classes/pref/prefs.php | 5 +++++ classes/rssutils.php | 1 + config.php-dist | 1 + 4 files changed, 9 insertions(+) diff --git a/classes/pref/feeds.php b/classes/pref/feeds.php index a04b0108..8249f756 100755 --- a/classes/pref/feeds.php +++ b/classes/pref/feeds.php @@ -660,6 +660,7 @@ class Pref_Feeds extends Handler_Protected { print " "; + if (DIGEST_SUBJECT !== false) { $include_in_digest = $row["include_in_digest"]; if ($include_in_digest) { @@ -671,6 +672,7 @@ class Pref_Feeds extends Handler_Protected { print "
 "; + } $always_display_enclosures = $row["always_display_enclosures"]; diff --git a/classes/pref/prefs.php b/classes/pref/prefs.php index 82456f34..0ae3e1bb 100644 --- a/classes/pref/prefs.php +++ b/classes/pref/prefs.php @@ -172,6 +172,7 @@ class Pref_Prefs extends Handler_Protected { "DEFAULT_UPDATE_INTERVAL", "USER_TIMEZONE", "SORT_HEADLINES_BY_FEED_DATE", "SSL_CERT_SERIAL", "DIGEST_PREFERRED_TIME"); + $digest_options = array("DIGEST_ENABLE", "DIGEST_CATCHUP", "DIGEST_PREFERRED_TIME"); $_SESSION["prefs_op_result"] = ""; @@ -502,6 +503,10 @@ class Pref_Prefs extends Handler_Protected { continue; } + /* Hide options from the user that are disabled in config.php. */ + if (DIGEST_SUBJECT === false && in_array($pref_name, $digest_options)) + continue; + if ($active_section != $line["section_id"]) { if ($active_section != "") { diff --git a/classes/rssutils.php b/classes/rssutils.php index 56108bd1..b469c470 100755 --- a/classes/rssutils.php +++ b/classes/rssutils.php @@ -217,6 +217,7 @@ class RSSUtils { } // Send feed digests by email if needed. + if (DIGEST_SUBJECT !== false) Digest::send_headlines_digests(); return $nf; diff --git a/config.php-dist b/config.php-dist index da9237ff..a8817fae 100755 --- a/config.php-dist +++ b/config.php-dist @@ -141,6 +141,7 @@ define('DIGEST_SUBJECT', '[tt-rss] New headlines for last 24 hours'); // Subject line for email digests + // Set this to false to disable digests entirely. // *************************************** // *** Other settings (less important) *** -- 2.39.2