Permalink
Browse files

Changed some conditions against the $USER variable

to work fine under PHP5.

Bug 2053
(http://moodle.org/bugs/bug.php?op=show&bugid=2053)
  • Loading branch information...
stronk7
stronk7 committed Oct 6, 2004
1 parent dcbe586 commit c5544714a85ea41f369a92b6bc84a7ffa8e0c9d4
Showing with 14 additions and 14 deletions.
  1. +5 −5 calendar/lib.php
  2. +6 −6 calendar/view.php
  3. +1 −1 course/lib.php
  4. +1 −1 mod/forum/lib.php
  5. +1 −1 user/edit.php
View
@@ -595,7 +595,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) {
@@ -866,13 +866,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);
@@ -1012,7 +1012,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;
}
@@ -1047,7 +1047,7 @@ function calendar_get_default_courses($ignoreref = false) {
return array($SESSION->cal_course_referer => SITEID);
}
- if(empty($USER)) {
+ if(empty($USER->id)) {
return array();
}
View
@@ -105,7 +105,7 @@
}
}
- 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 '';
}
View
@@ -809,7 +809,7 @@ function get_all_sections($courseid) {
function course_set_display($courseid, $display=0) {
global $USER;
- if (empty($USER)) {
+ if (empty($USER->id)) {
return false;
}
View
@@ -192,7 +192,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;
}
View
@@ -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!");
}

0 comments on commit c554471

Please sign in to comment.