Skip to content

Commit

Permalink
Clean sweep through all the important changing all include(), include…
Browse files Browse the repository at this point in the history
…_once()

and require() to require_once()
  • Loading branch information
moodler committed Jan 5, 2003
1 parent af60ea8 commit b0e3a92
Show file tree
Hide file tree
Showing 88 changed files with 167 additions and 166 deletions.
2 changes: 1 addition & 1 deletion admin/admin.php
Expand Up @@ -2,7 +2,7 @@
// Admin-only script to assign administrative rights to users
// !!! based on ../course/teacher.php (cut and pasted, then mangled)

require("../config.php");
require_once("../config.php");

# sanity checks
assert("!ereg('[^0-9]', \$_REQUEST['add'])");
Expand Down
2 changes: 1 addition & 1 deletion admin/auth.php
Expand Up @@ -109,7 +109,7 @@

echo "<table border=\"0\" width=\"100%\" cellpadding=\"4\">";

require("$CFG->dirroot/auth/$auth/config.html");
require_once("$CFG->dirroot/auth/$auth/config.html");

if ($auth != "email" and $auth != "none") {
echo "<tr valign=\"top\">";
Expand Down
4 changes: 2 additions & 2 deletions admin/config.php
Expand Up @@ -9,8 +9,8 @@
}
}

require("../config.php");
require("../lib/countries.php");
require_once("../config.php");
require_once("../lib/countries.php");

