}
if (!file_exists("$CFG->dataroot/users")) {
- mkdir("$CFG->dataroot/users", 0777);
+ if (! mkdir("$CFG->dataroot/users", 0777)) {
+ $badpermissions = true;
+ }
}
if (!file_exists("$CFG->dataroot/users/$USER->id")) {
- mkdir("$CFG->dataroot/users/$USER->id", 0777);
+ if (! mkdir("$CFG->dataroot/users/$USER->id", 0777)) {
+ $badpermissions = true;
+ }
}
- ImageCopyBicubic($im1, $im, 0, 0, $cx-$half, $cy-$half, 100, 100, $half*2, $half*2);
- ImageCopyBicubic($im2, $im, 0, 0, $cx-$half, $cy-$half, 35, 35, $half*2, $half*2);
+ if ($badpermissions) {
+ $usernew->picture = "0";
+
+ } else {
+ ImageCopyBicubic($im1, $im, 0, 0, $cx-$half, $cy-$half, 100, 100, $half*2, $half*2);
+ ImageCopyBicubic($im2, $im, 0, 0, $cx-$half, $cy-$half, 35, 35, $half*2, $half*2);
- // Draw borders over the top.
- $black1 = ImageColorAllocate ($im1, 0, 0, 0);
- $black2 = ImageColorAllocate ($im2, 0, 0, 0);
- ImageLine ($im1, 0, 0, 0, 99, $black1);
- ImageLine ($im1, 0, 99, 99, 99, $black1);
- ImageLine ($im1, 99, 99, 99, 0, $black1);
- ImageLine ($im1, 99, 0, 0, 0, $black1);
- ImageLine ($im2, 0, 0, 0, 34, $black2);
- ImageLine ($im2, 0, 34, 34, 34, $black2);
- ImageLine ($im2, 34, 34, 34, 0, $black2);
- ImageLine ($im2, 34, 0, 0, 0, $black2);
-
- ImageJpeg($im1, "$CFG->dataroot/users/$USER->id/f1.jpg", 90);
- ImageJpeg($im2, "$CFG->dataroot/users/$USER->id/f2.jpg", 95);
- $usernew->picture = "1";
+ // Draw borders over the top.
+ $black1 = ImageColorAllocate ($im1, 0, 0, 0);
+ $black2 = ImageColorAllocate ($im2, 0, 0, 0);
+ ImageLine ($im1, 0, 0, 0, 99, $black1);
+ ImageLine ($im1, 0, 99, 99, 99, $black1);
+ ImageLine ($im1, 99, 99, 99, 0, $black1);
+ ImageLine ($im1, 99, 0, 0, 0, $black1);
+ ImageLine ($im2, 0, 0, 0, 34, $black2);
+ ImageLine ($im2, 0, 34, 34, 34, $black2);
+ ImageLine ($im2, 34, 34, 34, 0, $black2);
+ ImageLine ($im2, 34, 0, 0, 0, $black2);
+
+ ImageJpeg($im1, "$CFG->dataroot/users/$USER->id/f1.jpg", 90);
+ ImageJpeg($im2, "$CFG->dataroot/users/$USER->id/f2.jpg", 95);
+ $usernew->picture = "1";
+ }
} else {
$usernew->picture = $user->picture;
}