From 2ef75eee2f4d639cdfef7fbcefaf4485e143af4b Mon Sep 17 00:00:00 2001 From: defacer Date: Mon, 24 May 2004 11:10:00 +0000 Subject: [PATCH] Fixed a couple of warnings which happened if you accessed a course while not being logged in, during the redirection to login screen. --- calendar/lib.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/calendar/lib.php b/calendar/lib.php index ba94217bc4..8216cc4e85 100644 --- a/calendar/lib.php +++ b/calendar/lib.php @@ -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'); -- 2.39.5