summaryrefslogtreecommitdiff
path: root/classes/digest.php
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2021-03-02 19:21:21 +0300
committerAndrew Dolgov <[email protected]>2021-03-02 19:21:21 +0300
commitba86c64d38d9995d38af163ae4c51a42b21d5de7 (patch)
tree3180dba6d383a89e26e38a893170315344a8fb17 /classes/digest.php
parent386316aba1b955f50502562e1308e02680ffe997 (diff)
add digest preview button, also fix a bunch of bugs
Diffstat (limited to 'classes/digest.php')
-rw-r--r--classes/digest.php16
1 files changed, 8 insertions, 8 deletions
diff --git a/classes/digest.php b/classes/digest.php
index 26ca5221f..2fea99344 100644
--- a/classes/digest.php
+++ b/classes/digest.php
@@ -78,7 +78,7 @@ class Digest
Debug::log("All done.");
}
- static function prepare_headlines_digest($user_id, $days = 1, $limit = 1000) {
+ static function prepare_headlines_digest(int $user_id, int $days = 1, int $limit = 1000) {
$tpl = new Templator();
$tpl_t = new Templator();
@@ -87,20 +87,22 @@ class Digest
$tpl_t->readTemplateFromFile("digest_template.txt");
$user_tz_string = get_pref(Prefs::USER_TIMEZONE, $user_id);
+
+ if ($user_tz_string == 'Automatic')
+ $user_tz_string = 'GMT';
+
$local_ts = TimeHelper::convert_timestamp(time(), 'UTC', $user_tz_string);
$tpl->setVariable('CUR_DATE', date('Y/m/d', $local_ts));
$tpl->setVariable('CUR_TIME', date('G:i', $local_ts));
- $tpl->setVariable('TTRSS_HOST', Config::get(Config::get(Config::SELF_URL_PATH)));
+ $tpl->setVariable('TTRSS_HOST', Config::get(Config::SELF_URL_PATH));
$tpl_t->setVariable('CUR_DATE', date('Y/m/d', $local_ts));
$tpl_t->setVariable('CUR_TIME', date('G:i', $local_ts));
- $tpl_t->setVariable('TTRSS_HOST', Config::get(Config::get(Config::SELF_URL_PATH)));
+ $tpl_t->setVariable('TTRSS_HOST', Config::get(Config::SELF_URL_PATH));
$affected_ids = array();
- $days = (int) $days;
-
if (Config::get(Config::DB_TYPE) == "pgsql") {
$interval_qpart = "ttrss_entries.date_updated > NOW() - INTERVAL '$days days'";
} else /* if (Config::get(Config::DB_TYPE) == "mysql") */ {
@@ -131,9 +133,7 @@ class Digest
AND score >= 0
ORDER BY ttrss_feed_categories.title, ttrss_feeds.title, score DESC, date_updated DESC
LIMIT :limit");
- $sth->bindParam(':user_id', intval($user_id, 10), PDO::PARAM_INT);
- $sth->bindParam(':limit', intval($limit, 10), PDO::PARAM_INT);
- $sth->execute();
+ $sth->execute([':user_id' => $user_id, ':limit' => $limit]);
$headlines_count = 0;
$headlines = array();