diff --git a/core/core.php b/core/core.php index e901a60c..8366cd0d 100755 --- a/core/core.php +++ b/core/core.php @@ -200,7 +200,6 @@ class common { setlocale (LC_TIME, self::$i18n . '_' . strtoupper (self::$i18n) ); } else { - //setcookie('ZWII_I18N_SITE' , 'fr', time() + 3600, helper::baseUrl(false, false) , '', helper::isHttps(), true); self::$i18n = 'fr'; } @@ -252,11 +251,12 @@ class common { * - L'auto-détection est active */ - if ( $this->getData(['config','translate','scriptGoogle']) === true + if ( $this->getData(['config', 'i18n', 'enabled']) === true + AND $this->getData(['config','translate','scriptGoogle']) === true AND $this->getData(['config','translate','autoDetect']) === true AND $this->getInput('ZWII_I18N_SITE') !== '' AND !empty($_SERVER['HTTP_ACCEPT_LANGUAGE']) ) - { + { /** * Le cookie est prioritaire sur le navigateur * la traduction est celle de la langue du drapeau @@ -2129,7 +2129,7 @@ class core extends common { 'contentLeft' => $this->getData(['page',$this->getData(['page',$this->getUrl(0),'barLeft']),'content']) ]); $pageContent = $this->getData(['page', $this->getUrl(0), 'content']); - } + } else { $moduleId = $this->getUrl(0); $pageContent = ''; @@ -2298,30 +2298,31 @@ class core extends common { // Chargement de la bibliothèque googtrans // Le script de traduction est sélectionné - if ( $this->getData(['config','translate','scriptGoogle']) === true - AND - // et la traduction de la langue courante est automatique - ( $this->getInput('ZWII_I18N_SCRIPT') !== '' - // Ou traduction automatique - OR $this->getData(['config','translate','autoDetect']) === true - ) - // Cas des pages d'administration - // Pas connecté - AND $this->getUser('password') !== $this->getInput('ZWII_USER_PASSWORD') - AND $this->getUrl(1) !== 'login' - // Ou connecté avec option active - OR ($this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD') - AND $this->getData(['config','translate','admin']) === true - ) + if ($this->getData(['config', 'i18n', 'enabled']) === true) { + if ( $this->getData(['config','translate','scriptGoogle']) === true + // et la traduction de la langue courante est automatique + AND ( $this->getInput('ZWII_I18N_SCRIPT') !== '' + // Ou traduction automatique + OR $this->getData(['config','translate','autoDetect']) === true + ) + // Cas des pages d'administration + // Pas connecté + AND $this->getUser('password') !== $this->getInput('ZWII_USER_PASSWORD') + AND $this->getUrl(1) !== 'login' + // Ou connecté avec option active + OR ($this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD') + AND $this->getData(['config','translate','admin']) === true + ) - ) { - // Paramètre du script - setrawcookie("googtrans", '/fr/'. $this->getInput('ZWII_I18N_SCRIPT') , time() + 3600, helper::baseUrl()); - // Chargement de la librairie - $this->addOutput([ - 'vendor' => array_merge($this->output['vendor'], ['i18n']) - ]); + ) { + // Paramètre du script + setrawcookie("googtrans", '/fr/'. $this->getInput('ZWII_I18N_SCRIPT') , time() + 3600, helper::baseUrl()); + // Chargement de la librairie + $this->addOutput([ + 'vendor' => array_merge($this->output['vendor'], ['i18n']) + ]); + } } // Erreurs if($access === 'login') { @@ -2444,7 +2445,9 @@ class layout extends common { * @param Page par défaut */ public function showContent() { - echo $this->showi18n('Site'); + if ($this->getData(['config', 'i18n', 'enabled']) === true) { + echo $this->showi18n('Site'); + } if( $this->core->output['title'] AND ( @@ -2463,7 +2466,8 @@ class layout extends common { * La traduction est active et le site n'est pas en français. * La fonction est activée. */ - if ( $this->getData(['config','translate','scriptGoogle']) === true + if ( $this->getData(['config', 'i18n', 'enabled']) === true + AND $this->getData(['config','translate','scriptGoogle']) === true AND $this->getData(['config','translate','showCredits']) === true AND // et la traduction n'est pas manuelle @@ -2826,7 +2830,9 @@ class layout extends common { } // Retourne les items du menu echo ''; - echo $this->showi18n('Nav'); + if ($this->getData(['config', 'i18n', 'enabled']) === true) { + echo $this->showi18n('Nav'); + } } /** @@ -3068,7 +3074,9 @@ class layout extends common { if($this->getUser('group') >= self::GROUP_ADMIN) { $rightItems .= '
  • ' . template::ico('users') . '
  • '; $rightItems .= '
  • ' . template::ico('brush') . '
  • '; - $rightItems .= '
  • ' . template::ico('flag') . '
  • '; + if ($this->getData(['config', 'i18n', 'enabled']) === true) { + $rightItems .= '
  • ' . template::ico('flag') . '
  • '; + } $rightItems .= '
  • ' . template::ico('puzzle') . '
  • '; $rightItems .= '
  • ' . template::ico('cog-alt') . '
  • '; // Mise à jour automatique diff --git a/core/module/config/config.php b/core/module/config/config.php index f33fa582..6ca23381 100755 --- a/core/module/config/config.php +++ b/core/module/config/config.php @@ -396,9 +396,10 @@ class config extends common { 'legalPageId' => $legalPageId, 'searchPageId' => $searchPageId, 'metaDescription' => $this->getInput('configMetaDescription', helper::FILTER_STRING_LONG, true), - 'title' => $this->getInput('configTitle', helper::FILTER_STRING_SHORT, true) + 'title' => $this->getInput('configTitle', helper::FILTER_STRING_SHORT, true), ] ]); + $this->setData(['config', 'i18n', 'enabled', $this->getInput('configI18n',helper::FILTER_BOOLEAN) ]); // Générer robots.txt et sitemap $this->generateFiles(); // Valeurs en sortie diff --git a/core/module/config/view/advanced/advanced.php b/core/module/config/view/advanced/advanced.php index 104bb0fb..3650ac8e 100644 --- a/core/module/config/view/advanced/advanced.php +++ b/core/module/config/view/advanced/advanced.php @@ -16,7 +16,7 @@

    Maintenance

    -
    +
    $this->getData(['config', 'maintenance']) ]); ?> @@ -28,7 +28,7 @@ 'ico' => 'download' ]); ?>
    -
    +
    helper::baseUrl() . 'config/manage', 'value' => 'Restaurer', @@ -42,7 +42,6 @@

    Réglages

    -
    - $this->getData(['config', 'cookieConsent']), 'help' => 'Activation obligatoire selon les lois françaises sauf si vous utilisez votre propre système de consentement.' ]); ?>
    - helper::checkRewrite(), - 'help' => 'Vérifiez d\'abord que votre serveur l\'autorise : ce n\'est pas le cas chez Free.' + 'help' => 'Vérifiez d\'abord que votre serveur autorise l\'URL rewriting (ce qui n\'est pas le cas chez Free).' ]); ?>
    - $this->getData(['config', 'autoBackup']), 'help' => 'Une archive contenant le dossier /site/data est copiée dans le dossier \'site/backup\'. La sauvegarde est conservée pendant 30 jours.

    Les fichiers du site ne sont pas sauvegardés automatiquement. Activation recommandée.' ]); ?>

    - file_exists('site/data/.backup'), - 'help' => 'Un fichier .backup.json est généré à chaque édition ou effacement d\'une donnée. La désactivation entraîne la suppression de ces fichiers. Activation recommandée.' + 'help' => 'Un fichier .backup.json est généré à chaque édition ou effacement d\'une donnée. La désactivation entraîne la suppression de ces fichiers.' ]); ?>
    - $this->getData(['config','captchaStrong']), - 'help' => 'Option recommandée pour sécuriser la connexion. S\'applique à tous les captchas du site. Le captcha simple se limite à une addition de nombres de 0 à 10. Le captcha renforcé utilise quatre opérations de nombres de 0 à 20. Activation recommandée.' + 'help' => 'Option recommandée pour sécuriser la connexion. S\'applique à tous les captchas du site. Le captcha simple se limite à une addition de nombres de 0 à 10. Le captcha complexe utilise quatre opérations de nombres de 0 à 20. Activation recommandée.' ]); ?>
    - $this->getData(['config','autoDisconnect']), 'help' => 'Déconnecte les sessions ouvertes précédemment sur d\'autres navigateurs ou terminaux. Activation recommandée.' ]); ?>
    +
    +
    +
    +
    +
    +
    +

    Mises à jour automatisée

    +
    - $this->getData(['config', 'autoUpdate']), - 'help' => 'Vérifie une fois par jour l\'existence d\'une mise à jour.', - 'disabled' => !$error + 'help' => 'La vérification est quotidienne. Option désactivée si la configuration du serveur ne le permet pas.', + 'disabled' => !$updateError ]); ?>
    - $this->getData(['config', 'autoUpdateHtaccess']), 'help' => 'Lors d\'une mise à jour automatique, conserve le fichier htaccess de la racine du site.', - 'disabled' => !$error + 'disabled' => !$updateError ]); ?>
    @@ -132,7 +139,7 @@ 'href' => helper::baseUrl() . 'install/update', 'value' => 'Mise à jour manuelle', 'class' => 'buttonRed', - 'disabled' => !$error + 'disabled' => !$updateError ]); ?>
    @@ -310,7 +317,7 @@
    -
    +
    $this->getData(['config', 'connect','captcha']) ]); ?> diff --git a/core/module/config/view/index/index.php b/core/module/config/view/index/index.php index 3e64719e..4e6bf701 100755 --- a/core/module/config/view/index/index.php +++ b/core/module/config/view/index/index.php @@ -8,10 +8,10 @@ 'value' => 'Accueil' ]); ?>
    -
    +
    helper::baseUrl() . 'config/advanced', - 'value' => 'Avancée', + 'value' => 'Configuration avancée', 'ico' => 'cog-alt', ]); ?>
    @@ -123,4 +123,20 @@
    +
    +
    +
    +

    Langues étrangères

    +
    +
    + $this->getData(['config', 'i18n', 'enabled']), + 'help'=> 'Une nouvelle icône apparaîtra dans la barre d\'administration. Consultez l\'aide de la page concernée pour en apprendre plus.' + ]); ?> +
    +
    +
    +
    +
    +
    diff --git a/core/module/install/ressource/defaultdata.php b/core/module/install/ressource/defaultdata.php index 2ea064a0..f39e2fa9 100755 --- a/core/module/install/ressource/defaultdata.php +++ b/core/module/install/ressource/defaultdata.php @@ -33,7 +33,8 @@ class init extends common { 'log' => false, 'captcha' => true ], - 'translate' => [ + 'i18n' => [ + 'enabled' => false, 'scriptGoogle' => false, 'showCredits' => false, 'autoDetect' => false, diff --git a/core/module/translate/view/index/index.php b/core/module/translate/view/index/index.php index 30525a6a..7bf5faed 100755 --- a/core/module/translate/view/index/index.php +++ b/core/module/translate/view/index/index.php @@ -69,7 +69,7 @@
    'Drapeau masqué','site'=>'Drapeau affiché'], [ 'label' => 'Français', - 'selected' => $this->getData(['config', 'translate' , 'fr']) + 'selected' => $this->getData(['config', 'i18n' , 'fr']) ]); ?>
    @@ -79,21 +79,21 @@ 'Allemand', 'class' => 'translateFlagSelect', - 'selected' => $this->getData(['config', 'translate' , 'de']) + 'selected' => $this->getData(['config', 'i18n' , 'de']) ]); ?>
    'Anglais', 'class' => 'translateFlagSelect', - 'selected' => $this->getData(['config', 'translate' , 'en']) + 'selected' => $this->getData(['config', 'i18n' , 'en']) ]); ?>
    'Espagnol', 'class' => 'translateFlagSelect', - 'selected' => $this->getData(['config', 'translate' , 'es']) + 'selected' => $this->getData(['config', 'i18n' , 'es']) ]); ?>
    @@ -102,21 +102,21 @@ 'Italien', 'class' => 'translateFlagSelect', - 'selected' => $this->getData(['config', 'translate' , 'it']) + 'selected' => $this->getData(['config', 'i18n' , 'it']) ]); ?>
    'Néerlandais', 'class' => 'translateFlagSelect', - 'selected' => $this->getData(['config', 'translate' , 'nl']) + 'selected' => $this->getData(['config', 'i18n' , 'nl']) ]); ?>
    'Portugais', 'class' => 'translateFlagSelect', - 'selected' => $this->getData(['config', 'translate' , 'pt']) + 'selected' => $this->getData(['config', 'i18n' , 'pt']) ]); ?>