diff --git a/pandora_console/include/functions_io.php b/pandora_console/include/functions_io.php index 7e3d2660b2..d22641d4c7 100755 --- a/pandora_console/include/functions_io.php +++ b/pandora_console/include/functions_io.php @@ -593,22 +593,25 @@ function io_output_password($password) /** - * Prevents html tags if exists + * Clean html tags symbols for prevent use JS + * + * @param string $string String for safe. + * + * @return string */ function io_safe_html_tags(string $string) { - $init = strpos($string, '<'); - $output = ''; - - if ($init !== false) { + // Must have safe output for work properly. + $string = io_safe_output($string); + if (strpos($string, '<') !== false && strpos($string, '>') !== false) { $output = strstr($string, '<', true); $tmpOutput = strstr($string, '<'); $output .= strstr(substr($tmpOutput, 1), '>', true); $tmpOutput = strstr($string, '>'); $output .= substr($tmpOutput, 1); - $init = strpos($output, '<'); - if ($init !== false) { - $output .= io_safe_html_tags($output); + // If the string still contains tags symbols. + if (strpos($string, '<') !== false && strpos($string, '>') !== false) { + $output = io_safe_html_tags($output); } } else { $output = $string;