From 53a2b8c270422cecf1b2e0836412afef17483a0f Mon Sep 17 00:00:00 2001 From: fredtempez Date: Thu, 3 Dec 2020 14:06:12 +0100 Subject: [PATCH 1/7] modifs jean 1 --- core/module/user/user.php | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/core/module/user/user.php b/core/module/user/user.php index 1bcf15b1..7aca3638 100755 --- a/core/module/user/user.php +++ b/core/module/user/user.php @@ -598,21 +598,36 @@ class user extends common { // Traitement des données foreach($csv as $item ) { // Données valides - if( array_key_exists('id', $item) - AND array_key_exists('prenom',$item) + //if( array_key_exists('id', $item) + if( array_key_exists('prenom',$item) AND array_key_exists('nom',$item) - AND array_key_exists('groupe',$item) + //AND array_key_exists('groupe',$item) AND array_key_exists('email',$item) AND $item['nom'] AND $item['prenom'] - AND $item['id'] + //AND $item['id'] AND $item['email'] - AND $item['groupe'] + //AND $item['groupe'] ) { - // Validation du groupe - $item['groupe'] = (int) $item['groupe']; - $item['groupe'] = ( $item['groupe'] >= self::GROUP_BANNED AND $item['groupe'] <= self::GROUP_ADMIN ) - ? $item['groupe'] : 1; + if ( !array_key_exists('id', $item)) { + // Génération de l'identifiant à partir des deux premières lettres du prénom et du nom + $item['id'] = substr($item['prenom'],0,2) . substr($item['nom'],0,2); + } + + // Validation du groupe ou groupe inexistant valant 1 (membre) + if (!array_key_exists('groupe',$item)) { + $item['groupe'] = (int) $item['groupe']; + $item['groupe'] = ( $item['groupe'] >= self::GROUP_BANNED AND $item['groupe'] <= self::GROUP_ADMIN ) + ? $item['groupe'] : 1; + } else { + // Définition du groupe (membre) + $item['groupe'] = 1; + } + // Suppression d'espaces éventuels au début ou à la fin + $item['email'] = str_replace(' ', '', $item['email']); + $item['id'] = str_replace(' ', '', $item['id']); + $item['groupe'] = str_replace(' ', '', $item['groupe']); + // L'utilisateur existe if ( $this->getData(['user',helper::filter($item['id'] , helper::FILTER_ID)])) { @@ -625,7 +640,7 @@ class user extends common { $item['prenom'], self::$groups[$item['groupe']], $item['prenom'], - $item['email'], + helper::filter($item['email'] , helper::FILTER_MAIL), $item['notification'] ]; // L'utilisateur n'existe pas From 1d404290c30f4b42acaf26a49a3ae920eaa4192d Mon Sep 17 00:00:00 2001 From: fredtempez Date: Thu, 3 Dec 2020 14:10:57 +0100 Subject: [PATCH 2/7] modifs Jean 2 --- core/module/user/view/import/import.php | 7 ++++--- core/module/user/view/index/index.php | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/core/module/user/view/import/import.php b/core/module/user/view/import/import.php index 051aabba..03ca4cad 100755 --- a/core/module/user/view/import/import.php +++ b/core/module/user/view/import/import.php @@ -52,11 +52,12 @@ - -
- Compte créé | Compte créé et notifié | ou manquant : erreur, compte non importé + + +
+ Compte créé | Compte créé et notifié | Erreur dans le fichier, compte non créé.
\ No newline at end of file diff --git a/core/module/user/view/index/index.php b/core/module/user/view/index/index.php index 483ad22c..b1d48d87 100755 --- a/core/module/user/view/index/index.php +++ b/core/module/user/view/index/index.php @@ -7,7 +7,7 @@ 'value' => 'Accueil' ]); ?> -
+
helper::baseUrl() . 'user/import', 'ico' => 'plus', From 1a201d127a65ce34a8587c3c23747f5fe529cc60 Mon Sep 17 00:00:00 2001 From: fredtempez Date: Thu, 3 Dec 2020 14:28:14 +0100 Subject: [PATCH 3/7] espace + inversion de logique --- core/module/user/user.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/core/module/user/user.php b/core/module/user/user.php index 7aca3638..838d7f1a 100755 --- a/core/module/user/user.php +++ b/core/module/user/user.php @@ -611,17 +611,18 @@ class user extends common { ) { if ( !array_key_exists('id', $item)) { // Génération de l'identifiant à partir des deux premières lettres du prénom et du nom - $item['id'] = substr($item['prenom'],0,2) . substr($item['nom'],0,2); + $item['id'] = substr($item['prenom'],0,3) . substr($item['nom'],0,3); } // Validation du groupe ou groupe inexistant valant 1 (membre) - if (!array_key_exists('groupe',$item)) { + if ( !array_key_exists('groupe',$item)) { + // Définition du groupe (membre) + $item['groupe'] = 1; + } else { + $item['groupe'] = (int) $item['groupe']; $item['groupe'] = ( $item['groupe'] >= self::GROUP_BANNED AND $item['groupe'] <= self::GROUP_ADMIN ) ? $item['groupe'] : 1; - } else { - // Définition du groupe (membre) - $item['groupe'] = 1; } // Suppression d'espaces éventuels au début ou à la fin $item['email'] = str_replace(' ', '', $item['email']); From 0cd84b7f2e26c4aabcbbabef4d7d94c24f918939 Mon Sep 17 00:00:00 2001 From: fredtempez Date: Fri, 4 Dec 2020 12:56:20 +0100 Subject: [PATCH 4/7] 012 UI des options de langue --- core/core.php | 2 +- core/module/translate/translate.php | 2 +- core/module/translate/view/index/index.js.php | 69 +++++++++++++++++++ core/module/translate/view/index/index.php | 15 +++- 4 files changed, 83 insertions(+), 5 deletions(-) create mode 100644 core/module/translate/view/index/index.js.php diff --git a/core/core.php b/core/core.php index c53fb609..158806da 100755 --- a/core/core.php +++ b/core/core.php @@ -44,7 +44,7 @@ class common { const ACCESS_TIMER = 1800; // Numéro de version - const ZWII_VERSION = '10.4.00.011'; + const ZWII_VERSION = '10.4.00.012'; const ZWII_UPDATE_CHANNEL = "v10"; public static $actions = []; diff --git a/core/module/translate/translate.php b/core/module/translate/translate.php index 576ac36a..ce6f53c7 100755 --- a/core/module/translate/translate.php +++ b/core/module/translate/translate.php @@ -21,7 +21,7 @@ class translate extends common { ]; public static $typeTranslate = [ - 'none' => 'Masqué', + 'none' => 'Drapeau masqué', 'script' => 'Traduction automatique', 'site' => 'Traduction rédigée' ]; diff --git a/core/module/translate/view/index/index.js.php b/core/module/translate/view/index/index.js.php new file mode 100644 index 00000000..31e8d92c --- /dev/null +++ b/core/module/translate/view/index/index.js.php @@ -0,0 +1,69 @@ + +/** + * This file is part of Zwii. + * + * For full copyright and license information, please see the LICENSE + * file that was distributed with this source code. + * + * @author Rémi Jean + * @copyright Copyright (C) 2008-2018, Rémi Jean + * @authorFrédéric Tempez + * @copyright Copyright (C) 2018-2020, Frédéric Tempez + * @license GNU General Public License, version 3 + * @link http://zwiicms.fr/ + */ + +$(document).ready(function(){ + + /* + * Active le script Google quand une langue est traduite automatiquement + */ + $("form :input").change(function() { + $(this).closest('form').data('changed', true); + if($(this).closest('form').data('changed')) { + if( $(this).val() === "script" + || $(this).val() === "script" + || $(this).val() === "script" + || $(this).val() === "script" + || $(this).val() === "script" + || $(this).val() === "script" ) { + $("#translateScriptGoogle").prop("checked", true); + } + } + }); + + /** + * Désactive la traduction auto des langues lorsque le script est désélectionné + */ + $("#translateScriptGoogle").on("change", function() { + if ( $("input[name=translateScriptGoogle]").is(':not(:checked)') ) { + if ($("#translateDE :selected").val() === "script" ) { + $("#translateDE").val("none"); + } + if ($("#translateEN :selected").val() === "script" ) { + $("#translateEN").val("none"); + } + if ($("#translateES :selected").val() === "script" ) { + $("#translateEs").val("none"); + } + if ($("#translateIT :selected").val() === "script" ) { + $("#translateIT").val("none"); + } + if ($("#translateNL :selected").val() === "script" ) { + $("#translateNL").val("none"); + } + if ($("#translatePT :selected").val() === "script" ) { + $("#translatePT").val("none"); + } + $(".translateGoogleScriptOption").prop("checked", false); + } + }); + + /** + * Active le script quand une option est activée + */ + $(".translateGoogleScriptOption").on("change", function() { + $("#translateScriptGoogle").prop("checked", true); + }); + +}); \ No newline at end of file diff --git a/core/module/translate/view/index/index.php b/core/module/translate/view/index/index.php index 832bdbc9..2d166e99 100755 --- a/core/module/translate/view/index/index.php +++ b/core/module/translate/view/index/index.php @@ -14,11 +14,11 @@
-
-

Activation

+
+

Affichage des drapeaux et sélection du mode de traduction

- 'Masqué','site'=>'Affiché'], [ + 'Drapeau masqué','site'=>'Affiché'], [ 'label' => 'Français', 'selected' => $this->getData(['config', 'translate' , 'fr']) ]); ?> @@ -29,18 +29,21 @@
'Allemand', + 'class' => 'translateFlagSelect', 'selected' => $this->getData(['config', 'translate' , 'de']) ]); ?>
'Anglais', + 'class' => 'translateFlagSelect', 'selected' => $this->getData(['config', 'translate' , 'en']) ]); ?>
'Espagnol', + 'class' => 'translateFlagSelect', 'selected' => $this->getData(['config', 'translate' , 'es']) ]); ?>
@@ -49,18 +52,21 @@
'Italien', + 'class' => 'translateFlagSelect', 'selected' => $this->getData(['config', 'translate' , 'it']) ]); ?>
'Néerlandais', + 'class' => 'translateFlagSelect', 'selected' => $this->getData(['config', 'translate' , 'nl']) ]); ?>
'Portugais', + 'class' => 'translateFlagSelect', 'selected' => $this->getData(['config', 'translate' , 'pt']) ]); ?>
@@ -83,6 +89,7 @@
$this->getData(['config','translate', 'showCredits']), + 'class' => 'translateGoogleScriptOption', 'help' => 'Option recommandée pour le respect du droit d\'auteur' ]); ?>
@@ -91,12 +98,14 @@
$this->getData(['config','translate', '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','translate', 'admin']), + 'class' => 'translateGoogleScriptOption', 'help' => 'Traduit le site et l\'interface de ZwiiCMS quand un utilisateur est connecté' ]); ?>
From d641d9d673a973587eca4eeec2c54ca0643b8bf8 Mon Sep 17 00:00:00 2001 From: fredtempez Date: Fri, 4 Dec 2020 20:51:46 +0100 Subject: [PATCH 5/7] Erreur de mise en forme --- core/module/user/view/import/import.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/core/module/user/view/import/import.php b/core/module/user/view/import/import.php index 03ca4cad..49239caa 100755 --- a/core/module/user/view/import/import.php +++ b/core/module/user/view/import/import.php @@ -52,11 +52,10 @@
+
- - -
+ Compte créé | Compte créé et notifié | Erreur dans le fichier, compte non créé.
From c0643c03a0c76df46379c9240fe7cd32bb240545 Mon Sep 17 00:00:00 2001 From: fredtempez Date: Fri, 4 Dec 2020 20:53:10 +0100 Subject: [PATCH 6/7] bouton importation --- core/module/user/view/index/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/module/user/view/index/index.php b/core/module/user/view/index/index.php index b1d48d87..483ad22c 100755 --- a/core/module/user/view/index/index.php +++ b/core/module/user/view/index/index.php @@ -7,7 +7,7 @@ 'value' => 'Accueil' ]); ?>
-
+
helper::baseUrl() . 'user/import', 'ico' => 'plus', From 59354b45561010d5c6a3aa4e4d2403e8612b7b75 Mon Sep 17 00:00:00 2001 From: fredtempez Date: Fri, 4 Dec 2020 20:57:02 +0100 Subject: [PATCH 7/7] user original --- core/module/user/user.php | 34 +++++++++------------------------- 1 file changed, 9 insertions(+), 25 deletions(-) diff --git a/core/module/user/user.php b/core/module/user/user.php index 838d7f1a..4288af48 100755 --- a/core/module/user/user.php +++ b/core/module/user/user.php @@ -598,37 +598,21 @@ class user extends common { // Traitement des données foreach($csv as $item ) { // Données valides - //if( array_key_exists('id', $item) - if( array_key_exists('prenom',$item) + if( array_key_exists('id', $item) + AND array_key_exists('prenom',$item) AND array_key_exists('nom',$item) - //AND array_key_exists('groupe',$item) + AND array_key_exists('groupe',$item) AND array_key_exists('email',$item) AND $item['nom'] AND $item['prenom'] - //AND $item['id'] + AND $item['id'] AND $item['email'] - //AND $item['groupe'] + AND $item['groupe'] ) { - if ( !array_key_exists('id', $item)) { - // Génération de l'identifiant à partir des deux premières lettres du prénom et du nom - $item['id'] = substr($item['prenom'],0,3) . substr($item['nom'],0,3); - } - - // Validation du groupe ou groupe inexistant valant 1 (membre) - if ( !array_key_exists('groupe',$item)) { - // Définition du groupe (membre) - $item['groupe'] = 1; - } else { - - $item['groupe'] = (int) $item['groupe']; - $item['groupe'] = ( $item['groupe'] >= self::GROUP_BANNED AND $item['groupe'] <= self::GROUP_ADMIN ) - ? $item['groupe'] : 1; - } - // Suppression d'espaces éventuels au début ou à la fin - $item['email'] = str_replace(' ', '', $item['email']); - $item['id'] = str_replace(' ', '', $item['id']); - $item['groupe'] = str_replace(' ', '', $item['groupe']); - + // Validation du groupe + $item['groupe'] = (int) $item['groupe']; + $item['groupe'] = ( $item['groupe'] >= self::GROUP_BANNED AND $item['groupe'] <= self::GROUP_ADMIN ) + ? $item['groupe'] : 1; // L'utilisateur existe if ( $this->getData(['user',helper::filter($item['id'] , helper::FILTER_ID)])) {