ZwiiCMS/core/include/update.inc.php

1118 lines
38 KiB
PHP
Raw Normal View History

<?php
2022-09-29 08:45:59 +02:00
/**
* Mises à jour suivant les versions de Zwii
2022-09-29 08:45:59 +02:00
*/
// Pas d'installation depuis une version inférieur
if (
$this->getData(['core', 'dataVersion']) < 9227
) {
2022-04-14 22:08:23 +02:00
// Arrêt du script
exit('ZwiiCMS version 12 est incompatible avec la base de données installée. L\'installation d\'une version intermédiaire 10 ou 11 est nécessaire.');
}
2022-04-14 22:08:23 +02:00
// Version 10.0.00
2022-09-29 08:45:59 +02:00
if ($this->getData(['core', 'dataVersion']) < 10000) {
$this->setData(['config', 'faviconDark', 'faviconDark.ico']);
//----------------------------------------
// Mettre à jour les données des galeries
$hierarchy = array();
foreach ($this->getHierarchy() as $parentKey => $parentValue) {
$hierarchy[] = $parentKey;
foreach ($parentValue as $childKey) {
$hierarchy[] = $childKey;
}
}
// Mise à jour des données pour la galerie v2
foreach ($hierarchy as $parentKey => $parent) {
//La page a une galerie
2022-09-29 08:45:59 +02:00
if ($this->getData(['page', $parent, 'moduleId']) === 'gallery') {
// Parcourir les dossiers de la galerie
2023-02-12 17:52:18 +01:00
$tempData = $this->getData(['module', $parent]);
$i = 1;
foreach ($tempData as $galleryKey => $galleryItem) {
// Ordre de tri des galeries
2022-09-29 08:45:59 +02:00
if ($this->getdata(['module', $parent, $galleryKey, 'config', 'sort']) === NULL) {
$this->setdata(['module', $parent, $galleryKey, 'config', 'sort', 'SORT_ASC']);
}
// Position de la galerie, tri manuel
2022-09-29 08:45:59 +02:00
if ($this->getdata(['module', $parent, $galleryKey, 'config', 'position']) === NULL) {
$this->setdata(['module', $parent, $galleryKey, 'config', 'position', $i++]);
}
// Positions des images, tri manuel
2022-09-29 08:45:59 +02:00
if ($this->getdata(['module', $parent, $galleryKey, 'positions']) === NULL) {
$c = count($this->getdata(['module', $parent, $galleryKey, 'legend']));
$this->setdata(['module', $parent, $galleryKey, 'positions', range(0, $c - 1)]);
}
// Image de couverture
2022-09-29 08:45:59 +02:00
if ($this->getdata(['module', $parent, $galleryKey, 'config', 'homePicture']) === NULL) {
if (is_dir($this->getdata(['module', $parent, $galleryKey, 'config', 'directory']))) {
$iterator = new DirectoryIterator($this->getdata(['module', $parent, $galleryKey, 'config', 'directory']));
foreach ($iterator as $fileInfos) {
if ($fileInfos->isDot() === false and $fileInfos->isFile() and @getimagesize($fileInfos->getPathname())) {
$this->setdata(['module', $parent, $galleryKey, 'config', 'homePicture', $fileInfos->getFilename()]);
break;
}
}
}
}
}
}
}
// Contrôle des options php.ini pour la mise à jour auto
2023-02-12 17:52:18 +01:00
if (helper::getUrlContents(common::ZWII_UPDATE_URL . common::ZWII_UPDATE_CHANNEL . '/version') === false) {
2022-09-29 08:45:59 +02:00
$this->setData(['config', 'autoUpdate', false]);
}
$this->setData(['core', 'dataVersion', 10000]);
}
// Version 10.0.92
if ($this->getData(['core', 'dataVersion']) < 10092) {
// Suppression du dossier fullpage
if (is_dir('core/vendor/fullpage')) {
$dir = getcwd();
chdir('core/vendor/fullpage');
$files = glob('*');
2023-02-12 17:52:18 +01:00
foreach ($files as $file)
unlink($file);
chdir($dir);
2022-09-29 08:45:59 +02:00
rmdir('core/vendor/fullpage/');
}
if (file_exists('core/vendor/tinymce/templates/fullPageSections.html')) {
2022-09-29 08:45:59 +02:00
unlink('core/vendor/tinymce/templates/fullPageSections.html');
}
if (file_exists('core/vendor/tinymce/templates/fullPageSlides.html')) {
2022-09-29 08:45:59 +02:00
unlink('core/vendor/tinymce/templates/fullPageSlides.html');
}
$this->setData(['core', 'dataVersion', 10092]);
}
// Version 10.0.93
if ($this->getData(['core', 'dataVersion']) < 10093) {
// Déplacement du fichier admin.css dans data
if (file_exists('core/layout/admin.css')) {
2022-09-29 08:45:59 +02:00
copy('core/layout/admin.css', self::DATA_DIR . 'admin.css');
unlink('core/layout/admin.css');
}
//Déplacement d'un fichier de ressources
2022-09-29 08:45:59 +02:00
if (file_exists('core/module/config/ressource/.htaccess')) {
unlink('core/module/config/ressource/.htaccess');
2022-09-29 08:45:59 +02:00
rmdir('core/module/config/ressource');
}
$this->setData(['core', 'dataVersion', 10093]);
// Réorganisation du thème
2022-09-29 08:45:59 +02:00
$this->setData(['theme', 'text', 'linkTextColor', $this->getData(['theme', 'link', 'textColor'])]);
}
// Version 10.1.04
if ($this->getData(['core', 'dataVersion']) < 10104) {
2022-09-29 08:45:59 +02:00
$this->setData(['theme', 'text', 'linkColor', 'rgba(74, 105, 189, 1)']);
$this->deleteData(['theme', 'text', 'linkTextColor']);
$this->setdata(['theme', 'block', 'backgroundColor', 'rgba(236, 239, 241, 1)']);
$this->setdata(['theme', 'block', 'borderColor', 'rgba(236, 239, 241, 1)']);
$this->setdata(['theme', 'menu', 'radius', '0px']);
$this->setData(['core', 'dataVersion', 10104]);
}
// Version 10.2.00
if ($this->getData(['core', 'dataVersion']) < 10200) {
// Paramètres du compte connecté
if ($this->getUser('id')) {
2022-09-29 08:45:59 +02:00
$this->setData(['user', $this->getUser('id'), 'connectFail', 0]);
$this->setData(['user', $this->getUser('id'), 'connectTimeout', 0]);
$this->setData(['user', $this->getUser('id'), 'accessTimer', 0]);
$this->setData(['user', $this->getUser('id'), 'accessUrl', '']);
$this->setData(['user', $this->getUser('id'), 'accessCsrf', $_SESSION['csrf']]);
}
// Paramètres de sécurité
2022-09-29 08:45:59 +02:00
$this->setData(['config', 'connect', 'attempt', 999]);
$this->setData(['config', 'connect', 'timeout', 0]);
$this->setData(['config', 'connect', 'log', false]);
// Thème
2022-09-29 08:45:59 +02:00
$this->deleteData(['admin', 'colorButtonText']);
// Remettre à zéro le thème pour la génération du CSS du blog
if (file_exists(self::DATA_DIR . 'theme.css')) {
unlink(self::DATA_DIR . 'theme.css');
}
// Créer les en-têtes du journal
$d = 'Date;Heure;IP;Id;Action' . PHP_EOL;
$this->secure_file_put_contents(self::DATA_DIR . 'journal.log', $d);
// Init préservation htaccess
2022-09-29 08:45:59 +02:00
$this->setData(['config', 'autoUpdateHtaccess', false]);
// Options de barre de membre simple
2022-09-29 08:45:59 +02:00
$this->setData(['theme', 'menu', 'memberBar', true]);
// Thème Menu : couleur de page active non définie
2022-09-29 08:45:59 +02:00
if (!$this->getData(['theme', 'menu', 'activeTextColor'])) {
$this->setData(['theme', 'menu', 'activeTextColor', $this->getData(['theme', 'menu', 'textColor'])]);
}
$this->setData(['core', 'updateAvailable', false]);
$this->setData(['core', 'dataVersion', 10200]);
}
// Version 10.2.01
if ($this->getData(['core', 'dataVersion']) < 10201) {
// Options de barre de membre simple
2022-09-29 08:45:59 +02:00
$this->setData(['theme', 'footer', 'displayMemberBar', false]);
$this->deleteData(['theme', 'footer', 'displayMemberAccount']);
$this->deleteData(['theme', 'footer', 'displayMemberLogout']);
$this->setData(['core', 'dataVersion', 10201]);
}
// Version 10.3.00
if ($this->getData(['core', 'dataVersion']) < 10300) {
// Options de barre de membre simple
2022-09-29 08:45:59 +02:00
$this->setData(['config', 'page404', 'none']);
$this->setData(['config', 'page403', 'none']);
$this->setData(['config', 'page302', 'none']);
// Module de recherche
// Suppression du dossier search
if (is_dir('core/module/search')) {
$dir = getcwd();
chdir('core/module/search');
$files = glob('*');
2023-02-12 17:52:18 +01:00
foreach ($files as $file)
unlink($file);
chdir($dir);
2022-09-29 08:45:59 +02:00
rmdir('core/module/search/');
}
// Désactivation de l'option dans le pied de page
2022-09-29 08:45:59 +02:00
$this->setData(['theme', 'footer', 'displaySearch', false]);
// Inscription des nouvelles variables
2022-09-29 08:45:59 +02:00
$this->setData(['config', 'searchPageId', '']);
// Mettre à jour les données des galeries
$hierarchy = array(); foreach ($this->getHierarchy() as $parentKey => $parentValue) {
$hierarchy[] = $parentKey;
foreach ($parentValue as $childKey) {
$hierarchy[] = $childKey;
}
}
// Mise à jour des données de thème de la galerie
// Les données de thème sont communes au site
foreach ($hierarchy as $parentKey => $parent) {
//La page a une galerie
2022-09-29 08:45:59 +02:00
if ($this->getData(['page', $parent, 'moduleId']) === 'gallery') {
foreach ($this->getData(['module', $parent]) as $galleryKey => $galleryItem) {
// Transfert du theme dans une structure unique
2022-09-29 08:45:59 +02:00
if (is_array($this->getdata(['theme', $parent]))) {
$this->setdata(['theme', 'gallery', $this->getdata(['theme', $parent])]);
}
}
2022-09-29 08:45:59 +02:00
$this->deleteData(['theme', $parent]);
}
}
// Mise à jour du numéro de version
$this->setData(['core', 'dataVersion', 10300]);
}
// Version 10.3.01
if ($this->getData(['core', 'dataVersion']) < 10301) {
// Inscription des nouvelles variables
2022-09-29 08:45:59 +02:00
if ($this->getData(['config', 'searchPageId']) === '') {
$this->setData(['config', 'searchPageId', 'none']);
}
2022-09-29 08:45:59 +02:00
if ($this->getData(['config', 'legalPageId']) === '') {
$this->setData(['config', 'legalPageId', 'none']);
}
$this->setData(['core', 'dataVersion', 10301]);
}
// Version 10.3.02
if ($this->getData(['core', 'dataVersion']) < 10302) {
// Activation par défaut du captcha à la connexion
2022-09-29 08:45:59 +02:00
$this->setData(['config', 'connect', 'captcha', true]);
$this->setData(['core', 'dataVersion', 10302]);
}
// Version 10.3.03
if ($this->getData(['core', 'dataVersion']) < 10303) {
// Activation par défaut du captcha à la connexion
$this->setData(['config', 'captchaStrong', false]);
$this->setData(['core', 'dataVersion', 10303]);
}
// Version 10.3.04
if ($this->getData(['core', 'dataVersion']) < 10304) {
// Couleur des sous menus
2022-09-29 08:45:59 +02:00
$this->setData(['theme', 'menu', 'backgroundColorSub', $this->getData(['theme', 'menu', 'backgroundColor'])]);
// Nettoyage du fichier de thème pour forcer une régénération
if (file_exists(self::DATA_DIR . '/theme.css')) { // On ne sait jamais
2022-09-29 08:45:59 +02:00
unlink(self::DATA_DIR . '/theme.css');
}
$this->setData(['core', 'dataVersion', 10304]);
}
// Version 10.3.06
if ($this->getData(['core', 'dataVersion']) < 10306) {
// Liste des pages
$hierarchy = array();
foreach ($this->getHierarchy() as $parentKey => $parentValue) {
$hierarchy[] = $parentKey;
foreach ($parentValue as $childKey) {
$hierarchy[] = $childKey;
}
}
// Mettre à jour les données des blogs les articles sont dans posts
foreach ($hierarchy as $parentKey => $parent) {
//La page a un blog
2022-09-29 08:45:59 +02:00
if ($this->getData(['page', $parent, 'moduleId']) === 'blog') {
if (is_array($this->getData(['module', $parent]))) {
2022-09-29 08:45:59 +02:00
foreach ($this->getData(['module', $parent]) as $blogKey => $blogItem) {
if ($blogKey === 'posts' or $blogKey === 'config') {
continue;
}
$data = $this->getdata(['module', $parent, $blogKey]);
$this->deleteData(['module', $parent, $blogKey]);
$this->setData(['module', $parent, 'posts', $blogKey, $data]);
}
}
}
}
foreach ($hierarchy as $parentKey => $parent) {
//La page a une news
2022-09-29 08:45:59 +02:00
if ($this->getData(['page', $parent, 'moduleId']) === 'news') {
if (is_array($this->getData(['module', $parent]))) {
2022-09-29 08:45:59 +02:00
foreach ($this->getData(['module', $parent]) as $newsKey => $newsItem) {
if ($blogKey === 'posts' or $blogKey === 'config') {
continue;
}
$data = $this->getdata(['module', $parent, $newsKey]);
$this->deleteData(['module', $parent, $newsKey]);
$this->setData(['module', $parent, 'posts', $newsKey, $data]);
}
}
}
}
$this->setData(['core', 'dataVersion', 10306]);
}
// Version 10.3.08
if ($this->getData(['core', 'dataVersion']) < 10308) {
// RAZ la mise à jour auto bug 10.3.07
2022-09-29 08:45:59 +02:00
$this->setData(['core', 'updateAvailable', false]);
$this->setData(['core', 'dataVersion', 10308]);
}
// Version 10.4.00
if ($this->getData(['core', 'dataVersion']) < 10400) {
// Ajouter le prénom comme pseudo et le pseudo comme signature
2022-09-29 08:45:59 +02:00
foreach ($this->getData(['user']) as $userId => $userIds) {
$this->setData(['user', $userId, 'pseudo', $this->getData(['user', $userId, 'firstname'])]);
$this->setData(['user', $userId, 'signature', 2]);
}
// Ajouter les champs de blog v3
// Liste des pages dans pageList
$hierarchy = array();
foreach ($this->getHierarchy() as $parentKey => $parentValue) {
$hierarchy[] = $parentKey;
foreach ($parentValue as $childKey) {
$hierarchy[] = $childKey;
}
}
// Parcourir pageList et rechercher les modules de blog
foreach ($hierarchy as $parentKey => $parent) {
//La page est un blog
2022-09-29 08:45:59 +02:00
if ($this->getData(['page', $parent, 'moduleId']) === 'blog') {
$articleIds = array_keys(helper::arrayColumn($this->getData(['module', $parent, 'posts']), 'publishedOn', 'SORT_DESC'));
foreach ($articleIds as $key => $article) {
// Droits les deux groupes
2023-02-12 17:52:18 +01:00
$this->setData(['module', $parent, 'posts', $article, 'editConsent', 3]);
// Limite de taille 500
2023-02-12 17:52:18 +01:00
$this->setData(['module', $parent, 'posts', $article, 'commentMaxlength', '500']);
// Pas d'approbation des commentaires
2023-02-12 17:52:18 +01:00
$this->setData(['module', $parent, 'posts', $article, 'commentApproved', false]);
// pas de notification
2023-02-12 17:52:18 +01:00
$this->setData(['module', $parent, 'posts', $article, 'commentNotification', false]);
// groupe de notification
2023-02-12 17:52:18 +01:00
$this->setData(['module', $parent, 'posts', $article, 'commentGroupNotification', 3]);
}
// Traitement des commentaires
2023-02-12 17:52:18 +01:00
if (is_array($this->getData(['module', $parent, 'posts', $article, 'comment']))) {
foreach ($this->getData(['module', $parent, 'posts', $article, 'comment']) as $commentId => $comment) {
// Approbation
2023-02-12 17:52:18 +01:00
$this->setData(['module', $parent, 'posts', $article, 'comment', $commentId, 'approval', true]);
}
}
}
}
// Création du fichier locale.json
2022-09-29 08:45:59 +02:00
$this->setData(['locale', 'homePageId', $this->getData(['config', 'homePageId'])]);
$this->setData(['locale', 'page404', $this->getData(['config', 'page404'])]);
$this->setData(['locale', 'page403', $this->getData(['config', 'page403'])]);
$this->setData(['locale', 'page302', $this->getData(['config', 'page302'])]);
$this->setData(['locale', 'legalPageId', $this->getData(['config', 'legalPageId'])]);
$this->setData(['locale', 'searchPageId', $this->getData(['config', 'searchPageId'])]);
$this->setData(['locale', 'metaDescription', $this->getData(['config', 'metaDescription'])]);
$this->setData(['locale', 'title', $this->getData(['config', 'title'])]);
// Renommer les fichier de backup
if ($this->getInput('configAdvancedFileBackup', helper::FILTER_BOOLEAN) === false) {
$path = realpath('site/data');
2022-09-29 08:45:59 +02:00
foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path)) as $filename) {
if (strpos($filename, 'back.json')) {
rename($filename, str_replace('back.json', 'backup.json', $filename));
}
}
}
// Supprimer les fichiers CSS devenus inutiles du module search
2022-09-29 08:45:59 +02:00
if (file_exists('module/search/ressource/theme.css'))
unlink('module/search/ressource/theme.css');
2022-09-29 08:45:59 +02:00
if (file_exists('module/search/ressource/vartheme.css'))
unlink('module/search/ressource/vartheme.css');
2022-09-29 08:45:59 +02:00
$this->deleteData(['theme', 'search', 'keywordColor']);
// Nettoyer les modules avec des données null
$modules = $this->getData(['module']);
2022-09-29 08:45:59 +02:00
foreach ($modules as $key => $value) {
if (is_null($value)) {
unset($modules[$key]);
}
}
2022-09-29 08:45:59 +02:00
$this->setData(['module', $modules]);
$this->setData(['core', 'dataVersion', 10400]);
}
// Version 10.5.02
if ($this->getData(['core', 'dataVersion']) < 10502) {
// Forcer la régénération du thème
2022-09-29 08:45:59 +02:00
if (file_exists(self::DATA_DIR . 'theme.css')) {
unlink(self::DATA_DIR . 'theme.css');
}
$this->setData(['core', 'dataVersion', 10502]);
}
// Version 10.6.00
if ($this->getData(['core', 'dataVersion']) < 10600) {
// Mise à jour des données des modules autonomes
// Liste des pages dans pageList
$hierarchy = array();
foreach ($this->getHierarchy() as $parentKey => $parentValue) {
$hierarchy[] = $parentKey;
foreach ($parentValue as $childKey) {
$hierarchy[] = $childKey;
}
}
// Parcourir pageList et rechercher les modules au CSS autonomes
foreach ($hierarchy as $parentKey => $parent) {
if (
2022-09-29 08:45:59 +02:00
$this->getData(['page', $parent, 'moduleId']) === 'search'
|| $this->getData(['page', $parent, 'moduleId']) === 'gallery'
|| $this->getData(['page', $parent, 'moduleId']) === 'news'
) {
if (class_exists($parent)) {
$module = new $moduleId;
$module->update($parent);
}
}
}
2022-09-29 08:45:59 +02:00
// Suppression de l'option d'objets par page gérées par les modules
$this->deleteData(['config', 'itemsperPage']);
2022-09-29 08:45:59 +02:00
$this->setData(['core', 'dataVersion', 10600]);
}
2021-08-22 19:18:51 +02:00
// Version 11.0.00
if ($this->getData(['core', 'dataVersion']) < 11000) {
// Option de déconnexion auto activée
2022-09-29 08:45:59 +02:00
$this->setData(['config', 'autoDisconnect', true]);
// Mettre à jour les données de langue
2022-09-29 08:45:59 +02:00
$this->setData(['config', 'i18n', 'enable', true]);
$this->setData(['config', 'i18n', 'scriptGoogle', false]);
$this->setData(['config', 'i18n', 'showCredits', false]);
$this->setData(['config', 'i18n', 'autoDetect', false]);
$this->setData(['config', 'i18n', 'admin', false]);
$this->setData(['config', 'i18n', 'fr', 'none']);
$this->setData(['config', 'i18n', 'de', 'none']);
$this->setData(['config', 'i18n', 'en', 'none']);
$this->setData(['config', 'i18n', 'es', 'none']);
$this->setData(['config', 'i18n', 'it', 'none']);
$this->setData(['config', 'i18n', 'nl', 'none']);
$this->setData(['config', 'i18n', 'pt', 'none']);
// Supprimer les fichiers de backup
2023-02-12 17:52:18 +01:00
if (file_exists('site/data/.backup'))
unlink('site/data/.backup');
$path = realpath('site/data');
2022-09-29 08:45:59 +02:00
foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path)) as $filename) {
if (strpos($filename, 'backup.json')) {
unlink($filename);
}
}
// Externaliser les contenus des pages
// Liste des pages dans pageList
$hierarchy = array();
// Creation du contenu de la page
if (!is_dir(self::DATA_DIR . self::$siteContent . '/content')) {
mkdir(self::DATA_DIR . self::$siteContent . '/content', 0755);
}
foreach ($this->getHierarchy() as $parentKey => $parentValue) {
$hierarchy[] = $parentKey;
foreach ($parentValue as $childKey) {
$hierarchy[] = $childKey;
}
}
foreach ($hierarchy as $parentKey => $parent) {
$content = $this->getData(['page', $parent, 'content']);
//$this->secure_file_put_contents(self::DATA_DIR . self::$siteContent . '/content/' . $parent . '.html', $content);
$this->setPage($parent, $content, 'fr');
$this->setData(['page', $parent, 'content', $parent . '.html']);
}
// Référencement
2022-09-29 08:45:59 +02:00
$this->setData(['config', 'seo', 'robots', true]);
2021-08-22 19:18:51 +02:00
$this->setData(['core', 'dataVersion', 11000]);
}
// Version 11.0.10
if ($this->getData(['core', 'dataVersion']) < 11010) {
// Renommer une variable
$data = $this->getData(['config', 'i18n', 'active']);
$this->deleteData(['config', 'i18n', 'active']);
2022-09-29 08:45:59 +02:00
$this->setData(['config', 'i18n', 'enable', $data]);
$this->setData(['core', 'dataVersion', 11010]);
2021-10-11 17:07:09 +02:00
}
// Version 11.1.00
if ($this->getData(['core', 'dataVersion']) < 11100) {
// Anonymat des adresses iP de la journalisation
2022-09-29 08:45:59 +02:00
$this->setData(['config', 'connect', 'anonymousIp', 2]);
2021-10-11 17:07:09 +02:00
// Nouvelles options de contenu pour les écrans réduits
if ($this->getData(['theme', 'menu', 'burgerTitle'])) {
$this->setData(['theme', 'menu', 'burgerContent', 'title']);
} else {
$this->setData(['theme', 'menu', 'burgerContent', 'none']);
}
$this->setData(['theme', 'menu', 'burgerLogo', '']);
2021-10-11 17:07:09 +02:00
$this->setData(['core', 'dataVersion', 11100]);
2021-10-30 17:40:18 +02:00
}
// Version 11.2.00
if ($this->getData(['core', 'dataVersion']) < 11200) {
2021-10-30 18:12:34 +02:00
// Mise àjour des données de config
2021-10-30 17:40:18 +02:00
$this->setData(['config', 'connect', 'captchaStrong', $this->getData(['config', 'captchaStrong'])]);
2021-10-30 18:12:34 +02:00
$this->deleteData(['config', 'captchaStrong']);
$this->setData(['config', 'connect', 'autoDisconnect', $this->getData(['config', 'autoDisconnect'])]);
$this->deleteData(['config', 'autoDisconnect']);
$this->setData(['config', 'connect', 'captchaType', 'alpha']);
2021-10-30 18:12:34 +02:00
2021-11-04 13:55:23 +01:00
// Ajout de la variable shortTitle basée sur Title
foreach ($this->getHierarchy() as $parentKey => $parentValue) {
$hierarchy[] = $parentKey;
2021-11-04 13:55:23 +01:00
foreach ($parentValue as $childKey) {
$hierarchy[] = $childKey;
2021-11-04 13:55:23 +01:00
}
}
foreach ($hierarchy as $parentKey => $parent) {
2022-09-29 08:45:59 +02:00
$this->setData(['page', $parent, 'shortTitle', $this->getData(['page', $parent, 'title'])]);
2021-11-04 13:55:23 +01:00
}
2021-11-13 08:58:34 +01:00
// Incorporer les nouveaux champs du header et du menu
$this->setData(['theme', 'header', 'feature', 'wallpaper']);
$this->setData(['theme', 'header', 'featureContent', '<p>Bannière vide</p>']);
$this->setData(['theme', 'header', 'container', 'container']);
$this->setData(['theme', 'menu', 'container', 'container']);
// Option des cookies dans le footer
$this->setData(['theme', 'footer', 'displayCookie', false]);
2021-11-13 08:58:34 +01:00
// Acceptation et Paramètres des cookies RGPD
$this->setData(['locale', 'cookies', 'cookiesZwiiText', 'Ce site utilise des cookies nécessaires à son fonctionnement, ils permettent de fluidifier son fonctionnement par exemple en mémorisant les données de connexion, la langue que vous avez choisie ou la validation de ce message.']);
$this->setData(['locale', 'cookies', 'cookiesTitleText', 'Gérer les cookies']);
$this->setData(['locale', 'cookies', 'cookiesLinkMlText', 'Consulter les mentions légales']);
2021-11-28 14:29:22 +01:00
$this->setData(['locale', 'cookies', 'cookiesButtonText', 'J\'ai compris']);
// Supppression de l'option de traduction en mode connecté
2022-09-29 08:45:59 +02:00
$this->setData(['config', 'i18n', 'admin', false]);
2021-12-17 18:18:24 +01:00
// Option de dévoilement du mdp
$this->setData(['config', 'connect', 'showPassword', true]);
2022-02-18 18:40:30 +01:00
2021-10-30 18:12:34 +02:00
// Mise à jour
2021-10-30 17:40:18 +02:00
$this->setData(['core', 'dataVersion', 11200]);
}
// Version 11.2.02
if ($this->getData(['core', 'dataVersion']) < 11202) {
2022-02-18 18:40:30 +01:00
// Renommer les champs
2023-02-12 17:52:18 +01:00
$this->setData(['locale', 'cookies', 'mainLabel', $this->getData(['locale', 'cookies', 'cookiesZwiiText'])]);
$this->setData(['locale', 'cookies', 'gaLabel', $this->getData(['locale', 'cookies', 'cookiesGaText'])]);
$this->setData(['locale', 'cookies', 'titleLabel', $this->getData(['locale', 'cookies', 'cookiesTitleText'])]);
$this->setData(['locale', 'cookies', 'linkLegalLabel', $this->getData(['locale', 'cookies', 'cookiesLinkMlText'])]);
2022-09-29 08:45:59 +02:00
$this->setData(['locale', 'cookies', 'checkboxGaLabel', $this->getData(['locale', 'cookies', 'cookiesCheckboxGaText'])]);
$this->setData(['locale', 'cookies', 'buttonValidLabel', $this->getData(['locale', 'cookies', 'cookiesButtonText'])]);
// Effacer les anciens champs
$this->deleteData(['locale', 'cookies', 'cookiesZwiiText']);
$this->deleteData(['locale', 'cookies', 'cookiesGaText']);
$this->deleteData(['locale', 'cookies', 'cookiesTitleText']);
$this->deleteData(['locale', 'cookies', 'cookiesLinkMlText']);
$this->deleteData(['locale', 'cookies', 'cookiesCheckboxGaText']);
$this->deleteData(['locale', 'cookies', 'cookiesButtonText']);
// Mise à jour
$this->setData(['core', 'dataVersion', 11202]);
}
2022-02-18 12:43:48 +01:00
// Version 11.2.03
if ($this->getData(['core', 'dataVersion']) < 11203) {
// Supprimer l'information de redirection
2022-09-29 08:45:59 +02:00
$old = str_replace('?', '', $this->getData(['core', 'baseUrl']));
2022-02-18 12:43:48 +01:00
$new = '';
$c3 = 0;
2022-09-29 08:45:59 +02:00
$success = false;
2022-02-18 12:43:48 +01:00
// Boucler sur les pages
foreach ($this->getHierarchy() as $parentId => $childIds) {
$content = $this->getPage($parentId, self::$siteContent);
2022-02-18 12:43:48 +01:00
$titre = $this->getData(['page', $parentId, 'title']);
2023-02-12 17:52:18 +01:00
$content = $titre . ' ' . $content;
2022-09-29 08:45:59 +02:00
$replace = str_replace('href="' . $old, 'href="' . $new, stripslashes($content), $c1);
$replace = str_replace('src="' . $old, 'src="' . $new, stripslashes($replace), $c2);
2022-02-18 12:43:48 +01:00
if ($c1 > 0 || $c2 > 0) {
$success = true;
$this->setPage($parentId, $replace, self::$siteContent);
2022-02-18 12:43:48 +01:00
$c3 += $c1 + $c2;
}
2022-09-29 08:45:59 +02:00
foreach ($childIds as $childId) {
$content = $this->getPage($childId, self::$siteContent);
2023-02-12 17:52:18 +01:00
$content = $titre . ' ' . $content;
2022-09-29 08:45:59 +02:00
$replace = str_replace('href="' . $old, 'href="' . $new, stripslashes($content), $c1);
$replace = str_replace('src="' . $old, 'src="' . $new, stripslashes($replace), $c2);
2022-02-18 12:43:48 +01:00
if ($c1 > 0 || $c2 > 0) {
$success = true;
$this->setPage($childId, $replace, self::$siteContent);
2022-02-18 12:43:48 +01:00
$c3 += $c1 + $c2;
}
}
}
// Traiter les modules dont la redirection
$content = $this->getdata(['module']);
2022-09-29 08:45:59 +02:00
$replace = $this->recursive_array_replace('href="' . $old, 'href="' . $new, $content, $c1);
$replace = $this->recursive_array_replace('src="' . $old, 'src="' . $new, $replace, $c2);
2022-02-18 12:43:48 +01:00
if ($content !== $replace) {
2022-09-29 08:45:59 +02:00
$this->setdata(['module', $replace]);
2022-02-18 12:43:48 +01:00
$c3 += $c1 + $c2;
$success = true;
}
// Effacer la baseUrl
$this->deleteData(['core', 'baseUrl']);
// Mise à jour
$this->setData(['core', 'dataVersion', 11203]);
}
2022-02-07 07:57:49 +01:00
// Version 11.3.00
if ($this->getData(['core', 'dataVersion']) < 11300) {
// tableau de substitution
$fonts = [
'Abril+Fatface' => 'abril-fatface',
'Arimo' => 'arimo',
'Arvo' => 'arvo',
'Berkshire+Swash' => 'berkshire-swash',
'Cabin' => 'genera',
'Dancing+Script' => 'dancing-script',
'Droid+Sans' => 'droid-sans-2',
'Droid+Serif' => 'droid-serif-2',
'Fira+Sans' => 'fira-sans',
'Inconsolata' => 'inconsolata-2',
2022-09-29 08:45:59 +02:00
'Indie+Flower' => 'indie-flower',
'Josefin+Slab' => 'josefin-sans-std',
'Lobster' => 'lobster-2',
'Lora' => 'lora',
2022-09-29 08:45:59 +02:00
'Lato' => 'lato',
'Marvel' => 'montserrat-ace',
'Old+Standard+TT' => 'old-standard-tt-3',
2022-09-29 08:45:59 +02:00
'Open+Sans' => 'open-sans',
// Corriger l'erreur de nom de police installée par défaut, il manquait un O en majuscule
'open+Sans' => 'open-sans',
'Oswald' => 'oswald-4',
'PT+Mono' => 'pt-mono',
2022-09-29 08:45:59 +02:00
'PT+Serif' => 'pt-serif',
'Raleway' => 'raleway-5',
'Rancho' => 'rancho',
'Roboto' => 'Roboto',
'Signika' => 'signika',
'Ubuntu' => 'ubuntu',
'Vollkorn' => 'vollkorn'
];
2022-09-29 08:45:59 +02:00
$this->setData(['theme', 'footer', 'font', $fonts[$this->getData(['theme', 'footer', 'font'])]]);
$this->setData(['theme', 'header', 'font', $fonts[$this->getData(['theme', 'header', 'font'])]]);
2023-02-12 17:52:18 +01:00
$this->setData(['theme', 'menu', 'font', $fonts[$this->getData(['theme', 'menu', 'font'])]]);
$this->setData(['theme', 'text', 'font', $fonts[$this->getData(['theme', 'text', 'font'])]]);
$this->setData(['theme', 'title', 'font', $fonts[$this->getData(['theme', 'title', 'font'])]]);
$this->setData(['admin', 'fontTitle', $fonts[$this->getData(['admin', 'fontTitle'])]]);
$this->setData(['admin', 'fontText', $fonts[$this->getData(['admin', 'fontText'])]]);
2022-02-18 18:40:30 +01:00
2022-02-06 11:16:16 +01:00
unlink(self::DATA_DIR . 'admin.css');
unlink(self::DATA_DIR . 'theme.css');
// Mise à jour
2022-02-07 07:57:49 +01:00
$this->setData(['core', 'dataVersion', 11300]);
2022-02-12 17:12:12 +01:00
}
// Version 11.3.03
if ($this->getData(['core', 'dataVersion']) < 11303) {
// Ajout de la variable shortTitle basée sur Title
foreach ($this->getHierarchy() as $parentKey => $parentValue) {
$hierarchy[] = $parentKey;
foreach ($parentValue as $childKey) {
$hierarchy[] = $childKey;
}
}
foreach ($hierarchy as $parentKey => $parent) {
$this->setData(['page', $parent, 'extraPosition', false]);
}
// Mise à jour
$this->setData(['core', 'dataVersion', 11303]);
}
2022-02-26 14:26:51 +01:00
2022-03-21 09:42:25 +01:00
2022-09-29 08:45:59 +02:00
// Version 11.3.06
2022-03-21 09:33:12 +01:00
if ($this->getData(['core', 'dataVersion']) < 11306) {
// Supprime les fontes déclarées en double par la version précédentes
2023-07-29 17:18:33 +02:00
$files = $this->getData(['font', 'files']);
2022-03-21 09:33:12 +01:00
foreach ($files as $fontId => $fontFile) {
2023-07-29 17:18:33 +02:00
if (!is_null($this->getData(['font', 'imported', $fontId]))) {
$this->deleteData(['font', 'imported', $fontId]);
2022-03-21 09:33:12 +01:00
}
}
// Mise à jour
$this->setData(['core', 'dataVersion', 11306]);
}
2022-03-21 09:42:25 +01:00
2022-02-26 14:26:51 +01:00
// Version 11.4.00
if ($this->getData(['core', 'dataVersion']) < 11400) {
2022-02-12 17:12:12 +01:00
2022-02-18 18:40:30 +01:00
// Effacer le dossier
2022-09-29 08:45:59 +02:00
if (is_dir('core/module/addon')) {
2023-07-19 18:07:12 +02:00
$this->deleteDir('core/module/addon');
2022-02-18 18:40:30 +01:00
}
2022-02-12 17:12:12 +01:00
2022-03-07 15:28:19 +01:00
2022-03-07 11:31:52 +01:00
$fonts = [
2022-09-29 08:45:59 +02:00
'arimo' => [
'name' => 'Arimo',
'font-family' => 'Arimo, sans-serif',
'resource' => 'https://fonts.cdnfonts.com/css/arimo'
],
'dancing-script' => [
'name' => 'Dancing Script',
'font-family' => '\'Dancing Script\', sans-serif',
'resource' => 'https://fonts.cdnfonts.com/css/dancing-script'
],
'droid-sans-2' => [
'name' => 'Droid Sans',
2023-02-12 17:52:18 +01:00
'font-family' => '\'Droid Sans\', sans-serif',
2022-09-29 08:45:59 +02:00
'resource' => 'https://fonts.cdnfonts.com/css/droid-sans-2'
],
'droid-serif-2' => [
'name' => 'Droid Serif',
2023-02-12 17:52:18 +01:00
'font-family' => '\'Droid Serif\', serif',
2022-09-29 08:45:59 +02:00
'resource' => 'https://fonts.cdnfonts.com/css/droid-serif-2'
],
'indie-flower' => [
'name' => 'Indie Flower',
'font-family' => '\'Indie Flower\', sans-serif',
'resource' => 'https://fonts.cdnfonts.com/css/indie-flower'
],
'fira-sans' => [
'name' => 'Fira Sans',
'font-family' => '\'Fira Sans\', sans-serif',
'resource' => 'https://fonts.cdnfonts.com/css/fira-sans'
],
'liberation-sans' => [
'name' => 'Liberation Sans',
'font-family' => '\'Liberation Sans\', sans-serif',
'resource' => 'https://fonts.cdnfonts.com/css/liberation-sans'
],
'liberation-serif' => [
'name' => 'Liberation Serif',
'font-family' => '\'Liberation Serif\', serif',
'resource' => 'https://fonts.cdnfonts.com/css/liberation-serif'
],
'lobster-2' => [
'name' => 'Lobster',
'font-family' => 'Lobster, sans-serif',
'resource' => 'https://fonts.cdnfonts.com/css/lobster-2'
],
'lato' => [
'name' => 'lato',
'font-family' => 'Lato, sans-serif',
'resource' => 'https://fonts.cdnfonts.com/css/lato'
],
'old-standard-tt-3' => [
'name' => 'Old Standard TT',
'font-family' => '\'Old Standard TT\', serif',
'resource' => 'https://fonts.cdnfonts.com/css/old-standard-tt-3'
],
'open-sans' => [
'name' => 'Open Sans',
'font-family' => '\'Open Sans\', sans-serif',
'resource' => 'https://fonts.cdnfonts.com/css/open-sans'
],
'oswald-4' => [
'name' => 'Oswald',
'font-family' => 'Oswald, sans-serif',
'resource' => 'https://fonts.cdnfonts.com/css/oswald-4'
],
'pt-mono' => [
'name' => 'PT Mono',
'font-family' => '\'PT Mono\', monospace',
'resource' => 'https://fonts.cdnfonts.com/css/pt-mono'
],
'pt-serif' => [
'name' => 'PR Serif',
'font-family' => '\'PT Serif\', serif',
'resource' => 'https://fonts.cdnfonts.com/css/pt-serif'
],
'rancho' => [
'name' => 'Rancho',
'font-family' => 'Rancho, sans-serif',
'resource' => 'https://fonts.cdnfonts.com/css/rancho'
],
'ubuntu' => [
'name' => 'Ubuntu',
'font-family' => 'Ubuntu, sans-serif',
'resource' => 'https://fonts.cdnfonts.com/css/ubuntu'
],
'vollkorn' => [
'name' => 'Vollkorn',
'font-family' => 'Vollkorn, serif',
'resource' => 'https://fonts.cdnfonts.com/css/vollkorn'
]
2022-03-07 11:31:52 +01:00
];
2022-03-21 11:18:01 +01:00
// Conversion des fontes locales
2023-07-29 17:18:33 +02:00
$files = $this->getData(['font', 'files']);
2022-03-21 11:18:01 +01:00
if (is_array($files)) {
foreach ($files as $fontId => $fontName) {
2022-09-29 08:45:59 +02:00
if (
gettype($fontName) === 'string'
&& file_exists(self::DATA_DIR . 'fonts/' . $fontName)
) {
2023-02-12 17:52:18 +01:00
$this->setData([
2023-07-29 17:18:33 +02:00
'font',
2023-02-12 17:52:18 +01:00
'files',
$fontId,
[
'name' => ucfirst($fontId),
'font-family' => '\'' . ucfirst($fontId) . '\', sans-serif',
'resource' => $fontName
]
]);
2022-03-31 14:57:50 +02:00
}
2022-03-21 11:18:01 +01:00
}
}
2022-03-31 15:03:13 +02:00
// Consersion des fontes importées
2023-07-29 17:18:33 +02:00
$imported = $this->getData(['font', 'imported']);
2022-03-31 14:57:50 +02:00
if (is_array($imported)) {
2022-03-31 15:03:13 +02:00
foreach ($imported as $fontId => $fontUrl) {
2022-09-29 08:45:59 +02:00
if (gettype($fontUrl) === 'string') {
2023-02-12 17:52:18 +01:00
$this->setData([
2023-07-29 17:18:33 +02:00
'font',
2023-02-12 17:52:18 +01:00
'imported',
$fontId,
[
'name' => ucfirst($fontId),
'font-family' => '\'' . ucfirst($fontId) . '\', sans-serif',
'resource' => 'https:\\fonts.cdnfonts.com\css' . $fontUrl
]
]);
}
2022-03-21 11:18:01 +01:00
}
2022-03-14 09:39:49 +01:00
}
2022-03-31 15:37:44 +02:00
// Importation des fontes exemples
$template = $fonts;
foreach ($template as $fontId => $fontValue) {
2023-07-29 17:18:33 +02:00
$this->setData(['font', 'imported', $fontId, $fontValue]);
2022-03-14 09:39:49 +01:00
}
// Redirection des pages d'administration vers la bannière de connexion
$this->setData(['config', 'connect', 'redirectLogin', true]);
2022-05-19 15:20:57 +02:00
2022-03-29 13:07:31 +02:00
// Suppression de la variable URL dans core
$this->deleteData(['core', 'baseUrl']);
2022-03-29 13:07:31 +02:00
2022-03-07 11:31:52 +01:00
// Mise à jour
2022-03-13 11:55:26 +01:00
$this->setData(['core', 'dataVersion', 11400]);
2022-05-19 15:20:57 +02:00
}
2022-08-08 10:09:06 +02:00
2022-07-02 14:27:45 +02:00
// Version 11.5.06
2022-07-02 14:27:45 +02:00
if ($this->getData(['core', 'dataVersion']) < 11506) {
2022-05-19 15:20:57 +02:00
2022-07-02 14:27:45 +02:00
// Renommage de la barre de membre dans le pied de page
$data = $this->getData(['theme', 'footer', 'displayMemberBar']);
$this->setData(['theme', 'footer', 'memberBar', $data]);
$this->deleteData(['theme', 'footer', 'displayMemberBar']);
// Mise à jour
$this->setData(['core', 'dataVersion', 11506]);
}
2022-08-08 10:09:06 +02:00
2022-12-20 15:24:52 +01:00
// Version 12.0.00
2022-09-30 11:09:06 +02:00
if ($this->getData(['core', 'dataVersion']) < 12000) {
2022-07-31 19:17:56 +02:00
2022-05-19 15:20:57 +02:00
// Supprime un cookie non nécessaire
helper::deleteCookie('ZWII_USER_LONGTIME');
2022-05-26 20:06:45 +02:00
// Suppression de la variable URL dans core
$this->deleteData(['core', 'baseUrl']);
2022-07-31 19:17:56 +02:00
// Suppression de GA
2022-09-29 08:45:59 +02:00
$this->deleteData(['config', 'seo', 'analyticsId']);
$this->deleteData(['config', 'analyticsId']);
2022-07-31 19:17:56 +02:00
$this->deleteData(['locale', 'cookies', 'gaLabel']);
$this->deleteData(['locale', 'cookies', 'checkboxGaLabel']);
2022-08-28 19:41:41 +02:00
// Suppression du booléen de langue, désormais toujours actif et de Google Translate
$this->deleteData(['config', 'i18n', 'enable']);
$this->deleteData(['config', 'i18n', 'scriptGoogle']);
$this->deleteData(['config', 'i18n', 'showCredits']);
$this->deleteData(['config', 'i18n', 'autoDetect']);
2022-09-29 19:08:32 +02:00
helper::deleteCookie('ZWII_CONTENTSCRIPT');
2022-08-28 19:41:41 +02:00
2022-09-19 09:37:06 +02:00
// Nettoyage de fichiers inutiles
2023-02-18 08:57:08 +01:00
if (file_exists('core/module/user/view/import/import.help.html')) {
unlink('core/module/user/view/import/import.help.html');
2022-09-19 09:37:06 +02:00
}
// Supprimer les fichier associés
if (is_dir('core/module/translate/ressource')) {
2023-07-19 18:07:12 +02:00
$this->deleteDir('core/module/translate/ressource');
}
if (is_dir('core/vendor/i18n/css')) {
2023-07-19 18:07:12 +02:00
$this->deleteDir('core/vendor/i18n/css');
}
if (file_exists('core/vendor/i18n/inc.json')) {
unlink('core/vendor/i18n/inc.json');
}
if (file_exists('core/vendor/i18n/translate.js')) {
unlink('core/vendor/i18n/translate.js');
}
if (file_exists('core/vendor/i18n/translation.js')) {
unlink('core/vendor/i18n/translation.js');
}
2022-09-30 14:48:01 +02:00
// Copier les fichiers de l'interface
2022-10-03 09:12:19 +02:00
if (!is_dir(self::I18N_DIR)) {
2022-12-27 09:48:53 +01:00
// Créer le dossier
2022-09-30 14:48:01 +02:00
$this->copyDir('core/module/install/ressource/i18n', self::I18N_DIR);
}
2022-09-02 15:34:28 +02:00
// Langue de l'interface
$this->deleteData(['config', 'i18n']);
2022-12-20 15:24:52 +01:00
// Pas à l'installation
if ($this->getUser('id')) {
$this->setData(['user', $this->getUser('id'), 'language', 'fr_FR']);
}
2022-05-26 20:06:45 +02:00
// Mise à jour
2022-09-30 11:09:06 +02:00
$this->setData(['core', 'dataVersion', 12000]);
2022-07-02 14:27:45 +02:00
}
2023-03-12 10:17:31 +01:00
// Version 12.3.01
if ($this->getData(['core', 'dataVersion']) < 12301) {
2023-02-12 17:52:18 +01:00
// Valeur par défaut du délai de recherche de mise à jour en ligne
$this->setData(['config', 'autoUpdateDelay', 86400]);
2023-03-02 14:17:12 +01:00
2023-02-17 10:59:25 +01:00
// Nettoyage de flatPickr
2023-02-18 08:44:01 +01:00
if (is_dir('core/vendor/flatpickr')) {
2023-07-19 18:07:12 +02:00
$this->deleteDir('core/vendor/flatpickr');
2023-02-18 08:44:01 +01:00
}
2023-02-17 10:59:25 +01:00
2023-02-23 16:02:06 +01:00
// email reply
$this->deleteData(['config', 'smtp', 'sender']);
$this->setData(['config', 'smtp', 'from', 'no-reply@' . str_replace('www.', '', $_SERVER['HTTP_HOST'])]);
// Mise à jour
2023-03-12 10:17:31 +01:00
$this->setData(['core', 'dataVersion', 12301]);
}
2023-03-05 16:28:44 +01:00
// Version 12.3.08
if ($this->getData(['core', 'dataVersion']) < 12308) {
2023-03-29 10:19:56 +02:00
// Langue par défaut
$l = [
'fr_FR' => 'Français',
'en_EN' => 'English',
'es' => 'Español',
];
foreach ($l as $key => $value) {
2023-04-26 22:54:33 +02:00
if (is_dir(self::DATA_DIR . $key)) {
touch(self::DATA_DIR . $key . '/.default');
break;
}
}
2023-04-26 22:54:33 +02:00
2023-03-29 10:19:56 +02:00
// Mise à jour
$this->setData(['core', 'dataVersion', 12308]);
2023-03-29 10:19:56 +02:00
}
2023-04-26 22:54:33 +02:00
// Version 12.3.09
if ($this->getData(['core', 'dataVersion']) < 12309) {
// Mettre à jour les locales
foreach (self::$languages as $key => $value) {
// tableau des langues installées
if (is_dir(self::DATA_DIR . $key)) {
$d = json_decode(file_get_contents(self::DATA_DIR . $key . '/locale.json'), true);
$d = array_merge($d['locale'], ['poweredPageLabel' => 'Motorisé par']);
$t['locale'] = $d;
$this->secure_file_put_contents(self::DATA_DIR . $key . '/locale.json', $t);
2023-04-26 22:54:33 +02:00
}
}
// Mise à jour
$this->setData(['core', 'dataVersion', 12309]);
2023-04-26 22:57:30 +02:00
}
// Version 13.0.00
if ($this->getData(['core', 'dataVersion']) < 13000) {
2023-03-05 16:28:44 +01:00
// Nettoyage du dossier de langue d'installation'
if (file_exists('core/vendor/tinymce/langs/langs.zip'))
unlink('core/vendor/tinymce/langs/langs.zip');
2023-03-05 16:28:44 +01:00
if (file_exists('core/module/install/ressource/i18n/de.json'))
unlink('core/module/install/ressource/i18n/de.json');
if (file_exists('core/module/install/ressource/i18n/it.json'))
unlink('core/module/install/ressource/i18n/it.json');
if (file_exists('core/module/install/ressource/i18n/pt_PT.json'))
unlink('core/module/install/ressource/i18n/pt_PT.json');
if (file_exists('core/module/install/ressource/i18n/gr_GR.json'))
unlink('core/module/install/ressource/i18n/gr_GR.json');
2023-03-29 10:20:40 +02:00
// Création du dossier partage pour les nouveaux droits
2023-03-29 19:28:03 +02:00
if (!is_dir(self::FILE_DIR . 'source/partage')) {
mkdir(self::FILE_DIR . 'source/partage');
}
2023-03-29 10:20:40 +02:00
// Efface le dossier translate
if (is_dir('core/module/translate')) {
2023-07-19 18:07:12 +02:00
$this->deleteDir('core/module/translate');
}
2023-06-12 18:15:46 +02:00
// Renomme le fichier et le dossier des fontes
if (file_exists(self::DATA_DIR . 'fonts/fonts.html')) {
rename(self::DATA_DIR . 'fonts/fonts.html', self::DATA_DIR . 'fonts/font.html');
}
if (is_dir(self::DATA_DIR . 'fonts')) {
rename(self::DATA_DIR . 'fonts', self::DATA_DIR . 'font');
}
// Ajouter le prénom comme pseudo et le pseudo comme signature
foreach ($this->getData(['user']) as $userId => $userIds) {
switch ($this->getData(['user', $userId, 'group'])) {
case '1':
case '2':
$this->setData(['user', $userId, 'profil', 1]);
break;
default:
$this->setData(['user', $userId, 'profil', 0]);
break;
}
}
// Récupérer la liste de toutes les pages dans toutes langues
$hierarchy = array();
$languages = array();
// Tableau des langues non installées
foreach (self::$languages as $key => $value) {
if (is_dir(self::DATA_DIR . $key))
$languages[] = $key;
foreach ($this->getHierarchy() as $parentKey => $parentValue) {
$hierarchy[] = $parentKey;
foreach ($parentValue as $childKey) {
$hierarchy[] = $childKey;
}
}
}
// Mise à jour des pages, le profil est mis à 0 pour les groupes sans profil et 1 pour es groupes avec profil
$currentlanguage = self::$siteContent;
foreach ($languages as $langId) {
2023-07-28 15:00:38 +02:00
foreach ($hierarchy as $parentKey => $parent) {
switch ($this->getData(['page', $parent, 'group'])) {
case 1:
case 2:
$this->setData(['page', $parent, 'profil', 1]);
break;
default:
$this->setData(['page', $parent, 'profil', 0]);
break;
}
}
}
2023-07-28 15:00:38 +02:00
$_SESSION['ZWII_CONTENT'] = $currentlanguage;
// Supprime la clé OpenOgraph
$this->deleteData(['config', 'seo', 'keyApi']);
2023-03-29 10:20:40 +02:00
// Mise à jour
$this->setData(['core', 'dataVersion', 13000]);
}
2023-10-11 21:42:20 +02:00
// Version 13.0.05
if ($this->getData(['core', 'dataVersion']) < 13005) {
if (is_dir('core/module/plugin/view/dataImport')) {
$this->deleteDir('core/module/plugin/view/dataImport');
}
if (file_exists('core/module/plugin/view/index/index.js.php')) {
unlink('core/module/plugin/view/index/index.js.php');
}
2023-10-11 21:42:20 +02:00
// Installe l'adresse d'envoi si non spécifiée
if (empty($this->getData(['config', 'smtp', 'from']))) {
$this->setData(['config', 'smtp', 'from', 'no-reply@localhost']);
}
// Fixe la taille de l'administration identique à la taille de site
2023-10-14 14:35:26 +02:00
$size = $this->getData(['theme', 'site', 'width']);
$this->setData(['admin', 'width', $size]);
2023-10-11 21:42:20 +02:00
2023-10-14 14:35:26 +02:00
// Ancienne déclaration oubliée !!
if ($this->getData(['admin', 'backgroundColorButtonHelp']) === null) {
$this->setData(['admin', 'backgroundColorButtonHelp', 'rgba(255, 153, 0, 1)']);
}
// Mise à jour
2023-10-11 21:42:20 +02:00
$this->setData(['core', 'dataVersion', 13005]);
}
// Version 13.1.01
if ($this->getData(['core', 'dataVersion']) < 13101) {
// Supprime le choix du thème à l'installation
if (is_dir('core/module/install/ressource/themes')) {
$this->deleteDir('core/module/install/ressource/themes') ;
}
// Mise à jour
$this->setData(['core', 'dataVersion', 13101]);
2023-10-14 14:35:26 +02:00
}