MDL-8323 Add proper setup of course $CFG variables, fix use of global $COURSE

new function course_setup() thats does proper $CFG-> , locale and themes setup much sooner than print_header() originally (needed for MDL-8067), cleanup of forgotten global $course issues

MDL-8067 Fixed several $HTTPSREQUIRED issues - html editor now loads from https (the old hack did not wotk with IE7, new hack is uglier but works), fixed formlibs images (we can not set them in library global scope, we must wait for httpsrequired() and require_login() and od that in function), fixed links in meta.php, fixed help images

fixed setting of new $USER values in user edit forms
This commit is contained in:
skodak
2007-01-27 19:56:08 +00:00
parent cce6f1bd1a
commit dcf6d93c9c
12 changed files with 123 additions and 129 deletions
+3 -2
View File
@@ -7,6 +7,8 @@
require_once($CFG->dirroot.'/user/editlib.php');
require_once($CFG->dirroot.'/user/profile/lib.php');
httpsrequired();
$id = optional_param('id', $USER->id, PARAM_INT); // user id; -1 if creating new user
$course = optional_param('course', SITEID, PARAM_INT); // course id (defaults to Site)
@@ -14,7 +16,6 @@
error('Course ID was incorrect');
}
require_login($course->id);
httpsrequired(); // HTTPS is potentially required in this page because there are passwords
if ($id == -1) {
// creating new user
@@ -126,7 +127,7 @@
if ($user->id == $USER->id) {
// Override old $USER session variable
$usernew = (array)get_record('user', 'id', $newuser->id); // reload from db
$usernew = (array)get_record('user', 'id', $usernew->id); // reload from db
foreach ($usernew as $variable => $value) {
$USER->$variable = $value;
}