Browse Source

CNVD-C-2024-690565问题修复

tags/6.3.2
tianya 2 months ago
parent
commit
0a62192123
1 changed files with 5 additions and 1 deletions
  1. +5
    -1
      src/system/helpers/filter.helper.php

+ 5
- 1
src/system/helpers/filter.helper.php View File

@@ -24,6 +24,9 @@ if (!defined('DEDEINC')) exit ('dedebiz');
if (!function_exists('HtmlReplace')) { if (!function_exists('HtmlReplace')) {
function HtmlReplace($str, $rptype = 0) function HtmlReplace($str, $rptype = 0)
{ {
if (!is_string($str)) {
return '';
}
$str = stripslashes($str); $str = stripslashes($str);
$str = preg_replace("/<[\/]{0,1}style([^>]*)>(.*)<\/style>/i", '', $str); $str = preg_replace("/<[\/]{0,1}style([^>]*)>(.*)<\/style>/i", '', $str);
if ($rptype == 0) { if ($rptype == 0) {
@@ -39,7 +42,8 @@ if (!function_exists('HtmlReplace')) {
} else { } else {
$str = preg_replace("/[\r\n\t ]{1,}/", ' ', $str); $str = preg_replace("/[\r\n\t ]{1,}/", ' ', $str);
$str = preg_replace('/script/i', 'script', $str); $str = preg_replace('/script/i', 'script', $str);
$str = preg_replace("/<[\/]{0,1}(link|meta|ifr|fra)[^>]*>/i", '', $str);
$str = preg_replace("/<[\/]{0,1}(link|meta|iframe|frame|object|embed|form|input|button|textarea|select)[^>]*>/i", '', $str);
$str = preg_replace('/\son\w+\s*=\s*["\'][^"\']*["\']/i', '', $str);
} }
return addslashes($str); return addslashes($str);
} }


Loading…
Cancel
Save