Index: /extensions/NBC_UserAdvManager/trunk/admin/UserAdvManager_admin.php
===================================================================
--- /extensions/NBC_UserAdvManager/trunk/admin/UserAdvManager_admin.php	(revision 4134)
+++ /extensions/NBC_UserAdvManager/trunk/admin/UserAdvManager_admin.php	(revision 4135)
@@ -36,4 +36,7 @@
                l10n('Tab_UserManager'),
                $my_base_url.'&amp;tab=usermanager');
+$tabsheet->add('ghosttracker',
+               l10n('Tab_GhostTracker'),
+               $my_base_url.'&amp;tab=ghosttracker');
 $tabsheet->select($page['tab']);
 $tabsheet->assign();
@@ -56,10 +59,10 @@
   case 'global':
 	
-	if (isset($_POST['submit']) and !is_adviser() and isset($_POST['UserAdvManager_Mail_Info']) and isset($_POST['UserAdvManager_No_Casse']) and isset($_POST['UserAdvManager_Username_Char']) and isset($_POST['UserAdvManager_Confirm_Mail']) and isset($_POST['UserAdvManager_No_Comment_Anonymous']) and isset($_POST['UserAdvManager_Password_Enforced']) and isset($_POST['UserAdvManager_AdminPassword_Enforced']))
+	if (isset($_POST['submit']) and !is_adviser() and isset($_POST['UserAdvManager_Mail_Info']) and isset($_POST['UserAdvManager_No_Casse']) and isset($_POST['UserAdvManager_Username_Char']) and isset($_POST['UserAdvManager_Confirm_Mail']) and isset($_POST['UserAdvManager_No_Comment_Anonymous']) and isset($_POST['UserAdvManager_Password_Enforced']) and isset($_POST['UserAdvManager_AdminPassword_Enforced']) and isset($_POST['UserAdvManager_GhostUser_Tracker']))
   {
 		$_POST['UserAdvManager_MailInfo_Text'] = str_replace("\'", "'", str_replace("\\\\", "\\", $_POST['UserAdvManager_MailInfo_Text']));
 		$_POST['UserAdvManager_ConfirmMail_Text'] = str_replace("\'", "'", str_replace("\\\\", "\\", $_POST['UserAdvManager_ConfirmMail_Text']));
 		
-		$newconf_nbc_UserAdvManager = $_POST['UserAdvManager_Mail_Info'].';'.$_POST['UserAdvManager_No_Casse'].';'.$_POST['UserAdvManager_Confirm_Mail'].';'.(isset($_POST['UserAdvManager_No_Confirm_Group'])?$_POST['UserAdvManager_No_Confirm_Group']:'').';'.(isset($_POST['UserAdvManager_Validated_Group'])?$_POST['UserAdvManager_Validated_Group']:'').';'.(isset($_POST['UserAdvManager_Validated_Status'])?$_POST['UserAdvManager_Validated_Status']:'').';'.$_POST['UserAdvManager_No_Comment_Anonymous'].';'.$_POST['UserAdvManager_Username_Char'].';'.$_POST['UserAdvManager_Username_List'].';'.(isset($_POST['UserAdvManager_No_Confirm_Status'])?$_POST['UserAdvManager_No_Confirm_Status']:'').';'.$_POST['UserAdvManager_MailInfo_Text'].';'.$_POST['UserAdvManager_ConfirmMail_Text'].';'.$_POST['UserAdvManager_MailExclusion'].';'.$_POST['UserAdvManager_MailExclusion_List'].';'.$_POST['UserAdvManager_Password_Enforced'].';'.$_POST['UserAdvManager_Password_Score'].';'.$_POST['UserAdvManager_AdminPassword_Enforced'];
+		$newconf_nbc_UserAdvManager = $_POST['UserAdvManager_Mail_Info'].';'.$_POST['UserAdvManager_No_Casse'].';'.$_POST['UserAdvManager_Confirm_Mail'].';'.(isset($_POST['UserAdvManager_No_Confirm_Group'])?$_POST['UserAdvManager_No_Confirm_Group']:'').';'.(isset($_POST['UserAdvManager_Validated_Group'])?$_POST['UserAdvManager_Validated_Group']:'').';'.(isset($_POST['UserAdvManager_Validated_Status'])?$_POST['UserAdvManager_Validated_Status']:'').';'.$_POST['UserAdvManager_No_Comment_Anonymous'].';'.$_POST['UserAdvManager_Username_Char'].';'.$_POST['UserAdvManager_Username_List'].';'.(isset($_POST['UserAdvManager_No_Confirm_Status'])?$_POST['UserAdvManager_No_Confirm_Status']:'').';'.$_POST['UserAdvManager_MailInfo_Text'].';'.$_POST['UserAdvManager_ConfirmMail_Text'].';'.$_POST['UserAdvManager_MailExclusion'].';'.$_POST['UserAdvManager_MailExclusion_List'].';'.$_POST['UserAdvManager_Password_Enforced'].';'.$_POST['UserAdvManager_Password_Score'].';'.$_POST['UserAdvManager_AdminPassword_Enforced'].';'.$_POST['UserAdvManager_GhostUser_Tracker'];
 		
 		$conf['nbc_UserAdvManager'] = $newconf_nbc_UserAdvManager;
@@ -204,4 +207,6 @@
     'UserAdvManager_ADMINPASSWENF_TRUE'   => $conf_nbc_UserAdvManager[16]=='true' ?  'checked="checked"' : '' ,
 		'UserAdvManager_ADMINPASSWENF_FALSE'  => $conf_nbc_UserAdvManager[16]=='false' ?  'checked="checked"' : '' ,
+    'UserAdvManager_GHOSTRACKER_TRUE'     => $conf_nbc_UserAdvManager[17]=='true' ?  'checked="checked"' : '' ,
+		'UserAdvManager_GHOSTRACKER_FALSE'    => $conf_nbc_UserAdvManager[17]=='false' ?  'checked="checked"' : '' ,
 		'UserAdvManager_PASSWORD_TEST_SCORE'  => $UserAdvManager_Password_Test_Score,
     )
@@ -913,4 +918,528 @@
 		array_push($page['infos'], l10n('Err_UserManager_Settings'));
   }
