From 1b9b19af0fe6e98f71993c177cba4a7e9e268e8b Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Tue, 31 Jan 2012 15:52:33 +0400 Subject: [PATCH] try to send digests within 2 hours of preferred time only --- classes/pref_prefs.php | 9 +++++++++ include/functions.php | 4 +++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/classes/pref_prefs.php b/classes/pref_prefs.php index 78c66124..c8843ada 100644 --- a/classes/pref_prefs.php +++ b/classes/pref_prefs.php @@ -78,6 +78,15 @@ class Pref_Prefs extends Protected_Handler { $pref_name = db_escape_string($pref_name); $value = db_escape_string($_POST[$pref_name]); + if ($pref_name == 'DIGEST_PREFERRED_TIME') { + if (get_pref($this->link, 'DIGEST_PREFERRED_TIME') != $value) { + + db_query($this->link, "UPDATE ttrss_users SET + last_digest_sent = NULL WHERE id = " . $_SESSION['uid']); + + } + } + set_pref($this->link, $pref_name, $value); } diff --git a/include/functions.php b/include/functions.php index 9eb66de3..0ef1d013 100644 --- a/include/functions.php +++ b/include/functions.php @@ -2706,7 +2706,9 @@ if (get_pref($link, 'DIGEST_ENABLE', $line['id'], false)) { $preferred_ts = strtotime(get_pref($link, 'DIGEST_PREFERRED_TIME', $line['id'], '00:00')); - if ($preferred_ts && time() >= $preferred_ts) { + // try to send digests within 2 hours of preferred time + if ($preferred_ts && time() >= $preferred_ts && + time() - $preferred_ts <= 7200) { if ($debug) print "Sending digest for UID:" . $line['id'] . " - " . $line["email"] . " ... "; -- 2.39.5