From: garvinhicking <garvinhicking> Date: Tue, 23 Aug 2005 11:34:02 +0000 (+0000) Subject: Fix some Atom parsing issues, and fix GUID when using permalinks without %id%. X-Git-Tag: 0.9~183 X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=600bd4aa491ff8f3e36ba76c9540c1ddaaaa95d8;p=s9y.git Fix some Atom parsing issues, and fix GUID when using permalinks without %id%. Thanks to Riscky! --- 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 '<?xml version="1.0" encoding="utf-8" ?>'; 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/"> - <link href="{$serendipity['baseURL']}rss.php?version=atom1.0" rel="self" title="{$metadata['title']}" type="application/x.atom+xml" /> + <link href="{$self_url}" rel="self" title="{$metadata['title']}" type="application/x.atom+xml" /> <link href="{$serendipity['baseURL']}" rel="alternate" title="{$metadata['title']}" type="text/html" /> <link href="{$serendipity['baseURL']}rss.php?version=2.0" rel="alternate" title="{$metadata['title']}" type="application/rss+xml" /> <title type="html">{$metadata['title']}</title>