+  break;
+
+
+// *************************************************************************
+// +-----------------------------------------------------------------------+
+// |                           Ghost Tracker page                          |
+// +-----------------------------------------------------------------------+
+// *************************************************************************
+  case 'ghosttracker':
+  $conf_nbc_UserAdvManager = isset($conf['nbc_UserAdvManager']) ? explode(";" , $conf['nbc_UserAdvManager']) : array();
+	
+  if (isset($conf_nbc_UserAdvManager[17]) and $conf_nbc_UserAdvManager[17]=='true')
+  {
+// +-----------------------------------------------------------------------+
+// |                           initialization                              |
+// +-----------------------------------------------------------------------+
+
+		if (!defined('PHPWG_ROOT_PATH'))
+    {
+    	die('Hacking attempt!');
+    }
+          
+    include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
+
+// +-----------------------------------------------------------------------+
+// | Check Access and exit when user status is not ok                      |
+// +-----------------------------------------------------------------------+
+		check_status(ACCESS_ADMINISTRATOR);
+
+    $page['order_by_items'] = array(
+      'id' => l10n('registration_date'),
+      'username' => l10n('Username'),
+      'level' => l10n('Privacy level'),
+      'language' => l10n('language'),
+    );
+
+// +-----------------------------------------------------------------------+
+// |                               user list                               |
+// +-----------------------------------------------------------------------+
+
+		$page['filtered_users'] = get_unvalid_user_list();
+
+// +-----------------------------------------------------------------------+
+// |                            selected users                             |
+// +-----------------------------------------------------------------------+
+		if (isset($_POST['Del_Selected']))
+		{
+  		$collection = array();
+
+			switch ($_POST['target'])
+    	{
+    		case 'all' :
+      	{
+      		foreach($page['filtered_users'] as $local_user)
+        	{
+        		array_push($collection, $local_user['id']);
+        	}
+					break;
+				}
+      	case 'selection' :
+      	{
+      		if (isset($_POST['selection']))
+        	{
+        		$collection = $_POST['selection'];
+        	}
+        	break;
+      	}
+			}
+
+			if (count($collection) == 0)
+    	{
+    		array_push($page['errors'], l10n('Select at least one user'));
+   		}
+		}
+
+// +-----------------------------------------------------------------------+
+// |                             delete users                              |
+// +-----------------------------------------------------------------------+
+		if (isset($_POST['Del_Selected']) and count($collection) > 0)
+  	{
+  		if (in_array($conf['guest_id'], $collection))
+   		{
+    		array_push($page['errors'], l10n('Guest cannot be deleted'));
+    	}
+    	if (($conf['guest_id'] != $conf['default_user_id']) and
+    		in_array($conf['default_user_id'], $collection))
+    	{
+    		array_push($page['errors'], l10n('Default user cannot be deleted'));
+    	}
+    	if (in_array($conf['webmaster_id'], $collection))
+    	{
+    		array_push($page['errors'], l10n('Webmaster cannot be deleted'));
+    	}
+    	if (in_array($user['id'], $collection))
+    	{
+    		array_push($page['errors'], l10n('You cannot delete your account'));
+    	}
+
+			if (count($page['errors']) == 0)
+    	{
+    		foreach ($collection as $user_id)
+      	{
+      		delete_user($user_id);
+      	}
+     		array_push(
+      		$page['infos'],
+        	l10n_dec(
+        	'%d user deleted', '%d users deleted',
+        	count($collection)
+        	)
+      	);
+
+      	foreach ($page['filtered_users'] as $filter_key => $filter_user)
+      	{
+      		if (in_array($filter_user['id'], $collection))
+        	{
+        		unset($page['filtered_users'][$filter_key]);
+        	}
+     		}
+			}
+		}
+
+// +-----------------------------------------------------------------------+
+// |                 Resend new validation key to users                    |
+// +-----------------------------------------------------------------------+
+// +-----------------------------------------------------------------------+
+// |                            selected users                             |
+// +-----------------------------------------------------------------------+
+		if (isset($_POST['Mail_With_Key']))
+		{
+  		$collection = array();
+
+			switch ($_POST['target'])
+    	{
+    		case 'all' :
+      	{
+      		foreach($page['filtered_users'] as $local_user)
+        	{
+        		array_push($collection, $local_user['id']);
+        	}
+        	break;
+				}
+      	case 'selection' :
+      	{
+      		if (isset($_POST['selection']))
+        	{
+        		$collection = $_POST['selection'];
+        	}
+        	break;
+      	}
+			}
+
+    	if (count($collection) == 0)
+    	{
+    		array_push($page['errors'], l10n('Select at least one user'));
+    	}
+		}
+// +-----------------------------------------------------------------------+
+// |                 Resend new validation key to users                    |
+// +-----------------------------------------------------------------------+
+		if (isset($_POST['Mail_With_Key']) and count($collection) > 0)
+		{
+			if (in_array($conf['guest_id'], $collection))
+   		{
+    		array_push($page['errors'], l10n('No_validation_for_Guest'));
+    	}
+    	if (($conf['guest_id'] != $conf['default_user_id']) and
+    		in_array($conf['default_user_id'], $collection))
+    	{
+    		array_push($page['errors'], l10n('No_validation_for_default_user'));
+    	}
+   		if (in_array($conf['webmaster_id'], $collection))
+    	{
+    		array_push($page['errors'], l10n('No_validation_for_Webmaster'));
+    	}
+    	if (in_array($user['id'], $collection))
+    	{
+    		array_push($page['errors'], l10n('No_validation_for_your_account'));
+    	}
+
+    	if (count($page['errors']) == 0)
+    	{
+    		foreach ($collection as $user_id)
+      	{     	
+      		$typemail = 1;
+				  $query = "
+						SELECT id, username, mail_address
+						FROM ".USERS_TABLE."
+						WHERE id = '".$user_id."'
+						;";
+					$data = mysql_fetch_array(pwg_query($query));
+				
+      		ResendMail2User($typemail,$user_id,$data['username'],$data['mail_address'],true);
+      	}
+      	array_push(
+      		$page['infos'],
+        	l10n_dec(
+        		'%d_Mail_With_Key', '%d_Mails_With_Key',
+        	count($collection)
+        	)
+      	);
+      	
+				$page['filtered_users'] = get_unvalid_user_list();
+			}
+		}
+
+// +-----------------------------------------------------------------------+
+// |             Send reminder without new key to users                    |
+// +-----------------------------------------------------------------------+
+// +-----------------------------------------------------------------------+
+// |                            selected users                             |
+// +-----------------------------------------------------------------------+
+		if (isset($_POST['Mail_Without_Key']))
+		{
+  		$collection = array();
+
+			switch ($_POST['target'])
+    	{
+    		case 'all' :
+      	{
+      		foreach($page['filtered_users'] as $local_user)
+        	{
+        		array_push($collection, $local_user['id']);
+        	}
+        	break;
+				}
+      	case 'selection' :
+      	{
+      		if (isset($_POST['selection']))
+        	{
+        		$collection = $_POST['selection'];
+        	}
+        	break;
+      	}
+			}
+
+    	if (count($collection) == 0)
+    	{
+    		array_push($page['errors'], l10n('Select at least one user'));
+    	}
+		}
+// +-----------------------------------------------------------------------+
+// |             Send reminder without new key to users                    |
+// +-----------------------------------------------------------------------+
+		if (isset($_POST['Mail_Without_Key']) and count($collection) > 0)
+		{
+			if (in_array($conf['guest_id'], $collection))
+   		{
+    		array_push($page['errors'], l10n('No_validation_for_Guest'));
+    	}
+    	if (($conf['guest_id'] != $conf['default_user_id']) and
+    		in_array($conf['default_user_id'], $collection))
+    	{
+    		array_push($page['errors'], l10n('No_validation_for_default_user'));
+    	}
+   		if (in_array($conf['webmaster_id'], $collection))
+    	{
+    		array_push($page['errors'], l10n('No_validation_for_Webmaster'));
+    	}
+    	if (in_array($user['id'], $collection))
+    	{
+    		array_push($page['errors'], l10n('No_validation_for_your_account'));
+    	}
+
+    	if (count($page['errors']) == 0)
+    	{
+    		foreach ($collection as $user_id)
+      	{
+      		$typemail = 2;
+				  $query = "
+						SELECT id, username, mail_address
+						FROM ".USERS_TABLE."
+						WHERE id = '".$user_id."'
+					;";
+					
+					$data = mysql_fetch_array(pwg_query($query));
+				
+      		ResendMail2User($typemail,$user_id,$data['username'],$data['mail_address'],false);				
+      	}
+      	array_push(
+      		$page['infos'],
+        	l10n_dec(
+        		'%d_Reminder_Sent', '%d_Reminders_Sent',
+       		count($collection)
+        	)
+      	);
+      	
+				$page['filtered_users'] = get_unvalid_user_list();
+			}
+		}
+
+// +-----------------------------------------------------------------------+
+// |             								Force validation					                 |
+// +-----------------------------------------------------------------------+
+// +-----------------------------------------------------------------------+
+// |                            selected users                             |
+// +-----------------------------------------------------------------------+
+		if (isset($_POST['Force_Validation']))
+		{
+  		$collection = array();
+
+			switch ($_POST['target'])
+    	{
+    		case 'all' :
+      	{
+      		foreach($page['filtered_users'] as $local_user)
+        	{
+        		array_push($collection, $local_user['id']);
+        	}
+        	break;
+				}
+      	case 'selection' :
+      	{
+      		if (isset($_POST['selection']))
+        	{
+        		$collection = $_POST['selection'];
+        	}
+        	break;
+      	}
+			}
+
+    	if (count($collection) == 0)
+    	{
+    		array_push($page['errors'], l10n('Select at least one user'));
+    	}
+		}
+// +-----------------------------------------------------------------------+
+// |             								Force validation					                 |
+// +-----------------------------------------------------------------------+
+		if (isset($_POST['Force_Validation']) and count($collection) > 0)
+		{
+			if (in_array($conf['guest_id'], $collection))
+   		{
+    		array_push($page['errors'], l10n('No_validation_for_Guest'));
+    	}
+    	if (($conf['guest_id'] != $conf['default_user_id']) and
+    		in_array($conf['default_user_id'], $collection))
+    	{
+    		array_push($page['errors'], l10n('No_validation_for_default_user'));
+    	}
+   		if (in_array($conf['webmaster_id'], $collection))
+    	{
+    		array_push($page['errors'], l10n('No_validation_for_Webmaster'));
+    	}
+    	if (in_array($user['id'], $collection))
+    	{
+    		array_push($page['errors'], l10n('No_validation_for_your_account'));
+    	}
+
+    	if (count($page['errors']) == 0)
+    	{
+    		foreach ($collection as $user_id)
+      	{
+				  $query = "
+						SELECT id, username, mail_address
+						FROM ".USERS_TABLE."
+						WHERE id = '".$user_id."'
+					;";
+					
+					$data = mysql_fetch_array(pwg_query($query));
+				
+      		ForceValidation($data['id']);				
+      	}
+      	array_push(
+      		$page['infos'],
+        	l10n_dec(
+        		'%d_Validated_User', '%d_Validated_Users',
+       		count($collection)
+        	)
+      	);
+
+				$page['filtered_users'] = get_unvalid_user_list();
+			}
+		}
+		
+
+// +-----------------------------------------------------------------------+
+// |                              groups list                              |
+// +-----------------------------------------------------------------------+
+
+		$groups[-1] = '------------';
+
+    $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'];
+    }
+
+// +-----------------------------------------------------------------------+
+// |                           Template Init                               |
+// +-----------------------------------------------------------------------+
+		$base_url = PHPWG_ROOT_PATH.'admin.php?page=user_list';
+
+    if (isset($_GET['start']) and is_numeric($_GET['start']))
+    {
+      $start = $_GET['start'];
+    }
+    else
+    {
+      $start = 0;
+    }
+
+    $template->assign(
+      array(
+        'F_ADD_ACTION' => $base_url,
+        'F_USERNAME' => @htmlentities($_GET['username']),
+        'F_FILTER_ACTION' => get_root_url().'admin.php'
+        )
+   	  );
+
+/* Hide radio-button if not allow to assign adviser */
+		if ($conf['allow_adviser'])
+    	{
+      	$template->assign('adviser', true);
+    	}
+
+// +-----------------------------------------------------------------------+
+// |                               user list                               |
+// +-----------------------------------------------------------------------+
+
+		$profile_url = get_root_url().'admin.php?page=profile&amp;user_id=';
+		$perm_url = get_root_url().'admin.php?page=user_perm&amp;user_id=';
+
+    $visible_user_list = array();
+    foreach ($page['filtered_users'] as $num => $local_user)
+    {
+/* simulate LIMIT $start, $conf['users_page'] */
+			if ($num < $start)
+      {
+        continue;
+      }
+      if ($num >= $start + $conf['users_page'])
+      {
+        break;
+      }
+
+      $visible_user_list[] = $local_user;
+		}
+    
+		foreach ($visible_user_list as $local_user)
+    {
+      $groups_string = preg_replace(
+      	'/(\d+)/e',
+        "\$groups['$1']",
+        implode(
+        	', ',
+            $local_user['groups']
+         )
+			);
+
+	  	if (isset($_POST['pref_submit'])
+    		and isset($_POST['selection'])
+      	and in_array($local_user['id'], $_POST['selection']))
+	  	{
+				$checked = 'checked="checked"';
+	  	}
+			else
+    	{
+    		$checked = '';
+    	}
+
+    	$properties = array();
+    	if ( $local_user['level'] != 0 )
+			{
+    		$properties[] = l10n( sprintf('Level %d', $local_user['level']) );
+			}
+    	$properties[] =
+    		(isset($local_user['enabled_high']) and ($local_user['enabled_high'] == 'true'))
+      		? l10n('is_high_enabled') : l10n('is_high_disabled');
+
+			$expiration = expiration($local_user['id']);
+              
+   		$template->append(
+     		'users',
+       	array(
+       		'ID' => $local_user['id'],
+         	'CHECKED' => $checked,
+         	'U_PROFILE' => $profile_url.$local_user['id'],
+         	'U_PERM' => $perm_url.$local_user['id'],
+         	'USERNAME' => $local_user['username']
+						.($local_user['id'] == $conf['guest_id']
+						? '<BR />['.l10n('is_the_guest').']' : '')
+           	.($local_user['id'] == $conf['default_user_id']
+           	? '<BR />['.l10n('is_the_default').']' : ''),
+					'STATUS' => l10n('user_status_'.
+						$local_user['status']).(($local_user['adviser'] == 'true')
+           	? '<BR />['.l10n('adviser').']' : ''),
+					'EMAIL' => get_email_address_as_display_text($local_user['email']),
+         	'GROUPS' => $groups_string,
+         	'REGISTRATION' => $local_user['registration_date'],
+         	'EXPIRATION' => $expiration,
+				)
+			);
+		}
+
+// +-----------------------------------------------------------------------+
+// |                             errors display                            |
+// +-----------------------------------------------------------------------+
+		if ( isset ($errors) and count($errors) != 0)
+		{
+	  	$template->assign('errors',array());
+			foreach ($errors as $error)
+	  	{
+				array_push($page['errors'], $error);
+	  	}
+		}  
+
+// +-----------------------------------------------------------------------+
+// |                           templates display                           |
+// +-----------------------------------------------------------------------+
+		$template->set_filename('plugin_admin_content', dirname(__FILE__) . '/ghosttracker.tpl');
+    $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
+  }
+  else
+  {
+		array_push($page['infos'], l10n('Err_GhostTracker_Settings'));
+  }
   break; 
 }
