Merge branch '10400' into drapeaux

This commit is contained in:
Fred Tempez 2020-11-24 09:19:26 +01:00
commit bb59346027
5 changed files with 28 additions and 23 deletions

View File

@ -174,7 +174,6 @@ class common {
'theme' => '',
'admin' => '',
'blacklist' => '',
'translate' => '',
'locale' => ''
];
@ -229,7 +228,7 @@ class common {
}
// Auto traduction
if ( $this->getData(['translate','activated'])) {
if ( $this->getData(['config','translate','activated'])) {
// Lire la langue du navigateur
$lan = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
@ -1559,9 +1558,9 @@ class common {
$this->setData(['locale','searchPageId',$this->getData(['config','searchPageId'])]);
$this->setData(['locale','metaDescription',$this->getData(['config','metaDescription'])]);
$this->setData(['locale','title',$this->getData(['config','title'])]);
$this->setData(['translate','activated',false]);
$this->setData(['translate','showCredits',false]);
$this->setData(['translate','autoDetect',false]);
$this->setData(['config','translate','activated',false]);
$this->setData(['config','translate','showCredits',false]);
$this->setData(['config','translate','autoDetect',false]);
$this->setData(['core', 'dataVersion', 10400]);
}
}
@ -2149,7 +2148,7 @@ class core extends common {
// Librairie googtrans ajouté dynamiquement
if ( substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2) !== 'fr'
AND $this->getData(['translate','active']) === true
AND $this->getData(['config','translate','active']) === true
AND $this->getUser('password') !== $this->getInput('ZWII_USER_PASSWORD')) {
$this->addOutput([
'vendor' => array_merge($this->output['vendor'], ['i18n'])
@ -2290,8 +2289,8 @@ class layout extends common {
echo $this->core->output['content'];
if ( substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2) !== 'fr'
AND $this->getData(['translate','showCredits']) === true
AND $this->getData(['translate','active']) === true )
AND $this->getData(['config','translate','showCredits']) === true
AND $this->getData(['config','translate','active']) === true )
{
echo '<div id="googTransLogo"><a href="//policies.google.com/terms#toc-content" data-lity><img src="core/module/translate/ressource/googtrans.png" /></a></div>';
}
@ -2978,7 +2977,7 @@ class layout extends common {
* Affiche le cadre avec les drapeaux
*/
public function showi18n() {
if ( $this->getData(['translate','active']) === true
if ( $this->getData(['config','translate','active']) === true
AND $this->getUser('password') !== $this->getInput('ZWII_USER_PASSWORD')) {
echo '<div id="i18nContainer"><ul>';
foreach (self::$i18nList as $key => $value) {

View File

@ -41,7 +41,11 @@ class init extends common {
'attempt' => 3,
'log' => false,
'captcha' => true
]
],
'translate' => [
'active' => false,
'showCredits' => false
],
],
'core' => [
'dataVersion' => 10306,
@ -80,11 +84,6 @@ class init extends common {
'hideMenuChildren' =>false
]
],
'translate' => [
'activated' => false,
'showCredits' => false,
'autoDetect' => false
],
'module' => [],
'user' => [],
'theme' => [
@ -652,7 +651,13 @@ class init extends common {
'blog' => [
'config' => [
'feeds' => true,
'feedsLabel' => "Syndication RSS"
'feedsLabel' => "Syndication RSS",
"editConsent" => "all",
"commentMaxlength" => "500",
"commentApproved" => false,
"commentClose" => false,
"commentNotification" => false,
"commentGroupNotification" => 1
],
'posts' => [
'mon-premier-article' => [
@ -662,7 +667,8 @@ class init extends common {
'author' => 'Rémi',
'content' => 'Article bien rédigé et très pertinent, bravo !',
'createdOn' => 1421748000,
'userId' => ''
'userId' => '',
'approval' => true
]
],
'content' => '<p>Et eodem impetu Domitianum praecipitem per scalas itidem funibus constrinxerunt, eosque coniunctos per ampla spatia civitatis acri raptavere discursu. iamque artuum et membrorum divulsa conpage superscandentes corpora mortuorum ad ultimam truncata deformitatem velut exsaturati mox abiecerunt in flumen.</p><p>Ex his quidam aeternitati se commendari posse per statuas aestimantes eas ardenter adfectant quasi plus praemii de figmentis aereis sensu carentibus adepturi, quam ex conscientia honeste recteque factorum, easque auro curant inbracteari, quod Acilio Glabrioni delatum est primo, cum consiliis armisque regem superasset Antiochum. quam autem sit pulchrum exigua haec spernentem et minima ad ascensus verae gloriae tendere longos et arduos, ut memorat vates Ascraeus, Censorius Cato monstravit. qui interrogatus quam ob rem inter multos... statuam non haberet malo inquit ambigere bonos quam ob rem id non meruerim, quam quod est gravius cur inpetraverim mussitare.</p><p>Latius iam disseminata licentia onerosus bonis omnibus Caesar nullum post haec adhibens modum orientis latera cuncta vexabat nec honoratis parcens nec urbium primatibus nec plebeiis.</p>',

View File

@ -26,7 +26,7 @@ class translate extends common {
public function index() {
// Soumission du formulaire
if($this->isPost()) {
$this->setData(['translate', [
$this->setData(['config','translate', [
'activated' => $this->getInput('translateActivated', helper::FILTER_BOOLEAN),
'showCredits' => $this->getInput('translateCredits', helper::FILTER_BOOLEAN) ? $this->getInput('translateCredits', helper::FILTER_BOOLEAN) : false,
'autoDetect' => $this->getInput('translateAutoDetect', helper::FILTER_BOOLEAN)

View File

@ -19,7 +19,7 @@
<div class="row">
<div class="col6">
<?php echo template::checkbox('translateActivated', true, 'Activer le mode multi-langues', [
'checked' => $this->getData(['translate', 'activated'])
'checked' => $this->getData(['config','translate', 'activated'])
]); ?>
</div>
</div>
@ -33,13 +33,13 @@
<div class="row">
<div class="col6">
<?php echo template::checkbox('translateAutoDetect', true, 'Détection automatique de langue', [
'checked' => $this->getData(['translate', 'autoDetect']),
'checked' => $this->getData(['config','translate', 'autoDetect']),
'help' => 'Détecte la langue du navigateur et effectue une traduction grâce à Google Translate.'
]); ?>
</div>
<div class="col6">
<?php echo template::checkbox('translateCredits', true, 'Afficher les crédits du script Google', [
'checked' => $this->getData(['translate', 'showCredits']),
'checked' => $this->getData(['config','translate', 'showCredits']),
'help' => 'Option vivement recommandée pour le respect du droit d\'auteur'
]); ?>
</div>

View File

@ -263,12 +263,12 @@ class user extends common {
$redirect = helper::baseUrl() . 'user/login/' . str_replace('/', '_', $this->getUrl());
}
// Redirection si retour en arrière possible
elseif($this->getUrl(3)) {
elseif($this->getUser('group') === 3) {
$redirect = helper::baseUrl() . 'user';
}
// Redirection normale
else {
$redirect = helper::baseUrl() . $this->getUrl();
$redirect = helper::baseUrl();
}
// Valeurs en sortie
$this->addOutput([