From 1f64b1be201ee9b23ea52e4021bc5264697dc5b5 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Tue, 26 Sep 2006 07:44:05 +0100 Subject: import articles which have no link or guid (hello, microsoft); include guids in exported feeds --- backend.php | 10 +++++++--- functions.php | 13 +++++++++++-- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/backend.php b/backend.php index ebbf33a68..719cb1b16 100644 --- a/backend.php +++ b/backend.php @@ -593,9 +593,13 @@ if ($entry_author) { $entry_author = " - by $entry_author"; } - - print "" . $line["title"] . - "$entry_author"; + + if ($line["link"]) { + print "" . + $line["title"] . "$entry_author"; + } else { + print "" . $line["title"] . "$entry_author"; + } $parsed_updated = date(get_pref($link, 'LONG_DATE_FORMAT'), strtotime($line["updated"])); diff --git a/functions.php b/functions.php index cfad6cc79..56c778071 100644 --- a/functions.php +++ b/functions.php @@ -491,7 +491,8 @@ if (!$entry_guid) $entry_guid = $item["guid"]; if (!$entry_guid) $entry_guid = $item["link"]; - + if (!$entry_guid) $entry_guid = make_guid_from_title($item["title"]); + if (!$entry_guid) continue; $entry_timestamp = ""; @@ -521,7 +522,7 @@ if (!$entry_link) $entry_link = $item["link"]; if (!$entry_title) continue; - if (!$entry_link) continue; +# if (!$entry_link) continue; $entry_link = strip_tags($entry_link); @@ -2279,6 +2280,7 @@ $content_query_part = "content as content_preview,"; $query = "SELECT + guid, ttrss_entries.id,ttrss_entries.title, SUBSTRING(updated,1,16) as updated, unread,feed_id,marked,link,last_read, @@ -2308,6 +2310,7 @@ $feed_kind = "Tags"; $result = db_query($link, "SELECT + guid, ttrss_entries.id as id,title, SUBSTRING(updated,1,16) as updated, unread,feed_id, @@ -2351,6 +2354,7 @@ while ($line = db_fetch_assoc($result)) { print ""; + print "" . htmlspecialchars($line["guid"]) . ""; print "" . htmlspecialchars($line["link"]) . ""; $rfc822_date = date('r', strtotime($line["updated"])); @@ -2588,4 +2592,9 @@ return htmlspecialchars(db_unescape_string($s)); } + function make_guid_from_title($title) { + return preg_replace("/[ \"\',.:;]/", "-", + mb_strtolower(strip_tags($title))); + } + ?> -- cgit v1.2.3