Skip to content
Browse files

Checks for bad permissions and defaults to default picture

  • Loading branch information...
1 parent c1e88d4 commit 54bdcdbecc91d387f20b24277071b262e22f32d1 martin committed May 18, 2002
Showing with 28 additions and 19 deletions.
  1. +28 −19 user/edit.php
View
47 user/edit.php
@@ -60,30 +60,39 @@
}
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;
}

0 comments on commit 54bdcdb

Please sign in to comment.
Something went wrong with that request. Please try again.