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'],
19 'label' => 'portretfoto',
24 foreach ($cols as $col => &$colconf) {
25 $colpath = "{$user['dir']}/$col.txt";
26 if (file_exists($colpath)) {
27 $colconf['value'] = @$colconf['type'] == 'file' ? '' :
28 file_get_contents($colpath);
30 if (file_exists($user['dir']) and !is_writable($user['dir'])) {
31 continue; # locked parent directory
33 if (isset($colconf['value']) and !is_writable($colpath)) {
34 continue; # locked column file
36 $colconf['target'] = $colpath; # editing allowed
40 'login' => ['label' => 'login', 'value' => $user['name'], 'target' => NULL],
45 if (!file_exists($user['dir']) and !@mkdir($user['dir'])) {
46 print "<p class=warn>Fout bij het aanmaken van gebruikersprofiel voor <em>{$user['name']}</em>.</p>\n\n";
50 foreach ($_POST as $col => $val) {
51 if (!isset($cols[$col])) {
54 if (isset($cols[$col]['value']) and $cols[$col]['value'] === $val) {
57 $cols[$col]['value'] = $val; # update form value
58 if (empty($cols[$col]['target'])) {
59 $colwarn[$col] = "Kan niet worden aangepast.";
62 if (file_put_contents($cols[$col]['target'], $val) === FALSE) {
63 $colwarn[$col] = "Fout bij opslaan.";
67 foreach ($_FILES as $col => $val) {
68 if (!isset($cols[$col]) and @$cols[$col]['type'] == 'file') {
71 switch ($val['error']) {
74 case UPLOAD_ERR_NO_FILE:
77 $colwarn[$col] = "Afbeelding niet goed ontvangen.";
80 if (empty($cols[$col]['target'])) {
81 $colwarn[$col] = "Kan niet worden aangepast.";
84 if (!@move_uploaded_file($val['tmp_name'], $cols[$col]['target'])) {
85 $colwarn[$col] = "Fout bij opslaan.";
87 $cols[$col]['value'] = '';
90 if (!empty($_POST['newpass'])) {
91 require_once('login/pass.inc.php');
92 if ($error = passform($user, $_POST)) {
93 $colwarn['pass'] = $error;
98 print "<p class=warn>Instellingen zijn niet (volledig) opgeslagen. Probeer het later nog eens.</p>\n\n";
101 print "<p>Alle instellingen zijn opgeslagen.</p>\n\n";
106 <form method="post" enctype="multipart/form-data">
108 Geef een e-mailadres op waarmee we u kunnen bereiken indien nodig.
109 Wij zullen dit adres nooit vrij- of doorgeven.
112 foreach ($cols as $col => &$colconf) {
114 printf('<label for="%s">%s:</label> ', $col, ucfirst($colconf['label']));
116 if (empty($colconf['target'])) print ' readonly';
117 printf(' type="%s" name="%s" id="%1$s" value="%s"',
118 @$colconf['type'] ?: 'text',
120 htmlspecialchars(@$colconf['value'])
122 print ' placeholder="Niet ingesteld"';
125 if ($error = @$colwarn[$col]) {
126 print " <span class=warn>$error</span>\n";
131 if (isset($user['pass'])) {
132 if ($hide = empty($_POST['newpass'])) {
134 <p><a onclick="document.getElementById('pass').removeAttribute('hidden'); this.remove()">Wachtwoord wijzigen</a></p>
138 <div id="pass"<?php if ($hide) print ' hidden'; ?>>
139 <label for="newpass">Wachtwoord:</label>
140 <input type="password" name="oldpass" value="" placeholder="Huidig wachtwoord" />
141 <input type="password" name="newpass" value="" placeholder="Nieuw wachtwoord" />
142 <input type="password" name="passconf" value="" placeholder="Nogmaals" />
144 if ($error = @$colwarn['pass']) {
145 print " <span class=warn>$error</span>\n";
152 <input type="submit" value="Opslaan" />