diff --git a/core/core.php b/core/core.php index f3a219b3..9f530c38 100644 --- a/core/core.php +++ b/core/core.php @@ -301,35 +301,6 @@ class common { $this->user = $this->getData(['user', $this->getInput('ZWII_USER_ID')]); } - /** - * Traduction du site par script - * Traduction par clic sur le drapeau OU - * Traduction automatisée - * - Exclure la traduction manuelle - * - La mangue du navigateur est lisible - * - L'auto-détection est active - */ - - if ( $this->getData(['config', 'i18n', 'enable']) === true - AND $this->getData(['config', 'i18n','scriptGoogle']) === true - AND $this->getData(['config', 'i18n','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 - * */ - if ( $this->getInput('ZWII_I18N_SCRIPT') !== substr($_SERVER["HTTP_ACCEPT_LANGUAGE"],0,2 ) ) { - setrawcookie('googtrans', '/fr/'.substr( $_SERVER["HTTP_ACCEPT_LANGUAGE"],0,2 ), time() + 3600, helper::baseUrl(false, false)); - } else { - // Langue du drapeau si elle est définie - if ( $this->getInput('ZWII_I18N_SCRIPT') !== '' ) { - // Paramètre du script - setrawcookie("googtrans", '/fr/'. $this->getInput('ZWII_I18N_SCRIPT') , time() + 3600, helper::baseUrl(false,false)); - } - } - } // Construit la liste des pages parents/enfants if($this->hierarchy['all'] === []) { @@ -1361,23 +1332,6 @@ class common { echo $this->output['content']; - /** - * Affiche les crédits, conditions requis : - * La traduction est active et le site n'est pas en français. - * La fonction est activée. - */ - if ( $this->getData(['config', 'i18n', 'enable']) === true - AND $this->getData(['config', 'i18n','scriptGoogle']) === true - AND $this->getData(['config', 'i18n','showCredits']) === true - AND - // et la traduction n'est pas manuelle - ( $this->getInput('ZWII_I18N_SCRIPT') - AND $this->getData(['config', 'i18n', $this->getInput('ZWII_I18N_SCRIPT')]) === 'script' - ) - ) - { - echo ''; - } } /** @@ -1694,9 +1648,7 @@ class common { } // Retourne les items du menu echo ''; } @@ -2239,26 +2191,13 @@ class common { */ public function showi18n() { foreach (self::$i18nList as $key => $value) { - if ($this->getData(['config', 'i18n', $key]) === 'site' - OR ( - // Le script de traduction est actif et la langue est traduite par script - $this->getData(['config', 'i18n','scriptGoogle']) === true - AND $this->getData(['config', 'i18n', $key]) === 'script' - // Le drapeau n'est pas actif pour les non admin en mode connecté. - AND - ( $this->getUser('password') !== $this->getInput('ZWII_USER_PASSWORD') - OR $this->getUser('group') === self::GROUP_ADMIN ) - ) ) { if ( (isset($_COOKIE['ZWII_I18N_SITE'] ) AND $_COOKIE['ZWII_I18N_SITE'] === $key ) - OR - ( isset($_COOKIE['ZWII_I18N_SCRIPT']) - AND $_COOKIE['ZWII_I18N_SCRIPT'] === $key - ) ) { + ) { $select = ' class="i18nFlagSelected" '; } else { $select = ' class="i18nFlag" '; @@ -3072,35 +3011,6 @@ class core extends common { } } - // Chargement de la bibliothèque googtrans - - // Le script de traduction est sélectionné - if ($this->getData(['config', 'i18n', 'enable']) === true) { - if ( $this->getData(['config', 'i18n','scriptGoogle']) === true - // et la traduction de la langue courante est automatique - AND ( $this->getInput('ZWII_I18N_SCRIPT') !== '' - // Ou traduction automatique - OR $this->getData(['config', 'i18n','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', 'i18n','admin']) === true - ) - - ) { - - // Chargement de la librairie - $this->addOutput([ - 'vendor' => array_merge($this->output['vendor'], ['i18n']) - ]); - - } - } - // Erreurs if($access === 'login') { http_response_code(302); diff --git a/core/include/update.inc.php b/core/include/update.inc.php index 7459d589..1b91c5c7 100644 --- a/core/include/update.inc.php +++ b/core/include/update.inc.php @@ -870,6 +870,7 @@ if ($this->getData(['core', 'dataVersion']) < 11600) { $this->deleteData(['config', 'i18n', 'scriptGoogle']); $this->deleteData(['config', 'i18n', 'showCredits']); $this->deleteData(['config', 'i18n', 'autoDetect']); + helper::deleteCookie('ZWII_I18N_SCRIPT'); // Mise à jour $this->setData(['core', 'dataVersion', 11600]); diff --git a/core/module/install/install.php b/core/module/install/install.php index 38e5a93a..4f40af60 100644 --- a/core/module/install/install.php +++ b/core/module/install/install.php @@ -89,7 +89,6 @@ class install extends common { ); // Nettoyer les cookies de langue d'une précédente installation helper::deleteCookie('ZWII_I18N_SITE'); - helper::deleteCookie('ZWII_I18N_SCRIPT'); // Installation du site de test if ($this->getInput('installDefaultData',helper::FILTER_BOOLEAN) === FALSE) { $this->initData('page','fr',true); diff --git a/core/module/install/ressource/defaultdata.php b/core/module/install/ressource/defaultdata.php index c41a1d47..44716db9 100644 --- a/core/module/install/ressource/defaultdata.php +++ b/core/module/install/ressource/defaultdata.php @@ -41,11 +41,6 @@ class init extends common { 'redirectLogin' => true ], 'i18n' => [ - 'enable'=> true, - 'scriptGoogle'=> false, - 'showCredits'=> false, - 'autoDetect'=> false, - 'admin'=> false, 'fr'=> 'none', 'de'=> 'none', 'en'=> 'none', diff --git a/core/module/translate/translate.php b/core/module/translate/translate.php index f929870a..3b86c0b4 100644 --- a/core/module/translate/translate.php +++ b/core/module/translate/translate.php @@ -97,12 +97,6 @@ class translate extends common { // Soumission du formulaire if($this->isPost()) { - // Désactivation du script Google - $script = $this->getInput('translateScriptGoogle', helper::FILTER_BOOLEAN); - if ($script === false) { - setrawcookie('googtrans', '/fr/fr', time() + 3600, helper::baseUrl(false,false)); - $_SESSION['googtrans'] = '/fr/fr'; - } // Edition des langues foreach (self::$i18nList as $keyi18n => $value) { if ($keyi18n === 'fr') continue; @@ -114,7 +108,6 @@ class translate extends common { $this->removeDir( self::DATA_DIR . $keyi18n); // Au cas ou la langue est sélectionnée helper::deleteCookie('ZWII_I18N_SITE'); - helper::deleteCookie('ZWII_I18N_SCRIPT'); } // Active le script si une langue est en trad auto @@ -126,11 +119,6 @@ class translate extends common { // Enregistrement des données $this->setData(['config','i18n', [ - 'enable' => $this->getData(['config', 'i18n', 'enable']), - 'scriptGoogle' => $script, - 'showCredits' => $this->getInput('translateScriptGoogle', helper::FILTER_BOOLEAN) ? $this->getInput('translateCredits', helper::FILTER_BOOLEAN) : false, - 'autoDetect' => $this->getInput('translateScriptGoogle', helper::FILTER_BOOLEAN) ? $this->getInput('translateAutoDetect', helper::FILTER_BOOLEAN) : false, - //'admin' => $this->getInput('translateScriptGoogle', helper::FILTER_BOOLEAN) ? $this->getInput('translateAdmin', helper::FILTER_BOOLEAN) : false, 'fr' => $this->getInput('translateFR'), 'de' => $this->getInput('translateDE'), 'en' => $this->getInput('translateEN'), @@ -152,7 +140,6 @@ class translate extends common { if ($this->getData(['config','i18n',$key]) === 'site') { self::$translateOptions [$key] = [ 'none' => 'Drapeau masqué', - 'script' => 'Traduction automatique', 'site' => 'Traduction rédigée', 'delete' => 'Supprimer la traduction' ]; @@ -160,7 +147,6 @@ class translate extends common { } else { self::$translateOptions [$key] = [ 'none' => 'Drapeau masqué', - 'script' => 'Traduction automatique', 'site' => 'Traduction rédigée' ]; } @@ -183,20 +169,12 @@ class translate extends common { if ( $this->getInput('ZWII_I18N_' . strtoupper($this->getUrl(3))) !== $this->getUrl(2) ) { // Nettoyer et stocker le choix de l'utilisateur helper::deleteCookie('ZWII_I18N_SITE'); - helper::deleteCookie('ZWII_I18N_SCRIPT'); // Sélectionner setcookie('ZWII_I18N_' . strtoupper($this->getUrl(3)) , $this->getUrl(2), time() + 3600, helper::baseUrl(false, false) , '', helper::isHttps(), true); - setrawcookie('googtrans', '/fr/' . $this->getUrl(2), time() + 3600, helper::baseUrl(false,false)); - $_SESSION['googtrans'] = '/fr/' . $this->getUrl(2); // Désactivation du drapeau, langue FR par défaut } else { setcookie('ZWII_I18N_SITE' , 'fr', time() + 3600, helper::baseUrl(false, false) , '', helper::isHttps(), true); - helper::deleteCookie('ZWII_I18N_SCRIPT'); - // Désactivation du script Google - setrawcookie('googtrans', '/fr/fr', time() + 3600, helper::baseUrl(false,false)); - $_SESSION['googtrans'] = '/fr/fr'; } - // Valeurs en sortie $this->addOutput([ 'redirect' => helper::baseUrl() . $this->getData(['locale', $this->getUrl(2), 'homePageId' ]) diff --git a/core/module/translate/view/index/index.php b/core/module/translate/view/index/index.php index fabc4e6a..9679894d 100644 --- a/core/module/translate/view/index/index.php +++ b/core/module/translate/view/index/index.php @@ -28,37 +28,6 @@ -
-
-
-

Traduction automatique

-
-
- $this->getData(['config','i18n', 'scriptGoogle']), - 'help' => 'Le script Google Translate assure la traduction automatique du site.' - ]); ?> -
-
- $this->getData(['config','i18n', 'autoDetect']), - 'class' => 'translateGoogleScriptOption', - 'help' => 'Détecte la langue du navigateur, dans ce mode il n\'est pas nécessaire d\'afficher les drapeaux.' - ]); ?> -
-
-
-
- $this->getData(['config','i18n', 'showCredits']), - 'class' => 'translateGoogleScriptOption', - 'help' => 'Option recommandée pour le respect du droit d\'auteur' - ]); ?> -
-
-
-
-