}
if (!empty($User['admin']) and $Page == 'login/edit' and $Args) {
- $username = ltrim($Args, '/');
+ $username = strtolower(ltrim($Args, '/'));
$user = [
'dir' => "profile/$username",
'name' => $username,
];
- if (!is_writable($user['dir'])) {
- print "<p class=warn>Het is niet mogelijk om de gebruiker <em>{$user['name']}</em> aan te passen.</p>\n\n";
- return;
- }
}
$cols = [
if (file_exists($colpath)) {
$colconf['value'] = file_get_contents($colpath);
}
- if (!is_writable($user['dir'])) {
+ if (file_exists($user['dir']) and !is_writable($user['dir'])) {
continue; # locked parent directory
}
if (isset($colconf['value']) and !is_writable($colpath)) {
$colwarn = [];
if ($_POST) {
+ if (!file_exists($user['dir']) and !@mkdir($user['dir'])) {
+ print "<p class=warn>Fout bij het aanmaken van gebruikersprofiel voor <em>{$user['name']}</em>.</p>\n\n";
+ return;
+ }
foreach ($_POST as $col => $val) {
if (!isset($cols[$col])) {
continue; # unknown
$colwarn[$col] = "Kan niet worden aangepast.";
continue;
}
- if (!file_put_contents($cols[$col]['target'], $val)) {
+ if (file_put_contents($cols[$col]['target'], $val) === FALSE) {
$colwarn[$col] = "Fout bij opslaan.";
}
}