import articles which have no link or guid (hello, microsoft); include guids in exported feeds

This commit is contained in:
Andrew Dolgov 2006-09-26 07:44:05 +01:00
parent 7d3ab0dd30
commit 1f64b1be20
2 changed files with 18 additions and 5 deletions

View file

@ -593,9 +593,13 @@
if ($entry_author) { if ($entry_author) {
$entry_author = " - by $entry_author"; $entry_author = " - by $entry_author";
} }
print "<tr><td><a $link_target href=\"" . $line["link"] . "\">" . $line["title"] . if ($line["link"]) {
"</a>$entry_author</td>"; print "<tr><td><a $link_target href=\"" . $line["link"] . "\">" .
$line["title"] . "</a>$entry_author</td>";
} else {
print "<tr><td>" . $line["title"] . "$entry_author</td>";
}
$parsed_updated = date(get_pref($link, 'LONG_DATE_FORMAT'), $parsed_updated = date(get_pref($link, 'LONG_DATE_FORMAT'),
strtotime($line["updated"])); strtotime($line["updated"]));

View file

@ -491,7 +491,8 @@
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"];
if (!$entry_guid) $entry_guid = make_guid_from_title($item["title"]);
if (!$entry_guid) continue; if (!$entry_guid) continue;
$entry_timestamp = ""; $entry_timestamp = "";
@ -521,7 +522,7 @@
if (!$entry_link) $entry_link = $item["link"]; if (!$entry_link) $entry_link = $item["link"];
if (!$entry_title) continue; if (!$entry_title) continue;
if (!$entry_link) continue; # if (!$entry_link) continue;
$entry_link = strip_tags($entry_link); $entry_link = strip_tags($entry_link);
@ -2279,6 +2280,7 @@
$content_query_part = "content as content_preview,"; $content_query_part = "content as content_preview,";
$query = "SELECT $query = "SELECT
guid,
ttrss_entries.id,ttrss_entries.title, ttrss_entries.id,ttrss_entries.title,
SUBSTRING(updated,1,16) as updated, SUBSTRING(updated,1,16) as updated,
unread,feed_id,marked,link,last_read, unread,feed_id,marked,link,last_read,
@ -2308,6 +2310,7 @@
$feed_kind = "Tags"; $feed_kind = "Tags";
$result = db_query($link, "SELECT $result = db_query($link, "SELECT
guid,
ttrss_entries.id as id,title, ttrss_entries.id as id,title,
SUBSTRING(updated,1,16) as updated, SUBSTRING(updated,1,16) as updated,
unread,feed_id, unread,feed_id,
@ -2351,6 +2354,7 @@
while ($line = db_fetch_assoc($result)) { while ($line = db_fetch_assoc($result)) {
print "<item>"; print "<item>";
print "<id>" . htmlspecialchars($line["guid"]) . "</id>";
print "<link>" . htmlspecialchars($line["link"]) . "</link>"; print "<link>" . htmlspecialchars($line["link"]) . "</link>";
$rfc822_date = date('r', strtotime($line["updated"])); $rfc822_date = date('r', strtotime($line["updated"]));
@ -2588,4 +2592,9 @@
return htmlspecialchars(db_unescape_string($s)); return htmlspecialchars(db_unescape_string($s));
} }
function make_guid_from_title($title) {
return preg_replace("/[ \"\',.:;]/", "-",
mb_strtolower(strip_tags($title)));
}
?> ?>