From b011e37b4dcaf7918df16bcd690bac1c4ccc2b79 Mon Sep 17 00:00:00 2001
From: klarkxy <278370456@qq.com>
Date: Sat, 7 Dec 2024 17:39:58 +0800
Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=B8=80=E4=B8=AA=E5=87=BD?=
=?UTF-8?q?=E6=95=B0=E7=BB=9F=E4=B8=80=E5=A4=84=E7=90=86markdown=E7=9A=84?=
=?UTF-8?q?=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
web/admin/md_check.php | 17 +++++++++++++++++
web/admin/problem_add.php | 30 ++++++------------------------
web/admin/problem_edit.php | 23 ++++++-----------------
3 files changed, 29 insertions(+), 41 deletions(-)
create mode 100644 web/admin/md_check.php
diff --git a/web/admin/md_check.php b/web/admin/md_check.php
new file mode 100644
index 0000000..df23da0
--- /dev/null
+++ b/web/admin/md_check.php
@@ -0,0 +1,17 @@
+", "", $markdown);
+ $markdown = str_replace("
", "\n\n", $markdown);
+ $markdown = str_replace("
", "\n\n", $markdown);
+ return $markdown;
+}
diff --git a/web/admin/problem_add.php b/web/admin/problem_add.php
index ca9af06..cb9a85e 100644
--- a/web/admin/problem_add.php
+++ b/web/admin/problem_add.php
@@ -1,5 +1,6 @@
Please Login First!";
@@ -12,45 +13,26 @@ require_once ("../include/problem.php");
// contest_id
$title = $_POST['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 = html_entity_decode($description, ENT_QUOTES, 'UTF-8');
+$description = decodeMarkdownEntities($description);
$input = $_POST['input'];
-//$input = str_replace("", "", $input);
-//$input = str_replace("
", "
", $input);
-// $input = str_replace(",", ",", $input);
-// $input = html_entity_decode($input, ENT_QUOTES, 'UTF-8');
+$input = decodeMarkdownEntities($input);
$output = $_POST['output'];
-//$output = str_replace("", "", $output);
-//$output = str_replace("
", "
", $output);
-// $output = str_replace(",", ",", $output);
-// $output = html_entity_decode($output, ENT_QUOTES, 'UTF-8');
+$output = decodeMarkdownEntities($output);
$sample_input = $_POST['sample_input'];
$sample_output = $_POST['sample_output'];
$test_input = $_POST['test_input'];
$test_output = $_POST['test_output'];
-/* don't do this , we will left them empty for not generating invalid test data files
-if ($sample_input=="") $sample_input="\n";
-if ($sample_output=="") $sample_output="\n";
-if ($test_input=="") $test_input="\n";
-if ($test_output=="") $test_output="\n";
-*/
+
$hint = $_POST['hint'];
-//$hint = str_replace("", "", $hint);
-//$hint = str_replace("
", "
", $hint);
-// $hint = str_replace(",", ",", $hint);
-// $hint = html_entity_decode($hint, ENT_QUOTES, 'UTF-8');
+$hint = decodeMarkdownEntities($hint);
$source = $_POST['source'];
diff --git a/web/admin/problem_edit.php b/web/admin/problem_edit.php
index 5b0a1a5..78f6e2e 100644
--- a/web/admin/problem_edit.php
+++ b/web/admin/problem_edit.php
@@ -1,6 +1,7 @@
", "", $description);
- // $description = str_replace("", "
", $description);
- // $description = str_replace(",", ",", $description);
- // $description = html_entity_decode($description,ENT_QUOTES,"UTF-8");
+ $description = decodeMarkdownEntities($description);
$input = $_POST['input'];
- // $input = str_replace("", "", $input);
- // $input = str_replace("
", "
", $input);
- // $input = str_replace(",", ",", $input);
- // $input = html_entity_decode($input,ENT_QUOTES,"UTF-8");
+ $input = decodeMarkdownEntities($input);
+
$output = $_POST['output'];
- // $output = str_replace("", "", $output);
- // $output = str_replace("
", "
", $output);
- // $output = str_replace(",", ",", $output);
- // $output = html_entity_decode($output,ENT_QUOTES,"UTF-8");
+ $output = decodeMarkdownEntities($output);
$sample_input = $_POST['sample_input'];
$sample_output = $_POST['sample_output'];
@@ -257,10 +249,7 @@ include_once("kindeditor.php") ;
//if ($sample_output=="") $sample_output="\n";
$hint = $_POST['hint'];
- // $hint = str_replace("", "", $hint);
- // $hint = str_replace("
", "
", $hint);
- // $hint = str_replace(",", ",", $hint);
- // $hint = html_entity_decode($hint,ENT_QUOTES,"UTF-8");
+ $hint = decodeMarkdownEntities($hint);
$source = $_POST['source'];
$remote_oj= $_POST['remote_oj'];