dockerMan: remove HTML from descriptions

This commit is contained in:
Squidly271
2021-05-25 06:14:05 -04:00
committed by GitHub
parent 95bf7f6967
commit 094e319596
@@ -223,6 +223,8 @@ if ($_GET['xmlTemplate']) {
$arrConfig['Name'] = 'AppData Config Path';
}
}
$arrConfig['Name'] = strip_tags($arrConfig['Name']);
$arrConfig['Description'] = strip_tags($arrConfig['Description']);
}
}
if (!empty($dockercfg['DOCKER_APP_UNRAID_PATH']) && file_exists($dockercfg['DOCKER_APP_UNRAID_PATH'])) {
@@ -252,7 +254,8 @@ if ($_GET['xmlTemplate']) {
}
}
}
$xml['Description'] = str_replace(['[', ']'], ['<', '>'], $xml['Overview']);
$xml['Overview'] = str_replace(['[', ']'], ['<', '>'], $xml['Overview']);
$xml['Description'] = $xml['Overview'] = strip_tags(str_replace("<br>","\n", $xml['Overview']));
echo "<script>var Settings=".json_encode($xml).";</script>";
}
}
@@ -1039,13 +1042,10 @@ function toggleAllocations() {
function load_contOverview() {
var new_overview = $("textarea[name='contOverview']").val();
new_overview = new_overview.replaceAll("[","<").replaceAll("]",">");
// if no html tags are present, treat the overview as Markdown
if ( stripTags(new_overview) == new_overview ) {
// Handle code block being created by authors indenting (manually editing the xml and spacing)
new_overview = new_overview.replaceAll(" ","&nbsp;&nbsp;&nbsp;&nbsp;");
new_overview = marked(new_overview);
} else
new_overview = new_overview.replaceAll("\n","");
// Handle code block being created by authors indenting (manually editing the xml and spacing)
new_overview = new_overview.replaceAll(" ","&nbsp;&nbsp;&nbsp;&nbsp;");
new_overview = marked(new_overview);
new_overview = new_overview.replaceAll("\n","<br>"); // has to be after marked
$("#contDescription").html(new_overview);
}