From 7dc30088bcbe327e2e98f7ed9deda5271733c1e5 Mon Sep 17 00:00:00 2001 From: skodak Date: Wed, 17 Jan 2007 19:53:03 +0000 Subject: [PATCH] force login in course calendar SC#349 --- calendar/view.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/calendar/view.php b/calendar/view.php index 82cb148c00b..a8f933b6211 100644 --- a/calendar/view.php +++ b/calendar/view.php @@ -44,8 +44,8 @@ require_once($CFG->dirroot.'/course/lib.php'); require_once($CFG->dirroot.'/calendar/lib.php'); - $course = optional_param('course', 0); - $view = optional_param('view', 'upcoming'); + $courseid = optional_param('course', 0, 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); $yr = optional_param('cal_y', 0, PARAM_INT); @@ -54,7 +54,9 @@ redirect($CFG->wwwroot.'/'.$CFG->admin.'/index.php'); } - if ($CFG->forcelogin) { + if ($courseid) { + require_login($courseid); + } else if ($CFG->forcelogin) { require_login(); } @@ -87,8 +89,8 @@ } // If a course has been supplied in the URL, change the filters to show that one - if (!empty($course)) { - if ($course = get_record('course', 'id', $course)) { + if (!empty($courseid)) { + if ($course = get_record('course', 'id', $courseid)) { if ($course->id == SITEID) { // If coming from the home page, show all courses $SESSION->cal_courses_shown = calendar_get_default_courses(true); @@ -100,6 +102,8 @@ calendar_set_referring_course($SESSION->cal_courses_shown); } } + } else { + $course = null; } if (empty($USER->id) or isguest()) {