X-Git-Url: http://git.shiar.net/minimedit.git/blobdiff_plain/4d2e4e3ea2eeeae35b3c904e45774bb3a302fd3b..e93a4651a5cc2ccc55964b419b4f57c9dd472520:/login/edit.php
diff --git a/login/edit.php b/login/edit.php
index 56451b5..46e2447 100644
--- a/login/edit.php
+++ b/login/edit.php
@@ -4,8 +4,9 @@ if (empty($user = &$User)) {
return;
}
-if (!empty($User['admin']) and $Page == 'login/edit' and $Args) {
- $username = strtolower(ltrim($Args, '/'));
+if (!empty($User['admin']) and !empty($Place['user'])) {
+ $username = strtolower($Place['user']);
+ unset($user);
$user = [
'dir' => "profile/$username",
'name' => $username,
@@ -16,11 +17,14 @@ $cols = [
'name' => [
'label' => 'volledige naam',
'explain' => "Alleen zichtbaar voor andere leden.",
+ 'filter' => ["\n", '; '],
+ 'size' => 30,
],
'email' => [
'label' => 'e-mailadres',
'type' => 'email',
'explain' => "Voor contact van of met deze site. Wij zullen dit nooit vrij- of doorgeven.",
+ 'size' => 30,
],
'avatar' => [
'label' => 'portretfoto',
@@ -45,11 +49,12 @@ foreach ($cols as $col => &$colconf) {
}
$cols = [
- 'login' => [
+ 'username' => [
'label' => 'login',
'value' => $user['name'],
'target' => NULL,
'pattern' => "[a-z0-9-]+",
+ 'size' => 10,
],
] + $cols;
@@ -133,12 +138,19 @@ if ($_POST) {
}
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
}
$cols[$col]['value'] = $val; # update form value
if (empty($cols[$col]['target'])) {
- $colwarn[$col] = "Kan niet worden aangepast.";
+ if (empty($cols[$col]['input'])) {
+ $colwarn[$col] = "Kan niet worden aangepast.";
+ }
continue;
}
if (file_put_contents($cols[$col]['target'], $val) === FALSE) {
@@ -216,9 +228,10 @@ foreach ($cols as $col => &$colconf) {
foreach ($colconf['values'] as $tag => $val) {
printf(
"\n\t\t" .
- '' .
- ' %s',
- $tag,
+ '' .
+ '' .
+ '',
+ "tags[$tag]", "tag-$tag",
$val['value'] ? ' checked' : '',
isset($val['target']) ? '' : ' readonly',
ucfirst($tag)
@@ -226,6 +239,11 @@ foreach ($cols as $col => &$colconf) {
}
}
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,
@@ -234,6 +252,7 @@ foreach ($cols as $col => &$colconf) {
'placeholder' => "Niet ingesteld",
'readonly' => empty($colconf['target']),
'pattern' => @$colconf['pattern'] ?: FALSE,
+ 'size' => @$colconf['size'] ?: FALSE,
];
if (@$colconf['type'] == 'file') {
$attrs['accept'] = "image/jpeg";