]> git.mjollnir.org Git - moodle.git/commitdiff
Fixed a couple of warnings which happened if you accessed a course while
authordefacer <defacer>
Mon, 24 May 2004 11:10:00 +0000 (11:10 +0000)
committerdefacer <defacer>
Mon, 24 May 2004 11:10:00 +0000 (11:10 +0000)
not being logged in, during the redirection to login screen.

calendar/lib.php

index ba94217bc4a0300b673e9cec3c7ce2e574948fff..8216cc4e850f07aa0fdbc1b41e97bb39ac9d9b15 100644 (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');