Changeset 3385 for extensions/NBC_UserAdvManager
- Timestamp:
- Jun 1, 2009, 10:40:57 PM (15 years ago)
- Location:
- extensions/NBC_UserAdvManager
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/NBC_UserAdvManager/admin/UserAdvManager_admin.php
r3352 r3385 18 18 $_POST['UserAdvManager_ConfirmMail_Text'] = str_replace("\'", "'", str_replace("\\\\", "\\", $_POST['UserAdvManager_ConfirmMail_Text'])); 19 19 20 $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'] ;20 $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']; 21 21 22 22 $conf['nbc_UserAdvManager'] = $newconf_nbc_UserAdvManager; … … 140 140 'UserAdvManager_NO_COMMENT_ANO_TRUE' => $conf_nbc_UserAdvManager[6]=='true' ? 'checked="checked"' : '' , 141 141 'UserAdvManager_NO_COMMENT_ANO_FALSE' => $conf_nbc_UserAdvManager[6]=='false' ? 'checked="checked"' : '' , 142 'UserAdvManager_MAILEXCLUSION_TRUE' => $conf_nbc_UserAdvManager[12]=='true' ? 'checked="checked"' : '' , 143 'UserAdvManager_MAILEXCLUSION_FALSE' => $conf_nbc_UserAdvManager[12]=='false' ? 'checked="checked"' : '' , 144 'UserAdvManager_MAILEXCLUSION_LIST' => $conf_nbc_UserAdvManager[13], 142 145 ) 143 146 ); 144 147 145 function Audit_UserAdvManager() 146 { 147 global $page, $conf, $errors; 148 149 $page_UserAdvMAnager_admin = get_admin_plugin_menu_link(__FILE__); 150 148 149 if ( isset($_POST['audit']) or isset($_POST['submit']) ) 150 { 151 151 $msg_error1 = ''; 152 $msg_error2 = ''; 153 $msg_ok_Audit = ''; 154 $msg_error_Audit = ''; 155 156 /* Usename non case sensitive */ 157 if (isset($conf_nbc_UserAdvManager[1]) and $conf_nbc_UserAdvManager[1] == 'true') 152 153 /* username insensible a la casse */ 154 if (isset($conf_nbc_UserAdvManager[3]) and $conf_nbc_UserAdvManager[3] == 'true') 158 155 { 159 156 $query = " … … 168 165 ;"; 169 166 $result = pwg_query($query); 170 while($row = mysql_fetch_array($result)) 171 $msg_error1 .= '<br/>'.l10n('Err_audit_no_casse').$row['username']; 172 173 if ($msg_error1 == '') 174 array_push($page['infos'], l10n('UserAdvManager_audit_ok')); 175 else 176 $msg_error1 = l10n('Err_audit_no_casse').$row['username']; 177 } 178 167 168 while($row = mysql_fetch_array($result)) 169 { 170 $msg_error1 .= (($msg_error1 <> '') ? '<br/>' : '') . l10n('Err_audit_no_casse').$row['username']; 171 } 172 } 173 174 175 176 $msg_error2 = ''; 177 179 178 /* Username without forbidden keys */ 180 179 if ( isset($conf_nbc_UserAdvManager[7]) and $conf_nbc_UserAdvManager[7] == 'true' ) … … 186 185 $result = pwg_query($query); 187 186 188 while($row = mysql_fetch_array($result)) 189 $msg_error2 .= '<br/>'.l10n('Err_audit_username_char').$row['username'].' ('.$row['mail_address'].')'; 190 191 if ($msg_error2 == '') 192 array_push($page['infos'], l10n('UserAdvManager_audit_ok')); 193 else 194 $msg_error2 = l10n('Err_audit_username_char').$row['username'].' ('.$row['mail_address'].')'; 195 } 196 187 while($row = mysql_fetch_array($result)) 188 { 189 if ( !ValidateUsername($row['username']) ) 190 $msg_error2 .= (($msg_error2 <> '') ? '<br/>' : '') . l10n('Err_audit_username_char').$row['username']; 191 } 192 } 193 194 195 $msg_error3 = ''; 196 197 /* Email without forbidden domain */ 198 if ( isset($conf_nbc_UserAdvManager[12]) and $conf_nbc_UserAdvManager[12] == 'true' ) 199 { 200 $query = " 201 SELECT ".$conf['user_fields']['username'].", ".$conf['user_fields']['email']." 202 FROM ".USERS_TABLE." 203 ;"; 204 $result = pwg_query($query); 205 206 while($row = mysql_fetch_array($result)) 207 { 208 $conf_nbc_UserAdvManager = isset($conf['nbc_UserAdvManager']) ? explode(";" , $conf['nbc_UserAdvManager']) : array(); 209 $conf_nbc_MailExclusion = split (",",$conf_nbc_UserAdvManager[13]); 210 for ($i = 0 ; $i < count($conf_nbc_MailExclusion) ; $i++) 211 { 212 if (ereg($conf_nbc_MailExclusion[$i], $row['mail_address'])) 213 { 214 $msg_error3 .= (($msg_error3 <> '') ? '<br/>' : '') . l10n('Err_audit_email_forbidden').$row['username'].' ('.$row['mail_address'].')'; 215 } 216 } 217 } 218 } 219 197 220 if ($msg_error1 <> '') 198 221 $errors[] = $msg_error1.'<br/><br/>'; 222 199 223 if ($msg_error2 <> '') 200 224 $errors[] = $msg_error2.'<br/><br/>'; 201 225 202 if ($msg_error1 <> '' or $msg_error2 <> '') 203 $errors[] = l10n('Err_audit_advise'); 226 if ($msg_error3 <> '') 227 $errors[] = $msg_error3.'<br/><br/>'; 228 229 230 if ($msg_error1 <> '' or $msg_error2 <> '' or $msg_error3 <> '') 231 array_push($page['errors'], l10n('Err_audit_advise')); 204 232 else 205 233 array_push($page['infos'], l10n('UserAdvManager_audit_ok')); 206 234 } 207 235 208 if ( isset($_POST['audit']) or isset($_POST['submit']) ) 209 { 210 Audit_UserAdvManager(); 211 } 236 212 237 // +-----------------------------------------------------------------------+ 213 238 // | errors display | … … 218 243 foreach ($errors as $error) 219 244 { 220 $template->assign('errors.error', array('ERROR'=>$error));245 array_push($page['errors'], $error); 221 246 } 222 247 } -
extensions/NBC_UserAdvManager/admin/UserAdvManager_admin.tpl
r3352 r3385 56 56 <input type="radio" value="false" {$UserAdvManager_NO_COMMENT_ANO_FALSE} name="UserAdvManager_No_Comment_Anonymous"/>{'UserAdvManager_No_Comment_Anonymous_false'|@translate}<br/> 57 57 </li> 58 58 <br/> 59 <li><label>{'UserAdvManager_MailExclusion'|@translate}</label><br/> 60 <input type="radio" value="true" {$UserAdvManager_MAILEXCLUSION_TRUE} name="UserAdvManager_MailExclusion"/>{'UserAdvManager_MailExclusion_true'|@translate}<br/> 61 <input type="radio" value="false" {$UserAdvManager_MAILEXCLUSION_FALSE} name="UserAdvManager_MailExclusion"/>{'UserAdvManager_MailExclusion_false'|@translate}<br/> 62 <br/> 63 <li><label>{'UserAdvManager_MailExclusion_List'|@translate}</label><br/> 64 <textarea name="UserAdvManager_MailExclusion_List" id="UserAdvManager_MailExclusion_List" rows="10" cols="80" {$TAG_INPUT_ENABLED}>{$UserAdvManager_MAILEXCLUSION_LIST}</textarea> 65 </li> 66 </li> 59 67 </ul> 60 68 <div align="center"><input class="submit" type="submit" value="{'audit'|@translate}" name="audit" /> <input class="submit" type="submit" value="{'submit'|@translate}" name="submit" {$TAG_INPUT_ENABLED} /></div> -
extensions/NBC_UserAdvManager/include/functions_UserAdvManager.inc.php
r3352 r3385 90 90 { 91 91 global $conf; 92 92 $conf_nbc_UserAdvManager = isset($conf['nbc_UserAdvManager']) ? explode(";" , $conf['nbc_UserAdvManager']) : array(); 93 93 $Confirm_Mail_ID = FindAvailableConfirmMailID(); 94 94 … … 295 295 global $conf; 296 296 297 $conf_nbc_UserAdvManager = isset($conf['nbc_UserAdvManager']) ? explode(";" , $conf[' UserAdvManager']) : array();297 $conf_nbc_UserAdvManager = isset($conf['nbc_UserAdvManager']) ? explode(";" , $conf['nbc_UserAdvManager']) : array(); 298 298 299 299 if ( isset($login) and isset($conf_nbc_UserAdvManager[8]) and $conf_nbc_UserAdvManager[8] <> '' ) … … 310 310 } 311 311 312 313 function ValidateEmailProvider($email) 314 { 315 global $conf; 316 317 $conf_nbc_UserAdvManager = isset($conf['nbc_UserAdvManager']) ? explode(";" , $conf['nbc_UserAdvManager']) : array(); 318 if (isset($conf_nbc_UserAdvManager[12])) 319 { 320 $conf_nbc_MailExclusion = split (",",$conf_nbc_UserAdvManager[13]); 321 for ($i = 0 ; $i < count($conf_nbc_MailExclusion) ; $i++) 322 { 323 if (ereg($conf_nbc_MailExclusion[$i], $email)) 324 return false; 325 else 326 return true; 327 } 328 } 329 } 312 330 ?> -
extensions/NBC_UserAdvManager/language/en_UK/plugin.lang.php
r3352 r3385 41 41 $lang['UserAdvManager_No_Comment_Anonymous_true'] = ' The author field have to be filled to send a comment.'; 42 42 $lang['UserAdvManager_No_Comment_Anonymous_false'] = ' Use the default Piwigo settings on comments sending.'; 43 $lang['UserAdvManager_MailExclusion'] = 'Email provider exclusion'; 44 $lang['UserAdvManager_MailExclusion_true'] = ' Set the email provider exclusion ON (i.e. : @hotmail.* or @msn.*)'; 45 $lang['UserAdvManager_MailExclusion_false'] = ' Set the email provider exclusion OFF.'; 46 $lang['UserAdvManager_MailExclusion_List'] = ' If email provider exclusion is set to ON, fill the email domains to exclude below. You have to use the following format :<br/>@[domaine_name].[domaine_extension] - Example : @hotmail.com<br/>Seperate the different domains with a comma (,)<br/>'; 47 48 $lang['audit'] = 'Audit'; 49 $lang['submit'] = 'Submit'; 43 50 44 51 $lang['Err_audit_no_casse'] = '<b>These accounts are identical to the case closely :</b> '; 45 52 $lang['Err_audit_username_char'] = '<b>This account uses one or more forbidden characters :</b> '; 53 $lang['Err_audit_email_forbidden'] = '<b>This account uses a forbidden email provider :</b> '; 46 54 $lang['Err_audit_advise'] = '<b>you make a correction to comply with new rules that you have activated.<br>use a utility géstion database to correct user accounts directly in the table ### _USERS'; 47 55 $lang['UserAdvManager_audit_ok'] = 'Audit OK'; … … 52 60 if ( isset($conf_UserAdvManager[1]) and $conf_UserAdvManager[1] == 'true' ) 53 61 $lang['reg_err_login5'] = 'user name is already taken, attention name is insensitive (Shift = Tiny).'; 62 $lang['reg_err_login6'] = 'Username does not contain the following characters: '; 63 $lang['reg_err_login7'] = 'Your email provider is banned for registration. Banned email providers are: '; 54 64 55 65 $lang['invalid_pwd'] = 'User name or password invalid !'; -
extensions/NBC_UserAdvManager/language/fr_FR/plugin.lang.php
r3352 r3385 41 41 $lang['UserAdvManager_No_Comment_Anonymous_true'] = ' Le champs auteur doit être renseigné pour enregistrer un commentaire.'; 42 42 $lang['UserAdvManager_No_Comment_Anonymous_false'] = ' Laisser le fonctionnement par défaut pour enregistrer un commentaire.'; 43 $lang['UserAdvManager_MailExclusion'] = 'Exclusion des domaines de messagerie'; 44 $lang['UserAdvManager_MailExclusion_true'] = ' Activer l\'exclusion des domaines de messagerie (par exemple @hotmail.* ou @msn.*)'; 45 $lang['UserAdvManager_MailExclusion_false'] = ' Désactiver l\'exclusion des domaines de messagerie.'; 46 $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 :<br/>@[nom_du_domaine].[extension_du_domaine] - Exemple : @hotmail.com<br/>Séparez les domaines par une virgule<br/>'; 43 47 44 48 $lang['audit'] = 'Audit'; … … 47 51 $lang['Err_audit_no_casse'] = '<b>Ces comptes sont identiques à la casse près :</b> '; 48 52 $lang['Err_audit_username_char'] = '<b>Ce compte contient un ou des caractères interdits :</b> '; 53 $lang['Err_audit_email_forbidden'] = '<b>Ce compte contient des domaines de messagerie interdit :</b> '; 49 54 $lang['Err_audit_advise'] = '<b>Vous avez des corrections a faire pour respecter les nouvelles règles que vous avez activé<br>utilisez un utilitaire de gestion de base de données pour corriger les comptes utilisateurs directement dans la table ###_USERS si nécessaire.</b>'; 50 55 $lang['UserAdvManager_audit_ok'] = 'Audit OK'; … … 56 61 $lang['new_reg_err_login5'] = 'ce nom utilisateur est déjà pris, ATTENTION le nom est insensible à la casse (Majuscule = Minuscule).'; 57 62 $lang['reg_err_login6'] = 'le nom utilisateur ne doit pas contenir les caractère suivants : '; 63 $lang['reg_err_login7'] = 'L\'adresse email est issue d\'un prestataire interdit. Les prestataires d\'adresses email interdits à l\'inscription sont : '; 58 64 59 65 $lang['invalid_pwd'] = 'Nom utilisateur ou Mot de passe invalide !'; -
extensions/NBC_UserAdvManager/main.inc.php
r3352 r3385 2 2 /* 3 3 Plugin Name: NBC UserAdvManager 4 Version: 2.10. 84 Version: 2.10.9 5 5 Description: Permet de renforcer les possibilités de gestion des utilisateurs - Enforce users management 6 6 Plugin URI: http://fr.piwigo.org/ext/extension_view.php?eid=216 … … 29 29 -- 2.10.8 : ConfirmMail page looks better (Sylvia theme only) 30 30 Improved code for checking author on guest comments 31 32 -- 2.10.9 : Bug fixed - Missing english translation 33 Bug fixed - Notice on forbidden characters function use 34 Bug fixed - Audit on forbidden characters in username didn't work 35 Adding of email provider exclusion (like *@hotmail.com) - Warning ! -> Known bug : This feature doesn't work on user profile page. So, already registered users can change their email address to a forbiden one. 31 36 32 37 */ … … 53 58 ++ (...) 54 59 55 -- Password control an senforcement60 -- Password control and enforcement 56 61 -- Empty password (done in Piwigo 2.x) 57 62 ++ Can not be the same as username … … 127 132 function UserAdvManager_InitPage() 128 133 { 134 load_language('plugin.lang', NBC_UserAdvManager_PATH); 129 135 global $conf, $template, $page, $lang; 130 136 … … 172 178 $_POST['login'] = ''; 173 179 } 180 181 /* Email without forbidden domains */ 182 /* This don't work on call of ValidateEmailProvider() function - Why ?? -> Due to the "return = false|true" in function ?*/ 183 //if (isset($conf_nbc_UserAdvManager[12]) and $conf_nbc_UserAdvManager[12] == 'true' and !empty($_POST['email']) and !ValidateEmailProvider($_POST['email'])) 184 //{ 185 // $lang['reg_err_login1'] = l10n('reg_err_login7')."'".$conf_nbc_UserAdvManager[13]."'"; 186 // $_POST['login'] = ''; 187 //} 188 /* This work with a code copy of ValidateEmailProvider() function */ 189 if (isset($conf_nbc_UserAdvManager[12]) and $conf_nbc_UserAdvManager[12] == 'true' and !empty($_POST['email'])) 190 { 191 $conf_nbc_MailExclusion = split (",",$conf_nbc_UserAdvManager[13]); 192 for ($i = 0 ; $i < count($conf_nbc_MailExclusion) ; $i++) 193 { 194 if (ereg($conf_nbc_MailExclusion[$i], $_POST['email'])) 195 { 196 $lang['reg_err_login1'] = l10n('reg_err_login7')."'".$conf_nbc_UserAdvManager[13]."'"; 197 $_POST['login'] = ''; 198 } 199 } 200 } 174 201 } 175 202 } … … 194 221 $_POST['login'] = ''; 195 222 } 223 224 225 /* Email without forbidden domains */ 226 /* This don't work on call of ValidateEmailProvider() function - Why ?? -> Due to the "return = false|true" in function ?*/ 227 //if (isset($conf_nbc_UserAdvManager[12]) and $conf_nbc_UserAdvManager[12] == 'true' and !empty($_POST['mail_address']) and !ValidateEmailProvider($_POST['mail_address'])) 228 //{ 229 // $lang['reg_err_mail_address'] = l10n('reg_err_login7')."'".$conf_nbc_UserAdvManager[13]."'"; 230 // $_POST['mail_address'] = ''; 231 //} 232 /* This work with a code copy of ValidateEmailProvider() function */ 233 if (isset($conf_nbc_UserAdvManager[12]) and $conf_nbc_UserAdvManager[12] == 'true' and !empty($_POST['mail_address'])) 234 { 235 $conf_nbc_MailExclusion = split (",",$conf_nbc_UserAdvManager[13]); 236 for ($i = 0 ; $i < count($conf_nbc_MailExclusion) ; $i++) 237 { 238 if (ereg($conf_nbc_MailExclusion[$i], $_POST['mail_address'])) 239 { 240 $lang['reg_err_login1'] = l10n('reg_err_login7')."'".$conf_nbc_UserAdvManager[13]."'"; 241 $_POST['login'] = ''; 242 } 243 } 244 } 196 245 } 197 246 } … … 247 296 $errors[] = $mail_error; 248 297 } 249 } 298 /* This don't work on user's profile page - Why ?? */ 299 if (isset($conf_nbc_UserAdvManager[12]) and $conf_nbc_UserAdvManager[12] == 'true' and !empty($_POST['mail_address'])) 300 { 301 $conf_nbc_MailExclusion = split (",",$conf_nbc_UserAdvManager[13]); 302 for ($i = 0 ; $i < count($conf_nbc_MailExclusion) ; $i++) 303 { 304 if (ereg($conf_nbc_MailExclusion[$i], $_POST['mail_address'])) 305 { 306 $mail_error = l10n('reg_err_login7')."'".$conf_nbc_UserAdvManager[13]."'"; 307 } 308 } 309 } 310 if (!empty($mail_error)) 311 { 312 $errors[] = $mail_error; 313 } 314 } 315 /* This don't work on call of ValidateEmailProvider() function - Why ?? -> Due to the "return = false|true" in function ?*/ 316 //if (isset($_POST['mail_address'])) 317 //{ 318 // $mail_error = ValidateEmailProvider($_POST['mail_address']); 319 // if (!empty($mail_error)) 320 // { 321 // $errors[] = $mail_error; 322 // } 323 //} 250 324 251 325 $typemail = 3; -
extensions/NBC_UserAdvManager/maintain.inc.php
r3352 r3385 10 10 $q = ' 11 11 INSERT INTO '.CONFIG_TABLE.' (param, value, comment) 12 VALUES ("nbc_UserAdvManager","true;false;false;-1;-1;-1;false;false;;-1;; ","Parametres du plugin nbc UserAdvManager")12 VALUES ("nbc_UserAdvManager","true;false;false;-1;-1;-1;false;false;;-1;;;false;;","Parametres du plugin nbc UserAdvManager") 13 13 ;'; 14 14 pwg_query($q);
Note: See TracChangeset
for help on using the changeset viewer.