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.";
61 if (!empty($_POST['newpass'])) {
62 require_once('login/pass.inc.php');
63 if ($error = passform($user, $_POST)) {
64 $colwarn['pass'] = $error;
69 print "<p class=warn>Instellingen zijn niet (volledig) opgeslagen. Probeer het later nog eens.</p>\n\n";
72 print "<p>Alle instellingen zijn opgeslagen.</p>\n\n";
79 Geef een e-mailadres op waarmee we u kunnen bereiken indien nodig.
80 Wij zullen dit adres nooit vrij- of doorgeven.
83 foreach ($cols as $col => &$colconf) {
85 printf('<label for="%s">%s:</label> ', $col, ucfirst($colconf['label']));
87 if (empty($colconf['target'])) print ' readonly';
88 printf(' type="%s" name="%s" id="%1$s" value="%s"',
89 @$colconf['type'] ?: 'text',
91 htmlspecialchars(@$colconf['value'])
93 print ' placeholder="Niet ingesteld"';
96 if ($error = @$colwarn[$col]) {
97 print " <span class=warn>$error</span>\n";
102 if (isset($user['pass'])) {
103 if ($hide = empty($_POST['newpass'])) {
105 <p><a onclick="document.getElementById('pass').removeAttribute('hidden'); this.remove()">Wachtwoord wijzigen</a></p>
109 <div id="pass"<?php if ($hide) print ' hidden'; ?>>
110 <label for="newpass">Wachtwoord:</label>
111 <input type="password" name="oldpass" value="" placeholder="Huidig wachtwoord" />
112 <input type="password" name="newpass" value="" placeholder="Nieuw wachtwoord" />
113 <input type="password" name="passconf" value="" placeholder="Nogmaals" />
115 if ($error = @$colwarn['pass']) {
116 print " <span class=warn>$error</span>\n";
123 <input type="submit" value="Opslaan" />