remove htmlentities

This commit is contained in:
Adrien MALINGREY 2024-10-20 13:44:55 +02:00
parent f001e1b61d
commit 458c04afa1
4 changed files with 50 additions and 35 deletions

View File

@ -7,7 +7,7 @@ $hostsListRegex = '/^[\da-zA-Z-.,:\/]+$/';
$protocolePortsListRegex = '/^(([TU]:)?[0-9\-]+|[a-z\-]+)(,([TU]:)?[0-9\-]+|,[a-z\-]+)*$/';
$portsListRegex = '/^([0-9\-]+|[a-z\-]+)(,[0-9\-]+|,[a-z\-]+)*$/';
$tempoRegex = '/^\d+[smh]?$/';
$fileNameRegex = '/^[^<>:"\/|?]+$/';
$fileNameRegex = '/^[^<>:\/|?]+$/';
$targets = filter_input(INPUT_GET, 'targets', FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => $targetsListRegex], "flags" => FILTER_NULL_ON_FAILURE]);
$preset = filter_input(INPUT_GET, "preset");

View File

@ -347,7 +347,7 @@ Exemples: <?= $_SERVER['REMOTE_ADDR']; ?>/24 <?= $_SERVER['SERVER_NAME']; ?> 10.
<label for="scriptInput">Scripts</label>
<input id="scriptInput" type="text" name="--script" placeholder="script"
title="<catégories|répertoire|nom|all>" list="scripts" pattern="[a-z][a-z0-9\-\.\/]*"
value="<?= htmlentities($options["--script"] ?? "", ENT_QUOTES); ?>">
value="<?= $options["--script"] ?? ""; ?>">
</div>
<div class="field">
@ -467,7 +467,7 @@ foreach (scandir($SCANSDIR) as $filename) {
<label for="saveAsInput">Enregistrer sous le nom</label>
<input id="saveAsInput" type="text" name="saveAs" placeholder="Réseau local" pattern='[^&lt;&gt;:&quot;\\\/\|@?]+'
title="Caractères interdits : &lt;&gt;:&quot;\/|@?"
value="<?= htmlentities($options["saveAs"] ?? "", ENT_QUOTES); ?>">
value="<?= $options["saveAs"] ?? ""; ?>">
</div>
<button type="submit" class="ui teal submit button">Démarrer</button>
@ -484,7 +484,7 @@ if (!file_exists($SCANSDIR)) {
foreach (scandir($SCANSDIR) as $filename) {
if (substr($filename, -4) == '.xml') {
$name = str_replace('!', '/', substr_replace($filename, '', -4));
echo "<a class='item' href='".htmlentities("$SCANSDIR/$filename", ENT_QUOTES)."'>$name</a>\n";
echo "<a class='item' href='$SCANSDIR/".rawurlencode($filename)."'>$name</a>\n";
}
}
?>

View File

@ -6,6 +6,7 @@
<xsl:import href="lib/parseCommand.xsl"/>
<xsl:import href="lib/serviceLabel.xsl"/>
<xsl:import href="lib/toast.xsl"/>
<xsl:output method="html" encoding="UTF-8"/>
<xsl:output indent="yes"/>
@ -162,37 +163,9 @@ table.order([1, 'asc']).draw()
$('.ui.dropdown').dropdown()
<xsl:if test="runstats/finished/@summary">
$.toast({
title : '<xsl:value-of select="runstats/finished/@exit"/>',
message : '<xsl:value-of select="runstats/finished/@summary"/>',
showIcon : 'satellite dish',
displayTime: 0,
closeIcon : true,
position : 'bottom right',
})
</xsl:if>
<xsl:if test="runstats/finished/@errormsg">
$.toast({
title : '<xsl:value-of select="runstats/finished/@exit"/>',
message : '<xsl:value-of select="runstats/finished/@errormsg"/>',
showIcon : 'exclamation triangle',
class : 'error',
displayTime: 0,
closeIcon : true,
position : 'bottom right',
})
</xsl:if>
<xsl:if test="$init">
$.toast({
message : 'Comparaison avec les résultats du <xsl:value-of select="$init/runstats/finished/@timestr"/>',
class : 'info',
showIcon : 'calendar',
displayTime: 0,
closeIcon : true,
position : 'bottom right',
})
</xsl:if>
<xsl:apply-templates select="runstats">
<xsl:with-param name="init" select="$init"/>
</xsl:apply-templates>
hiddenButton.onclick = function(event) {
if (lanScanForm.checkValidity()) {

42
templates/lib/toast.xsl Normal file
View File

@ -0,0 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
version="1.1">
<xsl:template match="runstats">
<xsl:param name="init"/>
<xsl:if test="finished/@summary">
$.toast({
title : '<xsl:value-of select="finished/@exit"/>',
message : '<xsl:value-of select="finished/@summary"/>',
showIcon : 'satellite dish',
displayTime: 0,
closeIcon : true,
position : 'bottom right',
})
</xsl:if>
<xsl:if test="finished/@errormsg">
$.toast({
title : '<xsl:value-of select="finished/@exit"/>',
message : '<xsl:value-of select="finished/@errormsg"/>',
showIcon : 'exclamation triangle',
class : 'error',
displayTime: 0,
closeIcon : true,
position : 'bottom right',
})
</xsl:if>
<xsl:if test="$init/runstats/finished">
$.toast({
message : 'Comparaison avec les résultats du <xsl:value-of select="$init/runstats/finished/@timestr"/>',
class : 'info',
showIcon : 'calendar',
displayTime: 0,
closeIcon : true,
position : 'bottom right',
})
</xsl:if>
</xsl:template>
</xsl:stylesheet>