Changeset 4317 for extensions/NBC_UserAdvManager/branches/2.12/main.inc.php
- Timestamp:
- Nov 19, 2009, 10:54:46 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/NBC_UserAdvManager/branches/2.12/main.inc.php
r4250 r4317 2 2 /* 3 3 Plugin Name: NBC UserAdvManager 4 Version: 2.12. 64 Version: 2.12.7 5 5 Description: 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 … … 99 99 -- 2.12.6 : Bug 1236 fixed - Admins was unable to add a new user in the user_list page. 100 100 Beginning of IT translations 101 102 -- 2.12.7 : Bug 1238 fixed - Simple custom email text wasn't send when Extended Description plugin wasn't set 103 Bug 1245 fixed - Semicolons (;) are no longer allowed in text areas (mail info text, ConfirmMail text, reminder text,...). They'll be replaced by dots (.). 104 Bug 1248 fixed - Php notice on user registration with a forbidden email domain 105 Bug 1250 fixed - Email provider didn't work after the third exclusion in list 106 Escaping all special characters typed in login name and recover them 101 107 */ 102 108 … … 286 292 from '.USERS_TABLE.' 287 293 where upper('.$conf['user_fields']['email'].') = upper(\''.$_POST['email'].'\');'; 288 list($count) = mysql_fetch_array(pwg_query($query)); 289 if ($count != 0) 290 { 291 return l10n('reg_err_mail_address_dbl'); 292 } 293 } 294 } 295 else 296 { 297 /* ***************************** */ 298 /* Standard Piwigo's email check */ 299 /* ***************************** */ 300 $atom = '[-a-z0-9!#$%&\'*+\\/=?^_`{|}~]'; // before arobase 301 $domain = '([a-z0-9]([-a-z0-9]*[a-z0-9]+)?)'; // domain name 302 $regex = '/^' . $atom . '+' . '(\.' . $atom . '+)*' . '@' . '(' . $domain . '{1,63}\.)+' . $domain . '{2,63}$/i'; 303 304 if (!preg_match($regex, $_POST['mail_address'])) 305 { 306 return l10n('reg_err_mail_address'); 307 } 308 309 if (!empty($_POST['mail_address'])) 310 { 311 $query = ' 312 select count(*) 313 from '.USERS_TABLE.' 314 where upper('.$conf['user_fields']['email'].') = upper(\''.$_POST['mail_address'].'\');'; 315 list($count) = mysql_fetch_array(pwg_query($query)); 294 list($count) = mysql_fetch_assoc(pwg_query($query)); 316 295 if ($count != 0) 317 296 { … … 372 351 373 352 /* Email without forbidden domains */ 374 if (isset($conf_nbc_UserAdvManager[12]) and $conf_nbc_UserAdvManager[12] == 'true' and !empty($_POST['mail_address']) and !ValidateEmailProvider($_POST['mail_address'])) 375 { 376 //$_POST['mail_address'] = ''; 377 return($lang['reg_err_login1'] = l10n('reg_err_login7')."'".$conf_nbc_UserAdvManager[13]."'"); 378 } 353 /* This doesn't work */ 354 // if (isset($conf_nbc_UserAdvManager[12]) and $conf_nbc_UserAdvManager[12] == 'true' and !empty($_POST['mail_address']) and !ValidateEmailProvider($_POST['mail_address'])) 355 // { 356 // $_POST['mail_address'] = ''; 357 // return($lang['reg_err_login1'] = l10n('reg_err_login7')."'".$conf_nbc_UserAdvManager[13]."'"); 358 // } 359 /* This work with a code copy of ValidateEmailProvider() function */ 360 if (isset($conf_nbc_UserAdvManager[12]) and $conf_nbc_UserAdvManager[12] == 'true' and !empty($_POST['mail_address'])) 361 { 362 $ncsemail = strtolower($_POST['mail_address']); 363 $conf_nbc_MailExclusion = preg_split("/[\s,]+/",$conf_nbc_UserAdvManager[13]); 364 for ($i = 0 ; $i < count($conf_nbc_MailExclusion) ; $i++) 365 { 366 $pattern = '/'.$conf_nbc_MailExclusion[$i].'/'; 367 if (preg_match($pattern, $ncsemail)) 368 { 369 $_POST['mail_address'] = ''; 370 return($lang['reg_err_login1'] = l10n('reg_err_login7')."'".$conf_nbc_UserAdvManager[13]."'"); 371 } 372 } 373 } 379 374 } 380 375 … … 393 388 { 394 389 /* Email without forbidden domains */ 395 if (isset($conf_nbc_UserAdvManager[12]) and $conf_nbc_UserAdvManager[12] == 'true' and !empty($_POST['mail_address'])) 396 { 397 if (!ValidateEmailProvider($_POST['mail_address'])) 390 /* This doesn't work */ 391 // if (isset($conf_nbc_UserAdvManager[12]) and $conf_nbc_UserAdvManager[12] == 'true' and !empty($_POST['mail_address'])) 392 // { 393 // if (!ValidateEmailProvider($_POST['mail_address'])) 394 // { 395 // $template->append('errors', l10n('reg_err_login7')."'".$conf_nbc_UserAdvManager[13]."'"); 396 // unset($_POST['validate']); 397 // } 398 // } 399 /* This work with a code copy of ValidateEmailProvider() function */ 400 if (isset($conf_nbc_UserAdvManager[12]) and $conf_nbc_UserAdvManager[12] == 'true' and !empty($_POST['mail_address'])) 398 401 { 399 $template->append('errors', l10n('reg_err_login7')."'".$conf_nbc_UserAdvManager[13]."'"); 400 unset($_POST['validate']); 402 $ncsemail = strtolower($_POST['mail_address']); 403 $conf_nbc_MailExclusion = preg_split("/[\s,]+/",$conf_nbc_UserAdvManager[13]); 404 for ($i = 0 ; $i < count($conf_nbc_MailExclusion) ; $i++) 405 { 406 $pattern = '/'.$conf_nbc_MailExclusion[$i].'/'; 407 if (preg_match($pattern, $ncsemail)) 408 { 409 $template->append('errors', l10n('reg_err_login7')."'".$conf_nbc_UserAdvManager[13]."'"); 410 unset($_POST['validate']); 411 } 412 } 401 413 } 402 }403 414 404 415 $typemail = 3; … … 424 435 425 436 /* Sending registration confirmation by email */ 426 if (( isset($conf_nbc_UserAdvManager[0]) and $conf_nbc_UserAdvManager[0] == 'true') or (isset($conf_nbc_UserAdvManager[2]) and $conf_nbc_UserAdvManager[2] == 'true'))437 if ((isset($conf_nbc_UserAdvManager[0]) and $conf_nbc_UserAdvManager[0] == 'true') or (isset($conf_nbc_UserAdvManager[2]) and $conf_nbc_UserAdvManager[2] == 'true')) 427 438 { 428 439 $confirm_mail_need = false; 429 440 430 if (!empty($_POST['mail_address']) and ValidateEmailProvider($_POST['mail_address']))441 if (!empty($_POST['mail_address'])) 431 442 { 432 443 $query = ' … … 438 449 list($current_email) = mysql_fetch_row(pwg_query($query)); 439 450 440 if ( $_POST['mail_address'] != $current_email and ( isset($conf_nbc_UserAdvManager[2]) and $conf_nbc_UserAdvManager[2] == 'true'))451 if ($_POST['mail_address'] != $current_email and ( isset($conf_nbc_UserAdvManager[2]) and $conf_nbc_UserAdvManager[2] == 'true')) 441 452 442 453 $confirm_mail_need = true; 443 454 } 444 455 445 if ((!empty($_POST['use_new_pwd']) and ( isset($conf_nbc_UserAdvManager[0]) and $conf_nbc_UserAdvManager[0] == 'true') or $confirm_mail_need))456 if ((!empty($_POST['use_new_pwd']) and (isset($conf_nbc_UserAdvManager[0]) and $conf_nbc_UserAdvManager[0] == 'true') or $confirm_mail_need)) 446 457 { 447 458 $query = ' … … 513 524 514 525 /* Email without forbidden domains */ 515 if (isset($conf_nbc_UserAdvManager[12]) and $conf_nbc_UserAdvManager[12] == 'true' and !empty($_POST['email']) and !ValidateEmailProvider($_POST['email'])) 516 { 517 $template->append('errors', l10n('reg_err_login7')."'".$conf_nbc_UserAdvManager[13]."'"); 518 unset($_POST['submit_add']); 526 /* This doesn't work */ 527 // if (isset($conf_nbc_UserAdvManager[12]) and $conf_nbc_UserAdvManager[12] == 'true' and !empty($_POST['email']) and !ValidateEmailProvider($_POST['email'])) 528 // { 529 // $template->append('errors', l10n('reg_err_login7')."'".$conf_nbc_UserAdvManager[13]."'"); 530 // unset($_POST['submit_add']); 531 // } 532 /* This work with a code copy of ValidateEmailProvider() function */ 533 if (isset($conf_nbc_UserAdvManager[12]) and $conf_nbc_UserAdvManager[12] == 'true' and !empty($_POST['email'])) 534 { 535 $ncsemail = strtolower($_POST['email']); 536 $conf_nbc_MailExclusion = preg_split("/[\s,]+/",$conf_nbc_UserAdvManager[13]); 537 for ($i = 0 ; $i < count($conf_nbc_MailExclusion) ; $i++) 538 { 539 $pattern = '/'.$conf_nbc_MailExclusion[$i].'/'; 540 if (preg_match($pattern, $ncsemail)) 541 { 542 $template->append('errors', l10n('reg_err_login7')."'".$conf_nbc_UserAdvManager[13]."'"); 543 unset($_POST['submit_add']); 544 } 545 } 519 546 } 520 547 }
Note: See TracChangeset
for help on using the changeset viewer.