MDL-68845 calendar: Move duplicated code to function

This commit is contained in:
Juan Leyva 2020-09-16 18:41:47 +02:00
parent 5486b031ee
commit ea9c822fc3
4 changed files with 49 additions and 7 deletions

View file

@ -141,10 +141,9 @@ $formdata = array(
$exportform = new core_calendar_export_form(null, $formdata);
$calendarurl = '';
if ($data = $exportform->get_data()) {
$password = $DB->get_record('user', array('id' => $USER->id), 'password');
$params = array();
$params['userid'] = $USER->id;
$params['authtoken'] = sha1($USER->id . (isset($password->password) ? $password->password : '') . $CFG->calendar_exportsalt);
$params['authtoken'] = calendar_get_export_token($USER);
$params['preset_what'] = $data->events['exportevents'];
$params['preset_time'] = $data->period['timeperiod'];