From 2855042c928950a377ea08f94e0a3e19e9bec1b7 Mon Sep 17 00:00:00 2001 From: comete-upn <logicielslibres@liste.parisnanterre.fr> Date: Fri, 15 Jan 2021 20:38:52 +0100 Subject: [PATCH] Checking that some variables exist before using it. --- renderer.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/renderer.php b/renderer.php index f20219a..4d69459 100644 --- a/renderer.php +++ b/renderer.php @@ -533,7 +533,7 @@ foreach ($htmlsection as $section) { } $titre = $nameSection[$i]; - $sectionIntro = $introSection[$i]; + $sectionIntro = isset($introSection[$i]) ? $introSection[$i] : ''; //If section is hidden continue if ($titre == null && !(has_capability('moodle/course:update', $context = context_course::instance($COURSE->id), $USER->id))) { $i++; @@ -777,7 +777,7 @@ public function print_iena_section_pages($course) // } /* if is not editing verify the rules to display the sections */ if (!$PAGE->user_is_editing() && (!has_capability('moodle/course:viewhiddensections', $context = context_course::instance($course->id), $USER->id))) { - if ($course->hiddensections && !(int)$thissection->visible) { + if (isset($course->hiddensections) && $course->hiddensections && !(int)$thissection->visible) { continue; } if (!$thissection->available && !empty($thissection->availableinfo)) { -- GitLab