Index: /extensions/NBC_UserAdvManager/trunk/admin/UserAdvManager_admin.php
===================================================================
--- /extensions/NBC_UserAdvManager/trunk/admin/UserAdvManager_admin.php (revision 4123)
+++ /extensions/NBC_UserAdvManager/trunk/admin/UserAdvManager_admin.php (revision 4124)
@@ -56,10 +56,10 @@
case 'global':
- if (isset($_POST['submit']) and !is_adviser() and isset($_POST['UserAdvManager_Mail_Info']) and isset($_POST['UserAdvManager_No_Casse']) and isset($_POST['UserAdvManager_Username_Char']) and isset($_POST['UserAdvManager_Confirm_Mail']) and isset($_POST['UserAdvManager_No_Comment_Anonymous']) and isset($_POST['UserAdvManager_Password_Enforced']))
+ if (isset($_POST['submit']) and !is_adviser() and isset($_POST['UserAdvManager_Mail_Info']) and isset($_POST['UserAdvManager_No_Casse']) and isset($_POST['UserAdvManager_Username_Char']) and isset($_POST['UserAdvManager_Confirm_Mail']) and isset($_POST['UserAdvManager_No_Comment_Anonymous']) and isset($_POST['UserAdvManager_Password_Enforced']) and isset($_POST['UserAdvManager_AdminPassword_Enforced']))
{
$_POST['UserAdvManager_MailInfo_Text'] = str_replace("\'", "'", str_replace("\\\\", "\\", $_POST['UserAdvManager_MailInfo_Text']));
$_POST['UserAdvManager_ConfirmMail_Text'] = str_replace("\'", "'", str_replace("\\\\", "\\", $_POST['UserAdvManager_ConfirmMail_Text']));
- $newconf_nbc_UserAdvManager = $_POST['UserAdvManager_Mail_Info'].';'.$_POST['UserAdvManager_No_Casse'].';'.$_POST['UserAdvManager_Confirm_Mail'].';'.(isset($_POST['UserAdvManager_No_Confirm_Group'])?$_POST['UserAdvManager_No_Confirm_Group']:'').';'.(isset($_POST['UserAdvManager_Validated_Group'])?$_POST['UserAdvManager_Validated_Group']:'').';'.(isset($_POST['UserAdvManager_Validated_Status'])?$_POST['UserAdvManager_Validated_Status']:'').';'.$_POST['UserAdvManager_No_Comment_Anonymous'].';'.$_POST['UserAdvManager_Username_Char'].';'.$_POST['UserAdvManager_Username_List'].';'.(isset($_POST['UserAdvManager_No_Confirm_Status'])?$_POST['UserAdvManager_No_Confirm_Status']:'').';'.$_POST['UserAdvManager_MailInfo_Text'].';'.$_POST['UserAdvManager_ConfirmMail_Text'].';'.$_POST['UserAdvManager_MailExclusion'].';'.$_POST['UserAdvManager_MailExclusion_List'].';'.$_POST['UserAdvManager_Password_Enforced'].';'.$_POST['UserAdvManager_Password_Score'];
+ $newconf_nbc_UserAdvManager = $_POST['UserAdvManager_Mail_Info'].';'.$_POST['UserAdvManager_No_Casse'].';'.$_POST['UserAdvManager_Confirm_Mail'].';'.(isset($_POST['UserAdvManager_No_Confirm_Group'])?$_POST['UserAdvManager_No_Confirm_Group']:'').';'.(isset($_POST['UserAdvManager_Validated_Group'])?$_POST['UserAdvManager_Validated_Group']:'').';'.(isset($_POST['UserAdvManager_Validated_Status'])?$_POST['UserAdvManager_Validated_Status']:'').';'.$_POST['UserAdvManager_No_Comment_Anonymous'].';'.$_POST['UserAdvManager_Username_Char'].';'.$_POST['UserAdvManager_Username_List'].';'.(isset($_POST['UserAdvManager_No_Confirm_Status'])?$_POST['UserAdvManager_No_Confirm_Status']:'').';'.$_POST['UserAdvManager_MailInfo_Text'].';'.$_POST['UserAdvManager_ConfirmMail_Text'].';'.$_POST['UserAdvManager_MailExclusion'].';'.$_POST['UserAdvManager_MailExclusion_List'].';'.$_POST['UserAdvManager_Password_Enforced'].';'.$_POST['UserAdvManager_Password_Score'].';'.$_POST['UserAdvManager_AdminPassword_Enforced'];
$conf['nbc_UserAdvManager'] = $newconf_nbc_UserAdvManager;
@@ -202,4 +202,6 @@
'UserAdvManager_PASSWORDENF_FALSE' => $conf_nbc_UserAdvManager[14]=='false' ? 'checked="checked"' : '' ,
'UserAdvManager_PASSWORD_SCORE' => $conf_nbc_UserAdvManager[15],
+ 'UserAdvManager_ADMINPASSWENF_TRUE' => $conf_nbc_UserAdvManager[16]=='true' ? 'checked="checked"' : '' ,
+ 'UserAdvManager_ADMINPASSWENF_FALSE' => $conf_nbc_UserAdvManager[16]=='false' ? 'checked="checked"' : '' ,
'UserAdvManager_PASSWORD_TEST_SCORE' => $UserAdvManager_Password_Test_Score,
)
@@ -207,5 +209,5 @@
- if ( isset($_POST['audit']) or isset($_POST['submit']) )
+ if (isset($_POST['audit']))
{
$msg_error1 = '';
@@ -298,5 +300,5 @@
// | errors display |
// +-----------------------------------------------------------------------+
- if ( isset ($errors) and count($errors) != 0)
+ if (isset ($errors) and count($errors) != 0)
{
$template->assign('errors',array());
Index: /extensions/NBC_UserAdvManager/trunk/admin/global.tpl
===================================================================
--- /extensions/NBC_UserAdvManager/trunk/admin/global.tpl (revision 4123)
+++ /extensions/NBC_UserAdvManager/trunk/admin/global.tpl (revision 4124)
@@ -5,87 +5,98 @@
Index: /extensions/NBC_UserAdvManager/trunk/include/functions_UserAdvManager.inc.php
===================================================================
--- /extensions/NBC_UserAdvManager/trunk/include/functions_UserAdvManager.inc.php (revision 4123)
+++ /extensions/NBC_UserAdvManager/trunk/include/functions_UserAdvManager.inc.php (revision 4124)
@@ -575,25 +575,24 @@
-/* Obsolete function - Check for no forbidden email provider */
-/* This don't work on function call */
-//function ValidateEmailProvider($email)
-//{
-// global $conf;
-//
-// $conf_nbc_UserAdvManager = isset($conf['nbc_UserAdvManager']) ? explode(";" , $conf['nbc_UserAdvManager']) : array();
-// if (isset($conf_nbc_UserAdvManager[12]))
-// {
-// $ncsemail = strtolower($email);
-// $conf_nbc_MailExclusion = preg_split('/,/',$conf_nbc_UserAdvManager[13]);
-// for ($i = 0 ; $i < count($conf_nbc_MailExclusion) ; $i++)
-// {
-// $pattern = '/'.$conf_nbc_MailExclusion[$i].'/';
-// if (preg_match($pattern, $ncsemail))
-// return false;
-// else
-// return true;
-// }
-// }
-//}
+/* Function called from main.inc.php - Check if user's email is in excluded email providers list */
+function ValidateEmailProvider($email)
+{
+ global $conf;
+
+ $conf_nbc_UserAdvManager = isset($conf['nbc_UserAdvManager']) ? explode(";" , $conf['nbc_UserAdvManager']) : array();
+ if (isset($conf_nbc_UserAdvManager[12]))
+ {
+ $ncsemail = strtolower($email);
+ $conf_nbc_MailExclusion = preg_split('/,/',$conf_nbc_UserAdvManager[13]);
+ for ($i = 0 ; $i < count($conf_nbc_MailExclusion) ; $i++)
+ {
+ $pattern = '/'.$conf_nbc_MailExclusion[$i].'/';
+ if (preg_match($pattern, $ncsemail))
+ return false;
+ else
+ return true;
+ }
+ }
+}
@@ -743,66 +742,71 @@
* Thanx to MathieuGut from http://m-gut.developpez.com
*/
-function testpassword($password) { // Le mot de passe passé en paramètre - $password given by user
-
-// Initialisation des variables - Variables initiation
-$points = 0;
-$point_lowercase = 0;
-$point_uppercase = 0;
-$point_numbers = 0;
-$point_characters = 0;
-
-// On récupère la longueur du mot de passe - Getting password lengh
-$length = strlen($password);
-
-// On fait une boucle pour lire chaque lettre - Loop to read password characters
-for($i = 0; $i < $length; $i++) {
-
- // On sélectionne une à une chaque lettre - Select each letters
- // $i étant à 0 lors du premier passage de la boucle - $i is 0 at first turn
- $letters = $password[$i];
-
- if ($letters>='a' && $letters<='z'){
- // On ajoute 1 point pour une minuscule - Adding 1 point to score for a lowercase
- $points = $points + 1;
-
- // On rajoute le bonus pour une minuscule - Adding bonus points for lowercase
- $point_lowercase = 1;
- }
- else if ($letters>='A' && $letters <='Z'){
- // On ajoute 2 points pour une majuscule - Adding 2 points to score for uppercase
- $points = $points + 2;
+function testpassword($password) // Le mot de passe passé en paramètre - $password given by user
+{
+
+ // Initialisation des variables - Variables initiation
+ $points = 0;
+ $point_lowercase = 0;
+ $point_uppercase = 0;
+ $point_numbers = 0;
+ $point_characters = 0;
+
+ // On récupère la longueur du mot de passe - Getting password lengh
+ $length = strlen($password);
+
+ // On fait une boucle pour lire chaque lettre - Loop to read password characters
+ for($i = 0; $i < $length; $i++)
+ {
+ // On sélectionne une à une chaque lettre - Select each letters
+ // $i étant à 0 lors du premier passage de la boucle - $i is 0 at first turn
+ $letters = $password[$i];
+
+ if ($letters>='a' && $letters<='z')
+ {
+ // On ajoute 1 point pour une minuscule - Adding 1 point to score for a lowercase
+ $points = $points + 1;
+
+ // On rajoute le bonus pour une minuscule - Adding bonus points for lowercase
+ $point_lowercase = 1;
+ }
+ else if ($letters>='A' && $letters <='Z')
+ {
+ // On ajoute 2 points pour une majuscule - Adding 2 points to score for uppercase
+ $points = $points + 2;
- // On rajoute le bonus pour une majuscule - Adding bonus points for uppercase
- $point_uppercase = 2;
- }
- else if ($letters>='0' && $letters<='9'){
- // On ajoute 3 points pour un chiffre - Adding 3 points to score for numbers
- $points = $points + 3;
+ // On rajoute le bonus pour une majuscule - Adding bonus points for uppercase
+ $point_uppercase = 2;
+ }
+ else if ($letters>='0' && $letters<='9')
+ {
+ // On ajoute 3 points pour un chiffre - Adding 3 points to score for numbers
+ $points = $points + 3;
- // On rajoute le bonus pour un chiffre - Adding bonus points for numbers
- $point_numbers = 3;
- }
- else {
- // On ajoute 5 points pour un caractère autre - Adding 5 points to score for special characters
- $points = $points + 5;
+ // On rajoute le bonus pour un chiffre - Adding bonus points for numbers
+ $point_numbers = 3;
+ }
+ else
+ {
+ // On ajoute 5 points pour un caractère autre - Adding 5 points to score for special characters
+ $points = $points + 5;
- // On rajoute le bonus pour un caractère autre - Adding bonus points for special characters
- $point_characters = 5;
- }
-}
-
-// Calcul du coefficient points/longueur - calculating the coefficient points / length
-$step1 = $points / $length;
-
-// Calcul du coefficient de la diversité des types de caractères... - Calculation of the diversity of character types...
-$step2 = $point_lowercase + $point_uppercase + $point_numbers + $point_characters;
-
-// Multiplication du coefficient de diversité avec celui de la longueur - Multiplying the coefficient of diversity with that of the length
-$score = $step1 * $step2;
-
-// Multiplication du résultat par la longueur de la chaîne - Multiplying the result by the length of the chain
-$finalscore = $score * $length;
-
-return $finalscore;
+ // On rajoute le bonus pour un caractère autre - Adding bonus points for special characters
+ $point_characters = 5;
+ }
+ }
+
+ // Calcul du coefficient points/longueur - calculating the coefficient points / length
+ $step1 = $points / $length;
+
+ // Calcul du coefficient de la diversité des types de caractères... - Calculation of the diversity of character types...
+ $step2 = $point_lowercase + $point_uppercase + $point_numbers + $point_characters;
+
+ // Multiplication du coefficient de diversité avec celui de la longueur - Multiplying the coefficient of diversity with that of the length
+ $score = $step1 * $step2;
+
+ // Multiplication du résultat par la longueur de la chaîne - Multiplying the result by the length of the chain
+ $finalscore = $score * $length;
+
+ return $finalscore;
}
?>
Index: /extensions/NBC_UserAdvManager/trunk/language/en_UK/plugin.lang.php
===================================================================
--- /extensions/NBC_UserAdvManager/trunk/language/en_UK/plugin.lang.php (revision 4123)
+++ /extensions/NBC_UserAdvManager/trunk/language/en_UK/plugin.lang.php (revision 4124)
@@ -57,6 +57,6 @@
$lang['UserAdvManager_ConfirmMail_Remail_true'] = 'Enable email reminder';
$lang['UserAdvManager_ConfirmMail_Remail_false'] = 'Disable email reminder';
-$lang['UserAdvManager_ConfirmMail_ReMail_Txt1'] = 'Custom content of the recall message with regeneration of validation key.
If left blank, the recall mail will include only the validation link. It is therefore strongly advised to take a little explanatory text. (NB: The text pre-filled with the installation of the plugin is given as an example)
(!!! WARNING ! Text modification is available ONLY if email reminder is enabled. Use the multi language tags from Extended Description plugin if this plugin is activated !!!)';
-$lang['UserAdvManager_ConfirmMail_ReMail_Txt2'] = 'Custom content of the recall message without regeneration of validation key.
If left blank, the recall mail will include only the validation link. It is therefore strongly advised to take a little explanatory text. (NB: The text pre-filled with the installation of the plugin is given as an example)
(!!! WARNING ! Text modification is available ONLY if email reminder is enabled. Use the multi language tags from Extended Description plugin if this plugin is activated !!!)';
+$lang['UserAdvManager_ConfirmMail_ReMail_Txt1'] = 'Custom content of the recall message with regeneration of validation key.
If left blank, the recall mail will include only the validation link. It is therefore strongly advised to take a little explanatory text. (NB: The text pre-filled with the installation of the plugin is given as an example)
(!!! WARNING ! Text modification is available ONLY if email reminder is enabled. Use the multi language tags from Extended Description plugin if this plugin is activated !!!)';
+$lang['UserAdvManager_ConfirmMail_ReMail_Txt2'] = 'Custom content of the recall message without regeneration of validation key.
If left blank, the recall mail will include only the validation link. It is therefore strongly advised to take a little explanatory text. (NB: The text pre-filled with the installation of the plugin is given as an example)
(!!! WARNING ! Text modification is available ONLY if email reminder is enabled. Use the multi language tags from Extended Description plugin if this plugin is activated !!!)';
Index: /extensions/NBC_UserAdvManager/trunk/language/fr_FR/plugin.lang.php
===================================================================
--- /extensions/NBC_UserAdvManager/trunk/language/fr_FR/plugin.lang.php (revision 4123)
+++ /extensions/NBC_UserAdvManager/trunk/language/fr_FR/plugin.lang.php (revision 4124)
@@ -9,25 +9,29 @@
$lang['Title_Tab1'] = 'UserAdvManager - Configuration Générale';
$lang['Tab_Global'] = 'Configuration Générale';
-$lang['UserAdvManager_Title'] = 'Configuration avancée des utilisateurs';
+$lang['UserAdvManager_Title1'] = 'Gestion de l\'inscription des utilisateurs';
+$lang['UserAdvManager_Title2'] = 'Validation d\'inscription et gestion de groupes / statuts';
$lang['UserAdvManager_Mail_Info'] = 'Mail d\'information à l\'utilisateur';
$lang['UserAdvManager_Mail_Info_true'] = ' Envoyer un mail à l\'utilisateur reprenant ses infos lors de son inscription ou la mise à jour de son profil.';
-$lang['UserAdvManager_Mail_Info_false'] = ' Désactive l\'envoi de mail d\'info.';
+$lang['UserAdvManager_Mail_Info_false'] = ' Désactive l\'envoi de mail d\'info. (valeur par défaut)';
$lang['UserAdvManager_MailInfo_Text'] = ' Texte utilisé pour l\'introduction du mail envoyé à l\'utilisateur pour son inscription ou la mise à jour de son profil
(!!! ATTENTION ! Utilisez la méthode multi language du plugin Extended Description si celui-ci est activé !!!)';
$lang['UserAdvManager_No_Casse'] = 'Utilisateur insensible à la casse';
$lang['UserAdvManager_No_Casse_true'] = ' Rendre le compte utilisateur insensible à la casse, lors de l\'inscription et l\identification.';
-$lang['UserAdvManager_No_Casse_false'] = ' Laisser les utilisateur sensible à la casse.';
+$lang['UserAdvManager_No_Casse_false'] = ' Laisser les utilisateur sensible à la casse. (valeur par défaut)';
$lang['UserAdvManager_Username_Char'] = 'Caractères limités pour le nom d\'utilisateur';
$lang['UserAdvManager_Username_Char_true'] = ' Interdire les caractères saisis dans le champs ci-après pour le nom d\'utilisateur lors de l\'inscription == ';
-$lang['UserAdvManager_Username_Char_false'] = ' Laisser le contrôle par défaut du nom d\'utilisateur.';
+$lang['UserAdvManager_Username_Char_false'] = ' Laisser le contrôle par défaut du nom d\'utilisateur. (valeur par défaut)';
$lang['UserAdvManager_Password_Enforced'] = 'Renforcement des mots de passe - Activer cette option rend la saisie du mot de passe obligatoire à l\'inscription des visiteurs. De plus, le mot de passe saisi par le visiteur devra répondre à un score de fiabilité.';
-$lang['UserAdvManager_Password_Enforced_Info'] = 'Explications : Le score d\'un mot de passe est calculé en fonction des paramètres de base : longueur, types de caractères utilisés(lettres, chiffres, majuscules, minuscules, caractères spéciaux). Si le mot de passe de l\'utilisateur ne répond pas au score, le score réalisé est affiché ainsi que le score planchet et une indication pour augmenter la valeur de ce score. Pour donner un ordre d\'idée, un score inférieur à 100 est considéré comme faible. Entre 100 et 500, la fiabilité est renforcée. Au dela de 500, c\'est Fort Knox !! ;-)
Vous pouvez tester la fiabilité d\'un mot de passe en utilisant les champs ci-dessous (pour test uniquement !) ;-)';
+$lang['UserAdvManager_Password_Enforced_Info'] = 'Explications : Le score d\'un mot de passe est calculé en fonction des paramètres de base : longueur, types de caractères utilisés(lettres, chiffres, majuscules, minuscules, caractères spéciaux). Si le mot de passe de l\'utilisateur ne répond pas au score, le score réalisé est affiché ainsi que le score planchet et une indication pour augmenter la valeur de ce score. Pour donner un ordre d\'idée, un score inférieur à 100 est considéré comme faible. Entre 100 et 500, la fiabilité est renforcée. Au dela de 500, c\'est Fort Knox !! ;-)
Vous pouvez tester la fiabilité d\'un mot de passe en utilisant les champs ci-dessous (pour test uniquement !)';
$lang['UserAdvManager_PasswordTest'] = 'Mot de passe à tester : ';
$lang['UserAdvManager_ScoreTest'] = 'Score obtenu : ';
$lang['PasswordTest'] = 'Calcul du score';
-$lang['UserAdvManager_Password_Enforced_true'] = ' Mot de passe renforcé obligatoire - Saisir le score minimum (planchet)de fiabilité du mots de passe == ';
-$lang['UserAdvManager_Password_Enforced_false'] = ' Ne pas renforcer les mots de passe (fonctionnement normal)';
+$lang['UserAdvManager_Password_Enforced_true'] = ' Mot de passe renforcé obligatoire - Saisir le score minimum (valeur planchet) de fiabilité du mots de passe == ';
+$lang['UserAdvManager_Password_Enforced_false'] = ' Ne pas renforcer les mots de passe. (valeur par défaut)';
+$lang['UserAdvManager_AdminPassword_Enforced'] = 'Appliquer également le contrôle du renforcement de mots de passe lorsqu\'un administrateur créé un utilisateur? A noter : Si l\'utilisateur ainsi créé désire changer de mot de passe et que le renforcement des mots de passe pour les utilisateurs est actif, il sera soumis à la règle configurée.';
+$lang['UserAdvManager_AdminPassword_Enforced_true'] = 'Activer le renforcement des mots de passe pour les admins.';
+$lang['UserAdvManager_AdminPassword_Enforced_false'] = 'Désactiver le renforcement des mots de passe pour les admins. (valeur par défaut)';
$lang['UserAdvManager_Confirm_Mail'] = 'Confirmation de l\'adresse email';
$lang['UserAdvManager_Confirm_Mail_true'] = ' Envoyer un mail permettant a l\'utilisateur de confirmer son adresse email et donc son compte utilisateur.';
-$lang['UserAdvManager_Confirm_Mail_false'] = ' Système d\'inscription et de mise à jour standard sans confirmation de l\'adresse email.';
+$lang['UserAdvManager_Confirm_Mail_false'] = ' Système d\'inscription et de mise à jour standard sans confirmation de l\'adresse email. (valeur par défaut)';
$lang['UserAdvManager_ConfirmMail_Text'] = ' Texte utilisé pour l\'introduction du mail envoyé à l\'utilisateur pour confirmer son adresse mail
(!!! ATTENTION ! Utilisez la méthode multi language du plugin Extended Description si celui-ci est activé !!!)';
$lang['UserAdvManager_Confirm_Group_Notice'] = 'ATTENTION : L\'utilisation des groupes de validation nécessite que vous ayez créé au moins un groupe d\'utilisateurs et qu\'il soit défini "par défaut" dans la gestion des groupes d\'utilisateurs de Piwigo.';
@@ -39,11 +43,11 @@
$lang['UserAdvManager_No_Comment_Anonymous'] = 'Pseudo obligatoire sur commentaire';
$lang['UserAdvManager_No_Comment_Anonymous_true'] = ' Le champs auteur doit être renseigné pour enregistrer un commentaire.';
-$lang['UserAdvManager_No_Comment_Anonymous_false'] = ' Laisser le fonctionnement par défaut pour enregistrer un commentaire.';
+$lang['UserAdvManager_No_Comment_Anonymous_false'] = ' Laisser le fonctionnement par défaut pour enregistrer un commentaire. (valeur par défaut)';
$lang['UserAdvManager_MailExclusion'] = 'Exclusion des domaines de messagerie';
$lang['UserAdvManager_MailExclusion_true'] = ' Activer l\'exclusion des domaines de messagerie (par exemple @hotmail.* ou @msn.*)';
-$lang['UserAdvManager_MailExclusion_false'] = ' Désactiver l\'exclusion des domaines de messagerie.';
+$lang['UserAdvManager_MailExclusion_false'] = ' Désactiver l\'exclusion des domaines de messagerie. (valeur par défaut)';
$lang['UserAdvManager_MailExclusion_List'] = ' Si l\'exclusion de domaines de messagerie est activée, saisissez les domaines à exclure ici. Il faut respecter le format suivant :
@[nom_du_domaine].[extension_du_domaine] - Exemple : @hotmail.com
Séparez les domaines par une virgule
';
-$lang['audit'] = 'Audit';
-$lang['submit'] = 'Valider';
+$lang['audit'] = 'Auditer les paramètres';
+$lang['submit'] = 'Sauvegarder les paramètres';
@@ -54,5 +58,5 @@
$lang['UserAdvManager_ConfirmMail_Info'] = 'Limitation du délai de validation de l\'inscription :
Si vous activez cette option, sélectionnez le délai (x) )souhaité dans la liste qui suit. Les visiteurs qui s\'inscriront alors auront x jours de délais pour valider leur inscription. Passé ce délai, le lien de validation qu\'ils auront reçu par mail sera expiré.
';
$lang['UserAdvManager_ConfirmMail_TimeOut_true'] = 'Activer la limitation du délai d\'inscription.';
-$lang['UserAdvManager_ConfirmMail_TimeOut_false'] = 'Désactiver la limitation du délai d\'inscription.';
+$lang['UserAdvManager_ConfirmMail_TimeOut_false'] = 'Désactiver la limitation du délai d\'inscription. (valeur par défaut)';
$lang['UserAdvManager_ConfirmMail_TimeOut'] = 'Délai d\activation :';
$lang['UserAdvManager_ConfirmMail_Delay_Info'] = 'Saisissez ici le nombre de jours avant expiration de la validation d\'inscription : ';
@@ -62,6 +66,6 @@
//$lang['UserAdvManager_ConfirmMail_AutoDel_false'] = 'Désactiver la suppression automatique.';
$lang['UserAdvManager_ConfirmMail_Remail'] = 'Activer ou désactiver la fonctionnalité de rappel des inscrits non validés :
';
-$lang['UserAdvManager_ConfirmMail_Remail_true'] = 'Activer le rappel par mail';
-$lang['UserAdvManager_ConfirmMail_Remail_false'] = 'Désactiver le rappel par mail';
+$lang['UserAdvManager_ConfirmMail_Remail_true'] = 'Activer le rappel par mail.';
+$lang['UserAdvManager_ConfirmMail_Remail_false'] = 'Désactiver le rappel par mail. (valeur par défaut)';
$lang['UserAdvManager_ConfirmMail_ReMail_Txt1'] = 'Contenu personnalisé du message de rappel avec regénération de clé de validation.
Si laissé vide, le mail de rappel ne comportera que le lien de validation. Il est donc vivement conseillé de saisir un petit texte explicatif. (NB : Le texte pré renseigné à l\'installation du plugin est donné en exemple)
(!!! ATTENTION ! La modification du texte n\'est possible QUE si le rappel par email est activé. Utilisez la méthode multi language du plugin Extended Description si celui-ci est activé !!!)';
$lang['UserAdvManager_ConfirmMail_ReMail_Txt2'] = 'Contenu personnalisé du message de rappel sans regénération de clé de validation.
Si laissé vide, le mail de rappel sera vide. Il est donc vivement conseillé de saisir un petit texte explicatif. (NB : Le texte pré renseigné à l\'installation du plugin est donné en exemple)
(!!! ATTENTION ! La modification du texte n\'est possible QUE si le rappel par email est activé. Utilisez la méthode multi language du plugin Extended Description si celui-ci est activé !!!)';
@@ -108,8 +112,12 @@
$lang['Err_audit_username_char'] = 'Ce compte contient un ou des caractères interdits : ';
$lang['Err_audit_email_forbidden'] = 'Ce compte contient des domaines de messagerie interdit : ';
-$lang['Err_audit_advise'] = 'Vous avez des corrections a faire pour respecter les nouvelles règles que vous avez activé
utilisez un utilitaire de gestion de base de données pour corriger les comptes utilisateurs directement dans la table ###_USERS si nécessaire.';
+$lang['Err_audit_advise'] = 'Vous avez des corrections a faire pour respecter les nouvelles règles que vous avez activées.
Utilisez un utilitaire de gestion de base de données pour corriger les comptes utilisateurs directement dans la table ###_USERS si nécessaire.
';
$lang['UserAdvManager_Empty Author'] = 'Le champs auteur doit être rempli pour enregistrer un commentaire.';
-$lang['reg_err_login3'] = 'Mot de passe obligatoire !';
-$lang['reg_err_login4'] = 'Le mot de passe choisi est trop faible.';
+$lang['reg_err_login3'] = 'Sécurité : Le mot de passe est obligatoire !';
+$lang['reg_err_login4_%s'] = 'Sécurité : Un système de contrôle calcule un score de complexité sur les mots de passe choisis. La complexité de votre mot de passe est trop faible (score = %s). Veuillez choisir un nouveau mot de passe plus sûre en respectant les règles suivantes :
+- Utiliser des lettres et des chiffres
+- Utiliser des minuscules et des majuscules
+- Augmenter sa longueur (nombre de caractères)
+Le score minimal des mots de passe imposé par l\'administrateur est de : ';
if ( isset($conf_UserAdvManager[1]) and $conf_UserAdvManager[1] == 'true' )
$lang['reg_err_login5'] = 'ce nom utilisateur est déjà pris, ATTENTION le nom est insensible à la casse (Majuscule = Minuscule).';
Index: /extensions/NBC_UserAdvManager/trunk/main.inc.php
===================================================================
--- /extensions/NBC_UserAdvManager/trunk/main.inc.php (revision 4123)
+++ /extensions/NBC_UserAdvManager/trunk/main.inc.php (revision 4124)
@@ -70,6 +70,7 @@
-- 2.11.5 : Bug 1195 fixed : Registration displays the good title
--- pre 2.12.0 : Password control and enforcement (step 1)
-
+-- pre 2.12.0 : Bug 1206 fixed : All plugin functionnalities work in user's profile page
+ Plugin's core code and admin panel refactoring
+ Password control and enforcement : A complexity score is computed on user registration. If this score is less than the goal set by admin, the password choosen is rejected.
*/
@@ -83,7 +84,5 @@
++ Password control and enforcement
- -- Empty password (done in Piwigo 2.x)
- ++ Can not be the same as username
- ++ complexity of the password (Numbers+Lettrers+Low and high case+Special+minimal length)
+ ?? Can not be the same as username -> Could password score control be sufficient ?
++ Security : Blocking brut-force attacks !
@@ -99,5 +98,8 @@
-if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+if (!defined('PHPWG_ROOT_PATH'))
+{
+ die('Hacking attempt!');
+}
define('NBC_UserAdvManager_DIR' , basename(dirname(__FILE__)));
@@ -135,8 +137,10 @@
$conf_nbc_UserAdvManager = isset($conf['nbc_UserAdvManager']) ? explode(";" , $conf['nbc_UserAdvManager']) : array();
-
- if (( isset($conf_nbc_UserAdvManager[0]) and $conf_nbc_UserAdvManager[0] == 'true') or ( isset($conf_nbc_UserAdvManager[2]) and $conf_nbc_UserAdvManager[2] == 'true'))
-
- SendMail2User(1, $register_user['id'], $register_user['username'], $_POST['password'], $register_user['email'], true);
+
+ /* Sending registration confirmation by email */
+ if ((isset($conf_nbc_UserAdvManager[0]) and $conf_nbc_UserAdvManager[0] == 'true') or (isset($conf_nbc_UserAdvManager[2]) and $conf_nbc_UserAdvManager[2] == 'true'))
+ {
+ SendMail2User(1, $register_user['id'], $register_user['username'], $_POST['password'], $register_user['email'], true);
+ }
}
@@ -148,9 +152,146 @@
function UserAdvManager_Deluser($user_id)
{
-
DeleteConfirmMail($user_id);
-
-}
-
+}
+
+
+/* Check users registration */
+add_event_handler('register_user_check', 'UserAdvManager_RegistrationCheck', EVENT_HANDLER_PRIORITY_NEUTRAL, 2);
+
+function UserAdvManager_RegistrationCheck($err, $user)
+{
+ global $errors, $conf;
+
+ $PasswordCheck = 0;
+
+ $conf_nbc_UserAdvManager = isset($conf['nbc_UserAdvManager']) ? explode(";" , $conf['nbc_UserAdvManager']) : array();
+
+ /* Password enforcement control */
+ if (isset($conf_nbc_UserAdvManager[14]) and $conf_nbc_UserAdvManager[14] == 'true' and !empty($conf_nbc_UserAdvManager[15]))
+ {
+ if (!empty($user['password']) and !is_admin())
+ {
+ $PasswordCheck = testpassword($user['password']);
+
+ if ($PasswordCheck < $conf_nbc_UserAdvManager[15])
+ {
+ $message = get_l10n_args('reg_err_login4_%s', $PasswordCheck);
+ return($lang['reg_err_pass'] = l10n_args($message).$conf_nbc_UserAdvManager[15]);
+ }
+ }
+ else if (!empty($user['password']) and is_admin() and isset($conf_nbc_UserAdvManager[16]) and $conf_nbc_UserAdvManager[16] == 'true')
+ {
+ $PasswordCheck = testpassword($user['password']);
+
+ if ($PasswordCheck < $conf_nbc_UserAdvManager[15])
+ {
+ $message = get_l10n_args('reg_err_login4_%s', $PasswordCheck);
+ return($lang['reg_err_pass'] = l10n_args($message).$conf_nbc_UserAdvManager[15]);
+ }
+ }
+ }
+
+ /* Username non case sensitive */
+ if (isset($conf_nbc_UserAdvManager[1]) and $conf_nbc_UserAdvManager[1] == 'true')
+ {
+ $new_username = NotSensibleSearchUsername($_POST['login']);
+ $_POST['login'] = $new_username == '' ? $_POST['login'] : $new_username;
+ }
+
+ /* Username without forbidden keys */
+ if (isset($conf_nbc_UserAdvManager[7]) and $conf_nbc_UserAdvManager[7] == 'true' and !empty($_POST['login']) and !ValidateUsername($_POST['login']))
+ {
+ $_POST['login'] = '';
+ return($lang['reg_err_login1'] = l10n('reg_err_login6')."'".$conf_nbc_UserAdvManager[8]."'");
+ }
+
+ /* Email without forbidden domains */
+ if (isset($conf_nbc_UserAdvManager[12]) and $conf_nbc_UserAdvManager[12] == 'true' and !empty($_POST['mail_address']) and !ValidateEmailProvider($_POST['mail_address']))
+ {
+ $_POST['login'] = '';
+ return($lang['reg_err_login1'] = l10n('reg_err_login7')."'".$conf_nbc_UserAdvManager[13]."'");
+ }
+}
+
+
+if (script_basename() == 'profile')
+{
+ add_event_handler('loc_begin_profile', 'UserAdvManager_Profile_Init');
+
+ function UserAdvManager_Profile_Init()
+ {
+ global $conf, $user, $template;
+
+ $conf_nbc_UserAdvManager = isset($conf['nbc_UserAdvManager']) ? explode(";" , $conf['nbc_UserAdvManager']) : array();
+
+ if (isset($_POST['validate']))
+ {
+ /* Email without forbidden domains */
+ if (isset($conf_nbc_UserAdvManager[12]) and $conf_nbc_UserAdvManager[12] == 'true' and !empty($_POST['mail_address']))
+ {
+ if (!ValidateEmailProvider($_POST['mail_address']))
+ {
+ $template->append('errors', l10n('reg_err_login7')."'".$conf_nbc_UserAdvManager[13]."'");
+ unset($_POST['validate']);
+ }
+ }
+
+ $typemail = 3;
+
+ if (!empty($_POST['use_new_pwd']))
+ {
+ $typemail = 2;
+
+ /* Password enforcement control */
+ if (isset($conf_nbc_UserAdvManager[14]) and $conf_nbc_UserAdvManager[14] == 'true' and !empty($conf_nbc_UserAdvManager[15]))
+ {
+ $PasswordCheck = testpassword($_POST['use_new_pwd']);
+
+ if ($PasswordCheck < $conf_nbc_UserAdvManager[15])
+ {
+ $message = get_l10n_args('reg_err_login4_%s', $PasswordCheck);
+ $template->append('errors', l10n_args($message).$conf_nbc_UserAdvManager[15]);
+ unset($_POST['use_new_pwd']);
+ unset($_POST['validate']);
+ }
+ }
+ }
+
+ /* Sending registration confirmation by email */
+ if (( isset($conf_nbc_UserAdvManager[0]) and $conf_nbc_UserAdvManager[0] == 'true') or ( isset($conf_nbc_UserAdvManager[2]) and $conf_nbc_UserAdvManager[2] == 'true'))
+ {
+ $confirm_mail_need = false;
+
+ if (!empty($_POST['mail_address']) and ValidateEmailProvider($_POST['mail_address']))
+ {
+ $query = '
+ SELECT '.$conf['user_fields']['email'].' AS email
+ FROM '.USERS_TABLE.'
+ WHERE '.$conf['user_fields']['id'].' = \''.$user['id'].'\'
+ ;';
+
+ list($current_email) = mysql_fetch_row(pwg_query($query));
+
+ if ( $_POST['mail_address'] != $current_email and ( isset($conf_nbc_UserAdvManager[2]) and $conf_nbc_UserAdvManager[2] == 'true') )
+
+ $confirm_mail_need = true;
+ }
+
+ if ((!empty($_POST['use_new_pwd']) and ( isset($conf_nbc_UserAdvManager[0]) and $conf_nbc_UserAdvManager[0] == 'true') or $confirm_mail_need) )
+ {
+ $query = '
+ SELECT '.$conf['user_fields']['username'].'
+ FROM '.USERS_TABLE.'
+ WHERE '.$conf['user_fields']['id'].' = \''.$user['id'].'\'
+ ;';
+
+ list($username) = mysql_fetch_row(pwg_query($query));
+
+ SendMail2User($typemail, $user['id'], $username, $_POST['use_new_pwd'], $_POST['mail_address'], $confirm_mail_need);
+ }
+ }
+ }
+ }
+}
@@ -160,16 +301,17 @@
{
load_language('plugin.lang', NBC_UserAdvManager_PATH);
- global $conf, $template, $page, $lang;
-
- $PasswordCheck = 0;
+ global $conf, $template, $page, $lang, $errors;
$conf_nbc_UserAdvManager = isset($conf['nbc_UserAdvManager']) ? explode(";" , $conf['nbc_UserAdvManager']) : array();
-
- if ( isset($conf_nbc_UserAdvManager[1]) and $conf_nbc_UserAdvManager[1] == 'true' )
+ /* Username non case sensitive */
+ if (isset($conf_nbc_UserAdvManager[1]) and $conf_nbc_UserAdvManager[1] == 'true')
+ {
$lang['reg_err_login5'] = l10n('reg_err_login5');
-
+ }
+
+
-/* User identication */
+/* User identification */
if (script_basename() == 'identification')
{
@@ -186,5 +328,4 @@
-
/* Admin user management */
if (script_basename() == 'admin' and isset($_GET['page']) and $_GET['page'] == 'user_list')
@@ -199,230 +340,16 @@
}
-
/* Username without forbidden keys */
if (isset($conf_nbc_UserAdvManager[7]) and $conf_nbc_UserAdvManager[7] == 'true' and !empty($_POST['login']) and !ValidateUsername($_POST['login']))
{
- $lang['reg_err_login1'] = l10n('reg_err_login6')."'".$conf_nbc_UserAdvManager[8]."'";
- $_POST['login'] = '';
+ $template->append('errors', l10n('reg_err_login6')."'".$conf_nbc_UserAdvManager[8]."'");
+ unset($_POST['submit_add']);
}
/* Email without forbidden domains */
- /* This don't work on call of ValidateEmailProvider() function - Why ?? -> Due to the "return = false|true" in function ?*/
- //if (isset($conf_nbc_UserAdvManager[12]) and $conf_nbc_UserAdvManager[12] == 'true' and !empty($_POST['email']) and !ValidateEmailProvider($_POST['email']))
- //{
- // $lang['reg_err_login1'] = l10n('reg_err_login7')."'".$conf_nbc_UserAdvManager[13]."'";
- // $_POST['login'] = '';
- //}
- /* This work with a code copy of ValidateEmailProvider() function */
- if (isset($conf_nbc_UserAdvManager[12]) and $conf_nbc_UserAdvManager[12] == 'true' and !empty($_POST['email']))
- {
- $ncsemail = strtolower($_POST['email']);
- $conf_nbc_MailExclusion = preg_split("/[\s,]+/",$conf_nbc_UserAdvManager[13]);
- for ($i = 0 ; $i < count($conf_nbc_MailExclusion) ; $i++)
- {
- $pattern = '/'.$conf_nbc_MailExclusion[$i].'/';
- if (preg_match($pattern, $ncsemail))
- {
- $lang['reg_err_login1'] = l10n('reg_err_login7')."'".$conf_nbc_UserAdvManager[13]."'";
- $_POST['login'] = '';
- }
- }
- }
- }
- }
-
-/* User creation */
- if (script_basename() == 'register')
- {
- if (isset($_POST['submit']))
- {
- /* Username non case sensitive */
- if (isset($conf_nbc_UserAdvManager[1]) and $conf_nbc_UserAdvManager[1] == 'true')
- {
- $new_username = NotSensibleSearchUsername($_POST['login']);
- $_POST['login'] = $new_username == '' ? $_POST['login'] : $new_username;
- }
-
-
- /* Username without forbidden keys */
- if (isset($conf_nbc_UserAdvManager[7]) and $conf_nbc_UserAdvManager[7] == 'true' and !empty($_POST['login']) and !ValidateUsername($_POST['login']))
- {
- $lang['reg_err_login1'] = l10n('reg_err_login6')."'".$conf_nbc_UserAdvManager[8]."'";
- $_POST['login'] = '';
- }
-
-
- if (isset($conf_nbc_UserAdvManager[14]) and $conf_nbc_UserAdvManager[14] == 'true' and !empty($conf_nbc_UserAdvManager[15]))
- {
- //$PasswordCheck = testpassword($_POST['password']);
- $PasswordCheck = 10;
- if ($PasswordCheck < $conf_nbc_UserAdvManager[15])
- {
- array_push($errors, l10n('reg_err_login4')."'".$conf_nbc_UserAdvManager[15]."'");
- //$lang['reg_err_login1'] = l10n('reg_err_login4')."'".$conf_nbc_UserAdvManager[15]."'";
- $_POST['password'] = "";
- $_POST['password_conf'] = "";
- $PasswordCheck = 0;
- }
- }
-
- /* Email without forbidden domains */
- /* This don't work on call of ValidateEmailProvider() function - Why ?? -> Due to the "return = false|true" in function ?*/
- //if (isset($conf_nbc_UserAdvManager[12]) and $conf_nbc_UserAdvManager[12] == 'true' and !empty($_POST['mail_address']) and !ValidateEmailProvider($_POST['mail_address']))
- //{
- // $lang['reg_err_mail_address'] = l10n('reg_err_login7')."'".$conf_nbc_UserAdvManager[13]."'";
- // $_POST['mail_address'] = '';
- //}
- /* This work with a code copy of ValidateEmailProvider() function */
- if (isset($conf_nbc_UserAdvManager[12]) and $conf_nbc_UserAdvManager[12] == 'true' and !empty($_POST['mail_address']))
- {
- $ncsemail = strtolower($_POST['mail_address']);
- $conf_nbc_MailExclusion = preg_split("/[\s,]+/",$conf_nbc_UserAdvManager[13]);
- for ($i = 0 ; $i < count($conf_nbc_MailExclusion) ; $i++)
- {
- $pattern = '/'.$conf_nbc_MailExclusion[$i].'/';
- if (preg_match($pattern, $ncsemail))
- {
- $lang['reg_err_login1'] = l10n('reg_err_login7')."'".$conf_nbc_UserAdvManager[13]."'";
- $_POST['login'] = '';
- }
- }
- }
- }
- }
-
-/* User profile update */
- if (script_basename() == 'profile')
- {
- if (isset($_POST['validate']))
- {
- /* Sending email to user */
- if (( isset($conf_nbc_UserAdvManager[0]) and $conf_nbc_UserAdvManager[0] == 'true') or ( isset($conf_nbc_UserAdvManager[2]) and $conf_nbc_UserAdvManager[2] == 'true'))
- {
- global $conf, $user ;
- $errors = array();
-
- $int_pattern = '/^\d+$/';
- if (empty($_POST['nb_image_line'])
- or (!preg_match($int_pattern, $_POST['nb_image_line'])))
- {
- $errors[] = l10n('nb_image_line_error');
- }
-
- if (empty($_POST['nb_line_page'])
- or (!preg_match($int_pattern, $_POST['nb_line_page'])))
- {
- $errors[] = l10n('nb_line_page_error');
- }
-
- if ($_POST['maxwidth'] != ''
- and (!preg_match($int_pattern, $_POST['maxwidth'])
- or $_POST['maxwidth'] < 50))
- {
- $errors[] = l10n('maxwidth_error');
- }
- if ($_POST['maxheight']
- and (!preg_match($int_pattern, $_POST['maxheight'])
- or $_POST['maxheight'] < 50))
- {
- $errors[] = l10n('maxheight_error');
- }
-
- if (isset($_POST['mail_address']))
- {
- $mail_error = validate_mail_address($user['id'], $_POST['mail_address']);
- if (!empty($mail_error))
- {
- $errors[] = $mail_error;
- }
-
- if (isset($conf_nbc_UserAdvManager[12]) and $conf_nbc_UserAdvManager[12] == 'true' and !empty($_POST['mail_address']))
- {
- $ncsemail = strtolower($_POST['mail_address']);
- $conf_nbc_MailExclusion = preg_split("/[\s,]+/",$conf_nbc_UserAdvManager[13]);
- for ($i = 0 ; $i < count($conf_nbc_MailExclusion) ; $i++)
- {
- $pattern = '/'.$conf_nbc_MailExclusion[$i].'/';
- if (preg_match($pattern, $ncsemail))
- {
- $mail_error = l10n('reg_err_login7')."'".$conf_nbc_UserAdvManager[13]."'";
- }
- }
- }
- if (!empty($mail_error))
- {
- $errors[] = $mail_error;
- }
- }
-
- $typemail = 3;
-
- if (!empty($_POST['use_new_pwd']))
- {
- $typemail = 2;
-
- // password must be the same as its confirmation
- if ($_POST['use_new_pwd'] != $_POST['passwordConf'])
- {
- $errors[] = l10n('New password confirmation does not correspond');
- }
-
- if (isset($conf_nbc_UserAdvManager[14]) and $conf_nbc_UserAdvManager[14] == 'true' and !empty($conf_nbc_UserAdvManager[15]))
- {
- //$PasswordCheck = testpassword($_POST['password']);
- $PasswordCheck = 10;
- if ($PasswordCheck < $conf_nbc_UserAdvManager[15])
- {
- $lang['reg_err_login1'] = l10n('reg_err_login4')."'".$conf_nbc_UserAdvManager[15]."'";
- }
- }
- else if (isset($conf_nbc_UserAdvManager[14]) and $conf_nbc_UserAdvManager[14] == 'true')
- {
- $lang['reg_err_login1'] = l10n('reg_err_login3');
- }
-
- if ( !defined('IN_ADMIN') )
- {// changing password requires old password
- $query = '
- SELECT '.$conf['user_fields']['password'].' AS password
- FROM '.USERS_TABLE.'
- WHERE '.$conf['user_fields']['id'].' = \''.$user['id'].'\'
- ;';
- list($current_password) = mysql_fetch_row(pwg_query($query));
-
- if ($conf['pass_convert']($_POST['password']) != $current_password)
- {
- $errors[] = l10n('Current password is wrong');
- }
- }
- }
-
- $confirm_mail_need = false;
-
- if (!empty($_POST['mail_address']))
- {
- $query = '
- SELECT '.$conf['user_fields']['email'].' AS email
- FROM '.USERS_TABLE.'
- WHERE '.$conf['user_fields']['id'].' = \''.$user['id'].'\'
- ;';
- list($current_email) = mysql_fetch_row(pwg_query($query));
-
- if ( $_POST['mail_address'] != $current_email and ( isset($conf_nbc_UserAdvManager[2]) and $conf_nbc_UserAdvManager[2] == 'true') )
- $confirm_mail_need = true;
- }
-
- if (count($errors) == 0 and (!empty($_POST['use_new_pwd']) and ( isset($conf_nbc_UserAdvManager[0]) and $conf_nbc_UserAdvManager[0] == 'true') or $confirm_mail_need) )
- {
- $query = '
- SELECT '.$conf['user_fields']['username'].'
- FROM '.USERS_TABLE.'
- WHERE '.$conf['user_fields']['id'].' = \''.$user['id'].'\'
- ;';
- list($username) = mysql_fetch_row(pwg_query($query));
-
-
- SendMail2User($typemail, $user['id'], $username, $_POST['use_new_pwd'], $_POST['mail_address'], $confirm_mail_need);
- }
+ if (isset($conf_nbc_UserAdvManager[12]) and $conf_nbc_UserAdvManager[12] == 'true' and !empty($_POST['email']) and !ValidateEmailProvider($_POST['email']))
+ {
+ $template->append('errors', l10n('reg_err_login7')."'".$conf_nbc_UserAdvManager[13]."'");
+ unset($_POST['submit_add']);
}
}
Index: /extensions/NBC_UserAdvManager/trunk/maintain.inc.php
===================================================================
--- /extensions/NBC_UserAdvManager/trunk/maintain.inc.php (revision 4123)
+++ /extensions/NBC_UserAdvManager/trunk/maintain.inc.php (revision 4124)
@@ -12,5 +12,5 @@
$q = '
INSERT INTO '.CONFIG_TABLE.' (param, value, comment)
- VALUES ("nbc_UserAdvManager","true;false;false;-1;-1;-1;false;false;;-1;;;false;;false;100;","Parametres du plugin nbc UserAdvManager")
+ VALUES ("nbc_UserAdvManager","true;false;false;-1;-1;-1;false;false;;-1;;;false;;false;100;false","Parametres du plugin nbc UserAdvManager")
;';
pwg_query($q);