From 39616d39c4a65296ea98e29e0ff22bc6d9ca8ba4 Mon Sep 17 00:00:00 2001 From: Dan Poltawski Date: Sat, 7 Sep 2013 09:45:07 +0800 Subject: [PATCH] MDL-41623 rss: clean output rss content --- blocks/rss_client/viewfeed.php | 7 ++++--- blog/renderer.php | 11 +++++++---- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/blocks/rss_client/viewfeed.php b/blocks/rss_client/viewfeed.php index 1c287d703c5..26451d6b742 100644 --- a/blocks/rss_client/viewfeed.php +++ b/blocks/rss_client/viewfeed.php @@ -84,15 +84,16 @@ if (!empty($rssrecord->preferredtitle)) { $feedtitle = $rss->get_title(); } echo ''."\n"; -echo ''."\n"; +echo ''."\n"; foreach ($rss->get_items() as $item) { echo ''."\n"; echo ''."\n"; echo ''."\n"; + echo format_text($item->get_description(), FORMAT_HTML) .''."\n"; } echo '
'. $feedtitle .'
'. s($feedtitle) .'
'."\n"; - echo ''. $item->get_title(); + echo ''; + echo s($item->get_title()); echo ''."\n"; echo '
'; - echo $item->get_description() .'
'."\n"; diff --git a/blog/renderer.php b/blog/renderer.php index b605016d10e..af1724de1ab 100644 --- a/blog/renderer.php +++ b/blog/renderer.php @@ -119,11 +119,14 @@ class core_blog_renderer extends plugin_renderer_base { // Body. $o .= format_text($entry->summary, $entry->summaryformat, array('overflowdiv' => true)); - // Uniquehash is used as a link to an external blog. if (!empty($entry->uniquehash)) { - $o .= $this->output->container_start('externalblog'); - $o .= html_writer::link($entry->uniquehash, get_string('linktooriginalentry', 'blog')); - $o .= $this->output->container_end(); + // Uniquehash is used as a link to an external blog. + $url = clean_param($entry->uniquehash, PARAM_URL); + if (!empty($url)) { + $o .= $this->output->container_start('externalblog'); + $o .= html_writer::link($url, get_string('linktooriginalentry', 'blog')); + $o .= $this->output->container_end(); + } } // Links to tags.