From 600bd4aa491ff8f3e36ba76c9540c1ddaaaa95d8 Mon Sep 17 00:00:00 2001 From: garvinhicking Date: Tue, 23 Aug 2005 11:34:02 +0000 Subject: [PATCH] Fix some Atom parsing issues, and fix GUID when using permalinks without %id%. Thanks to Riscky! --- include/functions.inc.php | 21 ++++++++++++++++++++- rss.php | 3 ++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/include/functions.inc.php b/include/functions.inc.php index 9ae649b..36e5038 100644 --- a/include/functions.inc.php +++ b/include/functions.inc.php @@ -282,7 +282,26 @@ function serendipity_utf8_encode($string) { } function serendipity_rss_getguid($entry, $comments = false) { - $guid = serendipity_archiveURL((isset($entry['entryid']) && $entry['entryid'] != '' ? $entry['entryid'] : $entry['id']), 'guid', 'baseURL', true, array('timestamp' => $entry['timestamp'])); + global $serendipity; + + $id = (isset($entry['entryid']) && $entry['entryid'] != '' ? $entry['entryid'] : $entry['id']); + + // When using %id%, we can make the GUID shorter and independent from the title. + // If not using %id%, the entryid needs to be used for uniqueness. + if (stristr($serendipity['permalinkStructure'], '%id%') !== FALSE) { + $title = 'guid'; + } else { + $title = $id; + } + + $guid = serendipity_archiveURL( + $id, + $title, + 'baseURL', + true, + array('timestamp' => $entry['timestamp']) + ); + if ($comments == true) { $guid .= '#c' . $entry['commentid']; } diff --git a/rss.php b/rss.php index 3d05a54..0a685c5 100644 --- a/rss.php +++ b/rss.php @@ -121,6 +121,7 @@ if (is_array($plugins)) { serendipity_plugin_api::hook_event('frontend_rss', $metadata); +$self_url = 'http://' . $_SERVER['HTTP_HOST'] . htmlspecialchars($_SERVER['REQUEST_URI']); echo ''; if (strstr($version, 'atom')) { @@ -284,7 +285,7 @@ case 'atom1.0': xmlns:admin="http://webns.net/mvcb/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"> - + {$metadata['title']} -- 2.39.5