Index: /extensions/NBC_UserAdvManager/ConfirmMail.php
===================================================================
--- /extensions/NBC_UserAdvManager/ConfirmMail.php	(revision 3352)
+++ /extensions/NBC_UserAdvManager/ConfirmMail.php	(revision 3352)
@@ -0,0 +1,63 @@
+<?php
+//----------------------------------------------------------- include
+define('PHPWG_ROOT_PATH','./../../');
+include_once( PHPWG_ROOT_PATH.'include/common.inc.php' );
+include_once (NBC_UserAdvManager_PATH.'include/constants.php');
+include_once (NBC_UserAdvManager_PATH.'include/functions_UserAdvManager.inc.php');
+
+// +-----------------------------------------------------------------------+
+// | Check Access and exit when user status is not ok                      |
+// +-----------------------------------------------------------------------+
+//check_status(ACCESS_NONE);
+load_language('plugin.lang', NBC_UserAdvManager_PATH);
+
+if ( isset($_GET['key']) )
+{
+
+  if ( VerifyConfirmMail($_GET['key']) )
+    $template->assign(array(
+      'CONFIRM_MAIL_MESSAGE' => l10n('confirm_mail_ok'),
+    ));
+  else  
+    $template->assign(array(
+      'CONFIRM_MAIL_MESSAGE' => l10n('confirm_mail_bad'),
+    ));
+      
+    
+//    redirect(make_index_url());
+}
+
+/**
+ * set in ./language/en_UK.iso-8859-1/local.lang.php (maybe to create)
+ * for example for clear theme:
+  $lang['Theme: clear'] = 'This is the clear theme based on yoga template. '.
+  ' A standard template/theme of PhpWebgallery.';
+ *
+ * Don't forget php tags !!!
+ *
+ * Another way is to code it thru the theme itself in ./themeconf.inc.php
+ */
+
+$title= l10n('confirm_mail_page_title');
+$page['body_id'] = 'theAboutPage';
+include(PHPWG_ROOT_PATH.'include/page_header.php');
+
+@include(PHPWG_ROOT_PATH.'template/'.$user['template'].
+  '/theme/'.$user['theme'].'/themeconf.inc.php');
+
+/* $template->set_filenames(array('confirm_mail' => realpath(NBC_UserAdvManager_PATH . 'ConfirmMail.tpl')));*/
+$template->set_filenames(
+  array(
+    'confirm_mail'=>NBC_UserAdvManager_PATH.'ConfirmMail.tpl',
+    )
+  );
+if ( isset($lang['Theme: '.$user['theme']]) )
+{
+  $template->assign(
+    'THEME_ABOUT',l10n('Theme: '.$user['theme'])
+    );
+}
+
+$template->pparse('confirm_mail');
+include(PHPWG_ROOT_PATH.'include/page_tail.php');
+?>
Index: /extensions/NBC_UserAdvManager/ConfirmMail.tpl
===================================================================
--- /extensions/NBC_UserAdvManager/ConfirmMail.tpl	(revision 3352)
+++ /extensions/NBC_UserAdvManager/ConfirmMail.tpl	(revision 3352)
@@ -0,0 +1,16 @@
+{* $Id: ConfirmMail.tpl $ *}
+<div id="content" class="content">
+  <div class="titrePage">
+    <ul class="categoryActions">
+      <li>
+        <a href="{$U_HOME}" title="{'return to homepage'|@translate}">
+          <img src="{$themeconf.icon_dir}/home.png" class="button" alt="{'home'|@translate}"/>
+        </a>
+      </li>
+    </ul>
+    <h2>{'title_confirm_mail'|@translate}</h2>
+  </div>
+  <ul>
+  {$CONFIRM_MAIL_MESSAGE}
+  </ul>
+</div>
Index: /extensions/NBC_UserAdvManager/admin/UserAdvManager_admin.php
===================================================================
--- /extensions/NBC_UserAdvManager/admin/UserAdvManager_admin.php	(revision 3352)
+++ /extensions/NBC_UserAdvManager/admin/UserAdvManager_admin.php	(revision 3352)
@@ -0,0 +1,226 @@
+<?php
+
+global $user, $lang, $conf, $errors;
+
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+// +-----------------------------------------------------------------------+
+// | Check Access and exit when user status is not ok                      |
+// +-----------------------------------------------------------------------+
+check_status(ACCESS_ADMINISTRATOR);
+
+load_language('plugin.lang', NBC_UserAdvManager_PATH);
+
+$error = array();
+
+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']) )
+{
+  $_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'];
+
+  $conf['nbc_UserAdvManager'] = $newconf_nbc_UserAdvManager;
+  
+  $query = '
+    UPDATE '.CONFIG_TABLE.'
+    SET value="'.$newconf_nbc_UserAdvManager.'"
+    WHERE param="nbc_UserAdvManager"
+    LIMIT 1
+  ;';
+  pwg_query($query);
+        
+  array_push($page['infos'], l10n('UserAdvManager_save_config'));
+}
+
+
+
+$conf_nbc_UserAdvManager = isset($conf['nbc_UserAdvManager']) ? explode(";" , $conf['nbc_UserAdvManager']) : array();
+
+/* Group setting for unvalidated and validated users */
+$groups[-1] = '---------';
+$No_Valid = -1;
+$Valid = -1;
+
+/* Check groups list in database  */
+$query = '
+SELECT id, name
+  FROM '.GROUPS_TABLE.'
+  ORDER BY name ASC
+;';
+$result = pwg_query($query);
+
+while ($row = mysql_fetch_array($result))
+{
+  $groups[$row['id']] = $row['name'];
+  /* configuration value for unvalidated users */
+  if (isset($conf_nbc_UserAdvManager[3]) and $conf_nbc_UserAdvManager[3] == $row['id'])
+  {
+    $No_Valid = $row['id'];
+  }
+  /* configuration value for validated users */
+  if (isset($conf_nbc_UserAdvManager[4]) and $conf_nbc_UserAdvManager[4] == $row['id'])
+  {
+    $Valid = $row['id'];
+  }
+}
+
+/* Template initialization for unvalidated users group */
+$template->assign(
+  'No_Confirm_Group',
+    array(
+      'group_options'=> $groups,
+      'group_selected' => $No_Valid
+    )
+  );
+/* Template initialization for validated users group */
+$template->assign(
+	'Validated_Group',
+	array(
+        'group_options'=> $groups,
+        'group_selected' => $Valid
+    )
+);
+
+/* Status setting for unvalidated and validated users */
+$status_options[-1] = '------------';
+$No_Valid_Status = -1;
+$Valid_Status = -1;
+
+/* Get status values */
+foreach (get_enums(USER_INFOS_TABLE, 'status') as $status)
+{
+  $status_options[$status] = l10n('user_status_'.$status);
+  	if (isset($conf_nbc_UserAdvManager[9]) and $conf_nbc_UserAdvManager[9] == $status)
+	{
+		$No_Valid_Status = $status;
+	}
+/* Template initialization for unvalidated users group */
+  $template->assign(
+    'No_Confirm_Status',
+    array(
+      'Status_options' => $status_options,
+      'Status_selected' => $No_Valid_Status
+      ));
+}
+/* Get status values */
+foreach (get_enums(USER_INFOS_TABLE, 'status') as $status)
+{
+  $status_options[$status] = l10n('user_status_'.$status);
+  	if (isset($conf_nbc_UserAdvManager[5]) and $conf_nbc_UserAdvManager[5] == $status)
+	{
+		$Valid_Status = $status;
+	}
+/* Template initialization for unvalidated users group */
+  $template->assign(
+    'Confirm_Status',
+    array(
+      'Status_options' => $status_options,
+      'Status_selected' => $Valid_Status
+      ));
+}
+
+
+$template->assign(
+  array(
+    'UserAdvManager_MAIL_INFO_TRUE'       => $conf_nbc_UserAdvManager[0]=='true' ?  'checked="checked"' : '' ,
+    'UserAdvManager_MAIL_INFO_FALSE'      => $conf_nbc_UserAdvManager[0]=='false' ?  'checked="checked"' : '' ,
+    'UserAdvManager_MAILINFO_TEXT'        => $conf_nbc_UserAdvManager[10],
+    'UserAdvManager_NO_CASSE_TRUE'        => $conf_nbc_UserAdvManager[1]=='true' ?  'checked="checked"' : '' ,
+    'UserAdvManager_NO_CASSE_FALSE'       => $conf_nbc_UserAdvManager[1]=='false' ?  'checked="checked"' : '' ,
+    'UserAdvManager_USERNAME_CHAR_TRUE'   => $conf_nbc_UserAdvManager[7]=='true' ?  'checked="checked"' : '' ,
+    'UserAdvManager_USERNAME_CHAR_FALSE'  => $conf_nbc_UserAdvManager[7]=='false' ?  'checked="checked"' : '' ,
+    'UserAdvManager_USERNAME_CHAR_LIST'   => $conf_nbc_UserAdvManager[8],
+    'UserAdvManager_CONFIRM_MAIL_TRUE'    => $conf_nbc_UserAdvManager[2]=='true' ?  'checked="checked"' : '' ,
+    'UserAdvManager_CONFIRM_MAIL_FALSE'   => $conf_nbc_UserAdvManager[2]=='false' ?  'checked="checked"' : '' ,
+    'UserAdvManager_CONFIRMMAIL_TEXT'     => $conf_nbc_UserAdvManager[11],
+    'UserAdvManager_No_Confirm_Group'     => $conf_nbc_UserAdvManager[3],
+    'UserAdvManager_Validated_Group'      => $conf_nbc_UserAdvManager[4],
+    'UserAdvManager_No_Confirm_Status'    => $conf_nbc_UserAdvManager[9],
+    'UserAdvManager_Validated_Status'     => $conf_nbc_UserAdvManager[5],
+    'UserAdvManager_NO_COMMENT_ANO_TRUE'  => $conf_nbc_UserAdvManager[6]=='true' ?  'checked="checked"' : '' ,
+    'UserAdvManager_NO_COMMENT_ANO_FALSE' => $conf_nbc_UserAdvManager[6]=='false' ?  'checked="checked"' : '' ,
+  )
+);
+
+function Audit_UserAdvManager()
+{
+  global $page, $conf, $errors;
+
+  $page_UserAdvMAnager_admin = get_admin_plugin_menu_link(__FILE__);
+
+  $msg_error1 = '';
+  $msg_error2 = '';
+  $msg_ok_Audit = '';
+  $msg_error_Audit = '';
+
+  /* Usename non case sensitive */  
+  if (isset($conf_nbc_UserAdvManager[1]) and $conf_nbc_UserAdvManager[1] == 'true')
+  {
+    $query = "
+      SELECT ".$conf['user_fields']['username']."
+      FROM ".USERS_TABLE." p1
+      WHERE EXISTS(
+        SELECT ".$conf['user_fields']['username']."
+        FROM ".USERS_TABLE." p2
+        WHERE p1.".$conf['user_fields']['id']." <> p2.".$conf['user_fields']['id']."
+        AND LOWER(p1.".$conf['user_fields']['username'].") = LOWER(p2.".$conf['user_fields']['username'].")
+      )
+    ;";
+    $result = pwg_query($query);
+  while($row = mysql_fetch_array($result))
+    $msg_error1 .= '<br/>'.l10n('Err_audit_no_casse').$row['username'];
+    
+  if ($msg_error1 == '')
+    array_push($page['infos'], l10n('UserAdvManager_audit_ok'));
+  else
+    $msg_error1 = l10n('Err_audit_no_casse').$row['username'];
+  }
+
+  /* Username without forbidden keys */
+  if ( isset($conf_nbc_UserAdvManager[7]) and $conf_nbc_UserAdvManager[7] == 'true' )
+  {
+    $query = "
+      SELECT ".$conf['user_fields']['username'].", ".$conf['user_fields']['email']."
+      FROM ".USERS_TABLE."
+    ;";
+    $result = pwg_query($query);
+
+  while($row = mysql_fetch_array($result))
+    $msg_error2 .= '<br/>'.l10n('Err_audit_username_char').$row['username'].' ('.$row['mail_address'].')';
+
+  if ($msg_error2 == '')
+    array_push($page['infos'], l10n('UserAdvManager_audit_ok'));
+  else
+    $msg_error2 = l10n('Err_audit_username_char').$row['username'].' ('.$row['mail_address'].')';
+  }
+
+  if ($msg_error1 <> '')
+    $errors[] = $msg_error1.'<br/><br/>';
+  if ($msg_error2 <> '')
+    $errors[] = $msg_error2.'<br/><br/>';
+
+  if ($msg_error1 <> '' or $msg_error2 <> '')
+    $errors[] = l10n('Err_audit_advise');
+  else
+    array_push($page['infos'], l10n('UserAdvManager_audit_ok'));
+}
+
+if ( isset($_POST['audit']) or isset($_POST['submit']) )
+{
+	Audit_UserAdvManager();
+}
+// +-----------------------------------------------------------------------+
+// |                             errors display                            |
+// +-----------------------------------------------------------------------+
+if ( isset ($errors) and count($errors) != 0)
+{
+  $template->assign('errors',array());
+  foreach ($errors as $error)
+  {
+    $template->assign('errors.error', array('ERROR'=>$error));
+  }
+}
+
+$template->set_filenames(array('plugin_admin_content' => dirname(__FILE__) . '/UserAdvManager_admin.tpl'));
+$template->assign_var_from_handle( 'ADMIN_CONTENT', 'plugin_admin_content');
+?>
Index: /extensions/NBC_UserAdvManager/admin/UserAdvManager_admin.tpl
===================================================================
--- /extensions/NBC_UserAdvManager/admin/UserAdvManager_admin.tpl	(revision 3352)
+++ /extensions/NBC_UserAdvManager/admin/UserAdvManager_admin.tpl	(revision 3352)
@@ -0,0 +1,62 @@
+<div class="titrePage">
+  <h2>{'Title'|@translate}</h2>
+</div>
+
+<form method="post" action="{$UserAdvManager_F_ACTION}" class="general">
+  <fieldset>
+  	<legend>{'UserAdvManager_Title'|@translate}</legend>
+    <ul>
+    	<li><label>{'UserAdvManager_Mail_Info'|@translate}</label><br/>
+        <input type="radio" value="true" {$UserAdvManager_MAIL_INFO_TRUE} name="UserAdvManager_Mail_Info"/>{'UserAdvManager_Mail_Info_true'|@translate}<br/>
+        <input type="radio" value="false" {$UserAdvManager_MAIL_INFO_FALSE} name="UserAdvManager_Mail_Info"/>{'UserAdvManager_Mail_Info_false'|@translate}<br/>
+    	</li>
+    	<br/>
+    	<li><label>{'UserAdvManager_MailInfo_Text'|@translate}</label><br/>
+        <textarea name="UserAdvManager_MailInfo_Text" id="UserAdvManager_MailInfo_Text" rows="10" cols="80" {$TAG_INPUT_ENABLED}>{$UserAdvManager_MAILINFO_TEXT}</textarea>
+    	</li>
+    	<br/>
+    	<li><label>{'UserAdvManager_No_Casse'|@translate}</label><br/>
+        <input type="radio" value="true" {$UserAdvManager_NO_CASSE_TRUE} name="UserAdvManager_No_Casse"/>{'UserAdvManager_No_Casse_true'|@translate}<br/>
+        <input type="radio" value="false" {$UserAdvManager_NO_CASSE_FALSE} name="UserAdvManager_No_Casse"/>{'UserAdvManager_No_Casse_false'|@translate}<br/>
+    	</li>
+    	<br/>
+    	<li><label>{'UserAdvManager_Username_Char'|@translate}</label><br/>
+        <input type="radio" value="true" {$UserAdvManager_USERNAME_CHAR_TRUE} name="UserAdvManager_Username_Char"/>{'UserAdvManager_Username_Char_true'|@translate}
+        <input type="text" name="UserAdvManager_Username_List" value="{$UserAdvManager_USERNAME_CHAR_LIST}" size="20" style="text-align: center;"/><br/>
+        <input type="radio" value="false" {$UserAdvManager_USERNAME_CHAR_FALSE} name="UserAdvManager_Username_Char"/>{'UserAdvManager_Username_Char_false'|@translate}<br/>
+    	</li>
+    	<br/>
+    	<li><label>{'UserAdvManager_Confirm_Mail'|@translate}</label><br/>
+        <input type="radio" value="true" {$UserAdvManager_CONFIRM_MAIL_TRUE} name="UserAdvManager_Confirm_Mail"/>{'UserAdvManager_Confirm_Mail_true'|@translate}<br/>
+        <input type="radio" value="false" {$UserAdvManager_CONFIRM_MAIL_FALSE} name="UserAdvManager_Confirm_Mail"/>{'UserAdvManager_Confirm_Mail_false'|@translate}<br/>
+    	</li>
+    	<br/>
+    	<li><label>{'UserAdvManager_ConfirmMail_Text'|@translate}</label><br/>
+        <textarea name="UserAdvManager_ConfirmMail_Text" id="UserAdvManager_ConfirmMail_Text" rows="10" cols="80" {$TAG_INPUT_ENABLED}>{$UserAdvManager_CONFIRMMAIL_TEXT}</textarea>
+    	</li>
+      <br/>
+    	<li><label>{'UserAdvManager_No_Confirm_Group'|@translate}</label><br/>
+		{html_options name="UserAdvManager_No_Confirm_Group" options=$No_Confirm_Group.group_options selected=$No_Confirm_Group.group_selected}
+    	</li>
+      <br/>
+    	<li><label>{'UserAdvManager_Validated_Group'|@translate}</label><br/>
+		{html_options name="UserAdvManager_Validated_Group" options=$Validated_Group.group_options selected=$Validated_Group.group_selected}
+    	</li>
+      <br/>
+    	<li><label>{'UserAdvManager_No_Confirm_Status'|@translate}</label><br/>
+		{html_options name="UserAdvManager_No_Confirm_Status" options=$No_Confirm_Status.Status_options selected=$No_Confirm_Status.Status_selected}
+    	</li>
+      <br/>
+    	<li><label>{'UserAdvManager_Validated_Status'|@translate}</label><br/>
+		{html_options name="UserAdvManager_Validated_Status" options=$Confirm_Status.Status_options selected=$Confirm_Status.Status_selected}
+    	</li>
+    	<br/>
+    	<li><label>{'UserAdvManager_No_Comment_Anonymous'|@translate}</label><br/>
+        <input type="radio" value="true" {$UserAdvManager_NO_COMMENT_ANO_TRUE} name="UserAdvManager_No_Comment_Anonymous"/>{'UserAdvManager_No_Comment_Anonymous_true'|@translate}<br/>
+        <input type="radio" value="false" {$UserAdvManager_NO_COMMENT_ANO_FALSE} name="UserAdvManager_No_Comment_Anonymous"/>{'UserAdvManager_No_Comment_Anonymous_false'|@translate}<br/>
+    	</li>
+
+    </ul>
+  	<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>
+  </fieldset>
+</form>
Index: /extensions/NBC_UserAdvManager/admin/index.php
===================================================================
--- /extensions/NBC_UserAdvManager/admin/index.php	(revision 3352)
+++ /extensions/NBC_UserAdvManager/admin/index.php	(revision 3352)
@@ -0,0 +1,33 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | PhpWebGallery - a PHP based picture gallery                           |
+// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
+// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
+// +-----------------------------------------------------------------------+
+// | file          : $Id: index.php 1912 2007-03-16 06:30:07Z rub $
+// | last update   : $Date: 2007-03-16 07:30:07 +0100 (ven, 16 mar 2007) $
+// | last modifier : $Author: rub $
+// | revision      : $Revision: 1912 $
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify  |
+// | it under the terms of the GNU General Public License as published by  |
+// | the Free Software Foundation                                          |
+// |                                                                       |
+// | This program is distributed in the hope that it will be useful, but   |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
+// | General Public License for more details.                              |
+// |                                                                       |
+// | You should have received a copy of the GNU General Public License     |
+// | along with this program; if not, write to the Free Software           |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA.                                                                  |
+// +-----------------------------------------------------------------------+
+
+// Recursive call
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
Index: /extensions/NBC_UserAdvManager/include/constants.php
===================================================================
--- /extensions/NBC_UserAdvManager/include/constants.php	(revision 3352)
+++ /extensions/NBC_UserAdvManager/include/constants.php	(revision 3352)
@@ -0,0 +1,4 @@
+<?php
+global $prefixeTable;
+define('USER_CONFIRM_MAIL_TABLE', $prefixeTable.'user_confirm_mail');
+?>
Index: /extensions/NBC_UserAdvManager/include/functions_UserAdvManager.inc.php
===================================================================
--- /extensions/NBC_UserAdvManager/include/functions_UserAdvManager.inc.php	(revision 3352)
+++ /extensions/NBC_UserAdvManager/include/functions_UserAdvManager.inc.php	(revision 3352)
@@ -0,0 +1,312 @@
+<?php
+include_once (NBC_UserAdvManager_PATH.'include/constants.php');
+include_once (NBC_UserAdvManager_PATH.'include/functions_UserAdvManager.inc.php');
+load_language('plugin.lang', NBC_UserAdvManager_PATH);
+
+function SendMail2User($typemail, $id, $username, $password, $email, $confirm)
+{
+  global $conf;
+  $conf_nbc_UserAdvManager = isset($conf['nbc_UserAdvManager']) ? explode(";" , $conf['nbc_UserAdvManager']) : array();
+  include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php');
+  $infos1_perso = "";
+  $infos2_perso = "";
+
+  switch($typemail)
+  {
+    case 1:
+      $subject = '['.$conf['gallery_title'].'] '.l10n_args(get_l10n_args('Add of %s', $username));
+      $password = $password <> '' ? $password : l10n('UserAdvManager_empty_pwd');
+      
+      if ( function_exists('get_user_language_desc') and isset($conf_nbc_UserAdvManager[10]) and $conf_nbc_UserAdvManager[10] <> '' )
+        $infos1_perso = get_user_language_desc($conf_nbc_UserAdvManager[10])."\n\n";
+      
+      break;
+      
+    case 2:
+      $subject = '['.$conf['gallery_title'].'] '.l10n_args(get_l10n_args('Update of %s', $username));
+      $password = $password <> '' ? $password : l10n('UserAdvManager_empty_pwd');
+
+      break;
+        
+    case 3:
+      $subject = '['.$conf['gallery_title'].'] '.l10n_args(get_l10n_args('Update of %s', $username));
+      $password = $password <> '' ? $password : l10n('UserAdvManager_no_update_pwd');
+
+      break;
+  }
+
+  if ( isset($conf_nbc_UserAdvManager[0]) and $conf_nbc_UserAdvManager[0] == 'true' )
+  {
+    $infos1 = array(
+      get_l10n_args('infos_mail %s', $username),
+      get_l10n_args('User: %s', $username),
+      get_l10n_args('Password: %s', $password),
+      get_l10n_args('Email: %s', $email),
+      get_l10n_args('', ''),
+    );
+  }
+
+
+  if ( isset($conf_nbc_UserAdvManager[2]) and $conf_nbc_UserAdvManager[2] == 'true' and $confirm)
+  {
+    $infos2 = array
+    (
+      get_l10n_args('Link: %s', AddConfirmMail($id, $email)),
+      get_l10n_args('', ''),
+    );
+
+    if ( function_exists('get_user_language_desc') and isset($conf_nbc_UserAdvManager[11]) and $conf_nbc_UserAdvManager[11] <> '' )
+      $infos2_perso = get_user_language_desc($conf_nbc_UserAdvManager[11])."\n\n";
+  }
+
+  pwg_mail($email, array(
+    'subject' => $subject,
+    'content' => (isset($infos1) ? $infos1_perso.l10n_args($infos1)."\n\n" : "").(isset($infos2) ? $infos2_perso.l10n_args($infos2)."\n\n" : "").get_absolute_root_url(),
+  ));
+}
+
+
+
+function FindAvailableConfirmMailID()
+{
+  while (true)
+  {
+    $id = generate_key(16);
+    $query = "
+      SELECT COUNT(*)
+      FROM ".USER_CONFIRM_MAIL_TABLE."
+      WHERE id = '".$id."'
+    ;";
+    list($count) = mysql_fetch_row(pwg_query($query));
+
+    if ($count == 0)
+      return $id;
+  }
+}
+
+
+
+function AddConfirmMail($user_id, $email)
+{
+  global $conf;
+   $conf_nbc_UserAdvManager = isset($conf['nbc_UserAdvManager']) ? explode(";" , $conf['nbc_UserAdvManager']) : array();
+  $Confirm_Mail_ID = FindAvailableConfirmMailID();
+
+  list($dbnow) = mysql_fetch_row(pwg_query('SELECT NOW();'));
+  
+  if ( isset($Confirm_Mail_ID) )
+  {
+    $query = "
+      SELECT status
+      FROM ".USER_INFOS_TABLE."
+      WHERE user_id = '".$user_id."'
+    ;";
+    list($status) = mysql_fetch_row(pwg_query($query));
+    
+    $query = "
+      INSERT INTO ".USER_CONFIRM_MAIL_TABLE."
+      (id, user_id, mail_address, status, date_check)
+      VALUES
+      ('".$Confirm_Mail_ID."', '".$user_id."', '".$email."', '".$status."', null)
+    ;";
+    pwg_query($query);
+
+    $query = "
+      DELETE FROM ".USER_GROUP_TABLE."
+      WHERE user_id = '".$user_id."'
+      AND (
+        group_id = '".$conf_nbc_UserAdvManager[3]."'
+        OR 
+        group_id = '".$conf_nbc_UserAdvManager[4]."'
+      )
+    ;";
+    pwg_query($query);
+
+    if ( !is_admin() and $conf_nbc_UserAdvManager[9] <> -1 )
+    {
+      $query = "
+        UPDATE ".USER_INFOS_TABLE."
+        SET status = '".$conf_nbc_UserAdvManager[9]."'
+        WHERE user_id = '".$user_id."'
+      ;";
+      pwg_query($query);
+    }
+
+    if ( $conf_nbc_UserAdvManager[3] <> -1 )
+    {
+      $query = "
+        INSERT INTO ".USER_GROUP_TABLE."
+        (user_id, group_id)
+        VALUES
+        ('".$user_id."', '".$conf_nbc_UserAdvManager[3]."')
+      ;";
+      pwg_query($query);
+    }
+    
+    return get_absolute_root_url().NBC_UserAdvManager_PATH.'ConfirmMail.php?key='.$Confirm_Mail_ID;
+  }
+}
+
+
+
+function DeleteConfirmMail($user_id)
+{
+  $query = "
+    DELETE FROM ".USER_CONFIRM_MAIL_TABLE."
+    WHERE user_id = '".$user_id."'
+  ;";
+  pwg_query($query);
+}
+
+
+
+function VerifyConfirmMail($id)
+{
+  global $conf;
+
+  include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
+  
+  $conf_nbc_UserAdvManager = isset($conf['nbc_UserAdvManager']) ? explode(";" , $conf['nbc_UserAdvManager']) : array();
+
+  $query = "
+    SELECT COUNT(*)
+    FROM ".USER_CONFIRM_MAIL_TABLE."
+    WHERE id = '".$id."'
+  ;";
+  list($count) = mysql_fetch_row(pwg_query($query));
+
+  if ($count == 1)
+  {
+    $query = "
+      SELECT user_id, status, date_check
+      FROM ".USER_CONFIRM_MAIL_TABLE."
+      WHERE id = '".$id."'
+    ;";
+    $data = mysql_fetch_array(pwg_query($query));
+    
+    
+    if (!empty($data) and isset($data['user_id']) and !isset($data['date_check']))
+    {
+      $query = "
+        SELECT registration_date
+        FROM ".USER_INFOS_TABLE."
+        WHERE user_id = '".$data['user_id']."'
+      ;";
+      list($registration_date) = mysql_fetch_row(pwg_query($query));
+  
+      if (!empty($registration_date))
+      {
+// Time limit process
+      }
+      
+      list($dbnow) = mysql_fetch_row(pwg_query('SELECT NOW();'));
+  
+      $query = '
+        UPDATE '.USER_CONFIRM_MAIL_TABLE.'
+        SET date_check="'.$dbnow.'"
+        WHERE id = "'.$id.'"
+      ;';
+      pwg_query($query);
+      
+      if ( $conf_nbc_UserAdvManager[3] <> -1 )
+      {
+        $query = "
+          DELETE FROM ".USER_GROUP_TABLE."
+          WHERE user_id = '".$data['user_id']."'
+          AND group_id = '".$conf_nbc_UserAdvManager[3]."'
+        ;";
+        pwg_query($query);
+      }
+    
+      if ( $conf_nbc_UserAdvManager[4] <> -1 )
+      {
+        $query = "
+          DELETE FROM ".USER_GROUP_TABLE."
+          WHERE user_id = '".$data['user_id']."'
+          AND group_id = '".$conf_nbc_UserAdvManager[4]."'
+        ;";
+        pwg_query($query);
+
+        $query = "
+          INSERT INTO ".USER_GROUP_TABLE."
+          (user_id, group_id)
+          VALUES
+          ('".$data['user_id']."', '".$conf_nbc_UserAdvManager[4]."')
+        ;";
+        pwg_query($query);
+      }
+
+      if ( ( $conf_nbc_UserAdvManager[5] <> -1 or isset($data['status']) ) )
+      {
+        $query = "
+          UPDATE ".USER_INFOS_TABLE."
+          SET status = '".(isset($data['status']) ? $data['status'] : $conf_nbc_UserAdvManager[5])."'
+          WHERE user_id = '".$data['user_id']."'
+        ;";
+        pwg_query($query);
+      }
+// Refresh user's category cache
+      invalidate_user_cache();
+  
+      return true;
+    }
+  }
+  else
+    return false;
+  
+}
+
+function NotSensibleSearchUsername($username)
+{
+  global $conf;
+  
+  if ( isset($username) )
+  {
+    $query = "
+      SELECT ".$conf['user_fields']['username']."
+      FROM ".USERS_TABLE."
+      WHERE LOWER(".$conf['user_fields']['username'].") = '".strtolower($username)."'
+    ;";
+    list($username) = mysql_fetch_row(pwg_query($query));
+
+    return isset($username) ? $username : '';
+  }
+}
+
+function SearchMail($email)
+{
+  global $conf, $lang;
+  
+  if ( isset($email) )
+  {
+    $query = "
+      SELECT COUNT(*)
+      FROM ".USERS_TABLE."
+      WHERE ".$conf['user_fields']['email']." = '".$email."'
+    ;";
+    list($nbr_mail) = mysql_fetch_row(pwg_query($query));
+  
+    return isset($nbr_mail) ? $nbr_mail : 0;
+  }
+}
+
+function ValidateUsername($login)
+{
+  global $conf;
+
+  $conf_nbc_UserAdvManager = isset($conf['nbc_UserAdvManager']) ? explode(";" , $conf['UserAdvManager']) : array();
+
+  if ( isset($login) and isset($conf_nbc_UserAdvManager[8]) and $conf_nbc_UserAdvManager[8] <> '' )
+  {
+    if ( ereg("[".$conf_nbc_UserAdvManager[8]."]", $login) )
+      return false;
+    else
+      return true;
+  }
+  else
+  {
+    return true;
+  }
+}
+
+?>
Index: /extensions/NBC_UserAdvManager/include/index.php
===================================================================
--- /extensions/NBC_UserAdvManager/include/index.php	(revision 3352)
+++ /extensions/NBC_UserAdvManager/include/index.php	(revision 3352)
@@ -0,0 +1,33 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | PhpWebGallery - a PHP based picture gallery                           |
+// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
+// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
+// +-----------------------------------------------------------------------+
+// | file          : $Id: index.php 1912 2007-03-16 06:30:07Z rub $
+// | last update   : $Date: 2007-03-16 07:30:07 +0100 (ven, 16 mar 2007) $
+// | last modifier : $Author: rub $
+// | revision      : $Revision: 1912 $
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify  |
+// | it under the terms of the GNU General Public License as published by  |
+// | the Free Software Foundation                                          |
+// |                                                                       |
+// | This program is distributed in the hope that it will be useful, but   |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
+// | General Public License for more details.                              |
+// |                                                                       |
+// | You should have received a copy of the GNU General Public License     |
+// | along with this program; if not, write to the Free Software           |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA.                                                                  |
+// +-----------------------------------------------------------------------+
+
+// Recursive call
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
Index: /extensions/NBC_UserAdvManager/index.php
===================================================================
--- /extensions/NBC_UserAdvManager/index.php	(revision 3352)
+++ /extensions/NBC_UserAdvManager/index.php	(revision 3352)
@@ -0,0 +1,33 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | PhpWebGallery - a PHP based picture gallery                           |
+// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
+// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
+// +-----------------------------------------------------------------------+
+// | file          : $Id: index.php 1912 2007-03-16 06:30:07Z rub $
+// | last update   : $Date: 2007-03-16 07:30:07 +0100 (ven, 16 mar 2007) $
+// | last modifier : $Author: rub $
+// | revision      : $Revision: 1912 $
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify  |
+// | it under the terms of the GNU General Public License as published by  |
+// | the Free Software Foundation                                          |
+// |                                                                       |
+// | This program is distributed in the hope that it will be useful, but   |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
+// | General Public License for more details.                              |
+// |                                                                       |
+// | You should have received a copy of the GNU General Public License     |
+// | along with this program; if not, write to the Free Software           |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA.                                                                  |
+// +-----------------------------------------------------------------------+
+
+// Recursive call
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
Index: /extensions/NBC_UserAdvManager/language/en_UK/index.php
===================================================================
--- /extensions/NBC_UserAdvManager/language/en_UK/index.php	(revision 3352)
+++ /extensions/NBC_UserAdvManager/language/en_UK/index.php	(revision 3352)
@@ -0,0 +1,33 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | PhpWebGallery - a PHP based picture gallery                           |
+// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
+// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
+// +-----------------------------------------------------------------------+
+// | file          : $Id: index.php 1912 2007-03-16 06:30:07Z rub $
+// | last update   : $Date: 2007-03-16 07:30:07 +0100 (ven, 16 mar 2007) $
+// | last modifier : $Author: rub $
+// | revision      : $Revision: 1912 $
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify  |
+// | it under the terms of the GNU General Public License as published by  |
+// | the Free Software Foundation                                          |
+// |                                                                       |
+// | This program is distributed in the hope that it will be useful, but   |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
+// | General Public License for more details.                              |
+// |                                                                       |
+// | You should have received a copy of the GNU General Public License     |
+// | along with this program; if not, write to the Free Software           |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA.                                                                  |
+// +-----------------------------------------------------------------------+
+
+// Recursive call
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
Index: /extensions/NBC_UserAdvManager/language/en_UK/plugin.lang.php
===================================================================
--- /extensions/NBC_UserAdvManager/language/en_UK/plugin.lang.php	(revision 3352)
+++ /extensions/NBC_UserAdvManager/language/en_UK/plugin.lang.php	(revision 3352)
@@ -0,0 +1,59 @@
+<?php
+
+global $lang,$conf;
+
+$conf_UserAdvManager = isset($conf['UserAdvManager']) ? explode(";" , $conf['UserAdvManager']) : array();
+
+$lang['infos_mail %s'] = '%s, please find here your information to login the gallery :';
+$lang['Password: %s'] = 'Password: %s';
+$lang['Add of %s'] = 'Add of %s';
+$lang['Update of %s'] = 'Update of %s';
+
+$lang['Link: %s'] = 'Please, click on this link to confirm your regsitration : %s';
+
+$lang['title_confirm_mail'] = 'Validate your registration';
+$lang['confirm_mail_page_title'] = 'Validate your registration';
+$lang['confirm_mail_ok'] = '<br/><br/><br/>Thank you to have confirmed your email address and your registration on the gallery. Have fun !<br/><br/><br/><br/>';
+$lang['confirm_mail_bad'] = '<br/><br/><br/>Your validation key is broken or you haven\'t validated your registration. Please contact the gallery\'s webmaster to check this issue.<br/><br/><br/><br/>';
+
+$lang['Title'] = 'UserAdvManager';
+$lang['UserAdvManager_Title'] = 'Advanced users settings';
+
+$lang['UserAdvManager_Mail_Info'] = 'Mail information user';
+$lang['UserAdvManager_Mail_Info_true'] = 'Send a information mail to the user when he registering or updating his profile.';
+$lang['UserAdvManager_Mail_Info_false'] = 'Turns off the sending of mail.';
+$lang['UserAdvManager_MailInfo_Text'] = 'Text used to introduce the email sent to user on his registration or at his profile update.<br>(!!! <blink>WARNING</blink> You can use the multi language tags from Extended Description plugin. This will work only if this plugin is activated !!!)';
+$lang['UserAdvManager_No_Casse'] = 'User insensitive';
+$lang['UserAdvManager_No_Casse_true'] = 'Make the user account insensitive at the registration and the identification step';
+$lang['UserAdvManager_No_Casse_false'] = 'Let the user-sensitive.';
+$lang['UserAdvManager_Username_Char'] = 'Limited charset for unsername';
+$lang['UserAdvManager_Username_Char_true'] = ' The following characters will be forbidden for username choice à regsitration == ';
+$lang['UserAdvManager_Username_Char_false'] = ' Use the default username charset control.';
+$lang['UserAdvManager_Confirm_Mail'] = 'Email address confirmation';
+$lang['UserAdvManager_Confirm_Mail_true'] = ' Send an email to user to allow him to validate his email and his registration.';
+$lang['UserAdvManager_Confirm_Mail_false'] = ' Use the default Piwigo registration system (without registration validation).';
+$lang['UserAdvManager_ConfirmMail_Text'] = 'Text used to introduce the email sent to user to allow him to validate his email address<br>(!!! <blink>WARNING</blink> You can use the multi language tags from Extended Description plugin. This will work only if this plugin is activated !!!)';
+$lang['UserAdvManager_No_Confirm_Group'] = 'Group to use for the users who haven\'t validated their email address.';
+$lang['UserAdvManager_Validated_Group'] = 'Group to use for the users who have validated their email address.';
+$lang['UserAdvManager_No_Confirm_Status'] = 'Status to use for the users who haven\'t validated their email address.';
+$lang['UserAdvManager_Validated_Status'] = 'Status to use for the users who have validated their email address. Let ------- for using default Piwigo values';
+$lang['UserAdvManager_No_Comment_Anonymous'] = 'Nickname are mandatory for comments';
+$lang['UserAdvManager_No_Comment_Anonymous_true'] = ' The author field have to be filled to send a comment.';
+$lang['UserAdvManager_No_Comment_Anonymous_false'] = ' Use the default Piwigo settings on comments sending.';
+
+$lang['Err_audit_no_casse'] = '<b>These accounts are identical to the case closely :</b> ';
+$lang['Err_audit_username_char'] = '<b>This account uses one or more forbidden characters :</b> ';
+$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';
+$lang['UserAdvManager_audit_ok'] = 'Audit OK';
+$lang['UserAdvManager_save_config'] ='Configuration registered.';
+
+$lang['UserAdvManager_Empty Author'] = 'The author field have to be filled to send a comment.';
+
+if ( isset($conf_UserAdvManager[1]) and $conf_UserAdvManager[1] == 'true' )
+  $lang['reg_err_login5'] = 'user name is already taken, attention name is insensitive (Shift = Tiny).';
+
+$lang['invalid_pwd'] = 'User name or password invalid !';
+
+$lang['UserAdvManager_empty_pwd'] = '[empty password]';
+$lang['UserAdvManager_no_update_pwd'] = '[profile updated without password changed]';
+?>
Index: /extensions/NBC_UserAdvManager/language/fr_FR/index.php
===================================================================
--- /extensions/NBC_UserAdvManager/language/fr_FR/index.php	(revision 3352)
+++ /extensions/NBC_UserAdvManager/language/fr_FR/index.php	(revision 3352)
@@ -0,0 +1,33 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | PhpWebGallery - a PHP based picture gallery                           |
+// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
+// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
+// +-----------------------------------------------------------------------+
+// | file          : $Id: index.php 1912 2007-03-16 06:30:07Z rub $
+// | last update   : $Date: 2007-03-16 07:30:07 +0100 (ven, 16 mar 2007) $
+// | last modifier : $Author: rub $
+// | revision      : $Revision: 1912 $
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify  |
+// | it under the terms of the GNU General Public License as published by  |
+// | the Free Software Foundation                                          |
+// |                                                                       |
+// | This program is distributed in the hope that it will be useful, but   |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
+// | General Public License for more details.                              |
+// |                                                                       |
+// | You should have received a copy of the GNU General Public License     |
+// | along with this program; if not, write to the Free Software           |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA.                                                                  |
+// +-----------------------------------------------------------------------+
+
+// Recursive call
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
Index: /extensions/NBC_UserAdvManager/language/fr_FR/plugin.lang.php
===================================================================
--- /extensions/NBC_UserAdvManager/language/fr_FR/plugin.lang.php	(revision 3352)
+++ /extensions/NBC_UserAdvManager/language/fr_FR/plugin.lang.php	(revision 3352)
@@ -0,0 +1,63 @@
+<?php
+
+global $lang,$conf;
+
+$conf_UserAdvManager = isset($conf['UserAdvManager']) ? explode(";" , $conf['UserAdvManager']) : array();
+
+$lang['infos_mail %s'] = '%s, voici vos informations pour vous identifier sur la galerie :';
+$lang['Password: %s'] = 'Mot de passe: %s';
+$lang['Add of %s'] = 'Création de %s';
+$lang['Update of %s'] = 'Mise à jour de %s';
+
+$lang['Link: %s'] = 'Cliquez sur le lien suivant pour confirmer votre inscription : %s';
+
+$lang['title_confirm_mail'] = 'Confirmation de votre inscription';
+$lang['confirm_mail_page_title'] = 'Confirmation d\'inscription';
+$lang['confirm_mail_ok'] = '<br/><br/><br/>Merci d\'avoir confirmé votre mail et aussi et surtout votre inscription sur le site, profitez bien des photos ...<br/><br/><br/><br/>';
+$lang['confirm_mail_bad'] = '<br/><br/><br/>Votre clef d\'activation unique est érroné ou vous avez déjà validé votre compte, veuillez contacter le webmaster pour régler ce problème.<br/><br/><br/><br/>';
+
+$lang['Title'] = 'UserAdvManager';
+$lang['UserAdvManager_Title'] = 'Configuration avancée des utilisateurs';
+
+$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_MailInfo_Text'] = 'Texte utilisé pour l\'introduction du mail envoyé à l\'utilisateur pour son inscription ou la mise à jour de son profil<br>(!!! <blink>ATTENTION</blink> Vous pouvez utiliser la méthode multi language du plugin Extended Description qui ne fonctionnera que 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_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_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_ConfirmMail_Text'] = 'Texte utilisé pour l\'introduction du mail envoyé à l\'utilisateur pour confirmer son adresse mail<br>(!!! <blink>ATTENTION</blink> utilisez la méthode multi language du plugin Extended Description et cela fonctionnera uniquement si celui-ci est activé !!!)';
+$lang['UserAdvManager_No_Confirm_Group'] = 'Groupe à utiliser pour les utilisateurs qui n\'ont pas encore confirmé leur adresse email';
+$lang['UserAdvManager_Validated_Group'] = 'Groupe à utiliser pour les utilisateurs qui ont validé leur adresse email';
+$lang['UserAdvManager_No_Confirm_Status'] = 'Status utilisateur à utiliser pour les utilisateurs qui n\'ont pas encore confirmé leur adresse email';
+$lang['UserAdvManager_Validated_Status'] = 'Status utilisateur à utiliser pour les utilisateurs qui ont validé leur adresse email, laissez ------- pour garder la valuer par défaut de PWG';
+$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['audit'] = 'Audit';
+$lang['submit'] = 'Valider';
+
+$lang['Err_audit_no_casse'] = '<b>Ces comptes sont identiques à la casse près :</b> ';
+$lang['Err_audit_username_char'] = '<b>Ce compte contient un ou des caractères interdits :</b> ';
+$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>';
+$lang['UserAdvManager_audit_ok'] = 'Audit OK';
+$lang['UserAdvManager_save_config'] ='Configuration enregistrée.';
+
+$lang['UserAdvManager_Empty Author'] = 'Le champs auteur doit être rempli pour enregistrer un commentaire.';
+
+if ( isset($conf_UserAdvManager[1]) and $conf_UserAdvManager[1] == 'true' )
+	$lang['new_reg_err_login5'] = 'ce nom utilisateur est déjà pris, ATTENTION le nom est insensible à la casse (Majuscule = Minuscule).';
+$lang['reg_err_login6'] = 'le nom utilisateur ne doit pas contenir les caractère suivants : ';
+
+$lang['invalid_pwd'] = 'Nom utilisateur ou Mot de passe invalide !';
+
+$lang['UserAdvManager_empty_pwd'] = '[mot de passe vide]';
+$lang['UserAdvManager_no_update_pwd'] = '[mise à jour du profil sans changement du mot de passe]';
+?>
Index: /extensions/NBC_UserAdvManager/language/index.php
===================================================================
--- /extensions/NBC_UserAdvManager/language/index.php	(revision 3352)
+++ /extensions/NBC_UserAdvManager/language/index.php	(revision 3352)
@@ -0,0 +1,33 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | PhpWebGallery - a PHP based picture gallery                           |
+// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
+// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
+// +-----------------------------------------------------------------------+
+// | file          : $Id: index.php 1912 2007-03-16 06:30:07Z rub $
+// | last update   : $Date: 2007-03-16 07:30:07 +0100 (ven, 16 mar 2007) $
+// | last modifier : $Author: rub $
+// | revision      : $Revision: 1912 $
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify  |
+// | it under the terms of the GNU General Public License as published by  |
+// | the Free Software Foundation                                          |
+// |                                                                       |
+// | This program is distributed in the hope that it will be useful, but   |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
+// | General Public License for more details.                              |
+// |                                                                       |
+// | You should have received a copy of the GNU General Public License     |
+// | along with this program; if not, write to the Free Software           |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA.                                                                  |
+// +-----------------------------------------------------------------------+
+
+// Recursive call
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
Index: /extensions/NBC_UserAdvManager/main.inc.php
===================================================================
--- /extensions/NBC_UserAdvManager/main.inc.php	(revision 3352)
+++ /extensions/NBC_UserAdvManager/main.inc.php	(revision 3352)
@@ -0,0 +1,353 @@
+<?php
+/*
+Plugin Name: NBC UserAdvManager
+Version: 2.10.8
+Description: Permet de renforcer les possibilités de gestion des utilisateurs - Enforce users management
+Plugin URI: http://fr.piwigo.org/ext/extension_view.php?eid=216
+Author: Nicco, Eric
+Author URI: http://gallery-nicco.no-ip.org, http://www.infernoweb.net
+*/
+
+/*
+ ***** Plugin history (branch 2.10)*****
+
+-- 2.10.0-beta : Initial beta release for Piwigo compatibility
+-- 2.10.1-beta : Small correction on generated path
+-- 2.10.2-beta : Bug resolved on register validation page
+
+-- 2.10.3 : Final and fully functional release
+			Bug resolved on plugin activation
+
+-- 2.10.4 : Bug fixed on profiles update
+
+-- 2.10.5 : Improved code on profiles update
+
+-- 2.10.6 : Old language packs (iso) deleted (forget from PWG 1.7.x version)
+
+-- 2.10.7 : Bug fixed on user's validation email sending
+
+-- 2.10.8 : ConfirmMail page looks better (Sylvia theme only)
+			Improved code for checking author on guest comments
+
+*/
+
+/*
+
+ ***** TODO List *****
+
+-- No validation needed for admins users comments (new trigger needed in comments.php)
+
+-- No single email check for admins (new trigger needed in (functions_user.inc.php ?))
+
+-- Administration page for Confirm Mail
+  ++ Admin tabsheet for Confirm Mail to set options :
+  		++ Setting a delay time with timeout for email confirmation (Timeout = CurrentDate - RegistrationDate)
+  		++ List of users who haven't validated - could be easy to set with groups options : Unvalidated users are in a "Unvalidated" group.
+  		++ List of users with expired validation time
+  		++ List of validates users ? -> Same as "List of users who haven't validated" : They could belong to a "validated" group.
+  		++ Opportunities to take actions on database tables :
+    		++ Re-asking validation (case of non reception of validation email)
+    		++ Force expiration
+			++ Force confirmation
+    		++ Cleanup expired user's accounts
+    	++ (...)
+
+-- Password control ans 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)
+  
+-- Security : Blocking brut-force attacks !
+
+-- Opportunity to copy a registered user for new user creation
+  ++ new copied user will (or not) belong to the same groups
+  ++ new copied user will (or not) get the same status (visitor, admin, webmaster, guest (??))
+  ++ new copied user will (or not) get the same properties
+  ++ new copied user will (or not) get the same language
+  ... and so on
+  
+*/
+
+
+
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+define('NBC_UserAdvManager_DIR' , basename(dirname(__FILE__)));
+define('NBC_UserAdvManager_PATH' , PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/');
+include_once (NBC_UserAdvManager_PATH.'include/constants.php');
+include_once (NBC_UserAdvManager_PATH.'include/functions_UserAdvManager.inc.php');
+load_language('plugin.lang', NBC_UserAdvManager_PATH);
+
+
+/* Plugin admin */
+add_event_handler('get_admin_plugin_menu_links', 'nbc_UserAdvManager_admin_menu');
+
+function nbc_UserAdvManager_admin_menu($menu)
+{
+  array_push($menu,
+    array(
+      'NAME' => 'UserAdvManager',
+      'URL'  => get_admin_plugin_menu_link(NBC_UserAdvManager_PATH.'/admin/UserAdvManager_admin.php')
+    )
+  );
+
+  return $menu;
+}
+
+
+
+/* User creation */
+add_event_handler('register_user', 'UserAdvManager_Adduser');
+
+function UserAdvManager_Adduser($register_user)
+{
+  global $conf;
+  
+  $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);
+}
+
+
+
+/* User deletion */
+add_event_handler('delete_user', 'UserAdvManager_Deluser');
+
+function UserAdvManager_Deluser($user_id)
+{
+
+  DeleteConfirmMail($user_id);
+
+}
+
+
+
+add_event_handler('init', 'UserAdvManager_InitPage');
+ 
+function UserAdvManager_InitPage()
+{
+  global $conf, $template, $page, $lang;
+
+  $conf_nbc_UserAdvManager = isset($conf['nbc_UserAdvManager']) ? explode(";" , $conf['nbc_UserAdvManager']) : array();
+  
+
+  if ( isset($conf_nbc_UserAdvManager[1]) and $conf_nbc_UserAdvManager[1] == 'true' )
+    $lang['reg_err_login5'] = l10n('new_reg_err_login5');
+  
+
+ 
+/* User identification */
+  if (script_basename() == 'identification')
+  {
+    if (isset($_POST['login']))
+    {
+      /* User non case sensitive */
+      if (isset($conf_nbc_UserAdvManager[1]) and $conf_nbc_UserAdvManager[1] == 'true' )
+      {
+        $new_username =  NotSensibleSearchUsername($_POST['username']);
+        $_POST['username'] = $new_username == '' ? $_POST['username'] : $new_username;
+      }
+    }
+  }
+
+
+
+/* Admin user management */
+  if (script_basename() == 'admin' and isset($_GET['page']) and $_GET['page'] == 'user_list')
+  {
+    if (isset($_POST['submit_add']))
+    {
+      /* User 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'] = '';
+      }
+    }
+  }
+
+/* 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'] = '';
+      }
+    }
+  }
+
+/* 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');
+        }
+        // periods must be integer values, they represents number of days
+        if (!preg_match($int_pattern, $_POST['recent_period'])
+            or $_POST['recent_period'] <= 0)
+        {
+          $errors[] = l10n('periods_error') ;
+        }
+
+        if (isset($_POST['mail_address']))
+        {
+          $mail_error = validate_mail_address($user['id'], $_POST['mail_address']);
+          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 ( !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);
+        }
+      }
+    }
+  }
+}
+
+add_event_handler('loc_begin_tpl_parse', 'ChangeRegisterProfilePage');
+
+function ChangeRegisterProfilePage()
+{
+  global $conf, $template;
+
+  $conf_nbc_UserAdvManager = isset($conf['nbc_UserAdvManager']) ? explode(";" , $conf['nbc_UserAdvManager']) : array();
+
+/* creation OU mise a jour de user */
+//  if (in_array(script_basename(), array('register', 'profile')))
+//  {
+    //if (isset($conf_UserAdvManager[1]) and $conf_UserAdvManager[1] == 'true' )
+    //{
+    //  $template->set_filenames( array('register'=>'register.tpl') );
+
+    //  $template->loadfile('register');
+
+    //  $template->uncompiled_code['register'] = str_replace('{lang:Mail address}', '* {lang:Mail address}', $template->uncompiled_code['register']);      
+    //}
+//  }
+}
+
+add_event_handler('user_comment_check', 'UserAdvManager_CheckEmptyCommentAuthor', 50, 2);
+
+function UserAdvManager_CheckEmptyCommentAuthor($comment_action, $comm)
+{
+  load_language('plugin.lang', NBC_UserAdvManager_PATH);
+  global $infos, $conf, $template;
+
+  $conf_nbc_UserAdvManager = isset($conf['nbc_UserAdvManager']) ? explode(";" , $conf['nbc_UserAdvManager']) : array();
+
+/* User creation OR update */
+  if (isset($conf_nbc_UserAdvManager[6]) and $conf_nbc_UserAdvManager[6] == 'true' and $conf['comments_forall'] == 'true' and $comm['author'] == 'guest')
+  {
+    $comment_action = 'reject';
+
+    array_push($infos, l10n('UserAdvManager_Empty Author'));
+  }
+
+  return $comment_action;
+}
+
+?>
Index: /extensions/NBC_UserAdvManager/maintain.inc.php
===================================================================
--- /extensions/NBC_UserAdvManager/maintain.inc.php	(revision 3352)
+++ /extensions/NBC_UserAdvManager/maintain.inc.php	(revision 3352)
@@ -0,0 +1,50 @@
+<?php
+
+if(!defined("NBC_UserAdvManager_PATH"))
+  define('NBC_UserAdvManager_PATH' , PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/');
+
+include_once (NBC_UserAdvManager_PATH.'include/constants.php');
+
+function plugin_install()
+{
+  $q = '
+    INSERT INTO '.CONFIG_TABLE.' (param, value, comment)
+    VALUES ("nbc_UserAdvManager","true;false;false;-1;-1;-1;false;false;;-1;;","Parametres du plugin nbc UserAdvManager")
+  ;';
+  pwg_query($q);
+
+
+	$q = "
+    CREATE TABLE IF NOT EXISTS ".USER_CONFIRM_MAIL_TABLE." (
+      id varchar(50) NOT NULL default '',
+      user_id smallint(5) NOT NULL default '0',
+      mail_address varchar(255) default NULL,
+      status enum('webmaster','admin','normal','generic','guest') default NULL,
+      date_check datetime default NULL,
+      PRIMARY KEY  (id)
+    )
+  ;";
+  pwg_query($q);
+}
+
+
+
+function plugin_uninstall()
+{
+  global $conf;
+
+  if (isset($conf['nbc_UserAdvManager']))
+  {
+    $q = '
+      DELETE FROM '.CONFIG_TABLE.'
+      WHERE param="nbc_UserAdvManager"
+    ;';
+
+    pwg_query($q);
+  }
+
+
+  $q = 'DROP TABLE '.USER_CONFIRM_MAIL_TABLE.';';
+  pwg_query( $q );
+}
+?>
