rename saveAs to name
This commit is contained in:
		| @ -109,7 +109,7 @@ if ($preset && isset($presets[$preset])) { | |||||||
|     '-h'             => FILTER_VALIDATE_BOOLEAN, |     '-h'             => FILTER_VALIDATE_BOOLEAN, | ||||||
|     '--stylesheet'   => FILTER_VALIDATE_URL, |     '--stylesheet'   => FILTER_VALIDATE_URL, | ||||||
| // lanScan | // lanScan | ||||||
|     'saveAs'        => ['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => $fileNameRegex]], |     'name'        => ['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => $fileNameRegex]], | ||||||
|     'originalURL'   => FILTER_VALIDATE_URL, |     'originalURL'   => FILTER_VALIDATE_URL, | ||||||
|     'refreshPeriod' => ['filter' => FILTER_VALIDATE_INT, 'options' => ['min_range' => 0]], |     'refreshPeriod' => ['filter' => FILTER_VALIDATE_INT, 'options' => ['min_range' => 0]], | ||||||
|     'sudo'          => FILTER_VALIDATE_BOOLEAN, |     'sudo'          => FILTER_VALIDATE_BOOLEAN, | ||||||
|  | |||||||
| @ -632,10 +632,10 @@ foreach (scandir($SCANSDIR) as $filename) { | |||||||
|       </div> |       </div> | ||||||
|  |  | ||||||
|       <div class="field"> |       <div class="field"> | ||||||
|         <label for="saveAsInput">Enregistrer sous le nom</label> |         <label for="nameInput">Enregistrer sous le nom</label> | ||||||
|         <input id="saveAsInput" type="text" name="saveAs" placeholder="Réseau local" pattern='[^<>:"\\\/\|@?]+' |         <input id="nameInput" type="text" name="name" placeholder="Réseau local" pattern='[^<>:"\\\/\|@?]+' | ||||||
|           title="Caractères interdits :  <>:"\/|@?" |           title="Caractères interdits :  <>:"\/|@?" | ||||||
|           value="<?= $options["saveAs"] ?? ""; ?>"> |           value="<?= $options["name"] ?? ""; ?>"> | ||||||
|       </div> |       </div> | ||||||
|  |  | ||||||
|       <button type="submit" class="ui teal submit button">Démarrer</button> |       <button type="submit" class="ui teal submit button">Démarrer</button> | ||||||
|  | |||||||
							
								
								
									
										6
									
								
								scan.php
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								scan.php
									
									
									
									
									
								
							| @ -41,7 +41,7 @@ $xml = new DOMDocument(); | |||||||
| $xml->load($tempPath); | $xml->load($tempPath); | ||||||
| `rm "$tempPath"`; | `rm "$tempPath"`; | ||||||
|  |  | ||||||
| $thisURL = $options["saveAs"]?? false ? "$BASEDIR/$SCANSDIR/".rawurlencode($options["saveAs"]).".xml" : ""; | $thisURL = $options["name"]?? false ? "$BASEDIR/$SCANSDIR/".rawurlencode($options["name"]).".xml" : ""; | ||||||
| $xml->insertBefore($xml->createProcessingInstruction('xslt-param', "name='thisURL' value='".htmlentities($thisURL, ENT_QUOTES)."'"), $xml->documentElement); | $xml->insertBefore($xml->createProcessingInstruction('xslt-param', "name='thisURL' value='".htmlentities($thisURL, ENT_QUOTES)."'"), $xml->documentElement); | ||||||
| foreach ($options as $option => $value) { | foreach ($options as $option => $value) { | ||||||
|     if (substr($option, 0, 1) != '-') { |     if (substr($option, 0, 1) != '-') { | ||||||
| @ -49,8 +49,8 @@ foreach ($options as $option => $value) { | |||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
| if ($options["saveAs"] ?? false) { | if ($options["name"] ?? false) { | ||||||
|     $path = "$SCANSDIR/{$options["saveAs"]}.xml"; |     $path = "$SCANSDIR/{$options["name"]}.xml"; | ||||||
|     $xml->save($path); |     $xml->save($path); | ||||||
|  |  | ||||||
|     header("Location: $path"); |     header("Location: $path"); | ||||||
|  | |||||||
| @ -24,7 +24,7 @@ | |||||||
|     <xsl:variable name="init" select="document($originalURL)/nmaprun"/> |     <xsl:variable name="init" select="document($originalURL)/nmaprun"/> | ||||||
|     <xsl:variable name="nextComparison"> |     <xsl:variable name="nextComparison"> | ||||||
|         <xsl:choose> |         <xsl:choose> | ||||||
|             <xsl:when test="$thisURL"><xsl:value-of select="$saveAs"/></xsl:when> |             <xsl:when test="$thisURL"><xsl:value-of select="$thisURL"/></xsl:when> | ||||||
|             <xsl:when test="$originalURL"><xsl:value-of select="$originalURL"/></xsl:when> |             <xsl:when test="$originalURL"><xsl:value-of select="$originalURL"/></xsl:when> | ||||||
|             <xsl:otherwise></xsl:otherwise> |             <xsl:otherwise></xsl:otherwise> | ||||||
|         </xsl:choose> |         </xsl:choose> | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user