Index: /extensions/NBC_UserAdvManager/branches/2.15/changelog.txt.php
===================================================================
--- /extensions/NBC_UserAdvManager/branches/2.15/changelog.txt.php	(revision 6999)
+++ /extensions/NBC_UserAdvManager/branches/2.15/changelog.txt.php	(revision 7000)
@@ -196,4 +196,6 @@
             Bug 1821 fixed - Cleanup of old deprecated functions slags (Case sensitivity on logins)
             Bug 1834 fixed - Improving plugin installation and uninstallation process
+
+-- 2.15.7 : Bug 1869 fixed - Compatibility with Adult_Content installation process
 */
 ?>
Index: /extensions/NBC_UserAdvManager/branches/2.15/language/de_DE/help/plugin.lang.php
===================================================================
--- /extensions/NBC_UserAdvManager/branches/2.15/language/de_DE/help/plugin.lang.php	(revision 6999)
+++ /extensions/NBC_UserAdvManager/branches/2.15/language/de_DE/help/plugin.lang.php	(revision 7000)
@@ -35,8 +35,4 @@
 Hinweis: Wenn der Benutzer erstellte Konto will Passwort zu ändern und Passwörter für die Benutzer Stärkung aktiv ist, wird es vorbehaltlich der Regel-Satz.';
 $lang['UAM_mailexcTitle'] = 'Ausschluss von Mail-Domänen';
-$lang['UAM_mailexcTitle_d'] = 'Standardmäßig akzeptiert Piwigo alle E-Mail-Adressen im Format xxx@yyy.zz. Durch die Aktivierung dieser Option können Sie auf bestimmte Domains im Format ausschließen: @[Domänenname].[Domain Extension].<br><br>
-Beispiele:<br>
-@hotmail.com -> Ausnahme-Adressen *@hotmail.com<br>
-@hotmail -> ohne alle Adressen *@hotmail *';
 $lang['UAM_infomailTitle'] = 'Informationen E-Mail an Benutzer';
 $lang['UAM_infomailTitle_d'] = 'Diese Option ermöglicht die Automatisierung Senden einer E-Mail-Informationen an einen Benutzer bei der Anmeldung oder bei Änderungen sein Passwort oder E-Mail-Adresse in ihrem Profil.<br><br>
@@ -183,3 +179,12 @@
 Bitte beachten Sie: Dieses Feature funktioniert nicht für alle registrierten Nutzer. Diejenigen mit &quot;admin&quot;, &quot;Webmaster&quot; oder &quot;Generic&quot; Status sind ausgeschlossen.';
 // --------- End: New or revised $lang ---- from version 2.15.6
+
+// --------- Starting below: New or revised $lang ---- from version 2.15.7
+$lang['UAM_mailexcTitle_d'] = 'Standardmäßig akzeptiert Piwigo alle E-Mail-Adressen im Format xxx@yyy.zz. Durch die Aktivierung dieser Option können Sie auf bestimmte Domains im Format ausschließen: @[Domänenname].[Domain Extension].<br><br>
+Beispiele:<br>
+@hotmail.com -> Ausnahme-Adressen *@hotmail.com<br>
+@hotmail -> ohne alle Adressen *@hotmail *
+<br><br>
+<b style=&quot;color: red;&quot;>Die Beschlagnahme ist nur möglich nach Eintragung der Option in der aktivierten Position.</b>';
+// --------- End: New or revised $lang ---- from version 2.15.7
 ?>
Index: /extensions/NBC_UserAdvManager/branches/2.15/language/en_UK/help/plugin.lang.php
===================================================================
--- /extensions/NBC_UserAdvManager/branches/2.15/language/en_UK/help/plugin.lang.php	(revision 6999)
+++ /extensions/NBC_UserAdvManager/branches/2.15/language/en_UK/help/plugin.lang.php	(revision 7000)
@@ -35,8 +35,4 @@
 Note: If the user account created wants to change password and strengthening passwords for users is active, it will be subject to the rule set.';
 $lang['UAM_mailexcTitle'] = 'Exclusion of mail domains';
