From 3d2a7f486742b8045f576a42620831baaefabce4 Mon Sep 17 00:00:00 2001
From: klarkxy <278370456@qq.com>
Date: Fri, 6 Dec 2024 15:46:55 +0800
Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E6=96=B0=E6=94=B9=E5=9B=9Ehtml=5Fenti?=
=?UTF-8?q?ty=5Fdecode?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
web/admin/problem_add.php | 16 +++++++++++-----
web/admin/problem_edit.php | 2 +-
2 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/web/admin/problem_add.php b/web/admin/problem_add.php
index e677422..31c0deb 100644
--- a/web/admin/problem_add.php
+++ b/web/admin/problem_add.php
@@ -12,24 +12,29 @@ require_once ("../include/problem.php");
// contest_id
$title = $_POST['title'];
-$title = str_replace(",", ",", $title);
+// $title = str_replace(",", ",", $title);
+$title = html_entity_decode($title, ENT_QUOTES, 'UTF-8');
+
$time_limit = $_POST['time_limit'];
$memory_limit = $_POST['memory_limit'];
$description = $_POST['description'];
//$description = str_replace("
", "", $description);
//$description = str_replace("
", "
", $description);
-$description = str_replace(",", ",", $description);
+// $description = str_replace(",", ",", $description);
+$description = html_entity_decode($description, ENT_QUOTES, 'UTF-8');
$input = $_POST['input'];
//$input = str_replace("", "", $input);
//$input = str_replace("
", "
", $input);
-$input = str_replace(",", ",", $input);
+// $input = str_replace(",", ",", $input);
+$input = html_entity_decode($input, ENT_QUOTES, 'UTF-8');
$output = $_POST['output'];
//$output = str_replace("", "", $output);
//$output = str_replace("
", "
", $output);
-$output = str_replace(",", ",", $output);
+// $output = str_replace(",", ",", $output);
+$output = html_entity_decode($output, ENT_QUOTES, 'UTF-8');
$sample_input = $_POST['sample_input'];
$sample_output = $_POST['sample_output'];
@@ -44,7 +49,8 @@ if ($test_output=="") $test_output="\n";
$hint = $_POST['hint'];
//$hint = str_replace("", "", $hint);
//$hint = str_replace("
", "
", $hint);
-$hint = str_replace(",", ",", $hint);
+// $hint = str_replace(",", ",", $hint);
+$hint = html_entity_decode($hint, ENT_QUOTES, 'UTF-8');
$source = $_POST['source'];
diff --git a/web/admin/problem_edit.php b/web/admin/problem_edit.php
index ac456a4..a535100 100644
--- a/web/admin/problem_edit.php
+++ b/web/admin/problem_edit.php
@@ -227,7 +227,7 @@ include_once("kindeditor.php") ;
if (!(isset($_SESSION[$OJ_NAME.'_'."p$id"]) || isset($_SESSION[$OJ_NAME.'_'.'administrator']) || isset($_SESSION[$OJ_NAME.'_'.'problem_editor']) )) exit();
$title = $_POST['title'];
- $title = str_replace(",", ",", $title);
+ $title = html_entity_decode($title,ENT_QUOTES,"UTF-8");
$time_limit = $_POST['time_limit'];