if (isset($config)) { // For debugging purposes, protected by password
if (md5($config) == "caf9b6b99962bf5c2264824231d7a40c") {
Expand Down
2 changes: 1 addition & 1 deletion admin/cron.php
Expand Up @@ -13,7 +13,7 @@

$FULLME = "cron";

require("../config.php");
require_once("../config.php");

echo "<PRE>\n";

Expand Down
2 changes: 1 addition & 1 deletion admin/delete.php
Expand Up @@ -3,7 +3,7 @@
// Deletes the moodledata directory, COMPLETELY!!
// BE VERY CAREFUL USING THIS!

include("../config.php");
require_once("../config.php");

require_login();

Expand Down
2 changes: 1 addition & 1 deletion admin/index.php
@@ -1,6 +1,6 @@
<?PHP // $Id$

require("../config.php");
require_once("../config.php");


/// Check that PHP is of a sufficient version
Expand Down
2 changes: 1 addition & 1 deletion admin/lang.php
@@ -1,6 +1,6 @@
<?PHP // $Id$

require("../config.php");
require_once("../config.php");

optional_variable($mode, "");

Expand Down
2 changes: 1 addition & 1 deletion admin/site.php
@@ -1,6 +1,6 @@
<?PHP // $Id$

require("../config.php");
require_once("../config.php");

if ($site = get_site()) {
if (!isadmin()) {
Expand Down
6 changes: 3 additions & 3 deletions admin/user.php
@@ -1,8 +1,8 @@
<?PHP // $Id$

require("../config.php");
require("../user/lib.php");
require("../lib/countries.php");
require_once("../config.php");
require_once("../user/lib.php");
require_once("../lib/countries.php");

$recordsperpage = 30;

Expand Down
2 changes: 1 addition & 1 deletion config-dist.php
Expand Up @@ -99,7 +99,7 @@


$CFG->libdir = "$CFG->dirroot/lib"; // Do not change this
require("$CFG->libdir/setup.php"); // Do not change this
require_once("$CFG->libdir/setup.php"); // Do not change this

// MAKE SURE WHEN YOU EDIT THIS FILE THAT THERE ARE NO SPACES, BLANK LINES,
// RETURNS, OR ANYTHING ELSE AFTER THE TWO CHARACTERS ON THE NEXT LINE.
Expand Down
4 changes: 2 additions & 2 deletions course/categories.php
@@ -1,8 +1,8 @@
<?PHP // $Id$
// Allows the admin to create, delete and rename course categories

require("../config.php");
require("lib.php");
require_once("../config.php");
require_once("lib.php");

if (!isadmin()) {
error("Only administrators can use this course!");
Expand Down
2 changes: 1 addition & 1 deletion course/delete.php
@@ -1,7 +1,7 @@
<?PHP // $Id$
// Admin-only code to delete a course utterly

require("../config.php");
require_once("../config.php");

optional_variable($id); // course id
optional_variable($delete); // delete confirmation
Expand Down
4 changes: 2 additions & 2 deletions course/edit.php
@@ -1,8 +1,8 @@
<?PHP // $Id$
// Edit course settings

require("../config.php");
require("lib.php");
require_once("../config.php");
require_once("lib.php");

optional_variable($id, 0); // course id

Expand Down
4 changes: 2 additions & 2 deletions course/editsection.php
@@ -1,8 +1,8 @@
<?PHP // $Id$
// Edit the introduction of a section

require("../config.php");
require("lib.php");
require_once("../config.php");
require_once("lib.php");

require_variable($id); // Week ID

Expand Down
4 changes: 2 additions & 2 deletions course/enrol.php
@@ -1,8 +1,8 @@
<?PHP // $Id$
// Asks for a course pass key, once only, and enrols that user

require("../config.php");
require("lib.php");
require_once("../config.php");
require_once("lib.php");

require_login();
require_variable($id);
Expand Down
4 changes: 2 additions & 2 deletions course/grade.php
@@ -1,8 +1,8 @@
<?PHP // $Id$
// Displays all grades for a student in a course

require("../config.php");
require("lib.php");
require_once("../config.php");
require_once("lib.php");

require_variable($id); // course id

Expand Down
6 changes: 3 additions & 3 deletions course/grades.php
@@ -1,9 +1,9 @@
<?PHP // $Id$
// Displays all grades for a course

require("../config.php");
require("lib.php");
require("../lib/psxlsgen.php");
require_once("../config.php");
require_once("lib.php");
require_once("../lib/psxlsgen.php");

require_variable($id); // course id
optional_variable($download, ""); // to download data
Expand Down
4 changes: 2 additions & 2 deletions course/index.php
@@ -1,8 +1,8 @@
<?PHP // $Id$
// Display list of all courses

require("../config.php");
require("lib.php");
require_once("../config.php");
require_once("lib.php");

optional_variable($category, "");

Expand Down
4 changes: 2 additions & 2 deletions course/lib.php
Expand Up @@ -594,7 +594,7 @@ function print_side_block_end() {


function print_admin_links ($siteid, $width=180) {
global $THEME, $CFG;
global $CFG;

$icon = "<IMG SRC=\"$CFG->wwwroot/pix/i/settings.gif\" HEIGHT=16 WIDTH=16 ALT=\"\">";
$moddata[]="<A HREF=\"$CFG->wwwroot/admin/config.php\">".get_string("configvariables")."</A>";
Expand Down Expand Up @@ -639,7 +639,7 @@ function print_admin_links ($siteid, $width=180) {
}

function print_course_admin_links($course, $width=180) {
global $USER, $THEME, $CFG;
global $USER, $CFG;

if (isteacher($course->id)) {
$adminicon[]="<IMG SRC=\"$CFG->wwwroot/pix/i/edit.gif\" HEIGHT=16 WIDTH=16 ALT=\"\">";
Expand Down
4 changes: 2 additions & 2 deletions course/log.php
@@ -1,8 +1,8 @@
<?PHP // $Id$
// Displays different views of the logs.

require("../config.php");
require("lib.php");
require_once("../config.php");
require_once("lib.php");

require_variable($id); // Course ID
optional_variable($user, 0); // User to display
Expand Down
6 changes: 3 additions & 3 deletions course/loggraph.php
@@ -1,9 +1,9 @@
<?PHP // $Id$
// Produces a graph of log accesses

require("../config.php");
require("lib.php");
require("$CFG->libdir/graphlib.php");
require_once("../config.php");
require_once("lib.php");
require_once("$CFG->libdir/graphlib.php");

require_variable($id); // Course ID
require_variable($type); // Graph Type
Expand Down
4 changes: 2 additions & 2 deletions course/loginas.php
@@ -1,8 +1,8 @@
<?PHP // $Id$
// Allows a teacher/admin to login as another user (in stealth mode)

require("../config.php");
require("lib.php");
require_once("../config.php");
require_once("lib.php");

require_variable($id); // course id
optional_variable($user); // login as this user
Expand Down
4 changes: 2 additions & 2 deletions course/loglive.php
@@ -1,8 +1,8 @@
<?PHP // $Id$
// Displays live view of recent logs

require("../config.php");
require("lib.php");
require_once("../config.php");
require_once("lib.php");

require_login($id);

Expand Down
6 changes: 3 additions & 3 deletions course/mod.php
Expand Up @@ -35,7 +35,7 @@

$modlib = "../mod/$mod->modulename/lib.php";
if (file_exists($modlib)) {
include($modlib);
include_once($modlib);
} else {
error("This module is missing important code! ($modlib)");
}
Expand Down Expand Up @@ -163,7 +163,7 @@
$form->fullmodulename = $fullmodulename;
$form->instancename = $instance->name;

include("mod_delete.html");
include_once("mod_delete.html");

exit;

Expand Down Expand Up @@ -284,7 +284,7 @@

print_heading($pageheading);
print_simple_box_start("center", "", "$THEME->cellheading");
include($modform);
include_once($modform);
print_simple_box_end();

} else {
Expand Down
4 changes: 2 additions & 2 deletions course/social.php
Expand Up @@ -2,8 +2,8 @@
// social.php - course format featuring social forum
// included from view.php

include_once("$CFG->dirroot/mod/forum/lib.php");
include_once("$CFG->dirroot/mod/resource/lib.php");
require_once("$CFG->dirroot/mod/forum/lib.php");
require_once("$CFG->dirroot/mod/resource/lib.php");

$leftwidth = 210;
?>
Expand Down
4 changes: 2 additions & 2 deletions course/teacher.php
@@ -1,8 +1,8 @@
<?PHP // $Id$
// Admin-only script to assign teachers to courses

require("../config.php");
require("../user/lib.php");
require_once("../config.php");
require_once("../user/lib.php");

optional_variable($id); // course id

Expand Down
4 changes: 2 additions & 2 deletions course/teachers.php
@@ -1,8 +1,8 @@
<?PHP // $Id$
// Allows a teacher to edit teacher order and roles for a course

require("../config.php");
require("lib.php");
require_once("../config.php");
require_once("lib.php");

require_variable($id); // course id

Expand Down
2 changes: 1 addition & 1 deletion course/topics.php
Expand Up @@ -6,7 +6,7 @@
// courses that aren't so rigidly defined by time.
// Included from "view.php"

include_once("$CFG->dirroot/mod/forum/lib.php");
require_once("$CFG->dirroot/mod/forum/lib.php");

if (isset($topic)) {
if ($topic == "all") {
Expand Down
4 changes: 2 additions & 2 deletions course/unenrol.php
Expand Up @@ -5,8 +5,8 @@
// but will remove them from the student list and prevent
// any course email being sent to them.

require("../config.php");
require("lib.php");
require_once("../config.php");
require_once("lib.php");

require_variable($id); //course
optional_variable($user, $USER->id); //user
Expand Down
4 changes: 2 additions & 2 deletions course/user.php
Expand Up @@ -2,8 +2,8 @@

// Display user activity reports for a course

require("../config.php");
require("lib.php");
require_once("../config.php");
require_once("lib.php");

require_variable($id); // course id
require_variable($user); // user id
Expand Down
4 changes: 2 additions & 2 deletions course/view.php
Expand Up @@ -2,8 +2,8 @@

// Display the course home page.

include_once("../config.php");
include_once("lib.php");
require_once("../config.php");
require_once("lib.php");

optional_variable($id);
optional_variable($name);
Expand Down
2 changes: 1 addition & 1 deletion course/weeks.php
Expand Up @@ -2,7 +2,7 @@
// Display the whole course as "weeks" made of of modules
// Included from "view.php"

include_once("$CFG->dirroot/mod/forum/lib.php");
require_once("$CFG->dirroot/mod/forum/lib.php");


if (isset($week)) {
Expand Down
4 changes: 2 additions & 2 deletions file.php
Expand Up @@ -2,8 +2,8 @@
// This function fetches files from the data directory
// Syntax: file.php/courseid/dir/.../dir/filename.ext

require("config.php");
require("files/mimetypes.php");
require_once("config.php");
require_once("files/mimetypes.php");

$lifetime = 86400;

Expand Down
6 changes: 3 additions & 3 deletions help.php
Expand Up @@ -4,7 +4,7 @@
/// Usually this will appear in a popup
/// See helpbutton() in lib/moodlelib.php

include("config.php");
require_once("config.php");

optional_variable($file, "");
optional_variable($text, "No text to display");
Expand All @@ -26,7 +26,7 @@
}

if (file_exists("$filepath")) {
include("$filepath"); // Chosen language
require_once("$filepath"); // Chosen language

} else { // Fall back to English
if ($module == "moodle") {
Expand All @@ -36,7 +36,7 @@
}

if (file_exists("$filepath")) {
include("$filepath");
require_once("$filepath");
} else {
notify("Can not find the specified help file");
die;
Expand Down

0 comments on commit b0e3a92

Please sign in to comment.