htmlentities -> htmlspecialchars

This commit is contained in:
2024-12-06 15:35:38 +08:00
parent daa005f029
commit d9b2d13caa
184 changed files with 410 additions and 405 deletions

View File

@@ -154,7 +154,7 @@ else {
$hydrop=yaml_parse($file_content);
$title=$hydrop['title'];
$source=implode(" ",$hydrop['tag']);
echo "<hr>".htmlentities($file_name." $title $source");
echo "<hr>".htmlspecialchars($file_name." $title $source");
if(!in_array($title,$inserted)){
$pid = addproblem($title,1,128, $description, $input, $output, $sample_input, $sample_output, $hint, $source, $spj, $OJ_DATA);
mkdir($OJ_DATA."/$pid/");
@@ -174,13 +174,13 @@ else {
if($save_path){
$description=str_replace("file://",$save_path."/",$description);
// echo htmlentities($description);
// echo htmlspecialchars($description);
}
$spj=0;
if($title!="" && (!in_array($title,$inserted)) && !hasProblem($title)){
$pid = addproblem($title,1,128, $description, $input, $output, $sample_input, $sample_output, $hint, $source, $spj, $OJ_DATA);
echo htmlentities("$description");
echo htmlspecialchars("$description");
mkdir($OJ_DATA."/$pid/");
array_push($inserted,$title);
}else{
@@ -189,7 +189,7 @@ else {
echo "skiped $title";
//$pid=0;
}
echo "PID:<a href='../problem.php?id=$pid' >".htmlentities($title,ENT_QUOTES,"UTF-8")."</a>";
echo "PID:<a href='../problem.php?id=$pid' >".htmlspecialchars($title,ENT_QUOTES,"UTF-8")."</a>";
}else if(basename($file_name)=="config.yaml"){
$hydrop=yaml_parse($file_content);
if($hydrop['type']=="objective"){
@@ -202,7 +202,7 @@ else {
$out.= $hydrop['answers'][$ansi][0]."\n";
$ansi++;
}
//echo htmlentities($out);
//echo htmlspecialchars($out);
if($pid>0){
file_put_contents($OJ_DATA."/$pid/data.out",$out);
file_put_contents($OJ_DATA."/$pid/data.in",($ansi-1)."\n");