-$lang['UAM_mailexcTitle_d'] = 'By default, Piwigo accepts all email addresses in the format xxx@yyy.zz. Enabling this option allows you to exclude certain domains in the format: @ [domain_name].[domain_extension].<br><br>
-Examples :<br>
-@hotmail.com -> excluding addresses *@hotmail.com<br>
-@hotmail -> excluding all addresses *@hotmail*';
 $lang['UAM_infomailTitle'] = 'Information email to user';
 $lang['UAM_infomailTitle_d'] = 'This option allows to automate sending an information email to a user when registering or when changes his password or email address in their profile.<br><br>
@@ -183,3 +179,12 @@
 Please note: This feature does not apply to all registered users. Those with &quot;admin&quot;, &quot;webmaster&quot; or &quot;generic&quot; status are excluded.';
 // --------- End: New or revised $lang ---- from version 2.15.6
+
+// --------- Starting below: New or revised $lang ---- from version 2.15.7
+$lang['UAM_mailexcTitle_d'] = 'By default, Piwigo accepts all email addresses in the format xxx@yyy.zz. Enabling this option allows you to exclude certain domains in the format: @ [domain_name].[domain_extension].<br><br>
+Examples :<br>
+@hotmail.com -> excluding addresses *@hotmail.com<br>
+@hotmail -> excluding all addresses *@hotmail*
+<br><br>
+<b style=&quot;color: red;&quot;>The seizure is only possible after registration of the option in the activated position.</b>';
+// --------- End: New or revised $lang ---- from version 2.15.7
 ?>
Index: /extensions/NBC_UserAdvManager/branches/2.15/language/es_ES/help/plugin.lang.php
===================================================================
--- /extensions/NBC_UserAdvManager/branches/2.15/language/es_ES/help/plugin.lang.php	(revision 6999)
+++ /extensions/NBC_UserAdvManager/branches/2.15/language/es_ES/help/plugin.lang.php	(revision 7000)
@@ -35,8 +35,4 @@
 Nota: Si el  usuario de la cuenta  creada quiere cambiar la contraseña, y el fortalecimiento de las contraseñas de los usuarios está activo, la misma estará sujeta a la norma establecida.';
 $lang['UAM_mailexcTitle'] = 'Exclusión de dominios de correo electrónico';
-$lang['UAM_mailexcTitle_d'] = 'De forma predeterminada, Piwigo acepta todas las direcciones de correo electrónico en el  formato xxx@yyy.zz. Al habilitar esta opción le permite excluir ciertos dominios en el formato: @[nombreDeDominio].[Domain_extension].<br><br>
-Ejemplos :<br>
-@hotmail.com -> con exclusión de direcciones *@hotmail.com<br>
-@hotmail -> con exclusión de todas las direcciones de *@hotmail*';
 $lang['UAM_infomailTitle'] = 'Información por correo electrónico para el usuario';
 $lang['UAM_infomailTitle_d'] = 'Esta opción permite automatizar el envío de un correo electrónico y la información a un usuario cuando se registra o cuando cambie su contraseña o dirección de correo electrónico en su perfil.<br><br>
@@ -184,3 +180,12 @@
 Atención: Esta característica no se aplica a todos los usuarios registrados. Las personas con estados &quot;admin&quot;, &quot;webmaster&quot; o &quot;generic&quot; están excluidos.';
 // --------- End: New or revised $lang ---- from version 2.15.6
+
+// --------- Starting below: New or revised $lang ---- from version 2.15.7
+$lang['UAM_mailexcTitle_d'] = 'De forma predeterminada, Piwigo acepta todas las direcciones de correo electrónico en el  formato xxx@yyy.zz. Al habilitar esta opción le permite excluir ciertos dominios en el formato: @[nombreDeDominio].[Domain_extension].<br><br>
+Ejemplos :<br>
+@hotmail.com -> con exclusión de direcciones *@hotmail.com<br>
+@hotmail -> con exclusión de todas las direcciones de *@hotmail*
+<br><br>
+<b style=&quot;color: red;&quot;>La convulsión sólo es posible tras el registro de la opción en la posición activada.</b>';
+// --------- End: New or revised $lang ---- from version 2.15.7
 ?>
Index: /extensions/NBC_UserAdvManager/branches/2.15/language/fr_FR/help/plugin.lang.php
===================================================================
--- /extensions/NBC_UserAdvManager/branches/2.15/language/fr_FR/help/plugin.lang.php	(revision 6999)
+++ /extensions/NBC_UserAdvManager/branches/2.15/language/fr_FR/help/plugin.lang.php	(revision 7000)
@@ -34,8 +34,4 @@
 A noter : Si l\'utilisateur du compte 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['UAM_mailexcTitle'] = 'Exclusion des domaines de messagerie';