Index: /extensions/NBC_UserAdvManager/trunk/admin/global.tpl
===================================================================
--- /extensions/NBC_UserAdvManager/trunk/admin/global.tpl	(revision 4134)
+++ /extensions/NBC_UserAdvManager/trunk/admin/global.tpl	(revision 4135)
@@ -47,4 +47,10 @@
         <textarea name="UserAdvManager_MailExclusion_List" id="UserAdvManager_MailExclusion_List" rows="3" cols="80" {$TAG_INPUT_ENABLED}>{$UserAdvManager_MAILEXCLUSION_LIST}</textarea><br><br>
     	</li>
+
+    	<li><label>{'UserAdvManager_GhostTracker'|@translate}</label><br>
+        <input type="radio" value="true" {$UserAdvManager_GHOSTRACKER_TRUE} name="UserAdvManager_GhostUser_Tracker">{'UserAdvManager_GhostTracker_true'|@translate}<br>
+        <input type="radio" value="false" {$UserAdvManager_GHOSTRACKER_FALSE} name="UserAdvManager_GhostUser_Tracker">{'UserAdvManager_GhostTracker_false'|@translate}<br><br>
+    	</li>
+
     </ul>
     
Index: /extensions/NBC_UserAdvManager/trunk/include/constants.php
===================================================================
--- /extensions/NBC_UserAdvManager/trunk/include/constants.php	(revision 4134)
+++ /extensions/NBC_UserAdvManager/trunk/include/constants.php	(revision 4135)
@@ -2,3 +2,4 @@
 global $prefixeTable;
 define('USER_CONFIRM_MAIL_TABLE', $prefixeTable.'user_confirm_mail');
