From fb3ff9801499ef806cf89f4b30dd3eca4b7e1776 Mon Sep 17 00:00:00 2001 From: Sam Hemelryk Date: Wed, 20 Mar 2013 17:27:08 +1300 Subject: [PATCH] MDL-38055 course: fixed double encoding of title properties Conflicts: lib/navigationlib.php --- blocks/course_overview/renderer.php | 3 ++- lib/navigationlib.php | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/blocks/course_overview/renderer.php b/blocks/course_overview/renderer.php index 8c424281c64..f532b181b77 100644 --- a/blocks/course_overview/renderer.php +++ b/blocks/course_overview/renderer.php @@ -104,7 +104,8 @@ class block_course_overview_renderer extends plugin_renderer_base { $html .= html_writer::end_tag('div'); } - $attributes = array('title' => s($course->fullname)); + // No need to pass title through s() here as it will be done automatically by html_writer. + $attributes = array('title' => $course->fullname); if ($course->id > 0) { $courseurl = new moodle_url('/course/view.php', array('id' => $course->id)); $coursefullname = format_string($course->fullname, true, $course->id); diff --git a/lib/navigationlib.php b/lib/navigationlib.php index bc9e1b0129e..a6699fffe70 100644 --- a/lib/navigationlib.php +++ b/lib/navigationlib.php @@ -2358,6 +2358,7 @@ class global_navigation extends navigation_node { $issite = ($course->id == $SITE->id); $shortname = format_string($course->shortname, true, array('context' => $coursecontext)); + $fullname = format_string($course->fullname, true, array('context' => $coursecontext)); if ($issite) { $parent = $this; @@ -2396,7 +2397,9 @@ class global_navigation extends navigation_node { $coursenode = $parent->add($shortname, $url, self::TYPE_COURSE, $shortname, $course->id); $coursenode->nodetype = self::NODETYPE_BRANCH; $coursenode->hidden = (!$course->visible); - $coursenode->title(format_string($course->fullname, true, array('context' => context_course::instance($course->id)))); + // We need to decode &'s here as they will have been added by format_string above and attributes will be encoded again + // later. + $coursenode->title(str_replace('&', '&', $fullname)); if (!$forcegeneric) { $this->addedcourses[$course->id] = $coursenode; }