mirror of
https://github.com/catalyst/moodle-auth_outage.git
synced 2026-05-16 21:41:31 +02:00
* Fix #314: Switch optional_param starttime to optional_param_array * convert default startime to timestamp * fix error debug warning
This commit is contained in:
19
edit.php
19
edit.php
@@ -48,7 +48,24 @@ if ($mform->is_cancelled()) {
|
||||
|
||||
$clone = optional_param('clone', 0, PARAM_INT);
|
||||
$edit = optional_param('edit', 0, PARAM_INT);
|
||||
$time = optional_param('starttime', 0, PARAM_INT);
|
||||
if (array_key_exists('starttime', $_POST) && is_array($_POST['starttime'])) {
|
||||
$start = optional_param_array('starttime', [], PARAM_INT);
|
||||
} else {
|
||||
$start = optional_param('starttime', 0, PARAM_INT);
|
||||
}
|
||||
if (!empty($start['year']) && !empty($start['month']) && !empty($start['day'])) {
|
||||
$hour = $start['hour'] ?? 0;
|
||||
$minute = $start['minute'] ?? 0;
|
||||
$time = make_timestamp(
|
||||
(int) $start['year'],
|
||||
(int) $start['month'],
|
||||
(int) $start['day'],
|
||||
(int) $hour,
|
||||
(int) $minute
|
||||
);
|
||||
} else {
|
||||
$time = 0;
|
||||
}
|
||||
if ($clone && $edit) {
|
||||
throw new invalid_parameter_exception('Cannot provide both clone and edit ids.');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user