12201 bug langues

This commit is contained in:
Fred Tempez 2023-02-02 21:00:03 +01:00
parent 3f2733c033
commit 58ba7af79c
3 changed files with 258 additions and 242 deletions

View File

@ -1,8 +1,10 @@
# Changelog
## Version 12.2.01
### Améliorations :
- Gère les erreurs d'écritures à l'aide dun contrôle des données écrites sur le disque. Cinq tentatives se terminent par un arrêt en cas d'impossibilité d'enregistrer les données.
### Correction :
- Bug majeur lors de l'installation d'une version fraiche, erreur lors de la création de la base de données des langues.
### Amélioration :
- Gestion des erreurs d'écritures à l'aide dun contrôle des données écrites sur le disque. Cinq tentatives se terminent par un arrêt en cas d'impossibilité d'enregistrer les données.
## Version 12.2.00
### Nouveautés :

View File

@ -52,7 +52,7 @@ class common
// URL langues de l'UI en ligne
const ZWII_UI_URL = 'https://forge.chapril.org/ZwiiCMS-Team/zwiicms-translations/raw/branch/master/';
// Numéro de version et branche pour l'autoupdate
// Numéro de version et branche pour l'auto-update
const ZWII_VERSION = '12.2.01';
const ZWII_UPDATE_CHANNEL = "v12";
@ -110,7 +110,8 @@ class common
'showPageContent' => false,
'state' => false,
'style' => '',
'title' => null, // Null car un titre peut être vide
'title' => null,
// Null car un titre peut être vide
// Trié par ordre d'exécution
'vendor' => [
'jquery',
@ -351,7 +352,8 @@ class common
'name' => $keys . '.json',
'dir' => $this->dataPath($keys, self::$i18nContent),
'backup' => file_exists('site/data/.backup')
]);;
]);
;
}
// Installation fraîche, initialisation des modules manquants
@ -471,7 +473,8 @@ class common
}
// Mise à jour des données core
if ($this->getData(['core', 'dataVersion']) !== intval(str_replace('.', '', self::ZWII_VERSION))) include('core/include/update.inc.php');
if ($this->getData(['core', 'dataVersion']) !== intval(str_replace('.', '', self::ZWII_VERSION)))
include('core/include/update.inc.php');
// Données de proxy
$proxy = $this->getData(['config', 'proxyType']) . $this->getData(['config', 'proxyUrl']) . ':' . $this->getData(['config', 'proxyPort']);
@ -664,6 +667,14 @@ class common
public function initData($module, $lang, $sampleSite = false)
{
// Créer la base de données des langues
if ($module === 'languages') {
copy('core/module/install/ressource/i18n/languages.json', self::DATA_DIR . 'languages.json');
$this->copyDir('core/module/install/ressource/i18n', self::I18N_DIR);
unlink(self::I18N_DIR . 'languages.json');
return;
}
// Tableau avec les données vierges
require_once('core/module/install/ressource/defaultdata.php');
@ -680,14 +691,6 @@ class common
}
$db->save;
// Créer la base de données des langues
if ($module === 'languages') {
copy('core/module/install/ressource/i18n/languages.json', self::DATA_DIR . 'languages.json');
$this->copyDir('core/module/install/ressource/i18n', self::I18N_DIR);
unlink(self::I18N_DIR . 'languages.json');
}
// Créer le jeu de pages du site de test
if ($module === 'page') {
$langFolder = $lang . '/content/';
@ -1193,8 +1196,10 @@ class common
public function removeDir($path)
{
foreach (new DirectoryIterator($path) as $item) {
if ($item->isFile()) @unlink($item->getRealPath());
if (!$item->isDot() && $item->isDir()) $this->removeDir($item->getRealPath());
if ($item->isFile())
@unlink($item->getRealPath());
if (!$item->isDot() && $item->isDir())
$this->removeDir($item->getRealPath());
}
return (rmdir($path));
}
@ -1367,8 +1372,10 @@ class common
}
// Page pleine pour la configuration des modules et l'édition des pages sauf l'affichage d'un article de blog
$pattern = ['config', 'edit', 'add', 'comment', 'data'];
if ((sizeof($blocks) === 1 ||
in_array($this->getUrl(1), $pattern))) { // Pleine page en mode configuration
if (
(sizeof($blocks) === 1 ||
in_array($this->getUrl(1), $pattern))
) { // Pleine page en mode configuration
$this->showContent();
} else {
echo '<div class="row siteContainer">';
@ -1824,7 +1831,8 @@ class common
// Mise en page de l'item
$items .= '<li id="' . $parentPageId . '">';
if (($this->getData(['page', $parentPageId, 'disable']) === true
if (
($this->getData(['page', $parentPageId, 'disable']) === true
and $this->getUser('password') !== $this->getInput('ZWII_USER_PASSWORD')
) or ($this->getData(['page', $parentPageId, 'disable']) === true
and $this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD')
@ -1889,7 +1897,8 @@ class common
$targetBlank = $this->getData(['page', $childKey, 'targetBlank']) ? ' target="_blank"' : '';
// Mise en page du sous-item
$items .= '<li id=' . $childKey . '>';
if (($this->getData(['page', $childKey, 'disable']) === true
if (
($this->getData(['page', $childKey, 'disable']) === true
and $this->getUser('password') !== $this->getInput('ZWII_USER_PASSWORD')
) or ($this->getData(['page', $childKey, 'disable']) === true
and $this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD')
@ -2098,7 +2107,8 @@ class common
}
if (common::$coreNotices) {
$notification = 'Données absentes, restauration de <p> | ';
foreach (common::$coreNotices as $item) $notification .= $item . ' | ';
foreach (common::$coreNotices as $item)
$notification .= $item . ' | ';
$notificationClass = 'notificationError';
} elseif (empty($_SESSION['ZWII_NOTIFICATION_SUCCESS']) === false) {
$notification = $_SESSION['ZWII_NOTIFICATION_SUCCESS'];
@ -2918,7 +2928,8 @@ class core extends common
}
}
// Empêcher l'accès aux pages désactivées par URL directe
if (($this->getData(['page', $this->getUrl(0), 'disable']) === true
if (
($this->getData(['page', $this->getUrl(0), 'disable']) === true
and $this->getUser('password') !== $this->getInput('ZWII_USER_PASSWORD')
) or ($this->getData(['page', $this->getUrl(0), 'disable']) === true
and $this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD')
@ -3256,7 +3267,8 @@ class core extends common
$this->addOutput([
'metaDescription' => $this->getData(['locale', 'metaDescription'])
]);
};
}
;
switch ($this->output['display']) {
// Layout brut
case self::DISPLAY_RAW:

View File

@ -1,4 +1,5 @@
{
"languages": {
"fr_FR": {
"version": "3",
"date": 1674298800
@ -24,3 +25,4 @@
"date": 1674298800
}
}
}