Skip to content

Commit

Permalink
A few tweaks. No big deal.
Browse files Browse the repository at this point in the history
  • Loading branch information
David Connelly committed Oct 19, 2023
1 parent d67994c commit 90fec2a
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions engine/tg_helpers/form_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -448,9 +448,9 @@ function post(string $field_name, ?bool $clean_up = null) {

if (isset($clean_up)) {
$value = filter_string($value);

if (is_numeric($value)) {
$var_type = (is_numeric(strpos($value, '.'))) ? 'double' : 'int';
$var_type = (strpos($value, '.') !== false) ? 'double' : 'int';
settype($value, $var_type);
}
}
Expand All @@ -463,13 +463,11 @@ function post(string $field_name, ?bool $clean_up = null) {
* Filter and sanitize a string.
*
* @param string $string The input string to be filtered and sanitized.
* @param string[] $allowed_tags An optional array of allowed HTML tags.
* @param string[] $allowed_tags An optional array of allowed HTML tags (default is an empty array).
* @return string The filtered and sanitized string.
*/
function filter_string(string $string, array $allowed_tags = []) {
// Potentially suitable for filtering data submitted via textarea.

// Remove HTML & PHP tags (please read note above for more!)
// Remove HTML & PHP tags
$string = strip_tags($string, implode('', $allowed_tags));

// Apply XSS filtering
Expand Down

0 comments on commit 90fec2a

Please sign in to comment.