+define('USER_LASTVISIT_TABLE', $prefixeTable.'user_lastvisit_check');
 ?>
Index: /extensions/NBC_UserAdvManager/trunk/include/functions_UserAdvManager.inc.php
===================================================================
--- /extensions/NBC_UserAdvManager/trunk/include/functions_UserAdvManager.inc.php	(revision 4134)
+++ /extensions/NBC_UserAdvManager/trunk/include/functions_UserAdvManager.inc.php	(revision 4135)
@@ -738,5 +738,5 @@
  * Returns a password's score for password complexity check
  *
- * @param password entered
+ * @param password filled by user
  * 
  * Thanx to MathieuGut from http://m-gut.developpez.com
@@ -810,3 +810,10 @@
   return $finalscore;
 }
+
+/* Function called from maintain.inc.php - to determine if database upgrade is needed */
+function table_exist($table)
+{
+  $query = 'DESC '.$table.';';
+  return (bool)($res=mysql_query($query));
+}
 ?>
Index: /extensions/NBC_UserAdvManager/trunk/language/en_UK/plugin.lang.php
===================================================================
--- /extensions/NBC_UserAdvManager/trunk/language/en_UK/plugin.lang.php	(revision 4134)
+++ /extensions/NBC_UserAdvManager/trunk/language/en_UK/plugin.lang.php	(revision 4135)
@@ -9,18 +9,29 @@
 $lang['Title_Tab1'] = 'UserAdvManager - Global Configuration';
 $lang['Tab_Global'] = 'Global Configuration';
-$lang['UserAdvManager_Title'] = 'Advanced users settings';
+$lang['UserAdvManager_Title1'] = 'Users registration management';
+$lang['UserAdvManager_Title2'] = 'Registration validation and groups / status management';
 $lang['UserAdvManager_Mail_Info'] = ' Mail information user';
 $lang['UserAdvManager_Mail_Info_true'] = ' Send an information mail to the user when he registes or updates his profile.';
