login/commits: navigation styling of page links
[minimedit.git] / login / edit.php
index 36058be29af2221ffbc108ad76a4e628d5a6963f..46e2447e34e5e5bfc63634a3e01e86130dc9b4bf 100644 (file)
@@ -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',
@@ -50,6 +54,7 @@ $cols = [
                'value' => $user['name'],
                'target' => NULL,
                'pattern' => "[a-z0-9-]+",
+               'size' => 10,
        ],
 ] + $cols;
 
@@ -133,6 +138,11 @@ 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
                }
@@ -229,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,
@@ -237,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";