diff options
Diffstat (limited to 'classes')
-rw-r--r-- | classes/Digest.php | 11 | ||||
-rw-r--r-- | classes/Pref_Prefs.php | 4 | ||||
-rw-r--r-- | classes/Pref_System.php | 6 | ||||
-rw-r--r-- | classes/Prefs.php | 5 | ||||
-rw-r--r-- | classes/UrlHelper.php | 4 |
5 files changed, 20 insertions, 10 deletions
diff --git a/classes/Digest.php b/classes/Digest.php index 27009530f..6005f5fe4 100644 --- a/classes/Digest.php +++ b/classes/Digest.php @@ -17,7 +17,7 @@ class Digest $pdo = Db::pdo(); - $res = $pdo->query("SELECT id,email FROM ttrss_users + $res = $pdo->query("SELECT id, login, email FROM ttrss_users WHERE email != '' AND (last_digest_sent IS NULL OR $interval_qpart)"); while ($line = $res->fetch()) { @@ -92,7 +92,8 @@ class Digest $tpl->readTemplateFromFile("digest_template_html.txt"); $tpl_t->readTemplateFromFile("digest_template.txt"); - $user_tz_string = get_pref(Prefs::USER_TIMEZONE, $user_id); + $user_tz_string = Prefs::get(Prefs::USER_TIMEZONE, $user_id); + $min_score = Prefs::get(Prefs::DIGEST_MIN_SCORE, $user_id); if ($user_tz_string == 'Automatic') $user_tz_string = 'GMT'; @@ -136,10 +137,10 @@ class Digest AND $interval_qpart AND ttrss_user_entries.owner_uid = :user_id AND unread = true - AND score >= 0 + AND score >= :min_score ORDER BY ttrss_feed_categories.title, ttrss_feeds.title, score DESC, date_updated DESC LIMIT " . (int)$limit); - $sth->execute([':user_id' => $user_id]); + $sth->execute([':user_id' => $user_id, ':min_score' => $min_score]); $headlines_count = 0; $headlines = array(); @@ -191,7 +192,7 @@ class Digest $tpl_t->addBlock('article'); - if ($headlines[$i]['feed_title'] != $headlines[$i + 1]['feed_title']) { + if (!isset($headlines[$i + 1]) || $headlines[$i]['feed_title'] != $headlines[$i + 1]['feed_title']) { $tpl->addBlock('feed'); $tpl_t->addBlock('feed'); } diff --git a/classes/Pref_Prefs.php b/classes/Pref_Prefs.php index 6985c49e4..5cbf3c6d1 100644 --- a/classes/Pref_Prefs.php +++ b/classes/Pref_Prefs.php @@ -74,6 +74,7 @@ class Pref_Prefs extends Handler_Protected { Prefs::DIGEST_ENABLE, Prefs::DIGEST_CATCHUP, Prefs::DIGEST_PREFERRED_TIME, + Prefs::DIGEST_MIN_SCORE, ], __('Advanced') => [ Prefs::BLACKLISTED_TAGS, @@ -127,6 +128,7 @@ class Pref_Prefs extends Handler_Protected { Prefs::DEBUG_HEADLINE_IDS => array(__("Show article and feed IDs"), __("In the headlines buffer")), Prefs::DISABLE_CONDITIONAL_COUNTERS => array(__("Disable conditional counter updates"), __("May increase server load")), Prefs::CDM_ENABLE_GRID => array(__("Grid view"), __("On wider screens, if always expanded")), + Prefs::DIGEST_MIN_SCORE => array(__("Required score"), __("Include articles with this or above score")), ]; // hidden in the main prefs UI (use to hide things that have description set above) @@ -688,7 +690,7 @@ class Pref_Prefs extends Handler_Protected { } } else if (in_array($pref_name, [Prefs::FRESH_ARTICLE_MAX_AGE, - Prefs::PURGE_OLD_DAYS, Prefs::LONG_DATE_FORMAT, Prefs::SHORT_DATE_FORMAT])) { + Prefs::PURGE_OLD_DAYS, Prefs::LONG_DATE_FORMAT, Prefs::SHORT_DATE_FORMAT, Prefs::DIGEST_MIN_SCORE])) { if ($pref_name == Prefs::PURGE_OLD_DAYS && Config::get(Config::FORCE_ARTICLE_PURGE) != 0) { $attributes = ["disabled" => true, "required" => true]; diff --git a/classes/Pref_System.php b/classes/Pref_System.php index e85c1134d..2220199e7 100644 --- a/classes/Pref_System.php +++ b/classes/Pref_System.php @@ -197,9 +197,13 @@ class Pref_System extends Handler_Administrative { <?= \Controls\hidden_tag("op", "Pref_System") ?> <?= \Controls\hidden_tag("method", "sendTestEmail") ?> + <?php + $user = ORM::for_table('ttrss_users')->find_one($_SESSION["uid"]); + ?> + <fieldset> <label><?= __("To:") ?></label> - <?= \Controls\input_tag("mail_address", "", "text", ['required' => 1]) ?> + <?= \Controls\input_tag("mail_address",$user->email, "text", ['required' => 1]) ?> <?= \Controls\submit_tag(__("Send test email")) ?> <span style="display: none; margin-left : 10px" class="alert alert-error" id="mail-test-result">...</span> </fieldset> diff --git a/classes/Prefs.php b/classes/Prefs.php index c5cf16598..e315802a9 100644 --- a/classes/Prefs.php +++ b/classes/Prefs.php @@ -61,6 +61,7 @@ class Prefs { const DISABLE_CONDITIONAL_COUNTERS = "DISABLE_CONDITIONAL_COUNTERS"; const WIDESCREEN_MODE = "WIDESCREEN_MODE"; const CDM_ENABLE_GRID = "CDM_ENABLE_GRID"; + const DIGEST_MIN_SCORE = "DIGEST_MIN_SCORE"; private const _DEFAULTS = [ Prefs::PURGE_OLD_DAYS => [ 60, Config::T_INT ], @@ -122,6 +123,7 @@ class Prefs { Prefs::DISABLE_CONDITIONAL_COUNTERS => [ false, Config::T_BOOL ], Prefs::WIDESCREEN_MODE => [ false, Config::T_BOOL ], Prefs::CDM_ENABLE_GRID => [ false, Config::T_BOOL ], + Prefs::DIGEST_MIN_SCORE => [ 0, Config::T_INT ], ]; const _PROFILE_BLACKLIST = [ @@ -138,6 +140,7 @@ class Prefs { //Prefs::SORT_HEADLINES_BY_FEED_DATE, Prefs::SSL_CERT_SERIAL, Prefs::DIGEST_PREFERRED_TIME, + Prefs::DIGEST_MIN_SCORE, Prefs::_PREFS_MIGRATED ]; @@ -247,7 +250,7 @@ class Prefs { /** * @return bool|int|null|string */ - static function get(string $pref_name, int $owner_uid, ?int $profile_id) { + static function get(string $pref_name, int $owner_uid, ?int $profile_id = null) { return self::get_instance()->_get($pref_name, $owner_uid, $profile_id); } diff --git a/classes/UrlHelper.php b/classes/UrlHelper.php index 82b8bf36e..7c426bedf 100644 --- a/classes/UrlHelper.php +++ b/classes/UrlHelper.php @@ -391,12 +391,12 @@ class UrlHelper { $response = $client->request($post_query ? 'POST' : 'GET', $url, $req_options); } catch (\LengthException $ex) { // Either 'Content-Length' indicated the download limit would be exceeded, or the transfer actually exceeded the download limit. - self::$fetch_last_error = (string) $ex; + self::$fetch_last_error = $ex->getMessage(); $span->setAttribute('error', self::$fetch_last_error); $span->end(); return false; } catch (GuzzleHttp\Exception\GuzzleException $ex) { - self::$fetch_last_error = (string) $ex; + self::$fetch_last_error = $ex->getMessage(); if ($ex instanceof GuzzleHttp\Exception\RequestException) { if ($ex instanceof GuzzleHttp\Exception\BadResponseException) { |