forked from miraty/libreqr

17 changed files with 5732 additions and 3999 deletions
@ -0,0 +1,49 @@ |
|||
# Changelog |
|||
|
|||
All notable changes to this project will be documented in this file. |
|||
|
|||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). |
|||
|
|||
## Unreleased |
|||
|
|||
### Added |
|||
|
|||
* i18n system |
|||
* English l10n |
|||
* Changelog |
|||
|
|||
### Changed |
|||
|
|||
* Use lesserphp instead of lessphp |
|||
|
|||
## 1.2.0 - 2020-03-23 |
|||
|
|||
### Added |
|||
|
|||
* Ability to chooses QR code colors |
|||
|
|||
### Changed |
|||
|
|||
* The software is now named LibreQR |
|||
* Parameters now uses GET instead of POST |
|||
* The OpenSearch plugin now generate QR codes with arguments used when added |
|||
|
|||
## 1.1.0 - 2019-03-29 |
|||
|
|||
### Added |
|||
|
|||
* OpenSearch |
|||
* WebManifest |
|||
|
|||
### Changed |
|||
|
|||
* Server-side LESS compilation |
|||
* Icons are now themed and in multiple dimensions |
|||
|
|||
### Fixed |
|||
|
|||
* Placeholder font |
|||
|
|||
## 1.0.0 - 2019-02-13 |
|||
|
|||
Initial release |
@ -1,47 +1,22 @@ |
|||
<?php |
|||
|
|||
// ----- Settings ----- |
|||
// ----- Paramètres ----- |
|||
|
|||
deleteOldQR(60 * 60 * 24 * 7); // Temps en secondes après lequel le code QR sera supprimé lors du chargement d'un page |
|||
// EN: Time in seconds after which the QR code will be deleted when a page loads. |
|||
// Default: 60 * 60 * 24 * 7 (one week) |
|||
// FR : Temps en secondes après lequel le code QR sera supprimé lors du chargement d'un page. |
|||
// Par défaut : 60 * 60 * 24 * 7 (une semaine) |
|||
deleteOldQR(60 * 60 * 24 * 7); |
|||
|
|||
$theme = "dark"; // dark, light ou parinux |
|||
// EN: Theme's name (must be in the themes directory) |
|||
// FR : Nom du thème (doit être dans le dossier themes) |
|||
$theme = "dark"; |
|||
|
|||
$fileNameLenght = 32; // Longueur du nom du fichier du code QR |
|||
|
|||
// ----- Trucs nécessaires partout ----- |
|||
|
|||
// Définit l'URL racine |
|||
if (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') |
|||
$protocol = "https"; |
|||
else |
|||
$protocol = "http"; |
|||
$instPath = $protocol . "://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; |
|||
$instPath = preg_replace('#\?.*$#', '', $instPath); |
|||
$instPath = preg_replace('#(manifest|opensearch|index).php$#i', '', $instPath); |
|||
// EN: Language used if those wanted by the user are not available |
|||
// FR : Langue utilisée si celles demandées par l'utilisateurice ne sont pas disponibles |
|||
$locale = "fr"; // fr ou en |
|||
|
|||
require "themes/" . $theme . "/theme.php"; // Charge le thème graphique |
|||
|
|||
function generateRandomString($length) { |
|||
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; |
|||
$charactersLength = strlen($characters); |
|||
$randomString = ''; |
|||
for ($i = 0; $i < $length; $i++) { |
|||
$randomString .= $characters[rand(0, $charactersLength - 1)]; |
|||
} |
|||
return $randomString; |
|||
} |
|||
$fileNameLenght = 32; // Longueur du nom du fichier du code QR |
|||
|
|||
function deleteOldQR($tempsDeSuppression) { |
|||
/* |
|||
Cette fonction supprime les fichiers (normalement des images de codes QR) |
|||
dans temp/ plus vieux que le temps en seconde passé en argument |
|||
*/ |
|||
$listeCodesQR = new DirectoryIterator("temp"); |
|||
foreach($listeCodesQR as $listeCodesQR) { |
|||
if ($listeCodesQR->getFilename() != "." AND $listeCodesQR->getFilename() != ".." AND $listeCodesQR->getFilename() != ".gitkeep") { |
|||
if ((time() - filemtime("temp/" . $listeCodesQR->getFilename())) > $tempsDeSuppression) { // Si le temps actuel (en heure Posix) moins la date de dernière modification de l'image est supérieur à la durée de vie demandée de l'image |
|||
unlink("temp/" . $listeCodesQR->getFilename()); // Alors supprimer cette image |
|||
} |
|||
} |
|||
} |
|||
} |
|||
//$additionalText = "This LibreQR instance is hosted by <a href='https://foo.bar'>foo</a>."; |
|||
|
@ -0,0 +1,48 @@ |
|||
<?php // ----- This file is included everywhere -----
|
|||
|
|||
require "config.inc.php"; |
|||
|
|||
// Defines locale used |
|||
$clientLocales = $_SERVER['HTTP_ACCEPT_LANGUAGE']; |
|||
$clientLocales = preg_replace("#[A-Z0-9]|q=|;|-|\.#", "", $clientLocales); |
|||
$clientLocales = explode(',', $clientLocales); |
|||
$availableLocales = array('fr', 'en', 'template'); |
|||
foreach ($clientLocales as $clientLocale) { |
|||
if (in_array($clientLocale, $availableLocales)) { |
|||
$locale = $clientLocale; |
|||
break; |
|||
} |
|||
} |
|||
require "locales/" . $locale . ".php"; |
|||
|
|||
// Defines root URL |
|||
if (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') |
|||
$protocol = "https"; |
|||
else |
|||
$protocol = "http"; |
|||
$instPath = $protocol . "://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; |
|||
$instPath = preg_replace('#\?.*$#', '', $instPath); |
|||
$instPath = preg_replace('#(manifest|opensearch|index).php$#i', '', $instPath); |
|||
|
|||
require "themes/" . $theme . "/theme.php"; // Load theme |
|||
|
|||
function generateRandomString($length) { |
|||
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; |
|||
$charactersLength = strlen($characters); |
|||
$randomString = ''; |
|||
for ($i = 0; $i < $length; $i++) { |
|||
$randomString .= $characters[rand(0, $charactersLength - 1)]; |
|||
} |
|||
return $randomString; |
|||
} |
|||
|
|||
// Deletes images in temp/ older than the specified time in seconds |
|||
function deleteOldQR($deleteAfter) { |
|||
$files = array_diff(scandir("temp"), array('..', '.', '.gitkeep')); |
|||
foreach($files as $file) { |
|||
// If this actual time (in Posix time) less last modification image date is greater than time asked |
|||
if ((time() - filemtime("temp/" . $file)) > $deleteAfter) { |
|||
unlink("temp/" . $file); // Deletes this image |
|||
} |
|||
} |
|||
} |
File diff suppressed because it is too large
File diff suppressed because it is too large
File diff suppressed because it is too large
@ -0,0 +1,47 @@ |
|||
<?php |
|||
$loc = array( |
|||
'subtitle' => "QR codes generator", |
|||
'description' => "Generate QR codes freely. Choose content, size, colors...", |
|||
|
|||
'label_content' => "Text to encode", |
|||
'label_redondancy' => "Redondancy rate", |
|||
'label_margin' => "Margin size", |
|||
'label_size' => "Image size", |
|||
'label_bgColor' => "Background color", |
|||
'label_mainColor' => "Foreground color", |
|||
|
|||
'placeholder' => "Enter the text to encode in the QR code", |
|||
|
|||
'value_default' => "default", |
|||
|
|||
'help_content' => " |
|||
You can encode what you want as text.<br> |
|||
Softwares which decodes these QR codes could suggest to open them with dedicated software, depending on their <a href='https://en.wikipedia.org/wiki/List_of_URI_schemes'>URI scheme</a>.<br><br> |
|||
For instance, to open a webpage:<br> |
|||
https://www.domain.tld/<br><br> |
|||
To send an email:<br> |
|||
mailto:contact@domain.tld<br><br> |
|||
To share geographic coordinates:<br> |
|||
geo:48.867564,2.364057<br><br> |
|||
To call a phone number:<br> |
|||
tel:+33639981871 |
|||
", |
|||
'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_margin' => "Number of pixels in the white bands around the QR code.", |
|||
'help_size' => "By how much will the dimensions of the image be multiplied?", |
|||
|
|||
'button_create' => "Generate", |
|||
'button_download' => "Download this QR code", |
|||
|
|||
'title_showOnlyQR' => "Show only this QR code", |
|||
|
|||
'metaText_qr' => " |
|||
<h3>What's a QR code ?</h3> |
|||
A QR code is a 2 dimensions barcode in which is written in binary text. It can be decoded with a device equipped with a photo sensor and an adequate software. |
|||
<a href='https://en.wikipedia.org/wiki/QR_code'>QR code on Wikipedia</a> |
|||
", |
|||
'metaText_legal' => "LibreQR 1.2.0 is a free software whose <a href='https://code.antopie.org/miraty/libreqr/''>source code</a> is available under the terms of the <abbr title='GNU Affero General Public License version 3 ou toute version ultérieure'><a href='LICENSE.html'>AGPLv3</a>+</abbr>.", |
|||
|
|||
'opensearch_description' => "Generate QR codes from your search or address bar", |
|||
'opensearch_actionName' => "Generate QR codes from your search or address bar", |
|||
); |
@ -0,0 +1,47 @@ |
|||
<?php |
|||
$loc = array( |
|||
'subtitle' => "Générateur de codes QR", |
|||
'description' => "Générez des codes QR librement. Choisissez le contenu, la taille, les couleurs...", |
|||
|
|||
'label_content' => "Texte à encoder", |
|||
'label_redondancy' => "Taux de redondance", |
|||
'label_margin' => "Taille de la marge", |
|||
'label_size' => "Taille de l'image", |
|||
'label_bgColor' => "Couleur de fond", |
|||
'label_mainColor' => "Couleur de premier plan", |
|||
|
|||
'placeholder' => "Entrez le texte à encoder dans le code QR", |
|||
|
|||
'value_default' => "par défaut", |
|||
|
|||
'help_content' => " |
|||
Vous pouvez encoder ce que vous voulez sous forme de texte.<br> |
|||
Les logiciels qui décodent ces codes QR pourraient proposer de les ouvrir avec un logiciel dédié, en fonction de leur <a href='https://fr.wikipedia.org/wiki/Sch%C3%A9ma_d%27URI'>schéma d'URI</a>.<br><br> |
|||
Par exemple, pour ouvrir une page Web :<br> |
|||
https://www.domaine.tld/<br><br> |
|||
Pour envoyer un mail :<br> |
|||
mailto:contact@domaine.tld<br><br> |
|||
Pour partager des coordonnées géographique :<br> |
|||
geo:48.867564,2.364057<br><br> |
|||
Pour appeler un numéro de téléphone :<br> |
|||
tel:+33639981871 |
|||
", |
|||
'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_margin' => "Nombre de pixels des bandes blanches autour du code QR.", |
|||
'help_size' => "Par combien les dimensions de l'image seront-elles multipliées ?", |
|||
|
|||
'button_create' => "Générer", |
|||
'button_download' => "Télécharger ce code QR", |
|||
|
|||
'title_showOnlyQR' => "Afficher uniquement ce code QR", |
|||
|
|||
'metaText_qr' => " |
|||
<h3>Qu'est-ce qu'un code QR ?</h3> |
|||
Un code QR est un code-barres en 2 dimensions dans lequel est inscrit en binaire du texte. Il peut être décodé avec un appareil muni d'un capteur photo et d'un logiciel adéquat. |
|||
<a href='https://fr.wikipedia.org/wiki/Code_QR'>Code QR sur Wikipédia</a> |
|||
", |
|||
'metaText_legal' => "LibreQR 1.2.0 est un logiciel libre dont le <a href='https://code.antopie.org/miraty/libreqr/''>code source</a> est disponible selon les termes de l'<abbr title='GNU Affero General Public License version 3 ou toute version ultérieure'><a href='LICENSE.html'>AGPLv3</a>+</abbr>.", |
|||
|
|||
'opensearch_description' => "Générez des codes QR depuis votre barre de recherche ou d'adresse", |
|||
'opensearch_actionName' => "Generate QR codes from your search or address bar", |
|||
); |
@ -0,0 +1,27 @@ |
|||
<?php |
|||
$loc = array( |
|||
'subtitle' => "subtitle", |
|||
'label_content' => "label_content", |
|||
'label_redondancy' => "label_redondancy", |
|||
'label_margin' => "label_margin", |
|||
'label_size' => "label_size", |
|||
'label_bgColor' => "label_bgColor", |
|||
'label_mainColor' => "label_mainColor", |
|||
|
|||
'placeholder' => "placeholder", |
|||
|
|||
'value_default' => "value_default", |
|||
|
|||
'help_content' => "help_content", |
|||
'help_redondancy' => "help_redondancy", |
|||
'help_margin' => "help_margin", |
|||
'help_size' => "help_size", |
|||
|
|||
'button_create' => "button_create", |
|||
'button_download' => "button_download", |
|||
|
|||
'title_showOnlyQR' => "title_showOnlyQR", |
|||
|
|||
'metaText_qr' => "metaText_qr", |
|||
'metaText_legal' => "metaText_legal", |
|||
); |
@ -1 +1 @@ |
|||
*{font-family:"Ubuntu", sans-serif;scrollbar-color:white #2a2a2a;scrollbar-width:auto;}a{color:white;text-decoration:underline;}a:hover{text-decoration:none;}#firstWrapper{display:flex;flex-direction:row;}#menusDeroulants{text-align:center;margin-left:20px;}#qrCode{max-width:480px;}.centrer{text-align:center;}.bouton{padding:3px 10px 3px 10px;text-decoration:none;}form{display:block;margin-bottom:30px;}.center{display:flex;flex-direction:column;justify-content:center;margin-left:auto;margin-right:auto;width:814px;}body{margin:18px;background-color:#2a2a2a;color:white;font-weight:normal;font-size:20px;}body h1{color:white;text-decoration:none;}label{font-size:20px;}header{text-align:center;padding:0px;margin:0px;height:64px;}#logo{width:64px;height:64px;}#titres{margin-left:20px;}h1,h2,h3,h4,h5,h6{margin:0px;font-weight:normal;}h1{font-size:33px;}h2{font-size:22px;}#lienTitres{text-align:left;justify-content:center;text-decoration:none;display:flex;flex-direction:row;}#showOnlyQR{margin-top:30px;}#titre{text-align:center;justify-content:center;}.param{padding:10px;padding-left:0px;margin-left:0px;padding-right:0px;margin-right:0px;}.conteneurInputColor{display:flex;flex-direction:row;justify-content:center;}::selection{color:#2a2a2a;background-color:white;}label[for=txt]{padding-left:22px;}#colors{display:flex;flex-direction:row;justify-content:space-between;text-align:center;}#colors .param{text-align:center;display:flex;justify-content:center;flex-direction:column;width:100%;}.metaText{color:#868686;text-align:left;transition:color 0.12s cubic-bezier(0.42,0.0,1.0,1.0);position:fixed;width:400px;}.metaText a:link{transition:color 0.12s cubic-bezier(0.42,0.0,1.0,1.0);color:#868686;text-decoration:underline;}.metaText:hover,.metaText:hover a:link{color:white;}footer{font-size:14px;bottom:20px;left:20px;}#info{font-size:16px;bottom:20px;right:20px;margin:0px;}#info h3{font-size:20px;font-weight:normal;padding-bottom:10px;}#redondancy,#margin,#txt,#size,input[type=color],input[type=submit],.bouton{border:2px #5f5f5f solid;border-radius:10px;font-size:20px;padding-left:10px;font-weight:normal;color:white;transition:border 0.1s linear;background-color:#31363b;margin-top:8px;}#redondancy:hover,#margin:hover,#txt:hover,#size:hover,input[type=color]:hover,input[type=submit]:hover,.bouton:hover{border:2px #808080 solid;}#redondancy:focus,#margin:focus,#txt:focus,#size:focus,input[type=color]:focus,input[type=submit]:focus,.bouton:focus{border:2px white solid;outline:none;}#redondancy,#size,#margin{background-color:#31363b;width:250px;height:40px;}#txt{background-color:#232629;color:white;padding:10px;margin:10px;width:500px;scrollbar-color:white #232629;scrollbar-width:auto;}input[type=submit]{font-size:28px;padding:10px;padding-left:14px;padding-right:14px;}#txt::placeholder{color:#868686;opacity:1;font-family:"Ubuntu", sans-serif;font-weight:normal;font-size:1em;}input[type=color]{height:60px;width:84px;padding:5px;border:2px #5f5f5f solid;}#helpImg{width:20px;height:20px;margin-bottom:-3px;margin-left:5px;}.boutonAide{height:0px;width:0px;color:#868686;cursor:help;font-size:0.8em;}.conteneurAide .contenuAide{position:absolute;transform:scale(0) rotate(-12deg);color:white;background:#151616;padding:15px;border-radius:10px;box-shadow:0 0 10px rgba(0,0,0,0.5);margin-top:23px;margin-left:-35px;transition:all .25s;opacity:0;max-width:500px;font-size:20px;text-align:left;}@media (max-width: 500px){.conteneurAide .contenuAide{position:fixed;margin:5px;left:0px;top:0px;}}.conteneurAide:hover .contenuAide,.conteneurAide:focus-within .contenuAide{transform:scale(1) rotate(0);opacity:1;}@media (max-width: 1400px){.metaText{width:250px;}}@media (max-width: 1050px){#metaTexts{display:flex;flex-direction:row;}.metaText{width:100%;position:static;font-size:20px;}#info{color:white;margin-bottom:20px;padding-top:30px;font-size:20px;}#info a:link{color:white;}}@media (max-width: 850px){#metaTexts{flex-direction:column;width:480px;justify-content:center;margin-left:auto;margin-right:auto;}.center{width:auto;}#firstWrapper{flex-direction:column;}body{margin:10px;}#txt{width:92%;}}@media (max-width: 500px){#metaTexts{width:auto;}#colors{flex-direction:column;}h1{font-size:28px;padding-top:6px;}#txt{width:85%;}#qrCode{max-width:94%;}}@media (max-width: 415px){h1{padding:0px;}} |
|||
*{font-family:"Ubuntu", sans-serif;scrollbar-color:white #2a2a2a;scrollbar-width:auto;}a{color:white;text-decoration:underline;}a:hover{text-decoration:none;}p{margin:0px;}#firstWrapper{display:flex;flex-direction:row;}#menusDeroulants{text-align:center;margin-left:20px;}#qrCode{max-width:480px;}.centered{text-align:center;}.bouton{padding:3px 10px 3px 10px;text-decoration:none;}form{display:block;margin-bottom:30px;}main{display:flex;flex-direction:column;justify-content:center;margin-left:auto;margin-right:auto;width:814px;}body{margin:18px;background-color:#2a2a2a;color:white;font-weight:normal;font-size:20px;}body h1{color:white;text-decoration:none;}label{font-size:20px;}header{text-align:center;padding:0px;margin:0px;height:64px;}#logo{width:64px;height:64px;}#titres{margin-left:20px;}h1,h2,h3,h4,h5,h6{margin:0px;font-weight:normal;}h1{font-size:33px;}h2{font-size:22px;}#lienTitres{text-align:left;justify-content:center;text-decoration:none;display:flex;flex-direction:row;}#showOnlyQR{margin-top:30px;}#titre{text-align:center;justify-content:center;}.param{padding:10px;padding-left:0px;margin-left:0px;padding-right:0px;margin-right:0px;}.conteneurInputColor{display:flex;flex-direction:row;justify-content:center;}::selection{color:#2a2a2a;background-color:white;}label[for=txt]{padding-left:22px;}#colors{display:flex;flex-direction:row;justify-content:space-between;text-align:center;}#colors .param{text-align:center;display:flex;justify-content:center;flex-direction:column;width:100%;}.metaText{color:#868686;text-align:left;transition:color 0.12s cubic-bezier(0.42,0.0,1.0,1.0);position:fixed;width:400px;}.metaText a:link{transition:color 0.12s cubic-bezier(0.42,0.0,1.0,1.0);color:#868686;text-decoration:underline;}.metaText:hover,.metaText:hover a:link{color:white;}footer{font-size:14px;bottom:20px;left:20px;}#info{font-size:16px;bottom:20px;right:20px;margin:0px;}#info h3{font-size:20px;font-weight:normal;padding-bottom:10px;}#redondancy,#margin,#txt,#size,input[type=color],input[type=submit],.bouton{border:2px #5f5f5f solid;border-radius:10px;font-size:20px;padding-left:10px;font-weight:normal;color:white;transition:border 0.1s linear;background-color:#31363b;margin-top:8px;}#redondancy:hover,#margin:hover,#txt:hover,#size:hover,input[type=color]:hover,input[type=submit]:hover,.bouton:hover{border:2px #808080 solid;}#redondancy:focus,#margin:focus,#txt:focus,#size:focus,input[type=color]:focus,input[type=submit]:focus,.bouton:focus{border:2px white solid;outline:none;}#redondancy,#size,#margin{background-color:#31363b;width:250px;height:40px;}#txt{background-color:#232629;color:white;padding:10px;margin:10px;width:500px;scrollbar-color:white #232629;scrollbar-width:auto;}input[type=submit]{font-size:28px;padding:10px;padding-left:14px;padding-right:14px;}#txt::placeholder{color:#868686;opacity:1;font-family:"Ubuntu", sans-serif;font-weight:normal;font-size:1em;}input[type=color]{height:60px;width:84px;padding:5px;border:2px #5f5f5f solid;}#helpImg{width:20px;height:20px;margin-bottom:-3px;margin-left:5px;}.boutonAide{height:0px;width:0px;color:#868686;cursor:help;font-size:0.8em;}.conteneurAide .contenuAide{position:absolute;transform:scale(0) rotate(-12deg);color:white;background:#151616;padding:15px;border-radius:10px;box-shadow:0 0 10px rgba(0,0,0,0.5);margin-top:23px;margin-left:-35px;transition:all .25s;opacity:0;max-width:500px;font-size:20px;text-align:left;}@media (max-width: 500px){.conteneurAide .contenuAide{position:fixed;margin:5px;left:0px;top:0px;}}.conteneurAide:hover .contenuAide,.conteneurAide:focus-within .contenuAide{transform:scale(1) rotate(0);opacity:1;}@media (max-width: 1400px){.metaText{width:250px;}}@media (max-width: 1050px){#metaTexts{display:flex;flex-direction:row;}.metaText{width:100%;position:static;font-size:20px;}#info{color:white;margin-bottom:20px;padding-top:30px;font-size:20px;}#info a:link{color:white;}}@media (max-width: 850px){#metaTexts{flex-direction:column;width:480px;justify-content:center;margin-left:auto;margin-right:auto;}main{width:auto;}#firstWrapper{flex-direction:column;}body{margin:10px;}#txt{width:92%;}}@media (max-width: 500px){#metaTexts{width:auto;}#colors{flex-direction:column;}h1{font-size:28px;padding-top:6px;}#txt{width:85%;}#qrCode{max-width:94%;}}@media (max-width: 415px){h1{padding:0px;}} |
Loading…
Reference in new issue