diff --git a/calendar/event.php b/calendar/event.php index 32574790036..397a98ae5eb 100644 --- a/calendar/event.php +++ b/calendar/event.php @@ -52,6 +52,7 @@ require_variable($_REQUEST['action']); optional_variable($_REQUEST['id']); + optional_variable($_REQUEST['type'], 'select'); $_REQUEST['id'] = intval($_REQUEST['id']); // Always a good idea, against SQL injections if(!$site = get_site()) { @@ -429,10 +430,6 @@ // START: Last column (3-month display) echo '
'; echo calendar_top_controls('display', array('m' => $prevmon, 'y' => $prevyr)); echo calendar_get_mini($courses, $groups, $users, $prevmon, $prevyr); diff --git a/calendar/lib.php b/calendar/lib.php index 8216cc4e850..11bba721c6a 100644 --- a/calendar/lib.php +++ b/calendar/lib.php @@ -611,11 +611,10 @@ function calendar_filter_controls($type, $vars = NULL, $course = NULL) { $getvars = ''; switch($type) { + case 'event': case 'upcoming': - $getvars = '&from=upcoming'; - break; case 'day': - $getvars = '&from=day'; + $getvars = '&from='.$type; break; case 'course': $getvars = '&from=course&id='.$_GET['id']; diff --git a/calendar/set.php b/calendar/set.php index 0358712e996..3989bdb2fe5 100644 --- a/calendar/set.php +++ b/calendar/set.php @@ -95,17 +95,20 @@ } switch($_GET['from']) { + case 'event': + redirect(CALENDAR_URL.'event.php?action='.$_GET['action'].'&type='.$_GET['type'].'&id='.intval($_GET['id'])); + break; case 'month': - redirect($CFG->wwwroot.'/calendar/view.php?view=month&cal_d='.$_GET['cal_d'].'&cal_m='.$_GET['cal_m'].'&cal_y='.$_GET['cal_y']); + redirect(CALENDAR_URL.'view.php?view=month&cal_d='.$_GET['cal_d'].'&cal_m='.$_GET['cal_m'].'&cal_y='.$_GET['cal_y']); break; case 'upcoming': - redirect($CFG->wwwroot.'/calendar/view.php?view=upcoming'); + redirect(CALENDAR_URL.'view.php?view=upcoming'); break; case 'day': - redirect($CFG->wwwroot.'/calendar/view.php?view=day&cal_d='.$_GET['cal_d'].'&cal_m='.$_GET['cal_m'].'&cal_y='.$_GET['cal_y']); + redirect(CALENDAR_URL.'view.php?view=day&cal_d='.$_GET['cal_d'].'&cal_m='.$_GET['cal_m'].'&cal_y='.$_GET['cal_y']); break; case 'course': - redirect($CFG->wwwroot.'/course/view.php?id='.intval($_GET['id'])); + redirect(CALENDAR_URL.'view.php?id='.intval($_GET['id'])); break; default: