3 if (empty($user = $User)) {
7 if (!empty($User['admin']) and $Page == 'login/edit' and $Args) {
8 $username = ltrim($Args, '/');
10 'dir' => "profile/$username",
13 if (!is_writable($user['dir'])) {
14 print "<p class=warn>Het is niet mogelijk om de gebruiker <em>{$user['name']}</em> aan te passen.</p>\n\n";
20 'name' => ['label' => 'volledige naam'],
21 'email' => ['label' => 'e-mailadres', 'type' => 'email'],
24 foreach ($cols as $col => &$colconf) {
25 $colpath = "{$user['dir']}/$col.txt";
26 if (file_exists($colpath)) {
27 $colconf['value'] = file_get_contents($colpath);
29 if (!is_writable($user['dir'])) {
30 continue; # locked parent directory
32 if (isset($colconf['value']) and !is_writable($colpath)) {
33 continue; # locked column file
35 $colconf['target'] = $colpath; # editing allowed
39 'login' => ['label' => 'login', 'value' => $user['name'], 'target' => NULL],
44 foreach ($_POST as $col => $val) {
45 if (!isset($cols[$col])) {
48 if (isset($cols[$col]['value']) and $cols[$col]['value'] === $val) {
51 $cols[$col]['value'] = $val; # update form value
52 if (empty($cols[$col]['target'])) {
53 $colwarn[$col] = "Kan niet worden aangepast.";
56 if (!file_put_contents($cols[$col]['target'], $val)) {
57 $colwarn[$col] = "Fout bij opslaan.";
62 print "<p class=warn>Instellingen zijn niet (volledig) opgeslagen. Probeer het later nog eens.</p>\n\n";
65 print "<p>Alle instellingen zijn opgeslagen.</p>\n\n";
72 Geef een e-mailadres op waarmee we u kunnen bereiken indien nodig.
73 Wij zullen dit adres nooit vrij- of doorgeven.
77 foreach ($cols as $col => &$colconf) {
79 printf('<label for="%s">%s:</label> ', $col, ucfirst($colconf['label']));
81 if (empty($colconf['target'])) print ' readonly';
82 printf(' type="%s" name="%s" id="%1$s" value="%s"',
83 @$colconf['type'] ?: 'text',
85 htmlspecialchars(@$colconf['value'])
87 print ' placeholder="Niet ingesteld"';
90 if ($error = @$colwarn[$col]) {
91 print " <span class=warn>$error</span>\n";
96 <input type="submit" value="Opslaan" />