]> git.mjollnir.org Git - moodle.git/commitdiff
A bit of an audit and a clean up of require_login to add consistency.
authormoodler <moodler>
Sat, 24 May 2003 07:29:17 +0000 (07:29 +0000)
committermoodler <moodler>
Sat, 24 May 2003 07:29:17 +0000 (07:29 +0000)
No major problems found, just some code tidy-up

course/categories.php
course/edit.php
course/editsection.php
course/enrol.php
course/grades.php
course/log.php
course/loglive.php
course/social.php
course/teachers.php
course/view.php

index 7ed3adc98201fc73c34a977e64bd14f0b0c47fcb..762130ed35cd92d2da52122d6448285b7dd65621 100644 (file)
@@ -4,6 +4,8 @@
        require_once("../config.php");
        require_once("lib.php");
 
+    require_login();
+
     if (!isadmin()) {
         error("Only administrators can use this course!");
     }
index 36b88a6b543eb103e7e58a2dc5bce8cc4a9ab78b..72f1c32ddf35fab992aef1f7ea0148e50ceb63a4 100644 (file)
@@ -6,18 +6,17 @@
 
     optional_variable($id, 0);   // course id
 
+    require_login();
+
     if ($id) {
         if (! $course = get_record("course", "id", $id)) {
             error("Course ID was incorrect");
         }
 
-           require_login($course->id);
-
         if (!isteacher($course->id)) {
             error("Only teachers can edit the course!");
         }
     } else {  // Admin is creating a new course
-        require_login();
 
         if (!iscreator()) {
             error("Only administrators and teachers can use this page");
index 280b2e06416710bac02876b63a898c5a7dda3169..54d67a8526fe828b9ffe5a5ee171b93b2d0d8883 100644 (file)
@@ -6,6 +6,8 @@
 
     require_variable($id);    // Week ID
 
+    require_login();
+
     if (! $section = get_record("course_sections", "id", $id)) {
         error("Course section is incorrect");
     }
@@ -14,8 +16,6 @@
         error("Could not find the course!");
     }
 
-    require_login($course->id);
-    
     if (!isteacher($course->id)) {
         error("Only teachers can edit this!");
     }
index d731cf6c5178516f3efc2920d99453c1236ba4cf..e9b64a2df3ef061a955d93d2fbb8457710306ca3 100644 (file)
@@ -4,9 +4,10 @@
     require_once("../config.php");
     require_once("lib.php");
 
-    require_login();
     require_variable($id);
 
+    require_login();
+
     if (! $course = get_record("course", "id", $id) ) {
         error("That's an invalid course id");
     }
index 269f77abf64ec846326eed6a9002c18a6063971d..41bc5426c5e427ca0f583d0ece445ff911b5f521 100644 (file)
@@ -8,12 +8,12 @@
     require_variable($id);              // course id
     optional_variable($download, "");   // to download data 
 
+    require_login();
+
     if (! $course = get_record("course", "id", $id)) {
         error("Course ID was incorrect");
     }
 
-       require_login($course->id);
-
     if (!isteacher($course->id)) {
         error("Only teachers can use this page!");
     }
index 617926adccf0c44708ea02330133e319742c8134..68442e0c5b9135f0ee5eedb3b2fccdb03e94dda7 100644 (file)
@@ -8,7 +8,7 @@
     optional_variable($user, 0); // User to display
     optional_variable($date, 0); // Date to display
 
-    require_login($id);
+    require_login();
 
     if (! $course = get_record("course", "id", $id) ) {
         error("That's an invalid course id");
index d2a8354760dcded8852c1729264bfa6c637c9f3c..a643335a5aabc794ac22087a62c53b9c27b52722 100644 (file)
@@ -4,7 +4,9 @@
     require_once("../config.php");
     require_once("lib.php");
 
-    require_login($id);
+    require_variable($id);
+
+    require_login();
 
     if (! $course = get_record("course", "id", $id) ) {
         error("That's an invalid course id");
index c66700ba5c79bb429bc7623fb8457b6be57e8059..6f01d8107127a8fb20cf2c17db50937bb4c769c8 100644 (file)
@@ -1,4 +1,4 @@
-<?  // $Id$
+<?php  // $Id$
     // social.php - course format featuring social forum
     //              included from view.php
     
@@ -8,10 +8,10 @@
     $leftwidth = 210;
 ?>
 
-<TABLE WIDTH="100%" BORDER="0" CELLSPACING="5" CELLPADDING="5">
-  <TR>
-    <TD WIDTH="<?=$leftwidth?>" VALIGN="TOP"> 
-      <? 
+<table width="100%" border="0" cellspacing="5" cellpadding="5">
+  <tr>
+    <td width="<?php echo $leftwidth?>" valign="top"> 
+      <?php 
       $moddata[]="<a title=\"".get_string("listofallpeople")."\" href=\"../user/index.php?id=$course->id\">".get_string("participants")."</a>";
       $modicon[]="<img src=\"$pixpath/i/users.gif\" height=16 width=16 alt=\"\">";
       $editmyprofile = "<a title=\"$USER->firstname $USER->lastname\" href=\"../user/edit.php?id=$USER->id&course=$course->id\">".
           } else {
               $subtext = get_string("subscribe", "forum");
           }
-          $headertext = "<table border=0 width=100% cellpadding=0 cellspacing=0><tr><td>".get_string("socialheadline")."</td><td align=right><font size=1><a href=\"../mod/forum/subscribe.php?id=$social->id\">$subtext</a></td></tr></table>";
+          $headertext = "<table border=0 width=100% cellpadding=0 cellspacing=0><tr><td>".
+                         get_string("socialheadline").
+                         "</td><td align=right><font size=1>".
+                         "<a href=\"../mod/forum/subscribe.php?id=$social->id\">$subtext</a></td>".
+                         "</tr></table>";
           print_heading_block($headertext);
           echo "<img alt=\"\" height=7 src=\"../pix/spacer.gif\"><br>";
     
@@ -67,7 +71,7 @@
           notify("Could not find or create a social forum here");
       }
       ?>
-    </TD
-  </TR
-</TABLE>
+    </td
+  </tr
+</table>
 
index 186552ebc290516f534ef35d6a81c107c1412578..b065d56f908c848e23e5a1dfcfeb8131a318449e 100644 (file)
@@ -6,12 +6,12 @@
 
     require_variable($id);   // course id
 
+       require_login();
+
     if (! $course = get_record("course", "id", $id)) {
         error("Course ID was incorrect");
     }
 
-       require_login($course->id);
-
     if (!isteacher($course->id)) {
         error("Only teachers can edit the course!");
     }
index 46c06d02bdabb0938c94027756e5ee4d40a637b7..35a0c34216006660d9334c85eb523df9cf00a18a 100644 (file)
@@ -22,7 +22,7 @@
         }
     }
 
-    require_login($id);
+    require_login($course->id);
 
     add_to_log($course->id, "course", "view", "view.php?id=$course->id", "$course->id");