-$lang['UserAdvManager_Mail_Info_false'] = ' Turns off the sending of mail.';
+$lang['UserAdvManager_Mail_Info_false'] = ' Turns off the sending of mail. (default)';
 $lang['UserAdvManager_MailInfo_Text'] = ' Text used to introduce the email sent to user to allow him to validate his email address<br><b style="color: red;">(!!! </b><b style="text-decoration: underline; color: red;">WARNING !</b> <b style="color: red;">Use the multi language tags from Extended Description plugin if this plugin is activated !!!)</b>';
 $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_No_Casse_false'] = ' Let the user-sensitive. (default)';
 $lang['UserAdvManager_Username_Char'] = ' Limited charset for unsername';
 $lang['UserAdvManager_Username_Char_true'] = ' The following characters will be forbidden for username choice';
-$lang['UserAdvManager_Username_Char_false'] = ' Use the default username charset control.';
+$lang['UserAdvManager_Username_Char_false'] = ' Use the default username charset control. (default)';
+$lang['UserAdvManager_Password_Enforced'] = 'Strengthening passwords - Enabling this option makes the seizure of the password required for visitors registration. Also, the password entered by the visitor will meet with a score of complexity.';
+$lang['UserAdvManager_Password_Enforced_Info'] = '<b style="text-decoration: underline; color: green;">Explanations:</b> <b style="color: green;">A password score is calculated on the basic parameters: length, type of characters used (letters, digits, uppercase, lowercase, special characters). If the password of the user does not score, the score reached is displayed with the minimal score to reach and an indication to increase the value of this score. To give you an idea, a score below 100 is considered "low complexity". Between 100 and 500, the complexity is increased and average. Beyond 500, that\'s Fort Knox! ;-)<br>You can do your passwords complexity tests by using the field below. This will allow you to get an idea of the score to define a custom complexity.</b>';
+$lang['UserAdvManager_PasswordTest'] = 'Passowrd to test : ';
+$lang['UserAdvManager_ScoreTest'] = 'Score : ';
+$lang['PasswordTest'] = 'Score calculation';
+$lang['UserAdvManager_Password_Enforced_true'] = ' Strong password required - Enter the minimum score (floor value) of passwords complexity == ';
+$lang['UserAdvManager_Password_Enforced_false'] = ' Do not strengthen passwords. (default)';
+$lang['UserAdvManager_AdminPassword_Enforced'] = 'Apply also the passwords complexity control when an administrator create a user? Note: If the created user wishes to change his password and strengthening passwords for users is active, he will be subject to the rules set.';
+$lang['UserAdvManager_AdminPassword_Enforced_true'] = 'Enable strengthening passwords for admins.';
+$lang['UserAdvManager_AdminPassword_Enforced_false'] = 'Disable strengthening passwords for admins. (default)';
 $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_Confirm_Mail_false'] = ' Use the default Piwigo registration system (without registration validation). (default)';
 $lang['UserAdvManager_ConfirmMail_Text'] = ' Text used to introduce the email sent to user to allow him to validate his email address<br><b style="color: red;">(!!! </b><b style="text-decoration: underline; color: red;">WARNING !</b> <b style="color: red;">Use the multi language tags from Extended Description plugin if this plugin is activated !!!)</b>';
 $lang['UserAdvManager_Confirm_Group_Notice'] = 'WARNING : Using validation groups requires that you have created at least one user group and is defined "by default" in Piwigo\'s user groups management.';
@@ -32,11 +43,14 @@
 $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['UserAdvManager_No_Comment_Anonymous_false'] = ' Use the default Piwigo settings on comments sending. (default)';
 $lang['UserAdvManager_MailExclusion'] = 'Email provider exclusion';
 $lang['UserAdvManager_MailExclusion_true'] = ' Set the email provider exclusion ON (i.e. : @hotmail.* or @msn.*)';
-$lang['UserAdvManager_MailExclusion_false'] = ' Set the email provider exclusion OFF.';
+$lang['UserAdvManager_MailExclusion_false'] = ' Set the email provider exclusion OFF. (default)';
 $lang['UserAdvManager_MailExclusion_List'] = ' If email provider exclusion is set to ON, fill the email domains to exclude below. You have to use the following format :<br>@[domaine_name].[domaine_extension] - Example : @hotmail.com<br>Seperate the different domains with a comma (,)<br>';
-$lang['audit'] = 'Audit';
-$lang['submit'] = 'Submit';
+$lang['UserAdvManager_GhostTracker'] = 'Ghost Tracker - Allows to manage registered users according their last visit date (see the "Ghost Tracker" tab) :';
+$lang['UserAdvManager_GhostTracker_true'] = ' Enable Ghost Tracker.';
+$lang['UserAdvManager_GhostTracker_false'] = ' Disable Ghost Tracker. (Default)';
+$lang['audit'] = 'Audit parameters';
+$lang['submit'] = 'Save parameters';
 
 
@@ -47,14 +61,10 @@
 $lang['UserAdvManager_ConfirmMail_Info'] = 'Time limitation for validation of registration :<br>If you enable this option, select the desired time (x) )in the field below. Visitors who register will then have x days to validate their registration. After this period the validation link they have received by mail will be expired.<br>';
 $lang['UserAdvManager_ConfirmMail_TimeOut_true'] = 'Enable limiting the registration deadline.';
-$lang['UserAdvManager_ConfirmMail_TimeOut_false'] = 'Disable limiting the registration deadline.';
+$lang['UserAdvManager_ConfirmMail_TimeOut_false'] = 'Disable limiting the registration deadline. (Default)';
 $lang['UserAdvManager_ConfirmMail_TimeOut'] = 'Validation delay :';
 $lang['UserAdvManager_ConfirmMail_Delay_Info'] = 'Enter the number of days before expiry of the registration validation : ';
-/* This function can't work due to no access to server's cron functionnalities */
-//$lang['UserAdvManager_ConfirmMail_AutoDel'] = 'Suppression automatique des comptes non validés après le délai d\'expiration : ';
-//$lang['UserAdvManager_ConfirmMail_AutoDel_true'] = 'Activer la suppression automatique - <b style="text-decoration: blink underline;">ATTENTION !</b> La suppression est aveugle et sans notification.';
-//$lang['UserAdvManager_ConfirmMail_AutoDel_false'] = 'Désactiver la suppression automatique.';
 $lang['UserAdvManager_ConfirmMail_Remail'] = 'Enable or disable email reminder of unvalidated registers :';
 $lang['UserAdvManager_ConfirmMail_Remail_true'] = 'Enable email reminder';
