login/edit: separate columns declaration
authorMischa POSLAWSKY <perl@shiar.org>
Tue, 10 Jul 2018 21:36:41 +0000 (23:36 +0200)
committerMischa POSLAWSKY <perl@shiar.org>
Sat, 14 Jul 2018 11:47:55 +0000 (13:47 +0200)
Move configuration unchanged into edit.inc.php to allow site customisation.

login/edit.inc.php [new file with mode: 0644]
login/edit.php

diff --git a/login/edit.inc.php b/login/edit.inc.php
new file mode 100644 (file)
index 0000000..86b35b2
--- /dev/null
@@ -0,0 +1,47 @@
+<?php
+$cols = [
+       'username' => [
+               'label' => 'login',
+               'value' => $user['name'],
+               'target' => NULL,
+               'pattern' => "[a-z0-9-]+",
+               'size' => 10,
+       ],
+       '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',
+       ],
+       'tags' => [
+               'label' => 'groepen',
+               'filename' => 'profile/.tags',
+               'values' => [],
+       ],
+];
+
+if (isset($user['pass'])) {
+       $cols['newpass'] = [
+               'label' => 'wachtwoord',
+               'input' => <<<'EOT'
+                       <input type="password" name="oldpass" value="" placeholder="Huidig wachtwoord" />
+                       <input type="password" id="newpass" name="newpass" value="" placeholder="Nieuw wachtwoord" />
+                       <input type="password" name="passconf" value="" placeholder="Nogmaals" />
+EOT
+               ,
+               'hide'  => 'pass',
+       ];
+}
index 4a2e6f4665c39d429d08a8fea4203ee401878150..15b0a2a7dbebd8ded892b98a882bd9d5ee1cef8a 100644 (file)
@@ -14,32 +14,7 @@ and !empty($Place['user']) and $Place['user'] !== $User['name']) {
        ];
 }
 
-$cols = [
-       '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',
-       ],
-       'tags' => [
-               'label' => 'groepen',
-               'values' => [],
-               'filename' => 'profile/.tags',
-       ],
-];
+require_once('edit.inc.php');
 
 foreach ($cols as $col => &$colconf) {
        if (!isset($colconf['filename'])) {
@@ -85,29 +60,6 @@ foreach ($cols as $col => &$colconf) {
        $colconf['target'] = $colpath;  # editing allowed
 }
 
-$cols = [
-       'username' => [
-               'label' => 'login',
-               'value' => $user['name'],
-               'target' => NULL,
-               'pattern' => "[a-z0-9-]+",
-               'size' => 10,
-       ],
-] + $cols;
-
-if (isset($user['pass'])) {
-       $cols['newpass'] = [
-               'label' => 'wachtwoord',
-               'input' => <<<'EOT'
-                       <input type="password" name="oldpass" value="" placeholder="Huidig wachtwoord" />
-                       <input type="password" id="newpass" name="newpass" value="" placeholder="Nieuw wachtwoord" />
-                       <input type="password" name="passconf" value="" placeholder="Nogmaals" />
-EOT
-               ,
-               'hide'  => 'pass',
-       ];
-}
-
 $colwarn = [];
 if ($_POST) {
        if (!file_exists($user['dir']) and !@mkdir($user['dir'])) {