diff --git a/core/core.php b/core/core.php
index 8366cd0d..d87648b2 100755
--- a/core/core.php
+++ b/core/core.php
@@ -252,8 +252,8 @@ class common {
*/
if ( $this->getData(['config', 'i18n', 'enabled']) === true
- AND $this->getData(['config','translate','scriptGoogle']) === true
- AND $this->getData(['config','translate','autoDetect']) === 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']) )
{
@@ -1659,17 +1659,17 @@ class common {
$this->setData(['config','autoDisconnect',true]);
// Mettre à jour les données de langue
- $this->setData(['config','translate','scriptGoogle', false ]);
- $this->setData(['config','translate','showCredits', false ]);
- $this->setData(['config','translate','autoDetect', false ]);
- $this->setData(['config','translate','admin', false ]);
- $this->setData(['config','translate','fr', false ]);
- $this->setData(['config','translate','de', false ]);
- $this->setData(['config','translate','en', false ]);
- $this->setData(['config','translate','es', false ]);
- $this->setData(['config','translate','it', false ]);
- $this->setData(['config','translate','nl', false ]);
- $this->setData(['config','translate','pt', false ]);
+ $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', false ]);
+ $this->setData(['config', 'i18n','de', false ]);
+ $this->setData(['config', 'i18n','en', false ]);
+ $this->setData(['config', 'i18n','es', false ]);
+ $this->setData(['config', 'i18n','it', false ]);
+ $this->setData(['config', 'i18n','nl', false ]);
+ $this->setData(['config', 'i18n','pt', false ]);
$this->setData(['core', 'dataVersion', 11000]);
}
@@ -2299,11 +2299,11 @@ class core extends common {
// Le script de traduction est sélectionné
if ($this->getData(['config', 'i18n', 'enabled']) === true) {
- if ( $this->getData(['config','translate','scriptGoogle']) === 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','translate','autoDetect']) === true
+ OR $this->getData(['config', 'i18n','autoDetect']) === true
)
// Cas des pages d'administration
// Pas connecté
@@ -2311,7 +2311,7 @@ class core extends common {
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
+ AND $this->getData(['config', 'i18n','admin']) === true
)
) {
@@ -2467,12 +2467,12 @@ class layout extends common {
* La fonction est activée.
*/
if ( $this->getData(['config', 'i18n', 'enabled']) === true
- AND $this->getData(['config','translate','scriptGoogle']) === true
- AND $this->getData(['config','translate','showCredits']) === 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','translate', $this->getInput('ZWII_I18N_SCRIPT')]) === 'script'
+ AND $this->getData(['config', 'i18n', $this->getInput('ZWII_I18N_SCRIPT')]) === 'script'
)
)
{
@@ -3182,10 +3182,10 @@ class layout extends common {
public function showi18n($id) {
echo '
';
foreach (self::$i18nList as $key => $value) {
- if ($this->getData(['config','translate',$key]) === 'site'
+ if ($this->getData(['config', 'i18n',$key]) === 'site'
OR (
- $this->getData(['config','translate','scriptGoogle']) === true
- AND $this->getData(['config','translate',$key]) === 'script'
+ $this->getData(['config', 'i18n','scriptGoogle']) === true
+ AND $this->getData(['config', 'i18n',$key]) === 'script'
)
) {
if (
@@ -3202,7 +3202,7 @@ class layout extends common {
}
echo '- ';
- echo '';
+ echo '';
echo '
';
}
}
diff --git a/core/module/config/view/index/index.php b/core/module/config/view/index/index.php
index 4e6bf701..ed0e2053 100755
--- a/core/module/config/view/index/index.php
+++ b/core/module/config/view/index/index.php
@@ -51,6 +51,21 @@
+
+
+
+
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.'
+ ]); ?>
+
+
+
+
+
@@ -120,22 +135,7 @@
]); ?>
-
-
-
-
-
-
-
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.'
- ]); ?>
-
-
-
+
Lorsque les langues étrangères sont activées, il convient d'adapter les pages spéciales.
diff --git a/core/module/install/ressource/defaultdata.php b/core/module/install/ressource/defaultdata.php
index f39e2fa9..6dbb6234 100755
--- a/core/module/install/ressource/defaultdata.php
+++ b/core/module/install/ressource/defaultdata.php
@@ -98,19 +98,6 @@ class init extends common {
],
'module' => [],
'user' => [],
- 'translate' => [
- 'scriptGoogle' => false,
- 'showCredits' => false,
- 'autoDetect' => false,
- 'admin' => false,
- 'fr' => 'none',
- 'de' => 'none',
- 'en' => 'none',
- 'es' => 'none',
- 'it' => 'none',
- 'nl' => 'none',
- 'pt' => 'none'
- ],
'theme' => [
'body' => [
'backgroundColor' => 'rgba(236, 239, 241, 1)',
diff --git a/core/module/translate/translate.php b/core/module/translate/translate.php
index 0eebb27d..2df155a4 100755
--- a/core/module/translate/translate.php
+++ b/core/module/translate/translate.php
@@ -52,7 +52,7 @@ class translate extends common {
$success = (copy (self::DATA_DIR . $copyFrom . '/page.json', self::DATA_DIR . $toCreate . '/page.json') === true && $success === true) ? true : false;
// Enregistrer la langue
if ($success) {
- $this->setData(['config', 'translate', $toCreate, 'site' ]);
+ $this->setData(['config', 'i18n', $toCreate, 'site' ]);
$notification = 'Données ' . self::$i18nList[$copyFrom] . ' copiées vers ' . self::$i18nList[$toCreate];
} else {
$notification = "Quelque chose n\'a pas fonctionné, vérifiez les permissions.";
@@ -67,7 +67,7 @@ class translate extends common {
}
// Tableau des langues installées
foreach (self::$i18nList as $key => $value) {
- if ($this->getData(['config','translate',$key]) === 'site') {
+ if ($this->getData(['config','i18n', $key]) === 'site') {
self::$languagesTarget[$key] = $value;
}
}
@@ -132,7 +132,8 @@ class translate extends common {
}
}
// Enregistrement des données
- $this->setData(['config','translate', [
+ $this->setData(['config','i18n', [
+ 'enabled' => $this->getData(['config', 'i18n', 'enabled']),
'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,
@@ -155,7 +156,7 @@ class translate extends common {
}
// Modification de option de suppression de la langue installée.
foreach (self::$i18nList as $key => $value) {
- if ($this->getData(['config','translate',$key]) === 'site') {
+ if ($this->getData(['config','i18n',$key]) === 'site') {
self::$translateOptions [$key] = [
'none' => 'Drapeau masqué',
'script' => 'Traduction automatique',
diff --git a/core/module/translate/view/index/index.php b/core/module/translate/view/index/index.php
index 7bf5faed..eadc2f0a 100755
--- a/core/module/translate/view/index/index.php
+++ b/core/module/translate/view/index/index.php
@@ -8,10 +8,10 @@
'value' => 'Retour'
]); ?>
-
+
helper::baseUrl() . 'translate/advanced',
- 'value' => 'Avancée',
+ 'value' => 'Gestion avancée',
'ico' => 'cog-alt',
]); ?>
@@ -30,13 +30,13 @@
$this->getData(['config','translate', 'scriptGoogle']),
+ 'checked' => $this->getData(['config','i18n', 'scriptGoogle']),
'help' => 'Le script Google Translate assure la traduction automatique du site.'
]); ?>
$this->getData(['config','translate', 'autoDetect']),
+ 'checked' => $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.'
]); ?>
@@ -45,14 +45,14 @@
$this->getData(['config','translate', 'showCredits']),
+ 'checked' => $this->getData(['config','i18n', 'showCredits']),
'class' => 'translateGoogleScriptOption',
'help' => 'Option recommandée pour le respect du droit d\'auteur'
]); ?>
$this->getData(['config','translate', 'admin']),
+ 'checked' => $this->getData(['config','i18n', 'admin']),
'class' => 'translateGoogleScriptOption',
'help' => 'Traduit le site et l\'interface de ZwiiCMS quand un utilisateur est connecté'
]); ?>
diff --git a/module/search/search.php b/module/search/search.php
index 8571d43d..76671419 100755
--- a/module/search/search.php
+++ b/module/search/search.php
@@ -19,7 +19,7 @@
class search extends common {
- const VERSION = '2.0';
+ const VERSION = '2.1';
const REALNAME = 'Recherche';
const DELETE = true;
const UPDATE = '0.0';
@@ -196,41 +196,42 @@ class search extends common {
// Traduction du mot clé si le script Google Trad est actif
// Le multi langue est sélectionné
- if ( $this->getData(['config','translate','scriptGoogle']) === true
- AND
- // et la traduction de la langue courante est automatique
- ( isset($_COOKIE['googtrans'])
- AND ( $this->getData(['config','translate', substr($_COOKIE['googtrans'],4,2)]) === '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')
- // 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','i18n','scriptGoogle']) === true
+ AND
+ // et la traduction de la langue courante est automatique
+ ( isset($_COOKIE['googtrans'])
+ AND ( $this->getData(['config','i18n', substr($_COOKIE['googtrans'],4,2)]) === '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')
+ // Ou connecté avec option active
+ OR ($this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD')
+ AND $this->getData(['config','i18n','admin']) === true
+ )
+ )
+ AND !isset($_COOKIE['ZWII_I18N_SITE'])
)
- AND !isset($_COOKIE['ZWII_I18N_SITE'])
- )
- {
- // Découper la chaîne
- $f = str_getcsv($motclef, ' ');
- // Supprimer les espaces et les guillemets
- $f = str_replace(' ','',$f);
- $f = str_replace('"','',$f);
- // Lire le cookie GoogTrans et déterminer les langues cibles
- $language['origin'] = substr($_COOKIE['googtrans'],4,2);
- $language['target'] = substr($_COOKIE['googtrans'],1,2);
- if ($language['target'] !== $language['origin']) {
- foreach ($f as $key => $value) {
- $e = $this->translate($language['origin'],$language['target'],$value);
- $motclef = str_replace($value,$e,$motclef);
+ {
+ // Découper la chaîne
+ $f = str_getcsv($motclef, ' ');
+ // Supprimer les espaces et les guillemets
+ $f = str_replace(' ','',$f);
+ $f = str_replace('"','',$f);
+ // Lire le cookie GoogTrans et déterminer les langues cibles
+ $language['origin'] = substr($_COOKIE['googtrans'],4,2);
+ $language['target'] = substr($_COOKIE['googtrans'],1,2);
+ if ($language['target'] !== $language['origin']) {
+ foreach ($f as $key => $value) {
+ $e = $this->translate($language['origin'],$language['target'],$value);
+ $motclef = str_replace($value,$e,$motclef);
+ }
}
}
}
-
// Suppression des mots < 3 caractères et des articles > 2 caractères de la chaîne $motclef
$arraymotclef = explode(' ', $motclef);
$motclef = '';