-$lang['UAM_mailexcTitle_d'] = 'Par défaut, Piwigo accepte toutes les adresses de messagerie au format xxx@yyy.zz. L\'activation de cette option permet d\'exclure certains domaines selon le format : @[nom_du_domaine].[extension_du_domaine].<br><br>
-Exemples :<br>
-@hotmail.com -> exclusion des adresses *@hotmail.com<br>
-@hotmail -> exclusion de toutes les adresses *@hotmail*';
 $lang['UAM_infomailTitle'] = 'Email d\'information';
 $lang['UAM_infomailTitle_d'] = 'Cette option permet d\'automatiser l\'envoi d\'un email d\'information à un utilisateur lorsqu\'il s\'inscrit ou modifie son mot de passe ou son adresse de messagerie dans son profil.<br><br>
@@ -181,3 +177,12 @@
 A savoir: Cette fonction ne s\'applique pas à tous les utilisateurs déjà inscrits. Ceux disposant du status &quot;admin&quot;, &quot;webmaster&quot; ou &quot;generique&quot; sont exclus de la règle.';
 // --------- End: New or revised $lang ---- from version 2.15.6
+
+// --------- Starting below: New or revised $lang ---- from version 2.15.7
+$lang['UAM_mailexcTitle_d'] = 'Par défaut, Piwigo accepte toutes les adresses de messagerie au format xxx@yyy.zz. L\'activation de cette option permet d\'exclure certains domaines selon le format : @[nom_du_domaine].[extension_du_domaine].<br><br>
+Exemples :<br>
+@hotmail.com -> exclusion des adresses *@hotmail.com<br>
+@hotmail -> exclusion de toutes les adresses *@hotmail*
+<br><br>
+<b style=&quot;color: red;&quot;>La saisie n\'est possible qu\'après enregistrement de l\'option en position activée.</b>';
+// --------- End: New or revised $lang ---- from version 2.15.7
 ?>
Index: /extensions/NBC_UserAdvManager/branches/2.15/language/it_IT/help/plugin.lang.php
===================================================================
--- /extensions/NBC_UserAdvManager/branches/2.15/language/it_IT/help/plugin.lang.php	(revision 6999)
+++ /extensions/NBC_UserAdvManager/branches/2.15/language/it_IT/help/plugin.lang.php	(revision 7000)
@@ -35,8 +35,4 @@
 Nota: Se l\'account utente creato vuole cambiare la password e il rafforzamento password per gli utenti è attivo, sarà soggetta alla regola.';
 $lang['UAM_mailexcTitle'] = 'L\'esclusione Email domini';
-$lang['UAM_mailexcTitle_d'] = 'Per impostazione predefinita, PhpWebGallery accetta tutti gli indirizzi di posta elettronica nel xxx@yyy.zz formato. L\'attivazione di questa opzione consente di escludere determinati domini nel formato: @[nome_dominio].[Domain_extension].<br><br>
-Esempi :<br>
-@hotmail.com -> esclusi gli indirizzi *@hotmail.com<br>
-@hotmail -> escludendo tutti gli indirizzi *@hotmail*';
 $lang['UAM_infomailTitle'] = 'E-mail informazioni per l\'utente';
 $lang['UAM_infomailTitle_d'] = 'Questa opzione consente di automatizzare l\'invio di una e-mail le informazioni a un utente al momento della registrazione o quando cambia la sua password o indirizzo e-mail nel loro profilo.<br><br>
@@ -180,3 +176,12 @@
 Please note: This feature does not apply to all registered users. Those with &quot;admin&quot;, &quot;webmaster&quot; or &quot;generic&quot; status are excluded.';
 // --------- End: New or revised $lang ---- from version 2.15.6