-$lang['UserAdvManager_ConfirmMail_Remail_false'] = 'Disable email reminder';
+$lang['UserAdvManager_ConfirmMail_Remail_false'] = 'Disable email reminder. (Default)';
 $lang['UserAdvManager_ConfirmMail_ReMail_Txt1'] = 'Custom content of the recall message with regeneration of validation key.<br>If left blank, the recall mail will include only the validation link. It is therefore strongly advised to take a little explanatory text. (NB: The text pre-filled with the installation of the plugin is given as an example)<br><br><b style="color: red;">(!!! </b><b style="text-decoration: underline; color: red;">WARNING !</b> <b style="color: red;">Text modification is available ONLY if email reminder is enabled. Use the multi language tags from Extended Description plugin if this plugin is activated !!!)</b>';
 $lang['UserAdvManager_ConfirmMail_ReMail_Txt2'] = 'Custom content of the recall message without regeneration of validation key.<br>If left blank, the recall mail will include only the validation link. It is therefore strongly advised to take a little explanatory text. (NB: The text pre-filled with the installation of the plugin is given as an example)<br><br><b style="color: red;">(!!! </b><b style="text-decoration: underline; color: red;">WARNING !</b> <b style="color: red;">Text modification is available ONLY if email reminder is enabled. Use the multi language tags from Extended Description plugin if this plugin is activated !!!)</b>';
@@ -103,4 +113,10 @@
 $lang['Err_audit_advise'] = '<b>you have to perform corrections to comply with new rules that you have activated.<br>Use a database management utility to correct user accounts directly in the table ### _USERS';
 $lang['UserAdvManager_Empty Author'] = 'The author field have to be filled to send a comment.';
+$lang['reg_err_login3'] = 'Security : Password is mandatory !';
+$lang['reg_err_login4_%s'] = 'Security : A control system calculates a score on the chosen passwords complexity. The complexity of your password is too low (score = %s). Please, choose a new password more secure by following these rules:<br>
+- Use letters and numbers<br>
+- Use lowercase and uppercase<br>
+- Increase its length (number of characters)<br>
+The minimum passwords score required by the administrator is: ';
 if ( isset($conf_UserAdvManager[1]) and $conf_UserAdvManager[1] == 'true' )
 	$lang['reg_err_login5'] = 'Username already exist, WARNING name is case insensitive (Shift = Tiny).';
@@ -112,4 +128,5 @@
 $lang['Err_ConfirmMail_Settings'] = 'This page will be available only if "Email address confirmation" is activated in tab "Global Configuration".';
 $lang['Err_UserManager_Settings'] = 'This page is available only if "Enable limiting the registration deadline" is active in the "ConfirmMail Settings" tab and an unvalidated users group is set in "Global Configuration" tab.';
+$lang['Err_GhostTracker_Settings'] = 'This page is available only if "Ghost Tracker" is active in the "Global Configuration" tab.';
 $lang['No_validation_for_Guest'] = 'The "Guest" account is not subject to validation';
 $lang['No_validation_for_default_user'] = 'The default account is not subject to validation';
Index: /extensions/NBC_UserAdvManager/trunk/language/fr_FR/plugin.lang.php
===================================================================
--- /extensions/NBC_UserAdvManager/trunk/language/fr_FR/plugin.lang.php	(revision 4134)
+++ /extensions/NBC_UserAdvManager/trunk/language/fr_FR/plugin.lang.php	(revision 4135)
@@ -21,10 +21,10 @@
 $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. (valeur par défaut)';
-$lang['UserAdvManager_Password_Enforced'] = 'Renforcement des mots de passe - Activer cette option rend la saisie du mot de passe obligatoire à l\'inscription des visiteurs. De plus, le mot de passe saisi par le visiteur devra répondre à un score de fiabilité.';
-$lang['UserAdvManager_Password_Enforced_Info'] = '<b style="text-decoration: underline; color: green;">Explications :</b> <b style="color: green;">Le score d\'un mot de passe est calculé en fonction des paramètres de base : longueur, types de caractères utilisés(lettres, chiffres, majuscules, minuscules, caractères spéciaux). Si le mot de passe de l\'utilisateur ne répond pas au score, le score réalisé est affiché ainsi que le score planchet et une indication pour augmenter la valeur de ce score. Pour donner un ordre d\'idée, un score inférieur à 100 est considéré comme faible. Entre 100 et 500, la fiabilité est renforcée. Au dela de 500, c\'est Fort Knox !! ;-)<br>Vous pouvez tester la fiabilité d\'un mot de passe en utilisant les champs ci-dessous (pour test uniquement !)</b>';
+$lang['UserAdvManager_Password_Enforced'] = 'Renforcement des mots de passe - Activer cette option rend la saisie du mot de passe obligatoire à l\'inscription des visiteurs. De plus, le mot de passe saisi par le visiteur devra répondre à un score de complexité.';
+$lang['UserAdvManager_Password_Enforced_Info'] = '<b style="text-decoration: underline; color: green;">Explications :</b> <b style="color: green;">Le score d\'un mot de passe est calculé en fonction des paramètres de base : longueur, types de caractères utilisés(lettres, chiffres, majuscules, minuscules, caractères spéciaux). Si le mot de passe de l\'utilisateur ne répond pas au score, le score réalisé est affiché ainsi que le score minimum à atteindre et une indication pour augmenter la valeur de ce score. Pour donner un ordre d\'idée, un score inférieur à 100 est considéré comme faible. Entre 100 et 500, la complexité est renforcée et dans la moyenne. Au dela de 500, c\'est Fort Knox !! ;-)<br>Vous pouvez faire vos essais de complexité d\'un mot de passe en utilisant le champ ci-dessous. Cela vous permettra de vous faire une idée du score à définir pour une complexité personnalisée.</b>';
 $lang['UserAdvManager_PasswordTest'] = 'Mot de passe à tester : ';
 $lang['UserAdvManager_ScoreTest'] = 'Score obtenu : ';
 $lang['PasswordTest'] = 'Calcul du score';
