]> git.mjollnir.org Git - s9y.git/commitdiff
Atom feeds became invalid, if entry has href or src attributes containing char repres...
authorbrockhaus <brockhaus>
Fri, 27 Jul 2007 14:17:34 +0000 (14:17 +0000)
committerbrockhaus <brockhaus>
Fri, 27 Jul 2007 14:17:34 +0000 (14:17 +0000)
docs/NEWS
include/functions_rss.inc.php

index abfd0842f1beade55559a54d49ada4f5d4cd5fd6..a66be57356fddc145bbf167fc673879b3ed4fbf3 100644 (file)
--- 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
index fdbcc843b9ddd68fc53050f9aaffc5338cfabffa..28e09c6338e6e35e4a266a6b58e5a32e52a92a33 100644 (file)
@@ -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 (<a>, <img>, ...) 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]) . '"';    
 }
+