diff --git a/core/core.php b/core/core.php index 45340442..4951e9d5 100644 --- a/core/core.php +++ b/core/core.php @@ -158,6 +158,7 @@ class common { 'pt' => 'Portugais (pt)', ]; // Langue du contenu courante + public static $i18nContent; public static $i18n; // Langue de l'interface, tableau des dialogues public static $dialog; @@ -267,14 +268,14 @@ class common { $this->input['_COOKIE'] = $_COOKIE; } - // Déterminer la langue sélectionnée pour le chargement des fichiers de données + // Déterminer la langue du contenu du site if (isset($this->input['_COOKIE']['ZWII_I18N_SITE']) ) { - self::$i18n = $this->input['_COOKIE']['ZWII_I18N_SITE']; - setlocale (LC_TIME, self::$i18n . '_' . strtoupper (self::$i18n) ); + self::$i18nContent = $this->input['_COOKIE']['ZWII_I18N_SITE']; + setlocale (LC_TIME, self::$i18nContent . '_' . strtoupper (self::$i18nContent) ); } else { - self::$i18n = 'fr'; + self::$i18nContent = ''; } // Instanciation de la classe des entrées / sorties @@ -283,19 +284,26 @@ class common { // Constructeur JsonDB $this->dataFiles[$keys] = new \Prowebcraft\JsonDb([ 'name' => $keys . '.json', - 'dir' => $this->dataPath ($keys, self::$i18n), + 'dir' => $this->dataPath ($keys, self::$i18nContent), 'backup' => file_exists('site/data/.backup') ]);; } + // Langue de l'administration + self::$i18n = $this->getData(['config', 'i18n', 'default']); + // La langue par défaut du contenu est celle du site si le cookie est absent. + if (self::$i18nContent === '') { + self::$i18nContent = self::$i18n; + } + // Installation fraîche, initialisation des modules manquants // La langue d'installation par défaut est fr foreach ($this->dataFiles as $stageId => $item) { - $folder = $this->dataPath ($stageId, self::$i18n); + $folder = $this->dataPath ($stageId, self::$i18nContent); if ( file_exists($folder . $stageId .'.json') === false || $this->getData([$stageId]) === NULL ) { - $this->initData($stageId, self::$i18n); + $this->initData($stageId, self::$i18nContent); common::$coreNotices [] = $stageId ; } } @@ -1576,7 +1584,7 @@ class common { ) { if ( $this->getData(['user', $this->getUser('id') , 'files']) === true - ) { + ) { $itemsRight .= '
  • ' . template::ico('folder', [ 'href' => helper::baseUrl(false) . 'core/vendor/filemanager/dialog.php?type=0&akey=' . md5_file(self::DATA_DIR.'core.json'), 'attr' => 'data-lity', @@ -2737,7 +2745,7 @@ class core extends common { ) { $this->addOutput([ 'title' => $title, - 'content' => $this->getPage($this->getUrl(0), self::$i18n) . + 'content' => $this->getPage($this->getUrl(0), self::$i18nContent) . // Concatène avec les paramètres avancés. $this->getData(['page', $this->getUrl(0), 'css']) . $this->getData(['page', $this->getUrl(0), 'js']), @@ -2747,10 +2755,10 @@ class core extends common { 'iconUrl' => $this->getData(['page', $this->getUrl(0), 'iconUrl']), 'disable' => $this->getData(['page', $this->getUrl(0), 'disable']), 'contentRight' => $this->getData(['page',$this->getUrl(0),'barRight']) - ? $this->getPage($this->getData(['page',$this->getUrl(0),'barRight']), self::$i18n) + ? $this->getPage($this->getData(['page',$this->getUrl(0),'barRight']), self::$i18nContent) : '', 'contentLeft' => $this->getData(['page',$this->getUrl(0),'barLeft']) - ? $this->getPage($this->getData(['page',$this->getUrl(0),'barLeft']), self::$i18n) + ? $this->getPage($this->getData(['page',$this->getUrl(0),'barLeft']), self::$i18nContent) : '' ]); } @@ -2771,13 +2779,13 @@ class core extends common { 'iconUrl' => $this->getData(['page', $this->getUrl(0), 'iconUrl']), 'disable' => $this->getData(['page', $this->getUrl(0), 'disable']), 'contentRight' => $this->getData(['page',$this->getUrl(0),'barRight']) - ? $this->getPage($this->getData(['page',$this->getUrl(0),'barRight']), self::$i18n) + ? $this->getPage($this->getData(['page',$this->getUrl(0),'barRight']), self::$i18nContent) : '', 'contentLeft' => $this->getData(['page',$this->getUrl(0),'barLeft']) - ? $this->getPage($this->getData(['page',$this->getUrl(0),'barLeft']), self::$i18n) + ? $this->getPage($this->getData(['page',$this->getUrl(0),'barLeft']), self::$i18nContent) : '' ]); - $pageContent = $this->getPage($this->getUrl(0), self::$i18n); + $pageContent = $this->getPage($this->getUrl(0), self::$i18nContent); } else { $moduleId = $this->getUrl(0); diff --git a/core/include/update.inc.php b/core/include/update.inc.php index 5c360349..9aa671a3 100644 --- a/core/include/update.inc.php +++ b/core/include/update.inc.php @@ -438,8 +438,8 @@ if ($this->getData(['core', 'dataVersion']) < 11000) { // Liste des pages dans pageList $pageList = array(); // Creation du contenu de la page - if (!is_dir(self::DATA_DIR . self::$i18n . '/content')) { - mkdir(self::DATA_DIR . self::$i18n . '/content', 0755); + if (!is_dir(self::DATA_DIR . self::$i18nContent . '/content')) { + mkdir(self::DATA_DIR . self::$i18nContent . '/content', 0755); } foreach ($this->getHierarchy(null,null,null) as $parentKey=>$parentValue) { $pageList [] = $parentKey; @@ -449,7 +449,7 @@ if ($this->getData(['core', 'dataVersion']) < 11000) { } foreach ($pageList as $parentKey => $parent) { $content = $this->getData(['page', $parent, 'content']); - //file_put_contents(self::DATA_DIR . self::$i18n . '/content/' . $parent . '.html', $content); + //file_put_contents(self::DATA_DIR . self::$i18nContent . '/content/' . $parent . '.html', $content); $this->setPage($parent, $content, 'fr'); $this->setData(['page', $parent, 'content', $parent . '.html']); } @@ -564,7 +564,7 @@ if ($this->getData(['core', 'dataVersion']) < 11203) { $success = false ; // Boucler sur les pages foreach($this->getHierarchy(null,null,null) as $parentId => $childIds) { - $content = $this->getPage($parentId, self::$i18n); + $content = $this->getPage($parentId, self::$i18nContent); $titre = $this->getData(['page', $parentId, 'title']); $content = $titre . ' ' . $content ; $replace = str_replace( 'href="' . $old , 'href="'. $new , stripslashes($content),$c1) ; @@ -572,17 +572,17 @@ if ($this->getData(['core', 'dataVersion']) < 11203) { if ($c1 > 0 || $c2 > 0) { $success = true; - $this->setPage($parentId, $replace, self::$i18n); + $this->setPage($parentId, $replace, self::$i18nContent); $c3 += $c1 + $c2; } foreach($childIds as $childId) { - $content = $this->getPage($childId, self::$i18n); + $content = $this->getPage($childId, self::$i18nContent); $content = $titre . ' ' . $content ; $replace = str_replace( 'href="' . $old , 'href="'. $new , stripslashes($content),$c1) ; $replace = str_replace( 'src="' . $old , 'src="'. $new , stripslashes($replace),$c2) ; if ($c1 > 0 || $c2 > 0) { $success = true; - $this->setPage($childId, $replace, self::$i18n); + $this->setPage($childId, $replace, self::$i18nContent); $c3 += $c1 + $c2; } } diff --git a/core/layout/blank.php b/core/layout/blank.php index 6e2d1852..909a5bfe 100644 --- a/core/layout/blank.php +++ b/core/layout/blank.php @@ -1,5 +1,5 @@ - + diff --git a/core/layout/light.php b/core/layout/light.php index 833cb19d..f793fac8 100644 --- a/core/layout/light.php +++ b/core/layout/light.php @@ -1,5 +1,5 @@ - + diff --git a/core/layout/main.php b/core/layout/main.php index ccbf15ca..5a1317a4 100644 --- a/core/layout/main.php +++ b/core/layout/main.php @@ -1,5 +1,5 @@ - + diff --git a/core/module/addon/addon.php b/core/module/addon/addon.php index 7cb5792d..600031d2 100644 --- a/core/module/addon/addon.php +++ b/core/module/addon/addon.php @@ -434,8 +434,8 @@ class addon extends common { // Export des pages hébergeant le module $pageParam[$pageId] = $this->getData(['page',$pageId]); // Export du contenu de la page - //$pageContent[$pageId] = file_get_contents(self::DATA_DIR . self::$i18n . '/content/' . $this->getData(['page', $pageId, 'content'])); - $pageContent[$pageId] = $this->getPage($pageId, self::$i18n); + //$pageContent[$pageId] = file_get_contents(self::DATA_DIR . self::$i18nContent . '/content/' . $this->getData(['page', $pageId, 'content'])); + $pageContent[$pageId] = $this->getPage($pageId, self::$i18nContent); // Export de fr/module.json $moduleId = 'fr/module.json'; $moduleDir = str_replace('site/data/','',$infoModules[$this->getUrl(2)]['dataDirectory']); diff --git a/core/module/maintenance/maintenance.php b/core/module/maintenance/maintenance.php index 284337df..20c67acd 100644 --- a/core/module/maintenance/maintenance.php +++ b/core/module/maintenance/maintenance.php @@ -37,7 +37,7 @@ class maintenance extends common { ? '' : $this->getData(['page',$this->getData(['locale','page302']),'title']), //'content' => $this->getdata(['page',$this->getData(['locale','page302']),'content']), - 'content' => $this->getPage($this->getData(['locale','page302']), self::$i18n), + 'content' => $this->getPage($this->getData(['locale','page302']), self::$i18nContent), 'view' => 'index' ]); } else { diff --git a/core/module/page/page.php b/core/module/page/page.php index 941f191c..8e92e14e 100644 --- a/core/module/page/page.php +++ b/core/module/page/page.php @@ -161,11 +161,11 @@ class page extends common { ] ]); // Creation du contenu de la page - if (!is_dir(self::DATA_DIR . self::$i18n . '/content')) { - mkdir(self::DATA_DIR . self::$i18n . '/content', 0755); + if (!is_dir(self::DATA_DIR . self::$i18nContent . '/content')) { + mkdir(self::DATA_DIR . self::$i18nContent . '/content', 0755); } - //file_put_contents(self::DATA_DIR . self::$i18n . '/content/' . $pageId . '.html', '

    Contenu de votre nouvelle page.

    '); - $this->setPage($pageId, '

    Contenu de votre nouvelle page.

    ', self::$i18n); + //file_put_contents(self::DATA_DIR . self::$i18nContent . '/content/' . $pageId . '.html', '

    Contenu de votre nouvelle page.

    '); + $this->setPage($pageId, '

    Contenu de votre nouvelle page.

    ', self::$i18nContent); // Met à jour le site map $this->createSitemap('all'); // Mise à jour de la liste des pages pour TinyMCE @@ -289,8 +289,8 @@ class page extends common { } // Effacer la page $this->deleteData(['page', $url[0]]); - if (file_exists(self::DATA_DIR . self::$i18n . '/content/' . $url[0] . '.html')) { - unlink(self::DATA_DIR . self::$i18n . '/content/' . $url[0] . '.html'); + if (file_exists(self::DATA_DIR . self::$i18nContent . '/content/' . $url[0] . '.html')) { + unlink(self::DATA_DIR . self::$i18nContent . '/content/' . $url[0] . '.html'); } $this->deleteData(['module', $url[0]]); // Met à jour le site map @@ -372,8 +372,8 @@ class page extends common { // Supprime l'ancienne page si l'id a changée if($pageId !== $this->getUrl(2)) { $this->deleteData(['page', $this->getUrl(2)]); - if (file_exists(self::DATA_DIR . self::$i18n . '/content/' . $this->getUrl(2) . '.html')) { - unlink (self::DATA_DIR . self::$i18n . '/content/' . $this->getUrl(2) . '.html'); + if (file_exists(self::DATA_DIR . self::$i18nContent . '/content/' . $this->getUrl(2) . '.html')) { + unlink (self::DATA_DIR . self::$i18nContent . '/content/' . $this->getUrl(2) . '.html'); } } // Traitement des pages spéciales affectées dans la config : @@ -496,11 +496,11 @@ class page extends common { ]); // Creation du contenu de la page - if (!is_dir(self::DATA_DIR . self::$i18n . '/content')) { - mkdir(self::DATA_DIR . self::$i18n . '/content', 0755); + if (!is_dir(self::DATA_DIR . self::$i18nContent . '/content')) { + mkdir(self::DATA_DIR . self::$i18nContent . '/content', 0755); } $content = empty($this->getInput('pageEditContent', null)) ? '

    ' : str_replace('

    ', '

     

    ', $this->getInput('pageEditContent', null)); - $this->setPage($pageId , $content, self::$i18n); + $this->setPage($pageId , $content, self::$i18nContent); // Met à jour le site map $this->createSitemap('all'); diff --git a/core/module/page/view/edit/edit.php b/core/module/page/view/edit/edit.php index 04bca720..dce2850e 100644 --- a/core/module/page/view/edit/edit.php +++ b/core/module/page/view/edit/edit.php @@ -109,7 +109,7 @@
    'editorWysiwyg', - 'value' => $this->getPage($this->getUrl(2), self::$i18n) + 'value' => $this->getPage($this->getUrl(2), self::$i18nContent) ]); ?>
    diff --git a/core/module/plugin/plugin.php b/core/module/plugin/plugin.php index 8862b04c..dda0cab5 100644 --- a/core/module/plugin/plugin.php +++ b/core/module/plugin/plugin.php @@ -502,8 +502,8 @@ class plugin extends common { // Mise en forme du tableau des modules employés dans les pages // Avec les commandes de sauvegarde et de restauration - $keyi18n = self::$i18n; - $valueI18n = $pagesInfos[self::$i18n]; + $keyi18n = self::$i18nContent; + $valueI18n = $pagesInfos[self::$i18nContent]; foreach ($valueI18n as $keyPage=>$value) { if (isset($infoModules[$pagesInfos[$keyi18n][$keyPage]['moduleId']])) { // Co[nstruire le tableau de sortie diff --git a/core/module/plugin/view/index/index.php b/core/module/plugin/view/index/index.php index ca894a5b..cbd2d385 100644 --- a/core/module/plugin/view/index/index.php +++ b/core/module/plugin/view/index/index.php @@ -69,7 +69,7 @@
    -

    Modules configurés

    +

    Modules configurés

    getData(['page', $parentId, 'block']) !== 'bar') { $url = $parentId; $titre = $this->getData(['page', $parentId, 'title']); - //$content = file_get_contents(self::DATA_DIR . self::$i18n . '/content/' . $this->getData(['page', $parentId, 'content'])); - $content = $this->getPage($parentId, self::$i18n); + //$content = file_get_contents(self::DATA_DIR . self::$i18nContent . '/content/' . $this->getData(['page', $parentId, 'content'])); + $content = $this->getPage($parentId, self::$i18nContent); $content = $titre . ' ' . $content ; // Pages sauf pages filles et articles de blog $tempData = $this->occurrence($url, $titre, $content, $motclef, self::$motentier); @@ -206,8 +206,8 @@ class search extends common { $this->getData(['page', $parentId, 'block']) !== 'bar') { $url = $childId; $titre = $this->getData(['page', $childId, 'title']); - //$content = file_get_contents(self::DATA_DIR . self::$i18n . '/content/' . $this->getData(['page', $childId, 'content'])); - $content = $this->getPage($childId, self::$i18n); + //$content = file_get_contents(self::DATA_DIR . self::$i18nContent . '/content/' . $this->getData(['page', $childId, 'content'])); + $content = $this->getPage($childId, self::$i18nContent); $content = $titre . ' ' . $content ; //Pages filles $tempData = $this->occurrence($url, $titre, $content, $motclef, self::$motentier);