-$lang['UserAdvManager_Password_Enforced_true'] = ' Mot de passe renforcé obligatoire - Saisir le score minimum (valeur planchet) de fiabilité du mots de passe == ';
+$lang['UserAdvManager_Password_Enforced_true'] = ' Mot de passe renforcé obligatoire - Saisir le score minimum (valeur plancher) de complexité du mots de passe == ';
 $lang['UserAdvManager_Password_Enforced_false'] = ' Ne pas renforcer les mots de passe. (valeur par défaut)';
 $lang['UserAdvManager_AdminPassword_Enforced'] = 'Appliquer également le contrôle du renforcement de mots de passe lorsqu\'un administrateur créé un utilisateur? A noter : Si l\'utilisateur ainsi créé désire changer de mot de passe et que le renforcement des mots de passe pour les utilisateurs est actif, il sera soumis à la règle configurée.';
@@ -48,4 +48,7 @@
 $lang['UserAdvManager_MailExclusion_false'] = ' Désactiver l\'exclusion des domaines de messagerie. (valeur par défaut)';
 $lang['UserAdvManager_MailExclusion_List'] = ' Si l\'exclusion de domaines de messagerie est activée, saisissez les domaines à exclure ici. Il faut respecter le format suivant :<br>@[nom_du_domaine].[extension_du_domaine] - Exemple : @hotmail.com<br><br>Séparez les domaines par une virgule<br>';
+$lang['UserAdvManager_GhostTracker'] = 'Gestion des visiteurs fantômes - Permet de gérer les inscrits en fonction de leur date de dernière visite (voir onglet "Ghost Tracker") :';
+$lang['UserAdvManager_GhostTracker_true'] = ' Activer la gestion des visiteurs fantômes.';
+$lang['UserAdvManager_GhostTracker_false'] = ' Désactiver la gestion des visiteurs fantômes. (valeur par défaut)';
 $lang['audit'] = 'Auditer les paramètres';
 $lang['submit'] = 'Sauvegarder les paramètres';
@@ -61,8 +64,4 @@
 $lang['UserAdvManager_ConfirmMail_TimeOut'] = 'Délai d\activation :';
 $lang['UserAdvManager_ConfirmMail_Delay_Info'] = 'Saisissez ici le nombre de jours avant expiration de la validation d\'inscription : ';
-/* This function can't work due to no access to server's cron functionnalities */
-//$lang['UserAdvManager_ConfirmMail_AutoDel'] = 'Suppression automatique des comptes non validés après le délai d\'expiration : ';
-//$lang['UserAdvManager_ConfirmMail_AutoDel_true'] = 'Activer la suppression automatique - <b style="text-decoration: blink underline;">ATTENTION !</b> La suppression est aveugle et sans notification.';
-//$lang['UserAdvManager_ConfirmMail_AutoDel_false'] = 'Désactiver la suppression automatique.';
 $lang['UserAdvManager_ConfirmMail_Remail'] = 'Activer ou désactiver la fonctionnalité de rappel des inscrits non validés :<br>';
 $lang['UserAdvManager_ConfirmMail_Remail_true'] = 'Activer le rappel par mail.';
@@ -76,4 +75,20 @@
 $lang['Title_Tab3'] = 'UserAdvManager - Gestion des visiteurs';
 $lang['Tab_UserManager'] = 'Gestion des visiteurs';
+$lang['UserAdvManager_ConfirmMail_User_List'] = 'Lorsque la limitation du délai d\'inscription est activée, vous trouverez ci-dessous la liste des utilisateurs en attente de validation d\'inscription <b style="text-decoration: underline;">qu\'ils soient ou pas</b> dans les délais pour la valider.<br><br>Dans cette vue, vous pouvez :
+<br><br>
+- Supprimer manuellement les comptes <b>(purge manuelle)</b>
+<br>
+- Générer l\'email de rappel <b>sans génération</b> d\'une nouvelle clef. Rappel : Cette fonction ne réinitialise pas la date d\'inscription du visiteur ciblé et le délai d\'expiration est toujours d\'actualité.
+<br>
+- Générer l\'email de rappel <b>avec génération</b> d\'une nouvelle clef. Rappel : Cette fonction réinitialise également la date d\'inscription du visiteur ciblé ce qui équivaut à prolonger le délai de validation.<br>
+- Valider manuellement une inscription en attente de validation même si la date d\'expiration est révolue <b>(forçage de la validation)</b>.
+<br>';
+$lang['Registration_Date'] = 'Date d\'enregistrement';
+
+
+/* UserManager Tab */
+$lang['UserManager_Title'] = 'Gestion avancée des visiteurs fantômes';
+$lang['Title_Tab3'] = 'UserAdvManager - Ghost Tracker';
+$lang['Tab_GhostTracker'] = 'Ghost Tracker';
 $lang['UserAdvManager_ConfirmMail_User_List'] = 'Lorsque la limitation du délai d\'inscription est activée, vous trouverez ci-dessous la liste des utilisateurs en attente de validation d\'inscription <b style="text-decoration: underline;">qu\'ils soient ou pas</b> dans les délais pour la valider.<br><br>Dans cette vue, vous pouvez :
 <br><br>
@@ -129,4 +144,5 @@
 $lang['Err_ConfirmMail_Settings'] = 'Cette page n\'est accessible que si "Confirmation de l\'adresse email" est actif dans l\'onglet "Configuration Générale".';
 $lang['Err_UserManager_Settings'] = 'Cette page n\'est accessible que si "Délai de validation d\'inscription" est actif dans l\'onglet "Configuration de ConfirmMail" et si un groupe de visiteurs non validés est configuré dans l\'onglet "Configuration Générale".';
+$lang['Err_GhostTracker_Settings'] = 'Cette page n\'est accessible que si "Gestion des visiteurs fantômes" est actif dans l\'onglet "Configuration Générale".';
 $lang['No_validation_for_Guest'] = 'Le compte Guest n\'est pas soumis à validation';
 $lang['No_validation_for_default_user'] = 'Le compte par défaut n\'est pas soumis à validation';
