fix date parsing in feeds
This commit is contained in:
parent
76798ff3f2
commit
9c9c7e6bb8
|
@ -15,7 +15,7 @@
|
||||||
|
|
||||||
if ($op == "feeds") {
|
if ($op == "feeds") {
|
||||||
|
|
||||||
if ($fetch) update_all_feeds($link);
|
if ($fetch) update_all_feeds($link, $fetch);
|
||||||
|
|
||||||
$result = pg_query("SELECT *,
|
$result = pg_query("SELECT *,
|
||||||
(SELECT count(id) FROM ttrss_entries
|
(SELECT count(id) FROM ttrss_entries
|
||||||
|
|
|
@ -1,12 +1,19 @@
|
||||||
<?
|
<?
|
||||||
require_once 'config.php';
|
require_once 'config.php';
|
||||||
|
|
||||||
function update_all_feeds($link) {
|
function update_all_feeds($link, $fetch) {
|
||||||
|
|
||||||
$result = pg_query($link, "SELECT feed_url,id FROM ttrss_feeds WHERE
|
if (!$fetch) {
|
||||||
last_updated is null OR title = '' OR
|
|
||||||
EXTRACT(EPOCH FROM NOW()) - EXTRACT(EPOCH FROM last_updated) > " .
|
$result = pg_query($link, "SELECT feed_url,id FROM ttrss_feeds WHERE
|
||||||
MIN_UPDATE_TIME);
|
last_updated is null OR title = '' OR
|
||||||
|
EXTRACT(EPOCH FROM NOW()) - EXTRACT(EPOCH FROM last_updated) > " .
|
||||||
|
MIN_UPDATE_TIME);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
$result = pg_query($link, "SELECT feed_url,id FROM ttrss_feeds");
|
||||||
|
}
|
||||||
|
|
||||||
$num_unread = 0;
|
$num_unread = 0;
|
||||||
|
|
||||||
|
@ -41,15 +48,16 @@
|
||||||
if (!$entry_guid) $entry_guid = $item["guid"];
|
if (!$entry_guid) $entry_guid = $item["guid"];
|
||||||
if (!$entry_guid) $entry_guid = $item["link"];
|
if (!$entry_guid) $entry_guid = $item["link"];
|
||||||
|
|
||||||
$entry_timestamp = $item["pubdate"];
|
$entry_timestamp = "";
|
||||||
if (!$entry_timestamp) $entry_timestamp = $item["modified"];
|
|
||||||
if (!$entry_timestamp) $entry_timestamp = $item["updated"];
|
$rss_2_date = $item['pubdate'];
|
||||||
|
$rss_1_date = $item['dc']['date'];
|
||||||
if (!$entry_timestamp) continue;
|
$atom_date = $item['issued'];
|
||||||
|
|
||||||
$entry_timestamp = strtotime($entry_timestamp);
|
if ($atom_date != "") $entry_timestamp = parse_w3cdtf($atom_date);
|
||||||
|
if ($rss_1_date != "") $entry_timestamp = parse_w3cdtf($rss_1_date);
|
||||||
if (!$entry_timestamp) continue;
|
if ($rss_2_date != "") $entry_timestamp = strtotime($rss_2_date);
|
||||||
|
if ($entry_timestamp == "") $entry_timestamp = time();
|
||||||
|
|
||||||
$entry_title = $item["title"];
|
$entry_title = $item["title"];
|
||||||
$entry_link = $item["link"];
|
$entry_link = $item["link"];
|
||||||
|
|
Loading…
Reference in New Issue