Merge branch '12300' into 12400

This commit is contained in:
Fred Tempez 2023-03-03 21:16:21 +01:00
commit 29d4d2d7ac
15 changed files with 1878 additions and 62 deletions

View File

@ -42,6 +42,15 @@ class helper
}
*/
// La traduction existe déjà dans le core
/*
if (array_key_exists($text, core::$dialog) === false && !empty($text)) {
$dialogues = json_decode(file_get_contents('core/module/install/ressource/i18n/fr_FR.json' ), true);
$data = array_merge($dialogues,[$text => '']);
file_put_contents ('core/module/install/ressource/i18n/fr_FR.json', json_encode($data, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT), LOCK_EX);
}
*/
return (array_key_exists($text, core::$dialog) && !empty(core::$dialog[$text]) ? core::$dialog[$text] : $text);
}

View File

@ -52,7 +52,8 @@ class JsonDb extends \Prowebcraft\Dot
public function set($key, $value = null, $save = true)
{
parent::set($key, $value);
if ($save) $this->save();
if ($save)
$this->save();
return $this;
}
@ -68,7 +69,8 @@ class JsonDb extends \Prowebcraft\Dot
public function add($key, $value = null, $pop = false, $save = true)
{
parent::add($key, $value, $pop);
if ($save) $this->save();
if ($save)
$this->save();
return $this;
}
@ -82,7 +84,8 @@ class JsonDb extends \Prowebcraft\Dot
public function delete($key, $save = true)
{
parent::delete($key);
if ($save) $this->save();
if ($save)
$this->save();
return $this;
}
@ -98,7 +101,8 @@ class JsonDb extends \Prowebcraft\Dot
public function clear($key = null, $format = false, $save = true)
{
parent::clear($key, $format);
if ($save) $this->save();
if ($save)
$this->save();
return $this;
}
@ -108,7 +112,8 @@ class JsonDb extends \Prowebcraft\Dot
* @param bool $reload Reboot data?
* @return array|mixed|null
*/
protected function loadData($reload = false) {
protected function loadData($reload = false)
{
if ($this->data === null || $reload) {
$this->db = $this->config['dir'] . DIRECTORY_SEPARATOR . $this->config['name'];
if (!file_exists($this->db)) {
@ -117,7 +122,7 @@ class JsonDb extends \Prowebcraft\Dot
if ($this->config['backup']) {
try {
//todo make backup of database
copy ($this->config['dir'] . DIRECTORY_SEPARATOR . $this->config['name'], $this->config['dir'] . DIRECTORY_SEPARATOR . $this->config['name'] . '.backup');
copy($this->config['dir'] . DIRECTORY_SEPARATOR . $this->config['name'], $this->config['dir'] . DIRECTORY_SEPARATOR . $this->config['name'] . '.backup');
} catch (\Exception $e) {
}
@ -135,11 +140,12 @@ class JsonDb extends \Prowebcraft\Dot
/**
* Save database
*/
public function save() {
public function save()
{
$lenght = strlen(json_encode($this->data));
$try = 0;
while ($try < 5) {
$written = file_put_contents($this->db, json_encode($this->data), JSON_UNESCAPED_UNICODE|JSON_PRETTY_PRINT|LOCK_EX); // Multi user get a locker
$written = file_put_contents($this->db, json_encode($this->data), JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT | LOCK_EX); // Multi user get a locker
if ($written == $lenght) {
break;
}

View File

@ -331,17 +331,18 @@ class common
]);
}
// Installation fraîche, initialisation des modules manquants
// Installation fraîche, initialisation des modules
if ($this->user === []) {
foreach ($this->dataFiles as $stageId => $item) {
$folder = $this->dataPath($stageId, self::$i18nContent);
if (
file_exists($folder . $stageId . '.json') === false ||
$this->getData([$stageId]) === NULL
file_exists($folder . $stageId . '.json') === false
) {
$this->initData($stageId, self::$i18nContent);
common::$coreNotices[] = $stageId;
}
}
}
// Langue de l'administration
if ($this->getData(['user']) !== []) {
@ -2668,7 +2669,7 @@ class core extends common
$css .= 'header span{color:' . $colors['normal'] . ';font-family:' . $fonts[$this->getData(['theme', 'header', 'font'])] . ';font-weight:' . $this->getData(['theme', 'header', 'fontWeight']) . ';font-size:' . $this->getData(['theme', 'header', 'fontSize']) . ';text-transform:' . $this->getData(['theme', 'header', 'textTransform']) . '}';
}
// Bannière au contenu personnalisé
// Bannière au Contenu HTML
if ($this->getData(['theme', 'header', 'feature']) === 'feature') {
// Hauteur de la taille du contenu perso
$css .= 'header {height:' . $this->getData(['theme', 'header', 'height']) . '; min-height:' . $this->getData(['theme', 'header', 'height']) . ';overflow: hidden;}';

View File

@ -7,6 +7,7 @@
if (file_exists('site/data/core.json')) {
$version = json_decode(file_get_contents('site/data/core.json'), true);
// Avant version 12.0.00
if ($version['core']['dataVersion'] < 12000) {
// Correspondance pour les dossiers de langue à convertir
$languages = [
@ -23,8 +24,17 @@ if (file_exists('site/data/core.json')) {
$end = rename('site/data/' . $key, 'site/data/' . $value);
}
}
sleep(2);
sleep(1);
}
// Avant version 12.3.00
if ($version['core']['dataVersion'] < 12300) {
// Nettoyage du dossier de langue de TinyMCE
unlink('core/vendor/tinymce/langs/*.js');
unlink('core/vendor/tinymce/langs/langs.zip');
unlink('core/vendor/tinymce/langs/README.md');
}
if ($version['core']['dataVersion'] < 12400) {
if (file_exists('core/module/install/ressource/i18n/languages.json'))
rename('core/module/install/ressource/i18n/languages.json', 'core/module/install/ressource/i18n/language.json');

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -2,15 +2,15 @@
"languages": {
"fr_FR": {
"version": 12300,
"date": 1676363607
"date": 1677838293
},
"es": {
"version": 12300,
"date": 1676888793
"date": 1677838293
},
"en_EN": {
"version": 12300,
"date": 1676888793
"date": 1677838293
}
}
}

View File

@ -119,7 +119,7 @@ class theme extends common
];
public static $headerFeatures = [
'wallpaper' => 'Couleur unie ou papier-peint',
'feature' => 'Contenu personnalisé'
'feature' => 'Contenu HTML'
];
public static $imagePositions = [
'top left' => 'En haut à gauche',

View File

@ -13,7 +13,7 @@
'target' => '_blank',
'value' => template::ico('help'),
'class' => 'buttonHelp'
]); */ ?>
]); */?>
</div>
<div class="col2 offset8">
<?php echo template::submit('themeFooterSubmit'); ?>
@ -22,7 +22,9 @@
<div class="row">
<div class="col12">
<div class="block">
<h4><?php echo helper::translate('Paramètres'); ?></h4>
<h4>
<?php echo helper::translate('Paramètres'); ?>
</h4>
<div class="row">
<div class="col6">
<?php echo template::select('themeFooterPosition', $module::$footerPositions, [
@ -59,7 +61,9 @@
<div class="row">
<div class="col12">
<div class="block">
<h4><?php echo helper::translate('Couleurs'); ?></h4>
<h4>
<?php echo helper::translate('Couleurs'); ?>
</h4>
<div class="row">
<div class="col6">
<?php echo template::text('themeFooterTextColor', [
@ -83,7 +87,9 @@
<div class="row">
<div class="col12">
<div class="block">
<?php echo helper::translate('Contenu'); ?></h4>
<h4>
<?php echo helper::translate('Éléments'); ?>
</h4>
<div class="row">
<div class="col3">
<?php echo template::checkbox('themefooterDisplayCopyright', true, 'Motorisé par', [
@ -118,7 +124,7 @@
]); ?>
</div>
<div class="col3">
<?php echo template::checkbox('themeFooterMemberBar', true, 'Barre du membre', [
<?php echo template::checkbox('themeFooterMemberBar', true, 'Barre de membre', [
'checked' => $this->getData(['theme', 'footer', 'memberBar']),
'help' => 'Affiche les icônes de gestion du compte et de déconnexion des membres simples connectés, ne s\'applique pas aux éditeurs et administrateurs.'
]); ?>
@ -134,13 +140,13 @@
</div>
<div class="col3">
<?php echo template::select('configLegalPageId', array_merge(['none' => 'Aucune'], helper::arrayColumn($module::$pagesList, 'title', 'SORT_ASC')), [
'label' => 'Page "Mentions légales" ' . template::flag('selected', '20px'),
'label' => helper::translate('Mentions légales') . '&nbsp;' . template::flag('selected', '20px'),
'selected' => $this->getData(['locale', 'legalPageId'])
]); ?>
</div>
<div class="col3">
<?php echo template::checkbox('themeFooterDisplaySearch', true, 'Rechercher', [
<?php echo template::checkbox('themeFooterDisplaySearch', true, 'Rechercher dans le site', [
'checked' => $this->getData(['locale', 'searchPageId']) === 'none' ? false : $this->getData(['theme', 'footer', 'displaySearch']),
'disabled' => $this->getData(['locale', 'searchPageId']) === 'none' ? true : false,
'help' => 'Option active si une page a été sélectionnée.'
@ -148,7 +154,7 @@
</div>
<div class="col3">
<?php echo template::select('configSearchPageId', array_merge(['none' => 'Aucune'], helper::arrayColumn($module::$pagesList, 'title', 'SORT_ASC')), [
'label' => 'Page "Rechercher" ' . template::flag('selected', '20px'),
'label' => helper::translate('Rechercher dans le site') . '&nbsp;' . template::flag('selected', '20px'),
'selected' => $this->getData(['locale', 'searchPageId'])
]); ?>
</div>
@ -159,7 +165,7 @@
<div class="row">
<div class="col12">
<?php echo template::textarea('themeFooterText', [
'label' => '<div class="titleWysiwygContent">' . helper::translate('Contenu personnalisé') . '</div>',
'label' => '<div class="titleWysiwygContent">' . helper::translate('Contenu HTML') . '</div>',
'value' => $this->getData(['theme', 'footer', 'text']),
'class' => 'editorWysiwyg'
]); ?>
@ -168,7 +174,8 @@
<div class="row">
<div class="col12">
<div class="block">
<h4><?php echo helper::translate('Mise en forme du texte'); ?>
<h4>
<?php echo helper::translate('Mise en forme du texte'); ?>
</h4>
<div class="row">
<div class="col3">
@ -204,7 +211,8 @@
<div class="row">
<div class="col12">
<div class="block">
<h4><?php echo helper::translate('Disposition'); ?>
<h4>
<?php echo helper::translate('Disposition'); ?>
</h4>
<div class="row">
<div class="col4">
@ -219,7 +227,7 @@
<div class="col4">
<p>
<strong>
<?php echo helper::translate('Contenu personnalisé'); ?>
<?php echo helper::translate('Contenu HTML'); ?>
</strong>
</p>
<div class="row">

View File

@ -33,7 +33,7 @@
</div>
<div class="col4">
<?php echo template::select('themeHeaderFeature', $module::$headerFeatures, [
'label' => 'Nature de contenu',
'label' => 'Contenu',
'selected' => $this->getData(['theme', 'header', 'feature'])
]); ?>
</div>
@ -104,7 +104,7 @@
</h4>
<div class="row">
<div class="col4">
<?php echo template::checkbox('themeHeaderTextHide', true, 'Masquer le Titre', [
<?php echo template::checkbox('themeHeaderTextHide', true, 'Titre masqué', [
'checked' => $this->getData(['theme', 'header', 'textHide'])
]); ?>
</div>
@ -209,7 +209,7 @@
<div class="row">
<div class="col12">
<?php echo template::textarea('themeHeaderText', [
'label' => '<div class="titleWysiwygContent">' . helper::translate('Contenu personnalisé') . '</div>',
'label' => '<div class="titleWysiwygContent">' . helper::translate('Contenu HTML') . '</div>',
'class' => 'editorWysiwyg',
'value' => $this->getData(['theme', 'header', 'featureContent'])
]); ?>

View File

@ -22,7 +22,7 @@
<div class="row">
<div class="col12">
<div class="block">
<h4><?php echo helper::translate(' Paramètres'); ?>
<h4><?php echo helper::translate('Paramètres'); ?>
</h4>
<div class="row">
<div class="col6">
@ -158,7 +158,7 @@
<?php echo template::text('themeMenuActiveTextColor', [
'class' => 'colorPicker',
'help' => 'Le curseur horizontal règle le niveau de transparence.',
'label' => 'Texte page active',
'label' => 'Couleur texte page active',
'value' => $this->getData(['theme', 'menu', 'activeTextColor'])
]); ?>
</div>

View File

@ -68,7 +68,7 @@ $("input, select").on("change",function() {
} else {
css += ".button, button{font-size:1em;}";
}
// Largeur du site
// Largeur de site
var margin = $("#themeSiteMargin").is(":checked") ? 0 : '20px' ;
css += ".container{max-width:" + $("#themeSiteWidth").val() + "}";
if ($("#themeSiteWidth").val() === "100%") {

View File

@ -27,7 +27,7 @@
<div class="row">
<div class="col4">
<?php echo template::select('themeSiteWidth', $module::$siteWidths, [
'label' => 'Largeur du site',
'label' => 'Largeur de site',
'selected' => $this->getData(['theme', 'site', 'width'])
]); ?>
</div>
@ -39,14 +39,14 @@
</div>
<div class="col4">
<?php echo template::select('themeSiteShadow', $module::$shadows, [
'label' => 'Ombre sur les bords du site',
'label' => 'Ombre',
'selected' => $this->getData(['theme', 'site', 'shadow'])
]); ?>
</div>
</div>
<div class="row">
<div class="col6">
<?php echo template::checkbox('themeSiteMargin', true, 'Pas de marge au-dessus et en-dessous du site', [
<?php echo template::checkbox('themeSiteMargin', true, 'Pas de marge au-dessus et en dessous du site', [
'checked' => $this->getData(['theme', 'site', 'margin'])
]); ?>
</div>

View File

@ -374,7 +374,7 @@ class user extends common
self::$users[] = [
$userId,
$userFirstname . ' ' . $this->getData(['user', $userId, 'lastname']),
self::$groups[$this->getData(['user', $userId, 'group'])],
helper::translate(self::$groups[$this->getData(['user', $userId, 'group'])]),
template::button('userEdit' . $userId, [
'href' => helper::baseUrl() . 'user/edit/' . $userId . '/' . $_SESSION['csrf'],
'value' => template::ico('pencil'),