<?php
global $User;
-if (empty($User)) {
+if (empty($user = $User)) {
return;
}
-$userdir = $User['dir'];
if (!empty($User['admin']) and $Page == 'login/edit' and $Args) {
- $user = ltrim($Args, '/');
- $userdir = "profile/$user";
- if (!is_writable($userdir)) {
- print "<p class=warn>Het is niet mogelijk om de gebruiker <em>$user</em> aan te passen.</p>\n\n";
+ $username = ltrim($Args, '/');
+ $user = [
+ 'dir' => "profile/$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;
}
}
];
foreach ($cols as $col => &$colconf) {
- $colpath = "$userdir/$col.txt";
+ $colpath = "{$user['dir']}/$col.txt";
if (file_exists($colpath)) {
$colconf['value'] = file_get_contents($colpath);
}
- if (!is_writable($userdir)) {
+ if (!is_writable($user['dir'])) {
continue; # locked parent directory
}
if (isset($colconf['value']) and !is_writable($colpath)) {