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'];