Fixed a couple of warnings which happened if you accessed a course while
not being logged in, during the redirection to login screen.
This commit is contained in:
+5
-1
@@ -929,7 +929,7 @@ function calendar_session_vars() {
|
||||
$SESSION->cal_show_course = true;
|
||||
}
|
||||
if(!isset($SESSION->cal_show_user)) {
|
||||
$SESSION->cal_show_user = $USER->id;
|
||||
$SESSION->cal_show_user = isset($USER->id) ? $USER->id : false;
|
||||
}
|
||||
if(empty($SESSION->cal_courses_shown)) {
|
||||
$SESSION->cal_courses_shown = calendar_get_default_courses(true);
|
||||
@@ -1074,6 +1074,10 @@ function calendar_get_default_courses($ignoreref = false) {
|
||||
return array($SESSION->cal_course_referer => 1);
|
||||
}
|
||||
|
||||
if(empty($USER)) {
|
||||
return array();
|
||||
}
|
||||
|
||||
$courses = array();
|
||||
if(isadmin($USER->id)) {
|
||||
$courses = get_records_sql('SELECT id, 1 FROM '.$CFG->prefix.'course');
|
||||
|
||||
Reference in New Issue
Block a user