From: brockhaus Date: Fri, 27 Jul 2007 14:17:34 +0000 (+0000) Subject: Atom feeds became invalid, if entry has href or src attributes containing char repres... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=ee304ad9bca1233d814d97262cd632ce3f26d791;p=s9y.git Atom feeds became invalid, if entry has href or src attributes containing char represented by XML Entities normaly (like href="test.de?a=1&b=2") --- diff --git a/docs/NEWS b/docs/NEWS index abfd084..a66be57 100644 --- a/docs/NEWS +++ b/docs/NEWS @@ -3,6 +3,11 @@ Version 1.3 () ------------------------------------------------------------------------ + * Atom feeds became invalid, if entry has href or src attributes + containing char represented by XML Entities normaly + (like href="test.de?a=1&b=2") + (brockhaus) + * The recent entries sidebar plugin shiped with s9y listed entries not accessable by the current user because of right restrictions. (brockhaus) @@ -22,8 +27,8 @@ Version 1.2 () * (beta4) Fix comment-RSS feeds - * (beta4) serendipity_plugin_comments now also supports Favatars in - combination with serendipity_event_gravatar instead of + * (beta4) serendipity_plugin_comments now also supports Favatars and + Pavatars in combination with serendipity_event_gravatar instead of Gravatars only. (brockhaus) * (beta4) Fix wrong event hook for entry manager to display toolbar diff --git a/include/functions_rss.inc.php b/include/functions_rss.inc.php index fdbcc84..28e09c6 100644 --- a/include/functions_rss.inc.php +++ b/include/functions_rss.inc.php @@ -64,8 +64,9 @@ function serendipity_printEntries_rss(&$entries, $version, $comments = false, $f $ext = ''; } - $addData = array('from' => 'functions_entries:printEntries_rss'); + $addData = array('from' => 'functions_entries:printEntries_rss','rss_options' => $options); serendipity_plugin_api::hook_event('frontend_display', $entry, $addData); + // Do some relative -> absolute URI replacing magic. Replaces all HREF/SRC (, , ...) references to only the serendipitypath with the full baseURL URI // garvin: Could impose some problems. Closely watch this one. $entry['body'] = preg_replace('@(href|src)=("|\')(' . preg_quote($serendipity['serendipityHTTPPath']) . ')(.*)("|\')(.*)>@imsU', '\1=\2' . $serendipity['baseURL'] . '\4\2\6>', $entry['body']); @@ -132,10 +133,16 @@ function serendipity_printEntries_rss(&$entries, $version, $comments = false, $f case 'atom0.3': $entry_hook = 'frontend_display:atom-0.3:per_entry'; + $hrefPattern = '@(href|src)\s*?="(.*?)"@si'; + $entry['feed_body'] = preg_replace_callback($hrefPattern, _hrefsrcEntityReplacer, $entry['feed_body']); + $entry['feed_ext'] = preg_replace_callback($hrefPattern, _hrefsrcEntityReplacer, $entry['feed_ext']); break; case 'atom1.0': - $entry_hook = 'frontend_display:atom-1.0:per_entry'; + $entry_hook = 'frontend_display:atom-1.0:per_entry'; + $hrefPattern = '@(href|src)\s*?="(.*?)"@si'; + $entry['feed_body'] = preg_replace_callback($hrefPattern, _hrefsrcEntityReplacer, $entry['feed_body']); + $entry['feed_ext'] = preg_replace_callback($hrefPattern, _hrefsrcEntityReplacer, $entry['feed_ext']); break; } @@ -143,4 +150,10 @@ function serendipity_printEntries_rss(&$entries, $version, $comments = false, $f $entry['per_entry_display_dat'] = $entry['display_dat']; } } + +} + +function _hrefsrcEntityReplacer($treffer){ + return $treffer[1] . '="' . htmlspecialchars($treffer[2]) . '"'; } +