Widespread changes throughout Moodle to make sure it works on
servers that have register_globals turned off (this is the
default setting on newer version of PHP).
In fact it's partly a hack that globalises all GET, POST, FILES
AND COOKIE variables. Unfortunately though the SESSION and
USER global session variables are only available as $_SESSION["USER"]
and $_SESSION["SESSION"], which is cumbersome to use.
So, for every request I now make a copy of these two session variables
into $USER and $SESSION. Whenever I update them thoughout Moodle I
now have to call save_session("USER") which copies them back to the
session variable. This seems to be working well now.
Because I'm using $_SESSION etc now this will raise
the required minimum version of PHP to 4.1.0
This commit is contained in:
+5
-4
@@ -36,15 +36,15 @@
|
||||
|
||||
$timenow = time();
|
||||
|
||||
if ($imagefile && $imagefile!="none") {
|
||||
$imageinfo = GetImageSize($imagefile);
|
||||
if ($filename = valid_uploaded_file($imagefile)) {
|
||||
$imageinfo = GetImageSize($filename);
|
||||
$image->width = $imageinfo[0];
|
||||
$image->height = $imageinfo[1];
|
||||
$image->type = $imageinfo[2];
|
||||
|
||||
switch ($image->type) {
|
||||
case 2: $im = ImageCreateFromJPEG($imagefile); break;
|
||||
case 3: $im = ImageCreateFromPNG($imagefile); break;
|
||||
case 2: $im = ImageCreateFromJPEG($filename); break;
|
||||
case 3: $im = ImageCreateFromPNG($filename); break;
|
||||
default: error("Image must be in JPG or PNG format");
|
||||
}
|
||||
if (function_exists("ImageCreateTrueColor") and $CFG->gdversion >= 2) {
|
||||
@@ -114,6 +114,7 @@
|
||||
foreach ($usernew as $variable => $value) {
|
||||
$USER->$variable = $value;
|
||||
}
|
||||
save_session("USER");
|
||||
redirect("view.php?id=$user->id&course=$course->id", "Changes saved");
|
||||
} else {
|
||||
error("Could not update the user record ($user->id)");
|
||||
|
||||
Reference in New Issue
Block a user