From 6ae2047b653270d73708f9793518b4feb9c2a4fd Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Sun, 8 Jul 2018 17:18:23 +0200 Subject: [PATCH] login/edit: filter to replace newlines in input values Multiple names on Lijtweg. --- login/edit.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/login/edit.php b/login/edit.php index 46b6132..6f3eff2 100644 --- a/login/edit.php +++ b/login/edit.php @@ -17,6 +17,7 @@ $cols = [ 'name' => [ 'label' => 'volledige naam', 'explain' => "Alleen zichtbaar voor andere leden.", + 'filter' => ["\n", '; '], ], 'email' => [ 'label' => 'e-mailadres', @@ -134,6 +135,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 } @@ -230,6 +236,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, -- 2.30.0