2020-07-01 20:47:02 +02:00
|
|
|
<?php require "inc.php"; ?>
|
2019-08-13 21:17:08 +02:00
|
|
|
<!--
|
2020-03-06 21:34:31 +01:00
|
|
|
_ _ _ ___ ____
|
|
|
|
| | (_| |__ _ __ ___ / _ \| _ \
|
|
|
|
| | | | '_ \| '__/ _ | | | | |_) |
|
|
|
|
| |___| | |_) | | | __| |_| | _ <
|
|
|
|
|_____|_|_.__/|_| \___|\__\_|_| \_\
|
|
|
|
|
|
|
|
LibreQR version 1.2.0
|
|
|
|
Créé par Miraty et diffusé sous AGPLv3+
|
2020-03-16 18:34:49 +01:00
|
|
|
Code source : https://code.antopie.org/miraty/libreqr
|
2020-03-06 21:34:31 +01:00
|
|
|
|
|
|
|
Ce fichier fait partie de LibreQR.
|
|
|
|
|
|
|
|
LibreQR est un logiciel libre ; vous pouvez le redistribuer ou le modifier
|
|
|
|
suivant les termes de la GNU Affero General Public License
|
|
|
|
telle que publiée par la Free Software Foundation ; soit la version 3
|
|
|
|
de la licence, soit (à votre gré) toute version ultérieure.
|
|
|
|
|
|
|
|
LibreQR est distribué dans l'espoir qu'il sera utile,
|
|
|
|
mais SANS AUCUNE GARANTIE ; sans même la garantie tacite de
|
|
|
|
QUALITÉ MARCHANDE ou d'ADÉQUATION à UN BUT PARTICULIER.
|
|
|
|
Consultez la GNU Affero General Public License pour plus de détails.
|
|
|
|
|
|
|
|
Vous devez avoir reçu une copie de la GNU Affero General Public License
|
|
|
|
en même temps que LibreQR ; si ce n'est pas le cas,
|
|
|
|
consultez <https://www.gnu.org/licenses/>.
|
|
|
|
|
2019-08-13 21:17:08 +02:00
|
|
|
-->
|
2019-01-26 14:23:19 +01:00
|
|
|
|
2020-03-06 21:34:31 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
function badQuery() { // Check if browser must be redirected
|
|
|
|
|
|
|
|
// Check if parameters are set
|
|
|
|
if (!isset($_GET['txt']))
|
|
|
|
return true;
|
|
|
|
else if (!isset($_GET['size']))
|
|
|
|
return true;
|
|
|
|
else if (!isset($_GET['redondancy']))
|
|
|
|
return true;
|
|
|
|
else if (!isset($_GET['margin']))
|
|
|
|
return true;
|
|
|
|
else if (!isset($_GET['bgColor']))
|
|
|
|
return true;
|
|
|
|
else if (!isset($_GET['mainColor']))
|
|
|
|
return true;
|
|
|
|
|
|
|
|
// Check parameters's types
|
|
|
|
else if (!is_numeric($_GET['size']))
|
|
|
|
return true;
|
|
|
|
else if (!is_string($_GET['redondancy']))
|
|
|
|
return true;
|
|
|
|
else if (!is_numeric($_GET['margin']))
|
|
|
|
return true;
|
|
|
|
else if (!is_string($_GET['bgColor']))
|
|
|
|
return true;
|
|
|
|
else if (!is_string($_GET['mainColor']))
|
|
|
|
return true;
|
|
|
|
|
|
|
|
// Check if redondancy value is correct
|
|
|
|
else if ($_GET['redondancy'] != "L" AND $_GET['redondancy'] != "M" AND $_GET['redondancy'] != "Q" AND $_GET['redondancy'] != "H")
|
|
|
|
return true;
|
|
|
|
|
|
|
|
else
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (badQuery()) {
|
|
|
|
|
|
|
|
parse_str(parse_url($_SERVER['REQUEST_URI'], PHP_URL_QUERY), $params);
|
|
|
|
|
|
|
|
if (!isset($params['txt']))
|
|
|
|
$params['txt'] = "";
|
|
|
|
|
|
|
|
if (!isset($params['redondancy']) OR !is_string($params['redondancy']) OR ($params['redondancy'] != "L" AND $params['redondancy'] != "M" AND $params['redondancy'] != "Q" AND $params['redondancy'] != "H"))
|
|
|
|
$params['redondancy'] = "H";
|
|
|
|
|
|
|
|
if (!isset($params['margin']) OR !is_numeric($params['margin']))
|
|
|
|
$params['margin'] = 2;
|
|
|
|
|
|
|
|
if (!isset($params['size']) OR !is_numeric($params['size']))
|
|
|
|
$params['size'] = 4;
|
|
|
|
|
|
|
|
if (!isset($params['bgColor']) OR !is_string($params['bgColor']))
|
|
|
|
$params['bgColor'] = "#FFFFFF";
|
|
|
|
|
|
|
|
if (!isset($params['mainColor']) OR !is_string($params['mainColor']))
|
|
|
|
$params['mainColor'] = "#000000";
|
|
|
|
|
|
|
|
header('Location: ' . $instPath . "?" . http_build_query($params));
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|
|
|
|
|
|
|
|
<!DOCTYPE html>
|
2020-07-01 20:47:02 +02:00
|
|
|
<html lang="<?= $locale ?>">
|
2019-01-26 14:23:19 +01:00
|
|
|
<head>
|
2019-08-13 21:17:08 +02:00
|
|
|
<meta charset="UTF-8">
|
2020-07-01 20:47:02 +02:00
|
|
|
<title>LibreQR · <?= $loc['subtitle'] ?></title>
|
|
|
|
<meta name="description" content="<?= $loc['description'] ?>">
|
2020-03-06 21:34:31 +01:00
|
|
|
<meta name="theme-color" content="<?php echo $variablesTheme['bg']; ?>">
|
2019-02-11 19:26:31 +01:00
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
2019-03-28 22:44:06 +01:00
|
|
|
<link rel="manifest" href="manifest.php">
|
2020-07-01 20:47:02 +02:00
|
|
|
<link rel="search" type="application/opensearchdescription+xml" title="<?= $loc['opensearch_actionName'] ?>" href="opensearch.php?redondancy=<?= $_GET['redondancy'] ?>&margin=<?= $_GET['margin'] ?>&size=<?= $_GET['size'] ?>&bgColor=<?= urlencode($_GET['bgColor']) ?>&mainColor=<?= urlencode($_GET['mainColor']) ?>">
|
2019-08-13 21:17:08 +02:00
|
|
|
<?php
|
2020-03-06 21:34:31 +01:00
|
|
|
// If style.min.css exists
|
|
|
|
if (file_exists("style.min.css"))
|
2020-03-17 14:03:25 +01:00
|
|
|
// And if it's older than theme.php or config.inc.php (so not up to date)
|
|
|
|
if (filemtime("themes/" . $theme . "/theme.php") > filemtime("style.min.css") OR filemtime("config.inc.php") > filemtime("style.min.css"))
|
2020-03-06 21:34:31 +01:00
|
|
|
// Then delete it
|
|
|
|
unlink("style.min.css");
|
2019-08-13 21:17:08 +02:00
|
|
|
|
2020-07-01 20:47:02 +02:00
|
|
|
require "lesserphp/lessc.inc.php";
|
2020-03-17 14:03:25 +01:00
|
|
|
$less = new lessc;
|
2020-07-01 20:47:02 +02:00
|
|
|
$less->setVariables($variablesTheme); // Make these colors available in style.less
|
2020-03-06 21:34:31 +01:00
|
|
|
$less->setFormatter("compressed");
|
2020-07-01 20:47:02 +02:00
|
|
|
$less->checkedCompile("style.less", "style.min.css"); // Compile, minimise and cache style.less into style.min.css
|
2020-03-06 21:34:31 +01:00
|
|
|
?>
|
|
|
|
<link type="text/css" rel="stylesheet" href="style.min.css">
|
|
|
|
<link type="text/css" rel="stylesheet" href="ubuntu/ubuntu.min.css">
|
2019-08-13 21:17:08 +02:00
|
|
|
|
|
|
|
<?php
|
2020-07-01 20:47:02 +02:00
|
|
|
foreach($themeDimensionsIcons as $dimFav) { // Set all icons dimensions
|
2020-03-06 21:34:31 +01:00
|
|
|
echo ' <link rel="icon" type="image/png" href="themes/' . $theme . '/icons/' . $dimFav . '.png" sizes="' . $dimFav . 'x' . $dimFav . '">' . "\n";
|
|
|
|
} ?>
|
2019-08-13 21:17:08 +02:00
|
|
|
|
2019-01-26 14:23:19 +01:00
|
|
|
</head>
|
|
|
|
|
2020-03-06 21:34:31 +01:00
|
|
|
<body>
|
|
|
|
|
2020-07-01 20:47:02 +02:00
|
|
|
<main>
|
2019-01-26 14:23:19 +01:00
|
|
|
|
2019-03-17 16:03:43 +01:00
|
|
|
<header>
|
2020-03-06 21:34:31 +01:00
|
|
|
<a id="lienTitres" href="./">
|
2020-07-01 20:47:02 +02:00
|
|
|
<img id="logo" src="themes/<?php echo $theme; ?>/icons/128.png">
|
2020-03-06 21:34:31 +01:00
|
|
|
<div id="titres">
|
|
|
|
<h1>LibreQR</h1>
|
2020-07-01 20:47:02 +02:00
|
|
|
<h2><?= $loc['subtitle'] ?></h2>
|
2020-03-06 21:34:31 +01:00
|
|
|
</div>
|
|
|
|
</a>
|
2019-03-17 16:03:43 +01:00
|
|
|
</header>
|
2019-08-13 21:17:08 +02:00
|
|
|
|
2020-03-06 21:34:31 +01:00
|
|
|
<form method="get" action="./">
|
2019-01-26 14:23:19 +01:00
|
|
|
|
2020-03-06 21:34:31 +01:00
|
|
|
<div id="firstWrapper">
|
2019-08-13 21:17:08 +02:00
|
|
|
|
2019-03-17 16:03:43 +01:00
|
|
|
<div class="param">
|
2020-07-01 20:47:02 +02:00
|
|
|
<label for="txt"><?= $loc['label_content'] ?></label>
|
2019-03-17 16:03:43 +01:00
|
|
|
<span class="conteneurAide">
|
2020-03-23 16:26:31 +01:00
|
|
|
<span class="boutonAide" tabindex="0"><img id="helpImg" src="help.svg.php?clr=<?= urlencode($variablesTheme["text"]) ?>" alt="Aide"></span>
|
2020-03-06 21:34:31 +01:00
|
|
|
<span class="contenuAide">
|
2020-07-01 20:47:02 +02:00
|
|
|
<?= $loc['help_content'] ?>
|
2020-03-06 21:34:31 +01:00
|
|
|
</span>
|
2019-03-17 16:03:43 +01:00
|
|
|
</span>
|
|
|
|
<br>
|
2020-07-01 20:47:02 +02:00
|
|
|
<textarea rows="8" required="" id="txt" placeholder="<?= $loc['placeholder'] ?>" name="txt"><?php
|
2020-03-06 21:34:31 +01:00
|
|
|
|
|
|
|
if (isset($_GET['txt'])) {
|
|
|
|
echo htmlspecialchars($_GET['txt']);
|
|
|
|
}
|
|
|
|
|
|
|
|
?></textarea>
|
2019-03-17 16:03:43 +01:00
|
|
|
</div>
|
|
|
|
|
2020-03-06 21:34:31 +01:00
|
|
|
<div id="menusDeroulants">
|
|
|
|
|
|
|
|
<div class="param">
|
2020-07-01 20:47:02 +02:00
|
|
|
<label for="redondancy"><?= $loc['label_redondancy'] ?></label>
|
2020-03-06 21:34:31 +01:00
|
|
|
<span class="conteneurAide">
|
2020-03-23 16:26:31 +01:00
|
|
|
<span class="boutonAide" tabindex="0"><img id="helpImg" src="help.svg.php?clr=<?= urlencode($variablesTheme["text"]) ?>" alt="Aide"></span>
|
2020-07-01 20:47:02 +02:00
|
|
|
<span class="contenuAide"><?= $loc['help_redondancy'] ?></span>
|
2020-03-06 21:34:31 +01:00
|
|
|
</span>
|
|
|
|
<br>
|
|
|
|
<select id="redondancy" name="redondancy">
|
2020-07-01 20:47:02 +02:00
|
|
|
<option <?php if (isset($_GET['redondancy']) AND ($_GET['redondancy'] == "L")) {echo 'selected="" ';} ?>value="L">L - 7%</option>
|
|
|
|
<option <?php if (isset($_GET['redondancy']) AND ($_GET['redondancy'] == "M")) {echo 'selected="" ';} ?>value="M">M - 15%</option>
|
|
|
|
<option <?php if (isset($_GET['redondancy']) AND ($_GET['redondancy'] == "Q")) {echo 'selected="" ';} ?>value="Q">Q - 25%</option>
|
|
|
|
<option <?php if ((isset($_GET['redondancy']) AND ($_GET['redondancy'] == "H")) OR (!isset($_GET['redondancy']) OR empty($_GET['redondancy']))) {echo 'selected="" ';} ?>value="H">H - 30%</option>
|
2020-03-06 21:34:31 +01:00
|
|
|
</select>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="param">
|
2020-07-01 20:47:02 +02:00
|
|
|
<label for="margin"><?= $loc['label_margin'] ?></label>
|
2020-03-06 21:34:31 +01:00
|
|
|
<span class="conteneurAide">
|
2020-03-23 16:26:31 +01:00
|
|
|
<span class="boutonAide" tabindex="0"><img id="helpImg" src="help.svg.php?clr=<?= urlencode($variablesTheme["text"]) ?>" alt="Aide"></span>
|
2020-07-01 20:47:02 +02:00
|
|
|
<span class="contenuAide"><?= $loc['help_margin'] ?></span>
|
2020-03-06 21:34:31 +01:00
|
|
|
</span>
|
|
|
|
<br>
|
|
|
|
<select id="margin" name="margin">
|
|
|
|
<option <?php if (isset($_GET['margin']) AND ($_GET['margin'] == "0")) {echo 'selected="" ';} ?>value="0">0</option>
|
|
|
|
<option <?php if (isset($_GET['margin']) AND ($_GET['margin'] == "1")) {echo 'selected="" ';} ?>value="1">1</option>
|
2020-07-01 20:47:02 +02:00
|
|
|
<option <?php if ((isset($_GET['margin']) AND ($_GET['margin'] == "2")) OR (!isset($_GET['margin']) OR empty($_GET['margin']))) {echo 'selected="" ';} ?>value="2">2 - <?= $loc['value_default'] ?></option>
|
2020-03-06 21:34:31 +01:00
|
|
|
<option <?php if (isset($_GET['margin']) AND ($_GET['margin'] == "3")) {echo 'selected="" ';} ?>value="3">3</option>
|
|
|
|
<option <?php if (isset($_GET['margin']) AND ($_GET['margin'] == "4")) {echo 'selected="" ';} ?>value="4">4</option>
|
|
|
|
<option <?php if (isset($_GET['margin']) AND ($_GET['margin'] == "5")) {echo 'selected="" ';} ?>value="5">5</option>
|
|
|
|
<option <?php if (isset($_GET['margin']) AND ($_GET['margin'] == "8")) {echo 'selected="" ';} ?>value="8">8</option>
|
|
|
|
<option <?php if (isset($_GET['margin']) AND ($_GET['margin'] == "10")) {echo 'selected="" ';} ?>value="10">10</option>
|
|
|
|
</select>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="param">
|
2020-07-01 20:47:02 +02:00
|
|
|
<label for="size"><?= $loc['label_size'] ?></label>
|
2020-03-06 21:34:31 +01:00
|
|
|
<span class="conteneurAide">
|
2020-03-23 16:26:31 +01:00
|
|
|
<span class="boutonAide" tabindex="0"><img id="helpImg" src="help.svg.php?clr=<?= urlencode($variablesTheme["text"]) ?>" alt="Aide"></span>
|
2020-07-01 20:47:02 +02:00
|
|
|
<span class="contenuAide"><?= $loc['help_size'] ?></span>
|
2020-03-06 21:34:31 +01:00
|
|
|
</span>
|
|
|
|
<br>
|
|
|
|
<select id="size" name="size">
|
|
|
|
<option <?php if (isset($_GET['size']) AND ($_GET['size'] == 1)) {echo 'selected="" ';} ?>value="1">1</option>
|
|
|
|
<option <?php if (isset($_GET['size']) AND ($_GET['size'] == 2)) {echo 'selected="" ';} ?>value="2">2</option>
|
|
|
|
<option <?php if (isset($_GET['size']) AND ($_GET['size'] == 3)) {echo 'selected="" ';} ?>value="3">3</option>
|
2020-07-01 20:47:02 +02:00
|
|
|
<option <?php if ((isset($_GET['size']) AND ($_GET['size'] == 4)) OR (!isset($_GET['size']) OR empty($_GET['size']))) {echo 'selected="" ';} ?>value="4">4 - <?= $loc['value_default'] ?></option>
|
2020-03-06 21:34:31 +01:00
|
|
|
<option <?php if (isset($_GET['size']) AND ($_GET['size'] == 5)) {echo 'selected="" ';} ?>value="5">5</option>
|
|
|
|
<option <?php if (isset($_GET['size']) AND ($_GET['size'] == 6)) {echo 'selected="" ';} ?>value="6">6</option>
|
|
|
|
<option <?php if (isset($_GET['size']) AND ($_GET['size'] == 8)) {echo 'selected="" ';} ?>value="8">8</option>
|
|
|
|
<option <?php if (isset($_GET['size']) AND ($_GET['size'] == 10)) {echo 'selected="" ';} ?>value="10">10</option>
|
|
|
|
<option <?php if (isset($_GET['size']) AND ($_GET['size'] == 15)) {echo 'selected="" ';} ?>value="15">15</option>
|
|
|
|
<option <?php if (isset($_GET['size']) AND ($_GET['size'] == 20)) {echo 'selected="" ';} ?>value="20">20</option>
|
|
|
|
</select>
|
|
|
|
</div>
|
|
|
|
|
2019-03-17 16:03:43 +01:00
|
|
|
</div>
|
|
|
|
|
2020-03-06 21:34:31 +01:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div id="colors">
|
|
|
|
|
2019-03-17 16:03:43 +01:00
|
|
|
<div class="param">
|
2020-07-01 20:47:02 +02:00
|
|
|
<label for="bgColor"><?= $loc['label_bgColor'] ?></label>
|
2020-03-06 21:34:31 +01:00
|
|
|
<div class="conteneurInputColor">
|
|
|
|
<input type="color" name="bgColor" id="bgColor" value="<?php if (!empty($_GET['bgColor'])) {echo htmlspecialchars($_GET['bgColor']);} else {echo "#FFFFFF";} ?>">
|
|
|
|
</div>
|
2019-03-17 16:03:43 +01:00
|
|
|
</div>
|
2019-01-26 14:23:19 +01:00
|
|
|
|
2020-03-06 21:34:31 +01:00
|
|
|
<div class="param">
|
2020-07-01 20:47:02 +02:00
|
|
|
<label for="mainColor"><?= $loc['label_mainColor'] ?></label>
|
2020-03-06 21:34:31 +01:00
|
|
|
<div class="conteneurInputColor">
|
|
|
|
<input type="color" name="mainColor" id="mainColor" value="<?php if (!empty($_GET['mainColor'])) {echo htmlspecialchars($_GET['mainColor']);} else {echo "#000000";} ?>">
|
|
|
|
</div>
|
|
|
|
</div>
|
2019-03-17 16:03:43 +01:00
|
|
|
</div>
|
2019-08-13 21:17:08 +02:00
|
|
|
|
2020-07-01 20:47:02 +02:00
|
|
|
<div class="centered">
|
|
|
|
<input class="bouton" type="submit" value="<?= $loc['button_create'] ?>" />
|
2019-03-17 16:03:43 +01:00
|
|
|
</div>
|
2019-02-11 19:26:31 +01:00
|
|
|
|
2019-03-17 16:03:43 +01:00
|
|
|
</form>
|
2019-02-11 19:26:31 +01:00
|
|
|
|
2020-03-06 21:34:31 +01:00
|
|
|
<?php
|
2019-02-11 19:26:31 +01:00
|
|
|
|
2020-03-06 21:34:31 +01:00
|
|
|
if (!empty($_GET['txt']) AND !empty($_GET['size']) AND !empty($_GET['redondancy']) AND !empty($_GET['margin']) AND !empty($_GET['bgColor']) AND !empty($_GET['mainColor'])) {
|
|
|
|
if (isset($_GET['txt']) AND isset($_GET['size']) AND isset($_GET['redondancy']) AND isset($_GET['margin']) AND isset($_GET['bgColor']) AND isset($_GET['mainColor'])) {
|
2020-03-06 23:21:38 +01:00
|
|
|
|
|
|
|
require "phpqrcode.php";
|
2019-08-13 21:17:08 +02:00
|
|
|
|
2020-03-06 21:34:31 +01:00
|
|
|
$cheminImage = "temp/" . generateRandomString($fileNameLenght) . ".png";
|
|
|
|
QRcode::png($_GET['txt'], $cheminImage, $_GET['redondancy'], $_GET['size'], $_GET['margin'], false, hexdec($_GET['bgColor']), hexdec($_GET['mainColor']));
|
|
|
|
?>
|
2020-07-01 20:47:02 +02:00
|
|
|
<div class="centered">
|
|
|
|
<a href="<?php echo $cheminImage; ?>" class="bouton" download="<?php echo htmlspecialchars($_GET['txt']); ?>.png"><?= $loc['button_download'] ?></a>
|
2020-03-06 21:34:31 +01:00
|
|
|
</div>
|
2019-02-11 19:26:31 +01:00
|
|
|
|
2020-07-01 20:47:02 +02:00
|
|
|
<div class="centered" id="showOnlyQR">
|
|
|
|
<a title="<?= $loc['title_showOnlyQR'] ?>" href="<?php echo $cheminImage; ?>"><img alt='Un code QR contenant "<?php echo htmlspecialchars($_GET['txt']); ?>"' id="qrCode" src="<?php echo $cheminImage; ?>"/></a>
|
2020-03-06 21:34:31 +01:00
|
|
|
</div>
|
|
|
|
<?php
|
|
|
|
}
|
2019-03-17 16:03:43 +01:00
|
|
|
}
|
2020-03-06 21:34:31 +01:00
|
|
|
?>
|
2019-02-11 19:26:31 +01:00
|
|
|
|
2020-07-01 20:47:02 +02:00
|
|
|
</main>
|
2019-02-11 19:26:31 +01:00
|
|
|
|
2020-03-06 21:34:31 +01:00
|
|
|
<div id="metaTexts">
|
2019-08-13 21:17:08 +02:00
|
|
|
|
2020-03-06 21:34:31 +01:00
|
|
|
<section id="info" class="metaText">
|
2020-07-01 20:47:02 +02:00
|
|
|
<?= $loc['metaText_qr'] ?>
|
2020-03-06 21:34:31 +01:00
|
|
|
</section>
|
2019-08-13 21:17:08 +02:00
|
|
|
|
2020-03-06 21:34:31 +01:00
|
|
|
<footer class="metaText">
|
2020-07-01 20:47:02 +02:00
|
|
|
<p>
|
|
|
|
<?= $loc['metaText_legal'] ?>
|
|
|
|
</p>
|
|
|
|
<?php if (isset($additionalText)) { ?>
|
|
|
|
<br>
|
|
|
|
<p>
|
|
|
|
<?= $additionalText ?>
|
|
|
|
</p>
|
|
|
|
<?php } ?>
|
2020-03-06 21:34:31 +01:00
|
|
|
</footer>
|
2019-02-11 19:26:31 +01:00
|
|
|
|
2020-03-06 21:34:31 +01:00
|
|
|
</div>
|
2019-02-11 19:26:31 +01:00
|
|
|
|
2019-03-17 16:03:43 +01:00
|
|
|
</body>
|
|
|
|
</html>
|