mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-05 17:51:40 +09:00
Convert outdated <script language="javascript"> to <script> #2615
This commit is contained in:
parent
e586552b29
commit
385067b005
2 changed files with 5 additions and 2 deletions
|
|
@ -139,7 +139,7 @@ class Context
|
||||||
*/
|
*/
|
||||||
private static $_check_patterns = array(
|
private static $_check_patterns = array(
|
||||||
'@<(?:\?|%)@' => 'DENY ALL',
|
'@<(?:\?|%)@' => 'DENY ALL',
|
||||||
'@<script\s*?language\s*?=@i' => 'DENY ALL',
|
'@<script\s*?language\s*?=\s*?(?![\'"]javascript[\'"])@i' => 'DENY ALL',
|
||||||
'@</?script@i' => 'ALLOW ADMIN ONLY',
|
'@</?script@i' => 'ALLOW ADMIN ONLY',
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,10 @@ class Utility
|
||||||
public static function cleanHeaderAndFooterScripts(string $content)
|
public static function cleanHeaderAndFooterScripts(string $content)
|
||||||
{
|
{
|
||||||
$content = utf8_clean($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);
|
return utf8_trim($content);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue