7 $userdir = $User['dir'];
8 if (!empty($User['admin']) and $Page == 'login/edit' and $Args) {
9 $user = ltrim($Args, '/');
10 $userdir = "profile/$user";
11 if (!is_writable($userdir)) {
12 print "<p class=warn>Het is niet mogelijk om de gebruiker <em>$user</em> aan te passen.</p>\n\n";
18 'email' => ['label' => 'e-mailadres', 'type' => 'email'],
21 foreach ($cols as $col => &$colconf) {
22 $colpath = "$userdir/$col.txt";
23 if (file_exists($colpath)) {
24 $colconf['value'] = file_get_contents($colpath);
26 if (!is_writable($userdir)) {
27 continue; # locked parent directory
29 if (isset($colconf['value']) and !is_writable($colpath)) {
30 continue; # locked column file
32 $colconf['target'] = $colpath; # editing allowed
37 foreach ($_POST as $col => $val) {
38 if (!isset($cols[$col])) {
41 if (isset($cols[$col]['value']) and $cols[$col]['value'] === $val) {
44 $cols[$col]['value'] = $val; # update form value
45 if (empty($cols[$col]['target'])) {
46 $colwarn[$col] = "Kan niet worden aangepast.";
49 if (!file_put_contents($cols[$col]['target'], $val)) {
50 $colwarn[$col] = "Fout bij opslaan.";
55 print "<p class=warn>Instellingen zijn niet (volledig) opgeslagen. Probeer het later nog eens.</p>\n\n";
58 print "<p>Alle instellingen zijn opgeslagen.</p>\n\n";
63 <form method="post" class="inline">
65 Geef een e-mailadres op waarmee we u kunnen bereiken indien nodig.
66 Wij zullen dit adres nooit vrij- of doorgeven.
70 foreach ($cols as $col => &$colconf) {
72 if (empty($colconf['target'])) print ' readonly';
73 printf(' type="%s" name="%s" id="%1$s" value="%s"',
74 @$colconf['type'] ?: 'text',
76 htmlspecialchars(@$colconf['value'])
78 print ' placeholder="Geen '.$colconf['label'].' ingesteld"';
81 if ($error = @$colwarn[$col]) {
82 print "<span class=warn>$error</span>\n";
86 <input type="submit" value="Opslaan" />