From c2b40b5c71065e95f49396d8c4d50e0322bdb4a8 Mon Sep 17 00:00:00 2001 From: adrien Date: Wed, 16 Oct 2024 22:11:04 +0200 Subject: [PATCH] fix no name --- scan.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/scan.php b/scan.php index 3cd999a..369474d 100755 --- a/scan.php +++ b/scan.php @@ -42,10 +42,13 @@ $xml->load($tempPath); $saveAsURL = isset($options["saveAs"])? "$BASEDIR/$SCANSDIR/{$options["saveAs"]}.xml" : ""; $xml->insertBefore($xml->createProcessingInstruction('xslt-param', "name='savedAs' value='".htmlentities($saveAsURL, ENT_QUOTES)."'"), $xml->documentElement); -$xml->insertBefore($xml->createProcessingInstruction('xslt-param', "name='compareWith' value='".htmlentities($options["compareWith"] ?? "", ENT_QUOTES)."'"), $xml->documentElement); -$xml->insertBefore($xml->createProcessingInstruction('xslt-param', "name='refreshPeriod' value='".htmlentities($options["refreshPeriod"] ?? "", ENT_QUOTES)."'"), $xml->documentElement); +foreach ($options as $arg => $value) { + if (substr($arg, 0, 1) != '-') { + $xml->insertBefore($xml->createProcessingInstruction('xslt-param', "name='$arg' value='".htmlentities($value, ENT_QUOTES)."'"), $xml->documentElement); + } +} -if (isset($options["saveAs"])) { +if ($options["saveAs"] ?? false) { $path = "$SCANSDIR/{$options["saveAs"]}.xml"; $xml->save($path);