Skip to content

Commit

Permalink
MDL-52216 mod_lesson: prevent invalid view modes
Browse files Browse the repository at this point in the history
  • Loading branch information
euven committed Nov 10, 2016
1 parent f4f89d4 commit 2395ad0
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions mod/lesson/edit.php
Expand Up @@ -38,6 +38,10 @@
require_capability('mod/lesson:manage', $context);

$mode = optional_param('mode', get_user_preferences('lesson_view', 'collapsed'), PARAM_ALPHA);
// Ensure a valid mode is set.
if (!in_array($mode, array('single', 'full', 'collapsed'))) {
$mode = 'collapsed';
}
$PAGE->set_url('/mod/lesson/edit.php', array('id'=>$cm->id,'mode'=>$mode));

if ($mode != get_user_preferences('lesson_view', 'collapsed') && $mode !== 'single') {
Expand Down

0 comments on commit 2395ad0

Please sign in to comment.