From 1eed580e8faf96227689156d87c6f1a11b440658 Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Tue, 10 Jul 2018 23:36:59 +0200 Subject: [PATCH] login/edit: declare column file storage Allow other columns to be declared before initialisation. --- login/edit.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/login/edit.php b/login/edit.php index e38ebc1..e174b06 100644 --- a/login/edit.php +++ b/login/edit.php @@ -20,22 +20,28 @@ $cols = [ '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); -- 2.30.0