+
+// --------- Starting below: New or revised $lang ---- from version 2.15.7
+$lang['UAM_mailexcTitle_d'] = 'Per impostazione predefinita, PhpWebGallery accetta tutti gli indirizzi di posta elettronica nel xxx@yyy.zz formato. L\'attivazione di questa opzione consente di escludere determinati domini nel formato: @[nome_dominio].[Domain_extension].<br><br>
+Esempi :<br>
+@hotmail.com -> esclusi gli indirizzi *@hotmail.com<br>
+@hotmail -> escludendo tutti gli indirizzi *@hotmail*
+<br><br>
+<b style=&quot;color: red;&quot;>Il sequestro è possibile solo dopo la registrazione della facoltà in posizione attiva.</b>';
+// --------- End: New or revised $lang ---- from version 2.15.7
 ?>
Index: /extensions/NBC_UserAdvManager/branches/2.15/main.inc.php
===================================================================
--- /extensions/NBC_UserAdvManager/branches/2.15/main.inc.php	(revision 6999)
+++ /extensions/NBC_UserAdvManager/branches/2.15/main.inc.php	(revision 7000)
@@ -2,5 +2,5 @@
 /*
 Plugin Name: UserAdvManager
-Version: 2.15.6
+Version: 2.15.7
 Description: Renforcer la gestion des utilisateurs - Enforce users management
 Plugin URI: http://fr.piwigo.org/ext/extension_view.php?eid=216
@@ -56,6 +56,6 @@
   $conf_UAM = unserialize($conf['UserAdvManager']);
 
-  /* Admins and Guests are not tracked for Ghost Tracker or Users Tracker */
-  if (!is_admin() and !is_a_guest())
+  /* Admins, Guests and Adult_Content users are not tracked for Ghost Tracker or Users Tracker */
+  if (!is_admin() and !is_a_guest() and $user['username'] != "16" and $user['username'] != "18")
   {
     if ((isset($conf_UAM[16]) and $conf_UAM[16] == 'true') or (isset($conf_UAM[19]) and $conf_UAM[19] == 'true'))
@@ -106,40 +106,44 @@
 
   $conf_UAM = unserialize($conf['UserAdvManager']);
-  
-  if ((isset($conf_UAM[0]) and $conf_UAM[0] == 'true') and (isset($conf_UAM[1]) and $conf_UAM[1] == 'local'))
-  {
-    /* This is to send an information email and set user to "waiting" group or status until admin validation */
-    $passwd = (isset($_POST['password'])) ? $_POST['password'] : '';
-    SendMail2User(1, $register_user['id'], $register_user['username'], $passwd, $register_user['email'], false);
-    setgroup($register_user['id']);// Set to "waiting" group or status until admin validation
-  }
-  elseif ((isset($conf_UAM[0]) and $conf_UAM[0] == 'false') and (isset($conf_UAM[1]) and $conf_UAM[1] == 'local'))
-  {
-    /* This is to set user to "wainting" group or status until admin validation */
-    setgroup($register_user['id']);// Set to "waiting" group or status until admin validation
-  }
-  elseif ((isset($conf_UAM[0]) and $conf_UAM[0] == 'true') and (isset($conf_UAM[1]) and $conf_UAM[1] == 'false'))
-  {
-    /* This is to send an information email without validation key */
-    $passwd = (isset($_POST['password'])) ? $_POST['password'] : '';
-    SendMail2User(1, $register_user['id'], $register_user['username'], $passwd, $register_user['email'], false);
-  }
-  /* Sending registration confirmation by email */
-  elseif ((isset($conf_UAM[0]) and $conf_UAM[0] == 'true') and (isset($conf_UAM[1]) and $conf_UAM[1] == 'true'))
-  {
-    if (is_admin() and isset($conf_UAM[20]) and $conf_UAM[20] == 'true')
-    {
-      $passwd = (isset($_POST['password'])) ? $_POST['password'] : '';
-      SendMail2User(1, $register_user['id'], $register_user['username'], $passwd, $register_user['email'], true); 
-    }
-    elseif (is_admin() and isset($conf_UAM[20]) and $conf_UAM[20] == 'false')
-    {
+
+  // Exclusion of Adult_Content users
+  if ($register_user['username'] != "16" and $register_user['username'] != "18")
+  {
+    if ((isset($conf_UAM[0]) and $conf_UAM[0] == 'true') and (isset($conf_UAM[1]) and $conf_UAM[1] == 'local') and ($register_user['username'] != "16" and $register_user['username'] != "18"))
+    {
+      /* This is to send an information email and set user to "waiting" group or status until admin validation */
       $passwd = (isset($_POST['password'])) ? $_POST['password'] : '';
       SendMail2User(1, $register_user['id'], $register_user['username'], $passwd, $register_user['email'], false);
-    }
-    elseif (!is_admin())
-    {
+      setgroup($register_user['id']);// Set to "waiting" group or status until admin validation
+    }
+    elseif ((isset($conf_UAM[0]) and $conf_UAM[0] == 'false') and (isset($conf_UAM[1]) and $conf_UAM[1] == 'local') and ($register_user['username'] != "16" and $register_user['username'] != "18"))
+    {
+      /* This is to set user to "waiting" group or status until admin validation */
+      setgroup($register_user['id']);// Set to "waiting" group or status until admin validation
+    }
+    elseif ((isset($conf_UAM[0]) and $conf_UAM[0] == 'true') and (isset($conf_UAM[1]) and $conf_UAM[1] == 'false') and ($register_user['username'] != "16" and $register_user['username'] != "18"))
+    {
+      /* This is to send an information email without validation key */
       $passwd = (isset($_POST['password'])) ? $_POST['password'] : '';
-      SendMail2User(1, $register_user['id'], $register_user['username'], $passwd, $register_user['email'], true);
+      SendMail2User(1, $register_user['id'], $register_user['username'], $passwd, $register_user['email'], false);
+    }
+    /* Sending registration confirmation by email */
+    elseif ((isset($conf_UAM[0]) and $conf_UAM[0] == 'true') and (isset($conf_UAM[1]) and $conf_UAM[1] == 'true') and ($register_user['username'] != "16" and $register_user['username'] != "18"))
+    {
+      if (is_admin() and isset($conf_UAM[20]) and $conf_UAM[20] == 'true')
+      {
+        $passwd = (isset($_POST['password'])) ? $_POST['password'] : '';
+        SendMail2User(1, $register_user['id'], $register_user['username'], $passwd, $register_user['email'], true); 
+      }
+      elseif (is_admin() and isset($conf_UAM[20]) and $conf_UAM[20] == 'false')
+      {
+        $passwd = (isset($_POST['password'])) ? $_POST['password'] : '';
+        SendMail2User(1, $register_user['id'], $register_user['username'], $passwd, $register_user['email'], false);
+      }
+      elseif (!is_admin())
+      {
+        $passwd = (isset($_POST['password'])) ? $_POST['password'] : '';
+        SendMail2User(1, $register_user['id'], $register_user['username'], $passwd, $register_user['email'], true);
+      }
     }
   }
@@ -161,5 +165,5 @@
 
 
-/* Check users registration */
+// Check users registration
 add_event_handler('register_user_check', 'UAM_RegistrationCheck', EVENT_HANDLER_PRIORITY_NEUTRAL, 2);
 
@@ -168,124 +172,128 @@
   global $errors, $conf;
 
-/* *********************************************************** */
-/* We need to reset the standard Piwigo's register controls    */
-/* because the call of register_user_check trigger resets them */
-/* *********************************************************** */
-  /* ********************************** */
-  /* Standard Piwigo's username control */
-  /* ********************************** */
-  if ($_POST['login'] == '')
-  {
-    return l10n('reg_err_login1');
-  }
-  if (preg_match('/^.* $/', $_POST['login']))
-  {
-    return l10n('reg_err_login2');
-  }
-  if (preg_match('/^ .*$/', $_POST['login']))
-  {
-    return l10n('reg_err_login3');
-  }
-  if (get_userid($_POST['login']))
-  {
-    return l10n('reg_err_login5');
-  }
-  
-  if (script_basename() == 'admin' and isset($_GET['page']) and $_GET['page'] == 'user_list') /* not the same email variable if we are on users registration page or on admin's user registration page*/
-  {
-  /* Email doblons check */
-    $atom   = '[-a-z0-9!#$%&\'*+\\/=?^_`{|}~]';   // before  arobase
-    $domain = '([a-z0-9]([-a-z0-9]*[a-z0-9]+)?)'; // domain name
-    $regex = '/^' . $atom . '+' . '(\.' . $atom . '+)*' . '@' . '(' . $domain . '{1,63}\.)+' . $domain . '{2,63}$/i';
-  
-    if (!preg_match($regex, $_POST['email']))
-    {
-      return l10n('reg_err_mail_address');
-    }
+  // Exclusion of Adult_Content users
+  if ($user['username'] != "16" and $user['username'] != "18")
+  {
+// ***********************************************************
+// We need to reset the standard Piwigo's register controls   
+// because the call of register_user_check trigger resets them
+// ***********************************************************
+  // **********************************
+  // Standard Piwigo's username control
+  // **********************************
+    if ($_POST['login'] == '')
+    {
+      return l10n('reg_err_login1');
+    }
+    if (preg_match('/^.* $/', $_POST['login']))
+    {
+      return l10n('reg_err_login2');
+    }
+    if (preg_match('/^ .*$/', $_POST['login']))
+    {
+      return l10n('reg_err_login3');
+    }
+    if (get_userid($_POST['login']))
+    {
+      return l10n('reg_err_login5');
+    }
+  
+    if (script_basename() == 'admin' and isset($_GET['page']) and $_GET['page'] == 'user_list') // not the same email variable if we are on users registration page or on admin's user registration page
+    {
+    // Email doblons check
+      $atom   = '[-a-z0-9!#$%&\'*+\\/=?^_`{|}~]';   // before  arobase
+      $domain = '([a-z0-9]([-a-z0-9]*[a-z0-9]+)?)'; // domain name
+      $regex = '/^' . $atom . '+' . '(\.' . $atom . '+)*' . '@' . '(' . $domain . '{1,63}\.)+' . $domain . '{2,63}$/i';
+  
+      if (!preg_match($regex, $_POST['email']))
+      {
+        return l10n('reg_err_mail_address');
+      }
     
-    $query = '
+      $query = '
 SELECT count(*)
 FROM '.USERS_TABLE.'
 WHERE upper('.$conf['user_fields']['email'].') = upper(\''.$_POST['email'].'\')
 ;';
-    list($count) = pwg_db_fetch_row(pwg_query($query));
-    if ($count != 0)
-    {
-      return l10n('reg_err_mail_address_dbl');
-    }
-  }
-
-  if (script_basename() == 'register') /* not the same email variable if we are on users registration page or on admin's user registration page*/
-  {
-  /* Email doblons check */
-    $atom   = '[-a-z0-9!#$%&\'*+\\/=?^_`{|}~]';   // before  arobase
-    $domain = '([a-z0-9]([-a-z0-9]*[a-z0-9]+)?)'; // domain name
-    $regex = '/^' . $atom . '+' . '(\.' . $atom . '+)*' . '@' . '(' . $domain . '{1,63}\.)+' . $domain . '{2,63}$/i';
-  
-    if (!preg_match($regex, $_POST['mail_address']))
-    {
-      return l10n('reg_err_mail_address');
-    }
+      list($count) = pwg_db_fetch_row(pwg_query($query));
+      if ($count != 0)
+      {
+        return l10n('reg_err_mail_address_dbl');
+      }
+    }
+
+    if (script_basename() == 'register') // not the same email variable if we are on users registration page or on admin's user registration page
+    {
+  // Email doblons check
+      $atom   = '[-a-z0-9!#$%&\'*+\\/=?^_`{|}~]';   // before  arobase
+      $domain = '([a-z0-9]([-a-z0-9]*[a-z0-9]+)?)'; // domain name
+      $regex = '/^' . $atom . '+' . '(\.' . $atom . '+)*' . '@' . '(' . $domain . '{1,63}\.)+' . $domain . '{2,63}$/i';
+  
+      if (!preg_match($regex, $_POST['mail_address']))
+      {
+        return l10n('reg_err_mail_address');
+      }
     
-    $query = '
+      $query = '
 SELECT count(*)
 FROM '.USERS_TABLE.'
 WHERE upper('.$conf['user_fields']['email'].') = upper(\''.$_POST['mail_address'].'\')
 ;';
-    list($count) = pwg_db_fetch_row(pwg_query($query));
-    if ($count != 0)
-    {
-      return l10n('reg_err_mail_address_dbl');
-    }
-  }
-/* ****************************************** */
-/* End of Piwigo's standard register controls */
-/* ****************************************** */
-
-
-/* ****************************************** */
-/* Here begins the advanced register controls */
-/* ****************************************** */
-  $PasswordCheck = 0;
-
-  $conf_UAM = unserialize($conf['UserAdvManager']);
-
-  /* Password enforcement control */
-  if (isset($conf_UAM[13]) and $conf_UAM[13] == 'true' and !empty($conf_UAM[14]))
-  {
-    if (!empty($user['password']) and !is_admin())
-    {
-      $PasswordCheck = testpassword($user['password']);
-  
-      if ($PasswordCheck < $conf_UAM[14])
-      {
-        $message = get_l10n_args('reg_err_login4_%s', $PasswordCheck);
-        return($lang['reg_err_pass'] = l10n_args($message).$conf_UAM[14]);
-      }
-    }
-    else if (!empty($user['password']) and is_admin() and isset($conf_UAM[15]) and $conf_UAM[15] == 'true')
-    { 
-      $PasswordCheck = testpassword($user['password']);
-  
-      if ($PasswordCheck < $conf_UAM[14])
-      {
-        $message = get_l10n_args('reg_err_login4_%s', $PasswordCheck);
-        return($lang['reg_err_pass'] = l10n_args($message).$conf_UAM[14]);
-      }
-    }
-  }
-
-  /* Username without forbidden keys */
-  if (isset($conf_UAM[6]) and $conf_UAM[6] == 'true' and !empty($_POST['login']) and ValidateUsername($_POST['login']) and !is_admin())
-  {
-    $_POST['login'] = '';
-    return($lang['reg_err_login1'] = l10n('reg_err_login6')."'".$conf_UAM[7]."'");
-  }
-
-  /* Email without forbidden domains */
-  if (isset($conf_UAM[11]) and $conf_UAM[11] == 'true' and !empty($_POST['mail_address']) and ValidateEmailProvider($_POST['mail_address']) and !is_admin())
-  {
-    $_POST['mail_address'] = '';
-    return($lang['reg_err_login1'] = l10n('reg_err_login7')."'".$conf_UAM[12]."'");
+      list($count) = pwg_db_fetch_row(pwg_query($query));
+      if ($count != 0)
+      {
+        return l10n('reg_err_mail_address_dbl');
+      }
+    }
+// ******************************************
+// End of Piwigo's standard register controls
+// ******************************************
+
+
+// ******************************************
+// Here begins the advanced register controls
+// ******************************************
+    $PasswordCheck = 0;
+
+    $conf_UAM = unserialize($conf['UserAdvManager']);
+
+    // Password enforcement control
+    if (isset($conf_UAM[13]) and $conf_UAM[13] == 'true' and !empty($conf_UAM[14]))
+    {
+      if (!empty($user['password']) and !is_admin())
+      {
+        $PasswordCheck = testpassword($user['password']);
+  
+        if ($PasswordCheck < $conf_UAM[14])
+        {
+          $message = get_l10n_args('reg_err_login4_%s', $PasswordCheck);
+          return($lang['reg_err_pass'] = l10n_args($message).$conf_UAM[14]);
+        }
+      }
+      else if (!empty($user['password']) and is_admin() and isset($conf_UAM[15]) and $conf_UAM[15] == 'true')
+      {
+        $PasswordCheck = testpassword($user['password']);
+  
+        if ($PasswordCheck < $conf_UAM[14])
+        {
+          $message = get_l10n_args('reg_err_login4_%s', $PasswordCheck);
+          return($lang['reg_err_pass'] = l10n_args($message).$conf_UAM[14]);
+        }
+      }
+    }
+
+    // Username without forbidden keys
+    if (isset($conf_UAM[6]) and $conf_UAM[6] == 'true' and !empty($_POST['login']) and ValidateUsername($_POST['login']) and !is_admin())
+    {
+      $_POST['login'] = '';
+      return($lang['reg_err_login1'] = l10n('reg_err_login6')."'".$conf_UAM[7]."'");
+    }
+
+    // Email without forbidden domains
+    if (isset($conf_UAM[11]) and $conf_UAM[11] == 'true' and !empty($_POST['mail_address']) and ValidateEmailProvider($_POST['mail_address']) and !is_admin())
+    {
+      $_POST['mail_address'] = '';
+      return($lang['reg_err_login1'] = l10n('reg_err_login7')."'".$conf_UAM[12]."'");
+    }
   }
 }
@@ -301,5 +309,5 @@
 
     $conf_UAM = unserialize($conf['UserAdvManager']);
-
+    
     if ((isset($conf_UAM[21]) and $conf_UAM[21] == 'true'))
     {
