return;
}
-if (!empty($User['admin']) and $Page == 'login/edit' and $Args) {
- $username = strtolower(ltrim($Args, '/'));
+if (!empty($User['admin'])
+and !empty($Place['user']) and $Place['user'] !== $User['name']) {
+ $username = strtolower($Place['user']);
+ unset($user);
$user = [
'dir' => "profile/$username",
'name' => $username,
'name' => [
'label' => 'volledige naam',
'explain' => "Alleen zichtbaar voor andere leden.",
+ 'filter' => ["\n", '; '],
+ 'size' => 30,
+ 'filename' => 'name.txt',
],
'email' => [
'label' => 'e-mailadres',
'type' => 'email',
'explain' => "Voor contact van of met deze site. Wij zullen dit nooit vrij- of doorgeven.",
+ 'size' => 30,
+ 'filename' => 'email.txt',
],
'avatar' => [
'label' => 'portretfoto',
'type' => 'file',
+ 'filename' => 'avatar.jpg',
],
];
foreach ($cols as $col => &$colconf) {
+ if (!isset($colconf['filename'])) {
+ continue; # exceptional storage
+ }
$filetype = @$colconf['type'] == 'file' ? 'jpg' : 'txt';
- $colpath = "{$user['dir']}/$col.$filetype";
+ $colpath = $user['dir'] . '/' . $colconf['filename'];
if (file_exists($colpath)) {
$colconf['value'] = $filetype != 'txt' ? '' :
file_get_contents($colpath);
}
$cols = [
- 'login' => [
+ 'username' => [
'label' => 'login',
'value' => $user['name'],
'target' => NULL,
'pattern' => "[a-z0-9-]+",
+ 'size' => 10,
],
] + $cols;
}
continue;
}
+
+ if (isset($cols[$col]['filter'])) {
+ list ($targetstr, $inputstr) = $cols[$col]['filter'];
+ $val = str_replace($inputstr, $targetstr, $val);
+ }
if (isset($cols[$col]['value']) and $cols[$col]['value'] === $val) {
continue; # unaltered
}
}
}
else {
+ if (isset($cols[$col]['filter'])) {
+ list ($targetstr, $inputstr) = $cols[$col]['filter'];
+ $colconf['value'] = str_replace($targetstr, $inputstr, $colconf['value']);
+ }
+
$attrs = [
'type' => @$colconf['type'] ?: 'text',
'name' => $col,
'placeholder' => "Niet ingesteld",
'readonly' => empty($colconf['target']),
'pattern' => @$colconf['pattern'] ?: FALSE,
+ 'size' => @$colconf['size'] ?: FALSE,
];
if (@$colconf['type'] == 'file') {
$attrs['accept'] = "image/jpeg";