Skip to content

Commit

Permalink
MDL-66875 calendar: allow the use of day, mon and year again.
Browse files Browse the repository at this point in the history
  • Loading branch information
lucaboesch committed Jan 24, 2020
1 parent 4e41ace commit 7287834
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions calendar/view.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,23 @@
$categoryid = optional_param('category', null, PARAM_INT);
$courseid = optional_param('course', SITEID, PARAM_INT);
$view = optional_param('view', 'upcoming', PARAM_ALPHA);
$day = optional_param('cal_d', 0, PARAM_INT);
$mon = optional_param('cal_m', 0, PARAM_INT);
$year = optional_param('cal_y', 0, PARAM_INT);
$time = optional_param('time', 0, PARAM_INT);
$lookahead = optional_param('lookahead', null, PARAM_INT);

$url = new moodle_url('/calendar/view.php');

// If a day, month and year were passed then convert it to a timestamp. If these were passed
// then we can assume the day, month and year are passed as Gregorian, as no where in core
// should we be passing these values rather than the time. This is done for BC.
if (!empty($day) && !empty($mon) && !empty($year)) {
if (checkdate($mon, $day, $year)) {
$time = make_timestamp($year, $mon, $day);
}
}

if (empty($time)) {
$time = time();
}
Expand Down

0 comments on commit 7287834

Please sign in to comment.