]> git.mjollnir.org Git - moodle.git/commitdiff
replace all uses of isset($USER->id) with empty() to allow proper operation of $CFG...
authorskodak <skodak>
Sat, 2 Sep 2006 11:44:04 +0000 (11:44 +0000)
committerskodak <skodak>
Sat, 2 Sep 2006 11:44:04 +0000 (11:44 +0000)
18 files changed:
blocks/blog_menu/block_blog_menu.php
blocks/course_list/block_course_list.php
blocks/rss_client/block_rss_client.php
blog/header.php
blog/lib.php
blog/tags.php
calendar/lib.php
course/lib.php
index.php
lib/moodlelib.php
lib/weblib.php
mod/assignment/lib.php
mod/assignment/type/upload/assignment.class.php
mod/choice/index.php
mod/choice/view.php
mod/glossary/sql.php
mod/survey/index.php
user/policy.php

index c689fb01859f45a0cf7787b282664b69a06e78d4..edc8ba2b2e0a9672621ab5eac9334ea6875bf04d 100755 (executable)
@@ -33,7 +33,7 @@ class block_blog_menu extends block_base {
         }
 
         global $CFG, $USER, $course;
-        if (isset($USER->id)) {
+        if (!empty($USER->id)) {
             $userBlog->userid = $USER->id;
         }   //what is $userBlog anyway
         if($this->content !== NULL) {
index dd9434c84f4c0cab3c0b46d9958988b61686a887..fe8bf720b2996a44382c160f573730e24e9659d5 100644 (file)
@@ -34,7 +34,7 @@ class block_course_list extends block_list {
            }
         }
 
-        if (empty($CFG->disablemycourses) and isset($USER->id) and !(isadmin() and $adminseesall)) {    // Just print My Courses
+        if (empty($CFG->disablemycourses) and !empty($USER->id) and !(isadmin() and $adminseesall)) {    // Just print My Courses
             if ($courses = get_my_courses($USER->id)) {
                 foreach ($courses as $course) {
                     if ($course->id == SITEID) {
index 555eaa6f4fe8b02d78dcb29fc6374209f1bd2de3..aa4603474f8dee8f37cd2364ae6abefe9629d6f5 100644 (file)
@@ -97,7 +97,7 @@
         // then allow the user to add rss feeds
         global $USER;
         $userisloggedin = false;
-        if (isset($USER) && isset($USER->id) && $USER->id && !isguest()) {
+        if (isset($USER) && !empty($USER->id) && $USER->id && !isguest()) {
             $userisloggedin = true;
         }
         if ( $userisloggedin && ($submitters == SUBMITTERS_ALL_ACCOUNT_HOLDERS || ($submitters == SUBMITTERS_ADMIN_AND_TEACHER && $isteacher)) ) {
index e5ba7a2b7a9eff0536953230c9e816340de2d694..f5304af25f3dff399032d252b39511c958d18877 100755 (executable)
@@ -41,7 +41,7 @@ $pageclass = 'page_blog';
 page_map_class($pagetype, $pageclass);    
 
 // Now, create our page object.
-if (!isset($USER->id)) {
+if (empty($USER->id)) {
     $PAGE = page_create_object($pagetype);
 } else {
     $PAGE = page_create_object($pagetype, $USER->id);
index e0f0b0965db0a5d9605574d6a9129f96fd9e1202..41e9dd9c13e11db683c86a65f7c566441e49f481 100755 (executable)
 
         echo '<div class="commands">';
 
-        if (isset($USER->id)) {
+        if (!empty($USER->id)) {
             $context = get_context_instance(CONTEXT_SYSTEM, SITEID);
             $canmanage = has_capability('moodle/blog:manageentries', $context->id);
             
index 46a99359e4cf8823e2d72c08f1f6520ff0cb5198..14f93e4b794abb0402c7f5977120131ce287f2a1 100755 (executable)
@@ -40,7 +40,7 @@ switch ($mode) {
         /// Everyone can add personal tags as long as they can write blog entries.
         if (!confirm_sesskey() ||
                 !has_capability('moodle/blog:writeentries', $context) ||
-                !isset($USER->id)) {
+                empty($USER->id)) {
             error ('you can not add tags');
         }
         
index 88f87ea66361c0cf1b571154610fcb5c2edbc731..ecd8c6aab8f7f1bf08ff4c8edc2a027d5446b54c 100644 (file)
@@ -1034,7 +1034,7 @@ function calendar_session_vars() {
         // The empty() instead of !isset() here makes a whole world of difference,
         // as it will automatically change to the user's id when the user first logs
         // in. With !isset(), it would never do that.
-        $SESSION->cal_users_shown = isset($USER->id) ? $USER->id : false;
+        $SESSION->cal_users_shown = !empty($USER->id) ? $USER->id : false;
     }
     else if(is_numeric($SESSION->cal_users_shown) && !empty($USER->id) && $SESSION->cal_users_shown != $USER->id) {
         // Follow the white rabbit, for example if a teacher logs in as a student
index e86a35458daea2f935111240b2dc8e6ecef04106..08d3af38477ca65bf9e51570dcca9f80c475d97c 100644 (file)
@@ -1566,7 +1566,7 @@ function print_my_moodle() {
 
     global $USER, $CFG;
 
-    if (!isset($USER->id)) {
+    if (empty($USER->id)) {
         error("It shouldn't be possible to see My Moodle without being logged in.");
     }
 
index 7674bc4d2be4c4f34c9157a5f55619302b76a7bc..242c947c6262569f62e089bfbaa9ca4f14c2d268 100644 (file)
--- a/index.php
+++ b/index.php
                         error('Could not find or create a main news forum for the site');
                     }
 
-                    if (isset($USER->id)) {
+                    if (!empty($USER->id)) {
                         $SESSION->fromdiscussion = $CFG->wwwroot;
                         if (forum_is_subscribed($USER->id, $newsforum->id)) {
                             $subtext = get_string('unsubscribe', 'forum');
index e53b490b7fdbe2af7439efbbf4f7f66bdf40a714..acad9ecffeddaf78341dee62f8e39d5478f7feb0 100644 (file)
@@ -1465,7 +1465,7 @@ function sesskey() {
 
 function require_logout() {
     global $USER, $CFG;
-    if (isset($USER) and isset($USER->id)) {
+    if (!empty($USER->id)) {
         add_to_log(SITEID, "user", "logout", "view.php?id=$USER->id&course=".SITEID, $USER->id, 0, $USER->id);
 
         if ($USER->auth == 'cas' && !empty($CFG->cas_enabled)) {
index 386a3e481e0b4c4b885d621504b9593492550e79..c873aba1476906d09ca8e9818159e8ec6acfcfc8 100644 (file)
@@ -2574,7 +2574,7 @@ function theme_setup($theme = '', $params=NULL) {
 function user_login_string($course=NULL, $user=NULL) {
     global $USER, $CFG, $SITE;
 
-    if (empty($user) and isset($USER->id)) {
+    if (empty($user) and !empty($USER->id)) {
         $user = $USER;
     }
 
index 3cdf636ebcaca47bcdd405323efcebc4e64b46ce..64d863936839f42c73c74a0997850be9c3a9b4bf 100644 (file)
@@ -291,7 +291,7 @@ class assignment_base {
             $submitted = '<a href="submissions.php?id='.$this->cm->id.'">'.
                          get_string('viewsubmissions', 'assignment', $count).'</a>';
         } else {
-            if (isset($USER->id)) {
+            if (!empty($USER->id)) {
                 if ($submission = $this->get_submission($USER->id)) {
                     if ($submission->timemodified) {
                         if ($submission->timemodified <= $this->assignment->timedue || empty($this->assignment->timedue)) {
index 729e038efa8477b7ed5fa529576493c3e4ce2d6d..d80391dc666eaec7415f3e29aeee157c6814d834 100644 (file)
@@ -1036,7 +1036,7 @@ class assignment_upload extends assignment_base {
                                $output .= '<img align="middle" src="'.$CFG->pixpath.'/f/'.$icon.'" height="16" width="16" alt="'.$icon.'" />'.
                                           '<a href="'.$ffurl.'" >'.$file.'</a> ['.$filesize.'] <br />';
                            } else {
-                       if (isset($USER->id)) {
+                       if (!empty($USER->id)) {
                                    if ($submission = $this->get_submission($USER->id)) { 
                                     //i have changed timemodified=0 for Draft assignments, thats' why we remove this condition 
                                     //otherwise student's dont' se etheir own submissions
index 970d016aa2eb059046ccff404dacf86b7a015893..66681a7f9812a5cb93b5f413c5a5b5ef4f07d1b4 100644 (file)
@@ -24,7 +24,7 @@
         notice("There are no choices", "../../course/view.php?id=$course->id");
     }
 
-    if ( isset($USER->id) and $allanswers = get_records("choice_answers", "userid", $USER->id)) {
+    if ( !empty($USER->id) and $allanswers = get_records("choice_answers", "userid", $USER->id)) {
         foreach ($allanswers as $aa) {
             $answers[$aa->choiceid] = $aa;
         }
index 87a1977bcb6495493637956cfc67931260246198..58a2c859306ab73cbb56f4b2e3f6571a3e7fa903 100644 (file)
@@ -69,7 +69,7 @@
     }
 
     //if user has already made a selection, and they are not allowed to update it, show their selected answer.
-    if (isset($USER->id) && ($current = get_record('choice_answers', 'choiceid', $choice->id, 'userid', $USER->id))) {
+    if (!empty($USER->id) && ($current = get_record('choice_answers', 'choiceid', $choice->id, 'userid', $USER->id))) {
         print_simple_box(get_string("yourselection", "choice", userdate($choice->timeopen)).": ".format_string(choice_get_option_text($choice, $current->optionid)), "center");
     }
 
index cfa9dc38faf7f6eb5ca85b8deed2e7e240988775..915353d2460621ab0ffc87737418fe848aaf5873 100644 (file)
@@ -41,7 +41,7 @@
     $fullpivot = 1;
 
     $userid = '';
-    if ( isset($USER->id) ) {
+    if ( !empty($USER->id) ) {
         $userid = "OR ge.userid = $USER->id";
     }
     switch ($tab) {
index f2283049fb572bc8cad885ff5748f8a72f8bdf8f..27609b7fa9b3c41f619c95d9b20cdf78540eae47 100644 (file)
@@ -42,7 +42,7 @@
     $currentsection = '';
 
     foreach ($surveys as $survey) {
-        if (isset($USER->id) and survey_already_done($survey->id, $USER->id)) {
+        if (!empty($USER->id) and survey_already_done($survey->id, $USER->id)) {
             $ss = $strdone;
         } else {
             $ss = $strnotdone;
index bcc1b9aa913417a8b690bd9b1f64cf316aadb7b0..0519883c6629decd7aabb0c20b7d4b4c0a45cff2 100644 (file)
@@ -7,7 +7,7 @@
     define('MESSAGE_WINDOW', true);  // This prevents the message window coming up
 
 
-    if (!isset($USER->id)) {
+    if (empty($USER->id)) {
         require_login();
     }