]> git.mjollnir.org Git - moodle.git/commitdiff
Changed some conditions against the $USER variable
authorstronk7 <stronk7>
Wed, 6 Oct 2004 16:52:24 +0000 (16:52 +0000)
committerstronk7 <stronk7>
Wed, 6 Oct 2004 16:52:24 +0000 (16:52 +0000)
to work fine under PHP5.

Bug 2053
(http://moodle.org/bugs/bug.php?op=show&bugid=2053)

Merged from MOODLE_14_STABLE

calendar/lib.php
calendar/view.php
course/lib.php
mod/forum/lib.php
user/edit.php

index e4588dc1cb06af0cfabb76f30a0867f5c210312c..e569689d9a160bc95b995efc52e0ef44610c7701 100644 (file)
@@ -593,7 +593,7 @@ function calendar_filter_controls($type, $vars = NULL, $course = NULL) {
         $content .= '<td style="width: 8px;"></td><td><a href="'.CALENDAR_URL.'set.php?var=showcourses'.$getvars.'" title="'.get_string('tt_showcourse', 'calendar').'">'.get_string('courseevents', 'calendar').'</a></td>'."\n";
     }
 
-    if(!empty($USER) && !isguest()) {
+    if(!empty($USER->id) && !isguest()) {
         $content .= "</tr>\n<tr>";
 
         if($groupevents) {
@@ -864,13 +864,13 @@ function calendar_get_course_cached(&$coursecache, $courseid) {
 function calendar_session_vars() {
     global $SESSION, $USER;
 
-    if(isset($USER) && isset($USER->realuser) && !isset($SESSION->cal_loggedinas)) {
+    if(!empty($USER->id) && isset($USER->realuser) && !isset($SESSION->cal_loggedinas)) {
         // We just logged in as someone else, update the filtering
         unset($SESSION->cal_users_shown);
         unset($SESSION->cal_courses_shown);
         $SESSION->cal_loggedinas = true;
     }
-    else if(isset($USER) && !isset($USER->realuser) && isset($SESSION->cal_loggedinas)) {
+    else if(!empty($USER->id) && !isset($USER->realuser) && isset($SESSION->cal_loggedinas)) {
         // We just logged back to our real self, update again
         unset($SESSION->cal_users_shown);
         unset($SESSION->cal_courses_shown);
@@ -1010,7 +1010,7 @@ function calendar_set_filters(&$courses, &$group, &$user, $courseeventsfrom = NU
 function calendar_edit_event_allowed($event) {
     global $USER;
 
-    if(empty($USER) || isguest($USER->id)) {
+    if(empty($USER->id) || isguest($USER->id)) {
         return false;
     }
 
@@ -1045,7 +1045,7 @@ function calendar_get_default_courses($ignoreref = false) {
         return array($SESSION->cal_course_referer => 1);
     }
 
-    if(empty($USER)) {
+    if(empty($USER->id)) {
         return array();
     }
 
index 8ade21a9fd79e691e319cdf3d8ee02cfd4903fb5..6e7c236419db8097cbee38a1f11f63fe595b5159 100644 (file)
         }
     }
 
-    if (empty($USER) or isguest()) {
+    if (empty($USER->id) or isguest()) {
         $defaultcourses = calendar_get_default_courses();
         calendar_set_filters($courses, $groups, $users, $defaultcourses, $defaultcourses);
 
@@ -198,7 +198,7 @@ function calendar_show_day($d, $m, $y, $courses, $groups, $users) {
     $events = calendar_get_upcoming($courses, $groups, $users, 1, 100, $starttime);
 
     // New event button
-    if (empty($USER) || isguest()) {
+    if (empty($USER->id) || isguest()) {
         $text = get_string('dayview', 'calendar').': '.calendar_course_filter_selector($getvars);
     } else {
         $text = '<div style="float: left;">'.get_string('dayview', 'calendar').': '.
@@ -319,7 +319,7 @@ function calendar_show_month_detailed($m, $y, $courses, $groups, $users) {
     calendar_events_by_day($events, $m, $y, $eventsbyday, $durationbyday, $typesbyday);
 
     // New event button
-    if(empty($USER) || isguest()) {
+    if(empty($USER->id) || isguest()) {
         $text = get_string('detailedmonthview', 'calendar').': '.calendar_course_filter_selector($getvars);
     }
     else {
@@ -482,7 +482,7 @@ function calendar_show_month_detailed($m, $y, $courses, $groups, $users) {
 
     echo "</tr>\n";
 
-    if(!empty($USER) && !isguest()) {
+    if(!empty($USER->id) && !isguest()) {
         echo '<tr>';
         // Group events
         if($SESSION->cal_show_groups) {
@@ -515,7 +515,7 @@ function calendar_show_upcoming_events($courses, $groups, $users, $futuredays, $
     $events = calendar_get_upcoming($courses, $groups, $users, $futuredays, $maxevents);
 
     // New event button
-    if(empty($USER) || isguest()) {
+    if(empty($USER->id) || isguest()) {
         $text = get_string('upcomingevents', 'calendar').': '.calendar_course_filter_selector('from=upcoming');
 
     } else {
@@ -601,7 +601,7 @@ function calendar_print_event($event) {
 function calendar_course_filter_selector($getvars = '') {
     global $USER, $SESSION;
 
-    if (empty($USER) or isguest()) {
+    if (empty($USER->id) or isguest()) {
         return '';
     }
 
index d25bfb167aec621ec94a6118aa820813e0626825..4ae1afa47adc7f804b069a1135b6d50ad00f1aeb 100644 (file)
@@ -811,7 +811,7 @@ function get_all_sections($courseid) {
 function course_set_display($courseid, $display=0) {
     global $USER;
 
-    if (empty($USER)) {
+    if (empty($USER->id)) {
         return false;
     }
 
index 17f304d3a12e06a36996fd5d364a72d3aeb7cd5e..97727d5dbfffde26a3539432730d62fc20c59a1e 100644 (file)
@@ -202,7 +202,7 @@ function forum_cron () {
         $strforums = get_string('forums', 'forum');
     }
 
-    if (!empty($USER)) { // Remember real USER account if necessary
+    if (!empty($USER->id)) { // Remember real USER account if necessary
         $realuser = $USER;
     }
 
index 640aa6d08b1e9c31a008574f486727e5671f201f..4cd9388d9e8b144da8dff68ff91bc38b90ef09b1 100644 (file)
@@ -1,4 +1,4 @@
-<?PHP // $Id$
+<?php // $Id$
 
     require_once("../config.php");
     require_once("$CFG->libdir/gdlib.php");
@@ -30,7 +30,7 @@
         // so that users can set up their accounts
         $newaccount  = true;
 
-        if (empty($USER)) {
+        if (empty($USER->id)) {
             error("Sessions don't seem to be working on this server!");
         }