Compare commits

..

3 commits

11 changed files with 123 additions and 109 deletions

View file

@ -99,7 +99,7 @@ function update_item($id, $changes) {
$item = get_item($id, true);
if (!is_array($item)) return false;
if (isset($changes['date']) && !is_null($changes['date']))
if (isset($changes['date']) && $changes['date'])
$changes['date'] = $db -> time2datetime($changes['date']);
try {

View file

@ -1,7 +1,7 @@
msgid ""
msgstr ""
"Project-Id-Version: \n"
"POT-Creation-Date: 2023-02-25 04:54+0100\n"
"POT-Creation-Date: 2023-02-25 17:17+0100\n"
"PO-Revision-Date: \n"
"Last-Translator: Benjamin Renard <brenard@zionetrix.net>\n"
"Language-Team: \n"
@ -74,6 +74,10 @@ msgstr "Impossible de se connecter à la base de données."
msgid "Invalid username or password."
msgstr "Nom d'utilisateur ou mot de passe invalide."
#: Auth/Form.php:64
msgid "Sign in"
msgstr "Connexion"
#: Auth/Http.php:34 Url.php:176
msgid "Authentication required"
msgstr "Authentification requise"
@ -236,34 +240,34 @@ msgstr ""
"Cette commande peut-être utilisée pour compiler les fichiers PO dans les "
"dossiers locales/*/LC_MESSAGES and les catalogues JS dans le dossier locales."
#: I18n.php:336
#: I18n.php:341
msgid "Fail to list EesyPHP PHP files."
msgstr "Une erreur est survenue en listant les fichiers PHP d'EesyPHP."
#: I18n.php:356
#: I18n.php:361
msgid "Fail to extract messages from EesyPHP PHP files using xgettext."
msgstr ""
"Une erreur est survenue en extrayant les messages depuis les fichiers PHP "
"d'EesyPHP en utilisant xgettext."
#: I18n.php:369
#: I18n.php:378
msgid "Fail to list application PHP files."
msgstr "Une erreur est survenue en listant les fichiers PHP de l'application."
#: I18n.php:389
#: I18n.php:398
msgid "Fail to extract messages from PHP files using xgettext."
msgstr ""
"Impossible d'extraire les messages depuis les fichiers PHP en utilisant "
"xgettext."
#: I18n.php:405
#: I18n.php:414
#, php-format
msgid "Fail to list JS files in the directory of static files '%s'."
msgstr ""
"Une erreur est survenue en listant les fichiers JS dans le dossier des "
"fichiers statiques '%s'."
#: I18n.php:427
#: I18n.php:436
#, php-format
msgid ""
"Fail to extract messages from JS files in the directory of static files '%s' "
@ -272,7 +276,7 @@ msgstr ""
"Une erreur est survenue en extrayant les messages depuis les fichiers JS du "
"dossier des fichiers statiques '%s' en utilisant xgettext."
#: I18n.php:449
#: I18n.php:458
#, php-format
msgid ""
"Fail to extract messages from templates directory '%s' using tsmarty2c.php "
@ -281,105 +285,105 @@ msgstr ""
"Impossible d'extraire les messages depuis le dossier de templates '%s' en "
"utilisant le script tsmarty2c.php."
#: I18n.php:485
#: I18n.php:494
msgid "Fail to merge messages using msgcat."
msgstr "Impossible de fusionner les messages en utilisant msgcat."
#: I18n.php:502
#: I18n.php:511
#, php-format
msgid "Compendium file %s not found."
msgstr "Fichier compendium %s introuvable."
#: I18n.php:513
#: I18n.php:522
#, php-format
msgid "POT file not found (%s). Please run extract_messages first."
msgstr ""
"Fichier POT introuvable (%s). Merci de lancer la commande extract_messages "
"pour commencer."
#: I18n.php:525 I18n.php:636
#: I18n.php:534 I18n.php:645
#, php-format
msgid "Lang directory '%s' found"
msgstr "Dossier de langue '%s' trouvé"
#: I18n.php:531 I18n.php:642
#: I18n.php:540 I18n.php:651
#, php-format
msgid "LC_MESSAGES directory not found in lang '%s' directory, ignore it."
msgstr ""
"Le dossier LC_MESSAGES est introuvable dans le dossier de langue '%s', on "
"l'ignore."
#: I18n.php:546
#: I18n.php:555
#, php-format
msgid "Fail to init messages in %s PO file using msginit (%s)."
msgstr ""
"Impossible d'initialiser les messages dans le fichier PO %s en utilisant "
"msginit (%s)."
#: I18n.php:564
#: I18n.php:573
#, php-format
msgid "Fail to update messages in %s PO file using msgmerge (%s)."
msgstr ""
"Impossible de mettre à jour les messages dans les fichiers PO %s en "
"utilisant msgmerge (%s)."
#: I18n.php:570 I18n.php:650
#: I18n.php:579 I18n.php:659
#, php-format
msgid "PO file not found in lang '%s' directory, ignore it."
msgstr ""
"Le fichier PO est introuvable dans le dossier de langue '%s', on l'ignore."
#: I18n.php:577 I18n.php:690
#: I18n.php:586 I18n.php:699
#, php-format
msgid "Fail to open root lang directory (%s)."
msgstr "Impossible d'ouvrir le dossier racine des langues (%s)."
#: I18n.php:606
#: I18n.php:615
#, php-format
msgid "Lang alias symlink found: %s -> %s"
msgstr "Lien symbolique d'alias de langue trouvé : %s -> %s"
#: I18n.php:613
#: I18n.php:622
#, php-format
msgid "JS catalog symlink for %s -> %s created (%s)"
msgstr "Lien symbolique de catalogue JS pour %s -> %s créé (%s)"
#: I18n.php:617
#: I18n.php:626
#, php-format
msgid "Fail to create JS catalog symlink for %s -> %s (%s)"
msgstr ""
"Impossible de créer le lien symbolique de catalogue JS pour %s -> %s (%s)"
#: I18n.php:623
#: I18n.php:632
#, php-format
msgid "JS catalog symlink for %s -> %s already exist (%s)"
msgstr "Le lien symbolique du catalogue JS pour %s -> %s existe déjà (%s)"
#: I18n.php:628
#: I18n.php:637
#, php-format
msgid "JS catalog file for %s already exist, but it's not a symlink to %s (%s)"
msgstr ""
"Le catalogue JS pour %s existe, mais il ne s'agit par d'un lien symbolique "
"vers %s (%s)"
#: I18n.php:663
#: I18n.php:672
#, php-format
msgid "Fail to compile messages from %s PO file as MO file using msgfmt (%s)."
msgstr ""
"Impossible de compiler les messages depuis le fichier PO %s en tant que "
"fichier MO en utilisant msgfmt (%s)."
#: I18n.php:673
#: I18n.php:682
#, php-format
msgid "Fail to open %s JS catalog file in write mode (%s)."
msgstr "Impossible d'ouvrir le catalogue JS %s en mode écriture (%s)."
#: I18n.php:678
#: I18n.php:687
#, php-format
msgid "Fail to write %s JS catalog in file (%s)."
msgstr "Impossible d'écrire le fichier du catalogue JS %s (%s)."
#: I18n.php:683
#: I18n.php:692
#, php-format
msgid "%s JS catalog writed (%s)."
msgstr "Catalogue JS %s créé (%s)."
@ -475,25 +479,27 @@ msgstr ""
"le gestionnaire de l'URL racine de l'application web."
#: templates/empty.tpl:60
msgid "Logout"
msgid "Sign out"
msgstr "Déconnexion"
#: templates/login.tpl:2
msgid "Connection"
msgstr "Connexion"
#: templates/login.tpl:7
#: templates/login.tpl:9
msgid "Username"
msgstr "Nom d'utilisateur"
#: templates/login.tpl:11
#: templates/login.tpl:13
msgid "Password"
msgstr "Mot de passe"
#: templates/login.tpl:14
#: templates/login.tpl:16
msgid "Submit"
msgstr "Envoyer"
#~ msgid "Logout"
#~ msgstr "Déconnexion"
#~ msgid "Connection"
#~ msgstr "Connexion"
#~ msgid ""
#~ "Authentication required but force_authentication function is not defined."
#~ msgstr ""

View file

@ -1,7 +1,7 @@
msgid ""
msgstr ""
"POT-Creation-Date: 2023-02-25 04:54+0100\n"
"PO-Revision-Date: 2023-02-25 04:54+0100\n"
"POT-Creation-Date: 2023-02-25 17:17+0100\n"
"PO-Revision-Date: 2023-02-25 17:17+0100\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"

View file

@ -1,7 +1,7 @@
msgid ""
msgstr ""
"POT-Creation-Date: 2023-02-25 04:54+0100\n"
"PO-Revision-Date: 2023-02-25 04:54+0100\n"
"POT-Creation-Date: 2023-02-25 17:17+0100\n"
"PO-Revision-Date: 2023-02-25 17:17+0100\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
@ -65,6 +65,10 @@ msgstr ""
msgid "Invalid username or password."
msgstr ""
#: Auth/Form.php:64
msgid "Sign in"
msgstr ""
#: Auth/Http.php:34 Url.php:176
msgid "Authentication required"
msgstr ""
@ -204,126 +208,126 @@ msgid ""
"directories to MO files and as JS catalogs in locales directory."
msgstr ""
#: I18n.php:336
#: I18n.php:341
msgid "Fail to list EesyPHP PHP files."
msgstr ""
#: I18n.php:356
#: I18n.php:361
msgid "Fail to extract messages from EesyPHP PHP files using xgettext."
msgstr ""
#: I18n.php:369
#: I18n.php:378
msgid "Fail to list application PHP files."
msgstr ""
#: I18n.php:389
#: I18n.php:398
msgid "Fail to extract messages from PHP files using xgettext."
msgstr ""
#: I18n.php:405
#: I18n.php:414
#, php-format
msgid "Fail to list JS files in the directory of static files '%s'."
msgstr ""
#: I18n.php:427
#: I18n.php:436
#, php-format
msgid ""
"Fail to extract messages from JS files in the directory of static files '%s' "
"using xgettext."
msgstr ""
#: I18n.php:449
#: I18n.php:458
#, php-format
msgid ""
"Fail to extract messages from templates directory '%s' using tsmarty2c.php "
"script."
msgstr ""
#: I18n.php:485
#: I18n.php:494
msgid "Fail to merge messages using msgcat."
msgstr ""
#: I18n.php:502
#: I18n.php:511
#, php-format
msgid "Compendium file %s not found."
msgstr ""
#: I18n.php:513
#: I18n.php:522
#, php-format
msgid "POT file not found (%s). Please run extract_messages first."
msgstr ""
#: I18n.php:525 I18n.php:636
#: I18n.php:534 I18n.php:645
#, php-format
msgid "Lang directory '%s' found"
msgstr ""
#: I18n.php:531 I18n.php:642
#: I18n.php:540 I18n.php:651
#, php-format
msgid "LC_MESSAGES directory not found in lang '%s' directory, ignore it."
msgstr ""
#: I18n.php:546
#: I18n.php:555
#, php-format
msgid "Fail to init messages in %s PO file using msginit (%s)."
msgstr ""
#: I18n.php:564
#: I18n.php:573
#, php-format
msgid "Fail to update messages in %s PO file using msgmerge (%s)."
msgstr ""
#: I18n.php:570 I18n.php:650
#: I18n.php:579 I18n.php:659
#, php-format
msgid "PO file not found in lang '%s' directory, ignore it."
msgstr ""
#: I18n.php:577 I18n.php:690
#: I18n.php:586 I18n.php:699
#, php-format
msgid "Fail to open root lang directory (%s)."
msgstr ""
#: I18n.php:606
#: I18n.php:615
#, php-format
msgid "Lang alias symlink found: %s -> %s"
msgstr ""
#: I18n.php:613
#: I18n.php:622
#, php-format
msgid "JS catalog symlink for %s -> %s created (%s)"
msgstr ""
#: I18n.php:617
#: I18n.php:626
#, php-format
msgid "Fail to create JS catalog symlink for %s -> %s (%s)"
msgstr ""
#: I18n.php:623
#: I18n.php:632
#, php-format
msgid "JS catalog symlink for %s -> %s already exist (%s)"
msgstr ""
#: I18n.php:628
#: I18n.php:637
#, php-format
msgid "JS catalog file for %s already exist, but it's not a symlink to %s (%s)"
msgstr ""
#: I18n.php:663
#: I18n.php:672
#, php-format
msgid "Fail to compile messages from %s PO file as MO file using msgfmt (%s)."
msgstr ""
#: I18n.php:673
#: I18n.php:682
#, php-format
msgid "Fail to open %s JS catalog file in write mode (%s)."
msgstr ""
#: I18n.php:678
#: I18n.php:687
#, php-format
msgid "Fail to write %s JS catalog in file (%s)."
msgstr ""
#: I18n.php:683
#: I18n.php:692
#, php-format
msgid "%s JS catalog writed (%s)."
msgstr ""
@ -412,21 +416,17 @@ msgid ""
msgstr ""
#: templates/empty.tpl:60
msgid "Logout"
msgid "Sign out"
msgstr ""
#: templates/login.tpl:2
msgid "Connection"
msgstr ""
#: templates/login.tpl:7
#: templates/login.tpl:9
msgid "Username"
msgstr ""
#: templates/login.tpl:11
#: templates/login.tpl:13
msgid "Password"
msgstr ""
#: templates/login.tpl:14
#: templates/login.tpl:16
msgid "Submit"
msgstr ""

View file

@ -57,6 +57,10 @@ msgstr ""
msgid "Invalid username or password."
msgstr ""
#: Auth/Form.php:64
msgid "Sign in"
msgstr ""
#: Auth/Http.php:34 Url.php:176
msgid "Authentication required"
msgstr ""
@ -196,126 +200,126 @@ msgid ""
"directories to MO files and as JS catalogs in locales directory."
msgstr ""
#: I18n.php:336
#: I18n.php:341
msgid "Fail to list EesyPHP PHP files."
msgstr ""
#: I18n.php:356
#: I18n.php:361
msgid "Fail to extract messages from EesyPHP PHP files using xgettext."
msgstr ""
#: I18n.php:369
#: I18n.php:378
msgid "Fail to list application PHP files."
msgstr ""
#: I18n.php:389
#: I18n.php:398
msgid "Fail to extract messages from PHP files using xgettext."
msgstr ""
#: I18n.php:405
#: I18n.php:414
#, php-format
msgid "Fail to list JS files in the directory of static files '%s'."
msgstr ""
#: I18n.php:427
#: I18n.php:436
#, php-format
msgid ""
"Fail to extract messages from JS files in the directory of static files '%s' "
"using xgettext."
msgstr ""
#: I18n.php:449
#: I18n.php:458
#, php-format
msgid ""
"Fail to extract messages from templates directory '%s' using tsmarty2c.php "
"script."
msgstr ""
#: I18n.php:485
#: I18n.php:494
msgid "Fail to merge messages using msgcat."
msgstr ""
#: I18n.php:502
#: I18n.php:511
#, php-format
msgid "Compendium file %s not found."
msgstr ""
#: I18n.php:513
#: I18n.php:522
#, php-format
msgid "POT file not found (%s). Please run extract_messages first."
msgstr ""
#: I18n.php:525 I18n.php:636
#: I18n.php:534 I18n.php:645
#, php-format
msgid "Lang directory '%s' found"
msgstr ""
#: I18n.php:531 I18n.php:642
#: I18n.php:540 I18n.php:651
#, php-format
msgid "LC_MESSAGES directory not found in lang '%s' directory, ignore it."
msgstr ""
#: I18n.php:546
#: I18n.php:555
#, php-format
msgid "Fail to init messages in %s PO file using msginit (%s)."
msgstr ""
#: I18n.php:564
#: I18n.php:573
#, php-format
msgid "Fail to update messages in %s PO file using msgmerge (%s)."
msgstr ""
#: I18n.php:570 I18n.php:650
#: I18n.php:579 I18n.php:659
#, php-format
msgid "PO file not found in lang '%s' directory, ignore it."
msgstr ""
#: I18n.php:577 I18n.php:690
#: I18n.php:586 I18n.php:699
#, php-format
msgid "Fail to open root lang directory (%s)."
msgstr ""
#: I18n.php:606
#: I18n.php:615
#, php-format
msgid "Lang alias symlink found: %s -> %s"
msgstr ""
#: I18n.php:613
#: I18n.php:622
#, php-format
msgid "JS catalog symlink for %s -> %s created (%s)"
msgstr ""
#: I18n.php:617
#: I18n.php:626
#, php-format
msgid "Fail to create JS catalog symlink for %s -> %s (%s)"
msgstr ""
#: I18n.php:623
#: I18n.php:632
#, php-format
msgid "JS catalog symlink for %s -> %s already exist (%s)"
msgstr ""
#: I18n.php:628
#: I18n.php:637
#, php-format
msgid "JS catalog file for %s already exist, but it's not a symlink to %s (%s)"
msgstr ""
#: I18n.php:663
#: I18n.php:672
#, php-format
msgid "Fail to compile messages from %s PO file as MO file using msgfmt (%s)."
msgstr ""
#: I18n.php:673
#: I18n.php:682
#, php-format
msgid "Fail to open %s JS catalog file in write mode (%s)."
msgstr ""
#: I18n.php:678
#: I18n.php:687
#, php-format
msgid "Fail to write %s JS catalog in file (%s)."
msgstr ""
#: I18n.php:683
#: I18n.php:692
#, php-format
msgid "%s JS catalog writed (%s)."
msgstr ""

View file

@ -40,22 +40,22 @@ msgid ""
msgstr ""
#: templates/empty.tpl:60
msgid "Logout"
msgid "Sign out"
msgstr ""
#: templates/login.tpl:2
msgid "Connection"
#: templates/login.tpl:3
msgid "Sign in"
msgstr ""
#: templates/login.tpl:7
#: templates/login.tpl:9
msgid "Username"
msgstr ""
#: templates/login.tpl:11
#: templates/login.tpl:13
msgid "Password"
msgstr ""
#: templates/login.tpl:14
#: templates/login.tpl:16
msgid "Submit"
msgstr ""

View file

@ -5,6 +5,7 @@ namespace EesyPHP\Auth;
use EesyPHP\App;
use EesyPHP\Auth;
use EesyPHP\Hook;
use EesyPHP\I18n;
use EesyPHP\Url;
use EesyPHP\Tpl;
@ -61,7 +62,7 @@ class Form extends Method {
else
Tpl :: assign('next', (isset($_REQUEST['next'])?urldecode($_REQUEST['next']):''));
Tpl :: assign('display_other_methods', $display_other_methods);
Tpl :: display('login.tpl', 'Connection');
Tpl :: display('login.tpl', I18n::_('Sign in'));
}
/**

View file

@ -285,10 +285,11 @@ class I18n {
*
* @param string $locale The locale of the input PO file
* @param string $path The path of the input PO file
* @param bool $core Set to True if it's a run for core translations
*
* @return string JSON encoded file content
*/
public static function po2json($locale, $path) {
public static function po2json($locale, $path, $core=false) {
$fileHandler = new \Sepia\PoParser\SourceHandler\FileSystem($path);
$poparser = new \Sepia\PoParser\Parser($fileHandler);
$catalog = $poparser->parse();
@ -305,7 +306,7 @@ class I18n {
return json_encode(array(
'messages' => $messages,
'locale' => $locale,
'domain' => self :: TEXT_DOMAIN,
'domain' => $core?self :: CORE_TEXT_DOMAIN:self :: TEXT_DOMAIN,
'plural_expr' => '(n > 1)',
));
}
@ -675,7 +676,7 @@ class I18n {
}
// Compile messages from PO file to JS catalog file
$js_catalog = self :: po2json($lang, $po_file);
$js_catalog = self :: po2json($lang, $po_file, $core_mode);
$js_file = "$root_path/$lang.js";
if(!$fd = fopen($js_file, 'w')) {
Log :: error(self::_("Fail to open %s JS catalog file in write mode (%s)."),

View file

@ -57,7 +57,7 @@
</a>
<div class="dropdown-menu dropdown-menu-right">
{block name="navbar-user-menu"}{/block}
<a class="dropdown-item" href="logout"><i class="fas fa-sign-out-alt"></i> {t domain=$CORE_TEXT_DOMAIN}Logout{/t}</a>
<a class="dropdown-item" href="logout"><i class="fas fa-sign-out-alt"></i> {t domain=$CORE_TEXT_DOMAIN}Sign out{/t}</a>
</div>
</li>
</ul>

View file

@ -1,5 +1,7 @@
{extends file='Tpl:empty.tpl'}
{block name="pagetitle"}<h2 class="center"><i class="fas fa-sign-in-alt"></i> {t domain=$CORE_TEXT_DOMAIN}Connection{/t}</h2>{/block}
{block name="pagetitle"}
<h2 class="center"><i class="fas fa-sign-in-alt"></i> {t domain=$CORE_TEXT_DOMAIN}Sign in{/t}</h2>
{/block}
{block name="content"}
<form action="login" method="POST">
<input type="hidden" name="next" value="{$next|escape:"quotes"}"/>