3 if (empty($user = &$User)) {
7 if (!empty($User['admin']) and $Page == 'login/edit' and $Args) {
8 $username = strtolower(ltrim($Args, '/'));
10 'dir' => "profile/$username",
16 'name' => ['label' => 'volledige naam'],
17 'email' => ['label' => 'e-mailadres', 'type' => 'email'],
20 foreach ($cols as $col => &$colconf) {
21 $colpath = "{$user['dir']}/$col.txt";
22 if (file_exists($colpath)) {
23 $colconf['value'] = file_get_contents($colpath);
25 if (file_exists($user['dir']) and !is_writable($user['dir'])) {
26 continue; # locked parent directory
28 if (isset($colconf['value']) and !is_writable($colpath)) {
29 continue; # locked column file
31 $colconf['target'] = $colpath; # editing allowed
35 'login' => ['label' => 'login', 'value' => $user['name'], 'target' => NULL],
40 if (!file_exists($user['dir']) and !@mkdir($user['dir'])) {
41 print "<p class=warn>Fout bij het aanmaken van gebruikersprofiel voor <em>{$user['name']}</em>.</p>\n\n";
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) === FALSE) {
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" />