Skip to content

Commit

Permalink
form - enctype unescaped
Browse files Browse the repository at this point in the history
```enctype="multipart/form-data"``` looks ugly :)
  • Loading branch information
nowackipawel authored Feb 10, 2019
1 parent 14ee71c commit bae0323
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions system/Helpers/form_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -83,7 +89,7 @@ function form_open(string $action = '', $attributes = [], array $hidden = []): s
$attributes .= ' accept-charset="' . strtolower($config->charset) . '"';
}

$form = '<form action="' . $action . '"' . $attributes . ">\n";
$form = '<form action="' . $action . '"' . (isset($enctype) ? ' enctype="' . $enctype . '" ' : '') . $attributes . ">\n";

// Add CSRF field if enabled, but leave it out for GET requests and requests to external websites
$before = Services::filters()->getFilters()['before'];
Expand Down

0 comments on commit bae0323

Please sign in to comment.