redondancy > redundancy

This commit is contained in:
Miraty 2022-02-13 01:24:34 +01:00
parent dd2afe6967
commit c49e34b2c2
8 changed files with 29 additions and 29 deletions

View File

@ -4,7 +4,7 @@
require "config.inc.php"; require "config.inc.php";
define("DEFAULT_REDONDANCY", "high"); define("DEFAULT_REDUNDANCY", "high");
define("DEFAULT_MARGIN", NULL); define("DEFAULT_MARGIN", NULL);
define("DEFAULT_SIZE", NULL); define("DEFAULT_SIZE", NULL);
define("DEFAULT_BGCOLOR", "FFFFFF"); define("DEFAULT_BGCOLOR", "FFFFFF");

View File

@ -6,7 +6,7 @@ require "inc.php";
$params = array( $params = array(
"txt" => "", "txt" => "",
"redondancy" => DEFAULT_REDONDANCY, "redundancy" => DEFAULT_REDUNDANCY,
"margin" => DEFAULT_MARGIN, "margin" => DEFAULT_MARGIN,
"size" => DEFAULT_SIZE, "size" => DEFAULT_SIZE,
"bgColor" => DEFAULT_BGCOLOR, "bgColor" => DEFAULT_BGCOLOR,
@ -17,7 +17,7 @@ $validFormSubmitted = false;
if ( if (
isset($_POST['txt']) isset($_POST['txt'])
AND isset($_POST['redondancy']) AND isset($_POST['redundancy'])
AND isset($_POST['margin']) AND isset($_POST['margin'])
AND isset($_POST['size']) AND isset($_POST['size'])
AND isset($_POST['bgColor']) AND isset($_POST['bgColor'])
@ -29,10 +29,10 @@ if (
else else
exit("Wrong value for txt"); exit("Wrong value for txt");
if ($_POST['redondancy'] === "low" OR $_POST['redondancy'] === "medium" OR $_POST['redondancy'] === "quartile" OR $_POST['redondancy'] === "high") if ($_POST['redundancy'] === "low" OR $_POST['redundancy'] === "medium" OR $_POST['redundancy'] === "quartile" OR $_POST['redundancy'] === "high")
$params['redondancy'] = $_POST['redondancy']; $params['redundancy'] = $_POST['redundancy'];
else else
exit("Wrong value for redondancy"); exit("Wrong value for redundancy");
if (is_numeric($_POST['margin']) AND $_POST['margin'] >= 0 AND $_POST['margin'] <= 1024) if (is_numeric($_POST['margin']) AND $_POST['margin'] >= 0 AND $_POST['margin'] <= 1024)
$params['margin'] = $_POST['margin']; $params['margin'] = $_POST['margin'];
@ -75,7 +75,7 @@ if (
<meta name="referrer" content="no-referrer"> <meta name="referrer" content="no-referrer">
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; img-src 'self' data:; style-src 'self'; manifest-src 'self'; form-action 'self';"> <meta http-equiv="Content-Security-Policy" content="default-src 'none'; img-src 'self' data:; style-src 'self'; manifest-src 'self'; form-action 'self';">
<link rel="manifest" href="manifest.php"> <link rel="manifest" href="manifest.php">
<link rel="search" type="application/opensearchdescription+xml" title="LibreQR" href="opensearch.php&#63;redondancy=<?= $params['redondancy'] ?>&amp;margin=<?= $params['margin'] ?>&amp;size=<?= $params['size'] ?>&amp;bgColor=<?= urlencode($params['bgColor']) ?>&amp;mainColor=<?= urlencode($params['mainColor']) ?>"> <link rel="search" type="application/opensearchdescription+xml" title="LibreQR" href="opensearch.php&#63;redundancy=<?= $params['redundancy'] ?>&amp;margin=<?= $params['margin'] ?>&amp;size=<?= $params['size'] ?>&amp;bgColor=<?= urlencode($params['bgColor']) ?>&amp;mainColor=<?= urlencode($params['mainColor']) ?>">
<?php <?php
require_once "less.php/lib/Less/Autoloader.php"; require_once "less.php/lib/Less/Autoloader.php";
Less_Autoloader::register(); Less_Autoloader::register();
@ -124,16 +124,16 @@ if (
<div class="param"> <div class="param">
<details> <details>
<summary><label for="redondancy"><?= $loc['label_redondancy'] ?></label></summary> <summary><label for="redundancy"><?= $loc['label_redundancy'] ?></label></summary>
<p class="helpText"> <p class="helpText">
<?= $loc['help_redondancy'] ?> <?= $loc['help_redundancy'] ?>
</p> </p>
</details> </details>
<select id="redondancy" name="redondancy"> <select id="redundancy" name="redundancy">
<option <?php if ($params['redondancy'] === "low") echo 'selected="" '; ?>value="low">L - 7%</option> <option <?php if ($params['redundancy'] === "low") echo 'selected="" '; ?>value="low">L - 7%</option>
<option <?php if ($params['redondancy'] === "medium") echo 'selected="" '; ?>value="medium">M - 15%</option> <option <?php if ($params['redundancy'] === "medium") echo 'selected="" '; ?>value="medium">M - 15%</option>
<option <?php if ($params['redondancy'] === "quartile") echo 'selected="" '; ?>value="quartile">Q - 25%</option> <option <?php if ($params['redundancy'] === "quartile") echo 'selected="" '; ?>value="quartile">Q - 25%</option>
<option <?php if ($params['redondancy'] === "high") echo 'selected="" '; ?>value="high">H - 30%</option> <option <?php if ($params['redundancy'] === "high") echo 'selected="" '; ?>value="high">H - 30%</option>
</select> </select>
</div> </div>
@ -213,7 +213,7 @@ if (
$qrCode $qrCode
->setText($params['txt']) ->setText($params['txt'])
->setSize($params['size']) ->setSize($params['size'])
->setErrorCorrection($params['redondancy']) ->setErrorCorrection($params['redundancy'])
->setForegroundColor(array( ->setForegroundColor(array(
'r' => hexdec(substr($params['mainColor'],0,2)), 'r' => hexdec(substr($params['mainColor'],0,2)),
'g' => hexdec(substr($params['mainColor'],2,2)), 'g' => hexdec(substr($params['mainColor'],2,2)),

View File

@ -4,7 +4,7 @@ $loc = array(
'description' => "Generate QR codes freely. Choose content, size, colors…", 'description' => "Generate QR codes freely. Choose content, size, colors…",
'label_content' => "Text to encode", 'label_content' => "Text to encode",
'label_redondancy' => "Redondancy rate", 'label_redundancy' => "Redundancy rate",
'label_margin' => "Margin size", 'label_margin' => "Margin size",
'label_size' => "Image size", 'label_size' => "Image size",
'label_bgColor' => "Background color", 'label_bgColor' => "Background color",
@ -20,7 +20,7 @@ $loc = array(
<p>To send an email: <code>mailto:contact@email.example</code></p> <p>To send an email: <code>mailto:contact@email.example</code></p>
<p>To share geographic coordinates: <code>geo:48.867564,2.364057</code></p> <p>To share geographic coordinates: <code>geo:48.867564,2.364057</code></p>
", ",
'help_redondancy' => "Redundancy is the duplication of information in the QR code to correct errors during decoding. A higher rate will produce a bigger QR code, but will have a better chance of being decoded correctly.", 'help_redundancy' => "Redundancy is the duplication of information in the QR code to correct errors during decoding. A higher rate will produce a bigger QR code, but will have a better chance of being decoded correctly.",
'help_margin' => "Number of pixels in each white band around the QR code.", 'help_margin' => "Number of pixels in each white band around the QR code.",
'help_size' => "Image width and height in pixels, without the margin.", 'help_size' => "Image width and height in pixels, without the margin.",

View File

@ -4,7 +4,7 @@ $loc = array(
'description' => "Générer des codes QR librement. Choix du contenu, de la taille, des couleurs…", 'description' => "Générer des codes QR librement. Choix du contenu, de la taille, des couleurs…",
'label_content' => "Texte à encoder", 'label_content' => "Texte à encoder",
'label_redondancy' => "Taux de redondance", 'label_redundancy' => "Taux de redondance",
'label_margin' => "Taille de la marge", 'label_margin' => "Taille de la marge",
'label_size' => "Taille de l'image", 'label_size' => "Taille de l'image",
'label_bgColor' => "Couleur de fond", 'label_bgColor' => "Couleur de fond",
@ -20,7 +20,7 @@ $loc = array(
<p>Pour envoyer un mail : <code>mailto:contact@email.example</code></p> <p>Pour envoyer un mail : <code>mailto:contact@email.example</code></p>
<p>Pour partager des coordonnées géographique : <code>geo:48.867564,2.364057</code></p> <p>Pour partager des coordonnées géographique : <code>geo:48.867564,2.364057</code></p>
", ",
'help_redondancy' => "La redondance est la duplication des informations dans le code QR afin de corriger les erreurs lors du décodage. Un taux plus élevé produira un code QR plus grand, mais aura plus de chance d'être décodé correctement.", 'help_redundancy' => "La redondance est la duplication des informations dans le code QR afin de corriger les erreurs lors du décodage. Un taux plus élevé produira un code QR plus grand, mais aura plus de chance d'être décodé correctement.",
'help_margin' => "Nombre de pixels de chaque bande blanche autour du code QR.", 'help_margin' => "Nombre de pixels de chaque bande blanche autour du code QR.",
'help_size' => "Largeur et hauteur de l'image en pixels, sans la marge.", 'help_size' => "Largeur et hauteur de l'image en pixels, sans la marge.",

View File

@ -4,7 +4,7 @@ $loc = array(
'description' => "Generatz de còdis QR liurament. Causissètz lo contengut, la talha, las colors…", 'description' => "Generatz de còdis QR liurament. Causissètz lo contengut, la talha, las colors…",
'label_content' => "Tèxt de codar", 'label_content' => "Tèxt de codar",
'label_redondancy' => "Taus de redondància", 'label_redundancy' => "Taus de redondància",
'label_margin' => "Talha del marge", 'label_margin' => "Talha del marge",
'label_size' => "Talha de limatge", 'label_size' => "Talha de limatge",
'label_bgColor' => "Color de fons", 'label_bgColor' => "Color de fons",
@ -20,7 +20,7 @@ $loc = array(
<p>Per enviar un corrièl: mailto:contact@email.example</p> <p>Per enviar un corrièl: mailto:contact@email.example</p>
<p>Per partejar de coordonadas geograficas: geo:48.867564,2.364057</p> <p>Per partejar de coordonadas geograficas: geo:48.867564,2.364057</p>
", ",
'help_redondancy' => "La redondància es la duplicacion de las informacions al còdi QR per dire de corregir las errors pendent lo deschiframent. Un taux mai naut produirà un còdi mai grand, mas serà de melhor deschifrar corrèctament.", 'help_redundancy' => "La redondància es la duplicacion de las informacions al còdi QR per dire de corregir las errors pendent lo deschiframent. Un taux mai naut produirà un còdi mai grand, mas serà de melhor deschifrar corrèctament.",
'help_margin' => "Nombre de pixèls de la banda blanca a lentorn del còdi QR.", 'help_margin' => "Nombre de pixèls de la banda blanca a lentorn del còdi QR.",
'help_size' => "Per quant deu la dimensions de limatge èsser multiplicada?", 'help_size' => "Per quant deu la dimensions de limatge èsser multiplicada?",

View File

@ -4,7 +4,7 @@ $loc = array(
'description' => "description", 'description' => "description",
'label_content' => "label_content", 'label_content' => "label_content",
'label_redondancy' => "label_redondancy", 'label_redundancy' => "label_redundancy",
'label_margin' => "label_margin", 'label_margin' => "label_margin",
'label_size' => "label_size", 'label_size' => "label_size",
'label_bgColor' => "label_bgColor", 'label_bgColor' => "label_bgColor",
@ -15,7 +15,7 @@ $loc = array(
'value_default' => "value_default", 'value_default' => "value_default",
'help_content' => "help_content", 'help_content' => "help_content",
'help_redondancy' => "help_redondancy", 'help_redundancy' => "help_redundancy",
'help_margin' => "help_margin", 'help_margin' => "help_margin",
'help_size' => "help_size", 'help_size' => "help_size",

View File

@ -11,7 +11,7 @@ require "inc.php"; ?>
<Language>*</Language> <Language>*</Language>
<InputEncoding>UTF-8</InputEncoding> <InputEncoding>UTF-8</InputEncoding>
<?php <?php
$redondancy = htmlspecialchars((isset($_GET['redondancy'])) ? $_GET['redondancy'] : DEFAULT_REDONDANCY); $redundancy = htmlspecialchars((isset($_GET['redundancy'])) ? $_GET['redundancy'] : DEFAULT_REDUNDANCY);
$margin = htmlspecialchars((isset($_GET['margin'])) ? $_GET['margin'] : DEFAULT_MARGIN); $margin = htmlspecialchars((isset($_GET['margin'])) ? $_GET['margin'] : DEFAULT_MARGIN);
$size = htmlspecialchars((isset($_GET['size'])) ? $_GET['size'] : DEFAULT_SIZE); $size = htmlspecialchars((isset($_GET['size'])) ? $_GET['size'] : DEFAULT_SIZE);
$bgColor = htmlspecialchars(urlencode((isset($_GET['bgColor'])) ? $_GET['bgColor'] : "%23" . DEFAULT_BGCOLOR)); $bgColor = htmlspecialchars(urlencode((isset($_GET['bgColor'])) ? $_GET['bgColor'] : "%23" . DEFAULT_BGCOLOR));
@ -19,14 +19,14 @@ require "inc.php"; ?>
?> ?>
<Url type="text/html" method="post" template="<?= $rootPath ?>"> <Url type="text/html" method="post" template="<?= $rootPath ?>">
<Param name="txt" value="{searchTerms}"/> <Param name="txt" value="{searchTerms}"/>
<Param name="redondancy" value="<?= $redondancy ?>"/> <Param name="redundancy" value="<?= $redundancy ?>"/>
<Param name="margin" value="<?= $margin ?>"/> <Param name="margin" value="<?= $margin ?>"/>
<Param name="size" value="<?= $size ?>"/> <Param name="size" value="<?= $size ?>"/>
<Param name="bgColor" value="<?= $bgColor ?>"/> <Param name="bgColor" value="<?= $bgColor ?>"/>
<Param name="mainColor" value="<?= $mainColor ?>"/> <Param name="mainColor" value="<?= $mainColor ?>"/>
</Url> </Url>
<Url type="application/opensearchdescription+xml" rel="self" template="<?= $rootPath ?>opensearch.php"> <Url type="application/opensearchdescription+xml" rel="self" template="<?= $rootPath ?>opensearch.php">
<Param name="redondancy" value="<?= $redondancy ?>"/> <Param name="redundancy" value="<?= $redundancy ?>"/>
<Param name="margin" value="<?= $margin ?>"/> <Param name="margin" value="<?= $margin ?>"/>
<Param name="size" value="<?= $size ?>"/> <Param name="size" value="<?= $size ?>"/>
<Param name="bgColor" value="<?= $bgColor ?>"/> <Param name="bgColor" value="<?= $bgColor ?>"/>

View File

@ -314,7 +314,7 @@ footer {
/* Inputs */ /* Inputs */
#redondancy, #margin, #txt, #size, input[type=color], input[type=submit], .button { #redundancy, #margin, #txt, #size, input[type=color], input[type=submit], .button {
border-width: 2px; border-width: 2px;
border-style: solid; border-style: solid;
border-radius: 10px; border-radius: 10px;
@ -366,7 +366,7 @@ footer {
} }
} }
#redondancy { #redundancy {
width: 250px; width: 250px;
height: 44px; height: 44px;
&:hover { &:hover {
@ -394,7 +394,7 @@ input[type=color] {
height: 38px; height: 38px;
} }
#redondancy, #size, #margin { #redundancy, #size, #margin {
@media @light { @media @light {
background-color: @bgField-light; background-color: @bgField-light;