Convert outdated <script language="javascript"> to <script> #2615

This commit is contained in:
Kijin Sung 2025-11-22 21:47:25 +09:00
parent e586552b29
commit 385067b005
2 changed files with 5 additions and 2 deletions

View file

@ -139,7 +139,7 @@ class Context
*/
private static $_check_patterns = array(
'@<(?:\?|%)@' => 'DENY ALL',
'@<script\s*?language\s*?=@i' => 'DENY ALL',
'@<script\s*?language\s*?=\s*?(?![\'"]javascript[\'"])@i' => 'DENY ALL',
'@</?script@i' => 'ALLOW ADMIN ONLY',
);

View file

@ -13,7 +13,10 @@ class Utility
public static function cleanHeaderAndFooterScripts(string $content)
{
$content = utf8_clean($content);
$content = preg_replace('!</?(html|head|body)[^>]*>!', '', $content);
$content = preg_replace('!</?(html|head|body)[^>]*>!i', '', $content);
$content = preg_replace_callback('!<script\b([^>]*?)language=[\'"]javascript[\'"]!i', function ($matches) {
return trim('<script ' . trim($matches[1]));
}, $content);
return utf8_trim($content);
}
}