Skip to content

Commit

Permalink
MDL-50881 calendar: do not throw exception without sesskey
Browse files Browse the repository at this point in the history
  • Loading branch information
marinaglancy committed Aug 11, 2015
1 parent 57739a7 commit 10c82ca
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions calendar/set.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@
require_once('../config.php');
require_once($CFG->dirroot.'/calendar/lib.php');

require_sesskey();

$var = required_param('var', PARAM_ALPHA);
$return = clean_param(base64_decode(required_param('return', PARAM_RAW)), PARAM_LOCALURL);
$courseid = optional_param('id', -1, PARAM_INT);
Expand All @@ -51,6 +49,12 @@
} else {
$return = new moodle_url($return);
}

if (!confirm_sesskey()) {
// Do not call require_sesskey() since this page may be accessed without session (for example by bots).
redirect($return);
}

$url = new moodle_url('/calendar/set.php', array('return'=>base64_encode($return->out_as_local_url(false)), 'course' => $courseid, 'var'=>$var, 'sesskey'=>sesskey()));
$PAGE->set_url($url);
$PAGE->set_context(context_system::instance());
Expand Down

0 comments on commit 10c82ca

Please sign in to comment.