From bcb36b4ab9e987ac5bc97f70dd754a916fa84a49 Mon Sep 17 00:00:00 2001 From: klarkxy <278370456@qq.com> Date: Fri, 9 May 2025 18:21:42 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8D=A2=E4=B8=AA=E5=9C=B0=E6=96=B9=E5=86=8D?= =?UTF-8?q?=E8=AF=95=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/template/syzoj/problem.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/web/template/syzoj/problem.php b/web/template/syzoj/problem.php index 6691b1e..25f8109 100644 --- a/web/template/syzoj/problem.php +++ b/web/template/syzoj/problem.php @@ -128,15 +128,15 @@ if ($pr_flag) { strpos($s, "class=\"md") === false ) // 没找到,那就加上 $s = "" . $s . ""; - // 删除代码块里的
防止引起混乱 + // 删除代码块里的html字符防止引起混乱 $s = preg_replace_callback('/(```.*?```|`[^`]*`)/s', function ($matches) { - return str_replace('
', '', $matches[0]); + $ss = str_replace('
', '', $matches[0]); + // 大于小于号 + $ss = htmlspecialchars_decode($ss, ENT_QUOTES | ENT_HTML5); + return $ss; }, $s); // 特殊转义 $s = str_replace("
", "\n", $s); - // 大于小于号 - $s = str_replace("<", "<", $s); - $s = str_replace(">", ">", $s); return $s; } ?>