fix empty name

master
Dirk Heilig 2024-07-12 14:11:01 +02:00
parent aa6eb6d457
commit 37a4bdd25d
2 changed files with 8 additions and 4 deletions

View File

@ -27,6 +27,9 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") {
$jobId = microtime(1) . "_" . uniqid();
#file_put_contents()
$queueDir = __DIR__ . "/../queue";
if(!is_dir($queueDir)){
mkdir($queueDir,0777,true);
}
$queueDir = realpath($queueDir);
$queueFile = $queueDir . "/" . $jobId . ".json";
file_put_contents($queueFile, json_encode($tags));
@ -96,7 +99,7 @@ EOT;
}
$err = "";
switch ($_GET["err"]) {
switch ($_GET["err"]??"") {
case "notags":
$err = "Please provide at least one tag";
break;
@ -111,9 +114,9 @@ switch ($_GET["err"]) {
<h1>c3RE AuerBoxTag Generator</h1>
<div style="color:red"><?php echo $err; ?></div>
<form method="post" action="/">
<label title="Render the first and last Char in Symbola if its not alphanumeric"><input type="checkbox" name="use_symbols" value="1"> Use Symbols
<!--label title="Render the first and last Char in Symbola if its not alphanumeric"><input type="checkbox" name="use_symbols" value="1"> Use Symbols
&#x24D8;
</label>
</label-->
<br>
<textarea name="tags" rows="10" cols="30" placeholder="one tag per line please" data-placeholder-nosym="one tag per line please" data-placeholder-sym="♡|||Anna|||♥"></textarea>
<br>

View File

@ -24,11 +24,12 @@ $tags = json_decode(file_get_contents($jobFile), true);
$zipFile = $dlDir . $jobId . ".zip";
chdir(__DIR__ . "/../AuerNameTag");
$shellArgs = array_map(function($tag){
return escapeshellarg($tag['name'].' '.$tag['symbolPrefix'].' '.$tag['symbolPost']);
return escapeshellarg($tag['text']);
}, $tags);
system("rm -rf out");
system("git reset --hard");
system("./make.sh " . implode(" ", $shellArgs));
chdir("out");
system("zip -r $zipFile .");
chdir("..");