Merge pull request 'Fix PHP8 strtime warning if argument is null (addendum)' (#86) from mechnich/tt-rss:more-strtotime-fixes into master
Reviewed-on: https://dev.tt-rss.org/fox/tt-rss/pulls/86
This commit is contained in:
commit
0ac143a29b
|
@ -193,7 +193,7 @@ class Counters {
|
||||||
}
|
}
|
||||||
|
|
||||||
// hide default un-updated timestamp i.e. 1970-01-01 (?) -fox
|
// hide default un-updated timestamp i.e. 1970-01-01 (?) -fox
|
||||||
if ((int)date('Y') - (int)date('Y', strtotime($line['last_updated'])) > 2)
|
if ((int)date('Y') - (int)date('Y', strtotime($line['last_updated'] ?? '')) > 2)
|
||||||
$last_updated = '';
|
$last_updated = '';
|
||||||
|
|
||||||
$cv = [
|
$cv = [
|
||||||
|
|
|
@ -22,7 +22,7 @@ class Digest
|
||||||
while ($line = $res->fetch()) {
|
while ($line = $res->fetch()) {
|
||||||
|
|
||||||
if (get_pref(Prefs::DIGEST_ENABLE, $line['id'])) {
|
if (get_pref(Prefs::DIGEST_ENABLE, $line['id'])) {
|
||||||
$preferred_ts = strtotime(get_pref(Prefs::DIGEST_PREFERRED_TIME, $line['id']));
|
$preferred_ts = strtotime(get_pref(Prefs::DIGEST_PREFERRED_TIME, $line['id']) ?? '');
|
||||||
|
|
||||||
// try to send digests within 2 hours of preferred time
|
// try to send digests within 2 hours of preferred time
|
||||||
if ($preferred_ts && time() >= $preferred_ts &&
|
if ($preferred_ts && time() >= $preferred_ts &&
|
||||||
|
|
|
@ -19,19 +19,19 @@ class FeedItem_Atom extends FeedItem_Common {
|
||||||
$updated = $this->elem->getElementsByTagName("updated")->item(0);
|
$updated = $this->elem->getElementsByTagName("updated")->item(0);
|
||||||
|
|
||||||
if ($updated) {
|
if ($updated) {
|
||||||
return strtotime($updated->nodeValue);
|
return strtotime($updated->nodeValue ?? '');
|
||||||
}
|
}
|
||||||
|
|
||||||
$published = $this->elem->getElementsByTagName("published")->item(0);
|
$published = $this->elem->getElementsByTagName("published")->item(0);
|
||||||
|
|
||||||
if ($published) {
|
if ($published) {
|
||||||
return strtotime($published->nodeValue);
|
return strtotime($published->nodeValue ?? '');
|
||||||
}
|
}
|
||||||
|
|
||||||
$date = $this->xpath->query("dc:date", $this->elem)->item(0);
|
$date = $this->xpath->query("dc:date", $this->elem)->item(0);
|
||||||
|
|
||||||
if ($date) {
|
if ($date) {
|
||||||
return strtotime($date->nodeValue);
|
return strtotime($date->nodeValue ?? '');
|
||||||
}
|
}
|
||||||
|
|
||||||
// consistent with strtotime failing to parse
|
// consistent with strtotime failing to parse
|
||||||
|
|
|
@ -17,13 +17,13 @@ class FeedItem_RSS extends FeedItem_Common {
|
||||||
$pubDate = $this->elem->getElementsByTagName("pubDate")->item(0);
|
$pubDate = $this->elem->getElementsByTagName("pubDate")->item(0);
|
||||||
|
|
||||||
if ($pubDate) {
|
if ($pubDate) {
|
||||||
return strtotime($pubDate->nodeValue);
|
return strtotime($pubDate->nodeValue ?? '');
|
||||||
}
|
}
|
||||||
|
|
||||||
$date = $this->xpath->query("dc:date", $this->elem)->item(0);
|
$date = $this->xpath->query("dc:date", $this->elem)->item(0);
|
||||||
|
|
||||||
if ($date) {
|
if ($date) {
|
||||||
return strtotime($date->nodeValue);
|
return strtotime($date->nodeValue ?? '');
|
||||||
}
|
}
|
||||||
|
|
||||||
// consistent with strtotime failing to parse
|
// consistent with strtotime failing to parse
|
||||||
|
|
|
@ -128,9 +128,9 @@ class Handler_Public extends Handler {
|
||||||
$tpl->setVariable('ARTICLE_CONTENT', $content, true);
|
$tpl->setVariable('ARTICLE_CONTENT', $content, true);
|
||||||
|
|
||||||
$tpl->setVariable('ARTICLE_UPDATED_ATOM',
|
$tpl->setVariable('ARTICLE_UPDATED_ATOM',
|
||||||
date('c', strtotime($line["updated"])), true);
|
date('c', strtotime($line["updated"] ?? '')), true);
|
||||||
$tpl->setVariable('ARTICLE_UPDATED_RFC822',
|
$tpl->setVariable('ARTICLE_UPDATED_RFC822',
|
||||||
date(DATE_RFC822, strtotime($line["updated"])), true);
|
date(DATE_RFC822, strtotime($line["updated"] ?? '')), true);
|
||||||
|
|
||||||
$tpl->setVariable('ARTICLE_AUTHOR', htmlspecialchars($line['author']), true);
|
$tpl->setVariable('ARTICLE_AUTHOR', htmlspecialchars($line['author']), true);
|
||||||
|
|
||||||
|
@ -214,7 +214,7 @@ class Handler_Public extends Handler {
|
||||||
$article['title'] = $line['title'];
|
$article['title'] = $line['title'];
|
||||||
$article['excerpt'] = $line["content_preview"];
|
$article['excerpt'] = $line["content_preview"];
|
||||||
$article['content'] = Sanitizer::sanitize($line["content"], false, $owner_uid, $feed_site_url, null, $line["id"]);
|
$article['content'] = Sanitizer::sanitize($line["content"], false, $owner_uid, $feed_site_url, null, $line["id"]);
|
||||||
$article['updated'] = date('c', strtotime($line["updated"]));
|
$article['updated'] = date('c', strtotime($line["updated"] ?? ''));
|
||||||
|
|
||||||
if (!empty($line['note'])) $article['note'] = $line['note'];
|
if (!empty($line['note'])) $article['note'] = $line['note'];
|
||||||
if (!empty($line['author'])) $article['author'] = $line['author'];
|
if (!empty($line['author'])) $article['author'] = $line['author'];
|
||||||
|
|
|
@ -122,7 +122,7 @@ class Af_Psql_Trgm extends Plugin {
|
||||||
|
|
||||||
print "</div>";
|
print "</div>";
|
||||||
|
|
||||||
print "<div style='text-align : right' class='text-muted'>" . TimeHelper::smart_date_time(strtotime($line["updated"])) . "</div>";
|
print "<div style='text-align : right' class='text-muted'>" . TimeHelper::smart_date_time(strtotime($line["updated"] ?? '')) . "</div>";
|
||||||
|
|
||||||
print "</li>";
|
print "</li>";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue