From bae03237260fa4d8adb147a3731b1cb84639b070 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Nowacki?= Date: Sun, 10 Feb 2019 15:35:01 +0100 Subject: [PATCH] form - enctype unescaped ```enctype="multipart/form-data"``` looks ugly :) --- system/Helpers/form_helper.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/system/Helpers/form_helper.php b/system/Helpers/form_helper.php index 4f21effbc568..01bc5d41f14f 100644 --- a/system/Helpers/form_helper.php +++ b/system/Helpers/form_helper.php @@ -70,7 +70,13 @@ function form_open(string $action = '', $attributes = [], array $hidden = []): s $csrfId = $attributes['csrf_id']; unset($attributes['csrf_id']); } - + + if(is_array($attributes) && array_key_exists('enctype', $attributes)) + { + $enctype = trim($attributes['enctype']); + unset($attributes['enctype']); + } + $attributes = stringify_attributes($attributes); if (stripos($attributes, 'method=') === false) @@ -83,7 +89,7 @@ function form_open(string $action = '', $attributes = [], array $hidden = []): s $attributes .= ' accept-charset="' . strtolower($config->charset) . '"'; } - $form = '
\n"; + $form = '\n"; // Add CSRF field if enabled, but leave it out for GET requests and requests to external websites $before = Services::filters()->getFilters()['before'];