fix scan args

This commit is contained in:
2024-10-10 18:07:44 +02:00
parent 01f8ee3ea0
commit f413212db9
4 changed files with 301 additions and 299 deletions

View File

@ -12,18 +12,19 @@ if (!file_exists($SCANS_DIR)) {
mkdir($SCANS_DIR);
}
$basedir = "{$_SERVER['REQUEST_SCHEME']}://{$_SERVER['SERVER_NAME']}:{$_SERVER['SERVER_PORT']}".dirname($_SERVER['REQUEST_URI']);
$basedir = "{$_SERVER['REQUEST_SCHEME']}://{$_SERVER['SERVER_NAME']}:{$_SERVER['SERVER_PORT']}" . dirname($_SERVER['REQUEST_URI']);
$args = '';
foreach ($options as $arg => $value) {
foreach ($inputs as $name => $value) {
echo "$name : $value $args<br>";
if (is_null($value)) {
http_response_code(400);
exit("Valeur incorecte pour le paramètre $option : ".filter_input(INPUT_GET, $option, FILTER_SANITIZE_FULL_SPECIAL_CHARS));
exit("Valeur incorecte pour le paramètre $option : " . filter_input(INPUT_GET, $option, FILTER_SANITIZE_FULL_SPECIAL_CHARS));
} else if ($value) {
if ($value === true) {
$args .= " -$arg";
$args .= " -$name";
} else {
$arg .= " -$arg ".escapeshellarg($value);
$args .= " -$name " . ($value);
}
}
}
@ -42,7 +43,7 @@ if (!file_exists($SCANS_DIR)) {
mkdir($SCANS_DIR);
}
$path = "$SCANS_DIR/".str_replace('/', '!', $targets).'.xml';
$path = "$SCANS_DIR/" . str_replace('/', '!', $targets) . '.xml';
if (!file_exists($path)) {
$xml->insertBefore($xml->createProcessingInstruction('xslt-param', "name='compareWith' value=''"), $xml->documentElement);
$xml->save($path);