3 if (empty($user = $User)) {
7 if (!empty($User['admin']) and $Page == 'login/edit' and $Args) {
8 $username = ltrim($Args, '/');
10 'dir' => "profile/$username",
12 if (!is_writable($user['dir'])) {
13 print "<p class=warn>Het is niet mogelijk om de gebruiker <em>{$user['name']}</em> aan te passen.</p>\n\n";
19 'email' => ['label' => 'e-mailadres', 'type' => 'email'],
22 foreach ($cols as $col => &$colconf) {
23 $colpath = "{$user['dir']}/$col.txt";
24 if (file_exists($colpath)) {
25 $colconf['value'] = file_get_contents($colpath);
27 if (!is_writable($user['dir'])) {
28 continue; # locked parent directory
30 if (isset($colconf['value']) and !is_writable($colpath)) {
31 continue; # locked column file
33 $colconf['target'] = $colpath; # editing allowed
38 foreach ($_POST as $col => $val) {
39 if (!isset($cols[$col])) {
42 if (isset($cols[$col]['value']) and $cols[$col]['value'] === $val) {
45 $cols[$col]['value'] = $val; # update form value
46 if (empty($cols[$col]['target'])) {
47 $colwarn[$col] = "Kan niet worden aangepast.";
50 if (!file_put_contents($cols[$col]['target'], $val)) {
51 $colwarn[$col] = "Fout bij opslaan.";
56 print "<p class=warn>Instellingen zijn niet (volledig) opgeslagen. Probeer het later nog eens.</p>\n\n";
59 print "<p>Alle instellingen zijn opgeslagen.</p>\n\n";
64 <form method="post" class="inline">
66 Geef een e-mailadres op waarmee we u kunnen bereiken indien nodig.
67 Wij zullen dit adres nooit vrij- of doorgeven.
71 foreach ($cols as $col => &$colconf) {
73 if (empty($colconf['target'])) print ' readonly';
74 printf(' type="%s" name="%s" id="%1$s" value="%s"',
75 @$colconf['type'] ?: 'text',
77 htmlspecialchars(@$colconf['value'])
79 print ' placeholder="Geen '.$colconf['label'].' ingesteld"';
82 if ($error = @$colwarn[$col]) {
83 print "<span class=warn>$error</span>\n";
87 <input type="submit" value="Opslaan" />