]> git.mjollnir.org Git - moodle.git/commitdiff
Of $COURSE you can't redefine constants :)
authormoodler <moodler>
Wed, 29 Mar 2006 17:56:35 +0000 (17:56 +0000)
committermoodler <moodler>
Wed, 29 Mar 2006 17:56:35 +0000 (17:56 +0000)
lib/datalib.php
lib/moodlelib.php

index 2a605dffda50256ae59d5c06cb2d65f3d14d2289..2985bd11e6cde4c955a17b524cdcb4962cc8a575 100644 (file)
@@ -20,7 +20,6 @@ if ($SITE = get_site()) {
      * If $SITE global from {@link get_site()} is set then SITEID to $SITE->id, otherwise set to 1.
      */
     define('SITEID', $SITE->id);
-    define('COURSEID', SITEID);   // For now.  This will usually get reset later in require_login() etc.
 } else {
     /**
      * @ignore
@@ -29,6 +28,8 @@ if ($SITE = get_site()) {
     define('COURSEID', 1);
 }
 
+$COURSE->id = SITEID;   // For now.  This will usually get reset later in require_login() etc.
+
 /// FUNCTIONS FOR DATABASE HANDLING  ////////////////////////////////
 
 /**
index 4181946c41b0e0d8b0beb7d03fc2c68e73e564d4..fc0d8802fc92af707e9eb75bedde4d2a122de99a 100644 (file)
@@ -1495,7 +1495,7 @@ function require_logout() {
  * @uses $USER
  * @uses $FULLME
  * @uses SITEID
- * @uses COURSEID
+ * @uses $COURSE
  * @uses $MoodleSession
  * @param int $courseid id of the course
  * @param bool $autologinguest
@@ -1503,11 +1503,11 @@ function require_logout() {
  */
 function require_login($courseid=0, $autologinguest=true, $cm=null) {
 
-    global $CFG, $SESSION, $USER, $FULLME, $MoodleSession;
+    global $CFG, $SESSION, $USER, $COURSE, $FULLME, $MoodleSession;
 
-    // Redefine global COURSEID, this is a new idea in 1.6 Beta and not to be relied on yet
+    // Redefine global $COURSE, this is a new idea in 1.6 Beta and not to be relied on yet
     if ($courseid) {
-        define('COURSEID', $courseid);
+        $COURSE->id = $courseid;
     }
 
     // First check that the user is logged in to the site.