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:
defacer
2004-05-24 11:10:00 +00:00
parent 2727648d55
commit 2ef75eee2f
+5 -1
View File
@@ -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');