Index: /extensions/NBC_UserAdvManager/trunk/main.inc.php
===================================================================
--- /extensions/NBC_UserAdvManager/trunk/main.inc.php	(revision 4134)
+++ /extensions/NBC_UserAdvManager/trunk/main.inc.php	(revision 4135)
@@ -2,5 +2,5 @@
 /*
 Plugin Name: NBC UserAdvManager
-Version: 2.11.5
+Version: 2.12.0a
 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
@@ -60,5 +60,5 @@
 
 -- 2.11.3 : On Patricia's request (french forum and bug 1173), the unvalidated users management tab shows users according with the settings of unvalidated group and / or unvalidated status.
-						Feature 1172 : Email providers exclusion list can be set with CR/LF between each entry. The comma seperator (,) is still mandatory.
+						Feature 1172 added : Email providers exclusion list can be set with CR/LF between each entry. The comma seperator (,) is still mandatory.
 						Bug 1175 fixed : Bad translation tag in french language file.
 						Improvement of unvalidated users management tab (feature 1174)- Expired users are displayed in red color text.
@@ -71,6 +71,7 @@
 
 -- pre 2.12.0 : Bug 1206 fixed : All plugin functionnalities work in user's profile page
-            Plugin's core code and admin panel refactoring
-            Password control and enforcement : A complexity score is computed on user registration. If this score is less than the goal set by admin, the password choosen is rejected.
+                Plugin's core code and admin panel refactoring
+                Password control and enforcement : A complexity score is computed on user registration. If this score is less than the goal set by admin, the password choosen is rejected.
+                Feature 1194 "Ghost Tracker" added : New plugin tab displays users who don't comes back to the gallery since x days. Ability to send email reminders and to delete reminded but "dead" users. It's the reason why this feature is called "Ghost Tracker".
 */
 
@@ -79,7 +80,7 @@
  ***** 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 ?))
+++ 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 ?)
 
 ++ Password control and enforcement
@@ -357,4 +358,5 @@
 }
 
+
 add_event_handler('user_comment_check', 'UserAdvManager_CheckEmptyCommentAuthor', 50, 2);
 
Index: /extensions/NBC_UserAdvManager/trunk/maintain.inc.php
===================================================================
--- /extensions/NBC_UserAdvManager/trunk/maintain.inc.php	(revision 4134)
+++ /extensions/NBC_UserAdvManager/trunk/maintain.inc.php	(revision 4135)
@@ -5,4 +5,5 @@
 
 include_once (NBC_UserAdvManager_PATH.'include/constants.php');
+include_once (NBC_UserAdvManager_PATH.'include/functions_UserAdvManager.inc.php');
 
 function plugin_install()
@@ -12,5 +13,5 @@
   $q = '
     INSERT INTO '.CONFIG_TABLE.' (param, value, comment)
-    VALUES ("nbc_UserAdvManager","true;false;false;-1;-1;-1;false;false;;-1;;;false;;false;100;false","Parametres du plugin nbc UserAdvManager")
+    VALUES ("nbc_UserAdvManager","true;false;false;-1;-1;-1;false;false;;-1;;;false;;false;100;false,false","Parametres du plugin nbc UserAdvManager")
   ;';
   pwg_query($q);
@@ -37,5 +38,17 @@
       status enum('webmaster','admin','normal','generic','guest') default NULL,
       date_check datetime default NULL,
+      lastvisit DATETIME NULL DEFAULT NULL,
+      reminder ENUM('true','false') NULL DEFAULT NULL
       PRIMARY KEY  (id)
+    )
+  ;";
+  pwg_query($q);
+
+	$q = "
+    CREATE TABLE IF NOT EXISTS ".USER_LASTVISIT_TABLE." (
+      user_id SMALLINT(5) NOT NULL DEFAULT '0',
+      lastvisit DATETIME NULL DEFAULT NULL,
+      reminder ENUM('true','false') NULL,
+      PRIMARY KEY (`user_id`)
     )
   ;";
@@ -47,8 +60,8 @@
 	  global $conf;
 	
-/* Check for upgrade */
+/* Check for upgrade from 2.10 */
 	  $query = '
     SELECT *
-		FROM '.CONFIG_TABLE.'
+		  FROM '.CONFIG_TABLE.'
     WHERE param = "nbc_UserAdvManager_ConfirmMail"
   ;';
@@ -60,5 +73,13 @@
 		upgrade_210();
 	}
+
+/* Check for upgrade from 2.11 */
+  if (!table_exist(USER_LASTVISIT_TABLE))
+  {
+    /* upgrade from branch 2.11 */
+		upgrade_211();
+  }
 }
+
 
 function plugin_uninstall()
@@ -88,6 +109,10 @@
   $q = 'DROP TABLE '.USER_CONFIRM_MAIL_TABLE.';';
   pwg_query( $q );
+
+  $q = 'DROP TABLE '.USER_LASTVISIT_TABLE.';';
+  pwg_query( $q );
 }
 
+/* upgrade from branch 2.10 */
 function upgrade_210()
 {
@@ -107,4 +132,38 @@
   ;';
   pwg_query($q);
+
+upgrade_211();
+}
+
+/* upgrade from branch 2.11 */
+function upgrade_211()
+{
+	global $conf;
+
+  $conf_nbc_UserAdvManager = isset($conf['nbc_UserAdvManager']) ? explode(";" , $conf['nbc_UserAdvManager']) : array();
+
+  if ((!isset($conf_nbc_UserAdvManager[14]) and !isset($conf_nbc_UserAdvManager[15])) and !isset($conf_nbc_UserAdvManager[16]) and !isset($conf_nbc_UserAdvManager[17]))
+  {
+    $upgrade_nbc_UserAdvManager = $conf_nbc_UserAdvManager[0].';'.$conf_nbc_UserAdvManager[1].';'.$conf_nbc_UserAdvManager[2].';'.$conf_nbc_UserAdvManager[3].';'.$conf_nbc_UserAdvManager[4].';'.$conf_nbc_UserAdvManager[5].';'.$conf_nbc_UserAdvManager[6].';'.$conf_nbc_UserAdvManager[7].';'.$conf_nbc_UserAdvManager[8].';'.$conf_nbc_UserAdvManager[9].';'.$conf_nbc_UserAdvManager[10].';'.$conf_nbc_UserAdvManager[11].';'.$conf_nbc_UserAdvManager[12].';'.$conf_nbc_UserAdvManager[13].';false;100;false;false';
+		
+		$query = '
+	  	UPDATE '.CONFIG_TABLE.'
+	  	SET value="'.$upgrade_nbc_UserAdvManager.'"
+	  	WHERE param="nbc_UserAdvManager"
+	  	LIMIT 1
+	  	;';
+		
+		pwg_query($query);
+  }
+  
+	$q = "
+    CREATE TABLE IF NOT EXISTS ".USER_LASTVISIT_TABLE." (
+      user_id SMALLINT(5) NOT NULL DEFAULT '0',
+      lastvisit DATETIME NULL DEFAULT NULL,
+      reminder ENUM('true','false') NULL,
+      PRIMARY KEY (`user_id`)
+    )
+  ;";
+  pwg_query($q);
 }
 ?>
