Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MDL-32508 Add error when trying to access an unknown course section

  • Loading branch information...
commit 0c053c536821492c2edbec19ea9cc0516b6a72bb 1 parent 3df72f8
@andrewnicols andrewnicols authored danpoltawski committed
Showing with 7 additions and 0 deletions.
  1. +6 −0 course/format/renderer.php
  2. +1 −0  lang/en/error.php
View
6 course/format/renderer.php
@@ -419,6 +419,12 @@ public function print_single_section_page($course, $sections, $mods, $modnames,
$context = context_course::instance($course->id);
$canviewhidden = has_capability('moodle/course:viewhiddensections', $context);
+ if (!isset($sections[$displaysection])) {
+ // This section doesn't exist
+ print_error('unknowncoursesection', 'error', null, $course->fullname);
+ return;
+ }
+
if (!$sections[$displaysection]->visible && !$canviewhidden) {
if (!$course->hiddensections) {
echo $this->start_section_list();
View
1  lang/en/error.php
@@ -475,6 +475,7 @@
$string['unknowncontext'] = 'This is an unknown context.';
$string['unknowncourse'] = 'Unknown course named "{$a}"';
$string['unknowncourseidnumber'] = 'Unknown course ID "{$a}"';
+$string['unknowncoursesection'] = 'Unknown course section in course "{$a}"';
$string['unknowncourserequest'] = 'Unknown course request';
$string['unknownfiletype'] = 'Error unknown filtertype';
$string['unknowngroup'] = 'Unknown group "{$a}"';
Please sign in to comment.
Something went wrong with that request. Please try again.