A bit of an audit and a clean up of require_login to add consistency.

No major problems found, just some code tidy-up
This commit is contained in:
moodler
2003-05-24 07:29:17 +00:00
parent 73fafc3886
commit 783da26290
10 changed files with 30 additions and 22 deletions
+2
View File
@@ -4,6 +4,8 @@
require_once("../config.php");
require_once("lib.php");
require_login();
if (!isadmin()) {
error("Only administrators can use this course!");
}
+2 -3
View 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");
+2 -2
View 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!");
}
+2 -1
View 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");
}
+2 -2
View 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!");
}
+1 -1
View 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");
+3 -1
View 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");
+13 -9
View 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\">".
@@ -57,7 +57,11 @@
} 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>
+2 -2
View 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!");
}
+1 -1
View 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");