Index: /extensions/UserAdvManager/trunk/admin/UAM_admin.php
===================================================================
--- /extensions/UserAdvManager/trunk/admin/UAM_admin.php	(revision 11317)
+++ /extensions/UserAdvManager/trunk/admin/UAM_admin.php	(revision 11318)
@@ -33,4 +33,7 @@
 $UAM_Password_Test_Score = 0;
 $UAM_Exclusionlist_Error = false;
+$UAM_Illegal_Flag_Error1 = false;
+$UAM_Illegal_Flag_Error2 = false;
+$UAM_Illegal_Flag_Error3 = false;
 
 $dump_download = '';
@@ -111,5 +114,5 @@
     //General configuration settings
 		$_POST['UAM_MailInfo_Text'] = str_replace('\"', '"', str_replace("\'", "'", str_replace("\\\\", "\\", $_POST['UAM_MailInfo_Text'])));
-    
+
 		$_POST['UAM_ConfirmMail_Text'] = str_replace('\"', '"', str_replace("\'", "'", str_replace("\\\\", "\\", $_POST['UAM_ConfirmMail_Text'])));
 
@@ -135,4 +138,5 @@
     // Consistency check between ConfirmMail and AutoMail - We cannot use GTAutoMail if ConfirmMail is disabled
     $conf_UAM = unserialize($conf['UserAdvManager']);
+    $conf_UAM_ConfirmMail = unserialize($conf['UserAdvManager_ConfirmMail']);
     
     if (((isset($conf_UAM['1']) and ($conf_UAM['1'] == 'false' or $conf_UAM['1'] == 'local')) or ($_POST['UAM_Confirm_Mail'] == 'false' or $_POST['UAM_Confirm_Mail'] == 'local')) and $_POST['UAM_GTAutoMail'] == 'true')
@@ -141,4 +145,11 @@
       $_POST['UAM_GTAutoMail'] = $newvalue;
       array_push($page['errors'], l10n('UAM_Error_GTAutoMail_cannot_be_set_without_ConfirmMail'));
+    }
+
+    // Check if [Kdays] flag is used in a legal way (ConfirmMail Time out have to be set)
+    if (isset($conf_UAM_ConfirmMail[0]) and $conf_UAM_ConfirmMail[0] == 'false' and preg_match('#\[Kdays\]#i',$_POST['UAM_ConfirmMail_Text']) != 0)
+    {
+      $UAM_Illegal_Flag_Error1 = true;
+      array_push($page['errors'], l10n('UAM_Error_Using_illegal_Kdays'));
     }
 
@@ -193,4 +204,16 @@
     
     $_POST['UAM_ConfirmMail_Custom_Txt2'] = str_replace('\"', '"', str_replace("\'", "'", str_replace("\\\\", "\\", $_POST['UAM_ConfirmMail_Custom_Txt2'])));
+
+    // Check if [Kdays] flag is used in a legal way (ConfirmMail Time out have to be set)
+    if (isset($conf_UAM_ConfirmMail[0]) and $conf_UAM_ConfirmMail[0] == 'false' and preg_match('#\[Kdays\]#i',$_POST['UAM_ConfirmMail_ReMail_Txt1']) == 1)
+    {
+      $UAM_Illegal_Flag_Error2 = true;
+      array_push($page['errors'], l10n('UAM_Error_Using_illegal_flag'));
+    }
+    elseif (isset($conf_UAM_ConfirmMail[0]) and $conf_UAM_ConfirmMail[0] == 'false' and preg_match('#\[Kdays\]#i',$_POST['UAM_ConfirmMail_ReMail_Txt2']) == 1)
+    {
+      $UAM_Illegal_Flag_Error3 = true;
+      array_push($page['errors'], l10n('UAM_Error_Using_illegal_flag'));
+    }
     
 	  $newconf_UAM_ConfirmMail = array (
@@ -433,5 +456,8 @@
     'UAM_HIDEPASSW_FALSE'            => $conf_UAM[34]=='false' ?  'checked="checked"' : '' ,
 		'UAM_PASSWORD_TEST_SCORE'        => $UAM_Password_Test_Score,
-    'UAM_ERROR_REPORTS4'             => $UAM_Exclusionlist_Error,
+    'UAM_ERROR_REPORTS1'             => $UAM_Exclusionlist_Error,
+    'UAM_ERROR_REPORTS2'             => $UAM_Illegal_Flag_Error1,
+    'UAM_ERROR_REPORTS3'             => $UAM_Illegal_Flag_Error2,
+    'UAM_ERROR_REPORTS4'             => $UAM_Illegal_Flag_Error3,
 		'UAM_CONFIRMMAIL_TIMEOUT_TRUE'	 => $conf_UAM_ConfirmMail[0]=='true' ?  'checked="checked"' : '' ,
 		'UAM_CONFIRMMAIL_TIMEOUT_FALSE'  => $conf_UAM_ConfirmMail[0]=='false' ?  'checked="checked"' : '' ,
Index: /extensions/UserAdvManager/trunk/admin/template/global.tpl
===================================================================
--- /extensions/UserAdvManager/trunk/admin/template/global.tpl	(revision 11317)
+++ /extensions/UserAdvManager/trunk/admin/template/global.tpl	(revision 11318)
@@ -135,5 +135,5 @@
           </li>
 
-          {if $UAM_ERROR_REPORTS4}     
+          {if $UAM_ERROR_REPORTS1}     
             <div id="uam_leftmargin">
               <textarea class="uam_textfields" name="UAM_MailExclusion_List" id="UAM_MailExclusion_List" rows="3" style="color: red" {$TAG_INPUT_ENABLED}>{$UAM_MAILEXCLUSION_LIST}</textarea>
@@ -283,5 +283,9 @@
               </label>
             <br><br>
+            {if $UAM_ERROR_REPORTS2}
+                <textarea class="uam_textfields" name="UAM_ConfirmMail_Text" id="UAM_ConfirmMail_Text" rows="10" style="color: red" {$TAG_INPUT_ENABLED}>{$UAM_CONFIRMMAIL_TEXT}</textarea>
+            {else}
                 <textarea class="uam_textfields" name="UAM_ConfirmMail_Text" id="UAM_ConfirmMail_Text" rows="10" {$TAG_INPUT_ENABLED}>{$UAM_CONFIRMMAIL_TEXT}</textarea>
+            {/if}
             <br><br>
             </li>
@@ -427,5 +431,9 @@
                   </label>
                 <br><br>
+                {if $UAM_ERROR_REPORTS3}
+                    <textarea class="uam_textfields" name="UAM_ConfirmMail_ReMail_Txt1" id="UAM_ConfirmMail_ReMail_Txt1" rows="10" style="color: red" {$TAG_INPUT_ENABLED}>{$UAM_CONFIRMMAIL_REMAIL_TXT1}</textarea>
+                {else}
                     <textarea class="uam_textfields" name="UAM_ConfirmMail_ReMail_Txt1" id="UAM_ConfirmMail_ReMail_Txt1" rows="10" {$TAG_INPUT_ENABLED}>{$UAM_CONFIRMMAIL_REMAIL_TXT1}</textarea>
+                {/if}
                 <br><br>
                 </li>
@@ -443,5 +451,9 @@
                   </label>
                 <br><br>
+                {if $UAM_ERROR_REPORTS4}
+                    <textarea class="uam_textfields" name="UAM_ConfirmMail_ReMail_Txt2" id="UAM_ConfirmMail_ReMail_Txt2" rows="10" style="color: red" {$TAG_INPUT_ENABLED}>{$UAM_CONFIRMMAIL_REMAIL_TXT2}</textarea>
+                {else}
                     <textarea class="uam_textfields" name="UAM_ConfirmMail_ReMail_Txt2" id="UAM_ConfirmMail_ReMail_Txt2" rows="10" {$TAG_INPUT_ENABLED}>{$UAM_CONFIRMMAIL_REMAIL_TXT2}</textarea>
+                {/if}
                 <br>
                 </li>
Index: /extensions/UserAdvManager/trunk/changelog.txt.php
===================================================================
--- /extensions/UserAdvManager/trunk/changelog.txt.php	(revision 11317)
+++ /extensions/UserAdvManager/trunk/changelog.txt.php	(revision 11318)
@@ -257,5 +257,7 @@
 -- 2.20.9 : Bug fixed on installation from scratch (unable to save config)
 
--- 2.20.10 : Bug 2324 fixed - New feature : Add [days] flag to insert maximum numbers of days between two visits set in plugin's GhostTracker in GhostTracker reminder email.
+-- 2.20.10 : Bug 2324 fixed - New feature : Add [days] autotext flag to insert maximum numbers of days between two visits set in plugin's GhostTracker in GhostTracker reminder email.
+
+-- 2.20.11 : Bug 2336 fixed - New feature : Add [Kdays] autotext flag to insert the number of days until expiration.
 */
 ?>
Index: /extensions/UserAdvManager/trunk/include/functions.inc.php
===================================================================
--- /extensions/UserAdvManager/trunk/include/functions.inc.php	(revision 11317)
+++ /extensions/UserAdvManager/trunk/include/functions.inc.php	(revision 11318)
@@ -860,5 +860,5 @@
     if (isset($conf_UAM[9]) and $conf_UAM[9] <> '')
     {
-      // Management of Extension flags ([username], [mygallery], [myurl])
+      // Management of Extension flags ([username], [mygallery], [myurl], [Kdays])
       $patterns[] = '#\[username\]#i';
       $replacements[] = $username;
@@ -867,4 +867,10 @@
       $patterns[] = '#\[myurl\]#i';
       $replacements[] = $conf['gallery_url'];
+      
+      if (isset($conf_UAM_ConfirmMail[0]) and $conf_UAM_ConfirmMail[0] == 'true') // [Kdays] replacement only if related option is active
+      {
+        $patterns[] = '#\[Kdays\]#i';
+        $replacements[] = $conf_UAM_ConfirmMail[1];
+      }
       
       if (function_exists('get_user_language_desc'))
@@ -949,5 +955,5 @@
       if (isset($conf_UAM_ConfirmMail[2]) and $conf_UAM_ConfirmMail[2] <> '' and isset($conf_UAM_ConfirmMail[3]) and $conf_UAM_ConfirmMail[3] == 'true' and $confirm)
       {
-        // Management of Extension flags ([username], [mygallery], [myurl])
+        // Management of Extension flags ([username], [mygallery], [myurl], [Kdays])
         $patterns[] = '#\[username\]#i';
         $replacements[] = $username;
@@ -956,4 +962,10 @@
         $patterns[] = '#\[myurl\]#i';
         $replacements[] = $conf['gallery_url'];
+
+        if (isset($conf_UAM_ConfirmMail[0]) and $conf_UAM_ConfirmMail[0] == 'true') // [Kdays] replacement only if related option is active
+        {
+          $patterns[] = '#\[Kdays\]#i';
+          $replacements[] = $conf_UAM_ConfirmMail[1];
+        }
 
         if (function_exists('get_user_language_desc'))
@@ -985,5 +997,5 @@
       if (isset($conf_UAM_ConfirmMail[4]) and $conf_UAM_ConfirmMail[4] <> '' and isset($conf_UAM_ConfirmMail[3]) and $conf_UAM_ConfirmMail[3] == 'true' and !$confirm)
       {
-        // Management of Extension flags ([username], [mygallery], [myurl])
+        // Management of Extension flags ([username], [mygallery], [myurl], [Kdays])
         $patterns[] = '#\[username\]#i';
         $replacements[] = $username;
@@ -992,4 +1004,10 @@
         $patterns[] = '#\[myurl\]#i';
         $replacements[] = $conf['gallery_url'];
+
+        if (isset($conf_UAM_ConfirmMail[0]) and $conf_UAM_ConfirmMail[0] == 'true') // [Kdays] replacement only if related option is active
+        {
+          $patterns[] = '#\[Kdays\]#i';
+          $replacements[] = $conf_UAM_ConfirmMail[1];
+        }
         
         if (function_exists('get_user_language_desc'))
Index: /extensions/UserAdvManager/trunk/language/de_DE/plugin.lang.php
===================================================================
--- /extensions/UserAdvManager/trunk/language/de_DE/plugin.lang.php	(revision 11317)
+++ /extensions/UserAdvManager/trunk/language/de_DE/plugin.lang.php	(revision 11318)
@@ -328,3 +328,8 @@
 $lang['UAM_HidePassw'] = 'Passwort im Klartext in der Informations-E-Mail';
 // --------- End: New or revised $lang ---- from version 2.20.4
+
+
+// --------- Starting below: New or revised $lang ---- from version 2.20.11
+/*TODO*/$lang['UAM_Error_Using_illegal_flag'] = 'Syntax error ! The [Kdays] AutoText flag is used as the "Anmeldeschluss Validierung beschränkt" option was not activated. Please activate the option or correct the text field(s) colored in red.';
+// --------- End: New or revised $lang ---- from version 2.20.11
 ?>
Index: /extensions/UserAdvManager/trunk/language/en_UK/plugin.lang.php
===================================================================
--- /extensions/UserAdvManager/trunk/language/en_UK/plugin.lang.php	(revision 11317)
+++ /extensions/UserAdvManager/trunk/language/en_UK/plugin.lang.php	(revision 11318)
@@ -330,3 +330,8 @@
 $lang['UAM_HidePassw'] = 'Password in clear text in the information email';
 // --------- End: New or revised $lang ---- from version 2.20.4
+
+
+// --------- Starting below: New or revised $lang ---- from version 2.20.11
+$lang['UAM_Error_Using_illegal_flag'] = 'Syntax error ! The [Kdays] AutoText flag is used as the "Deadline for registration validation limited" option was not activated. Please activate the option or correct the text field(s) colored in red.';
+// --------- End: New or revised $lang ---- from version 2.20.11
 ?>
Index: /extensions/UserAdvManager/trunk/language/es_ES/plugin.lang.php
===================================================================
--- /extensions/UserAdvManager/trunk/language/es_ES/plugin.lang.php	(revision 11317)
+++ /extensions/UserAdvManager/trunk/language/es_ES/plugin.lang.php	(revision 11318)
@@ -368,3 +368,8 @@
 $lang['UAM_HidePassw'] = 'Contraseña en texto claro en la información del correo electrónico';
 // --------- End: New or revised $lang ---- from version 2.20.4
+
+
+// --------- Starting below: New or revised $lang ---- from version 2.20.11
+/*TODO*/$lang['UAM_Error_Using_illegal_flag'] = 'Syntax error ! The [Kdays] AutoText flag is used as the "Plazo para la validación de registro limitado" option was not activated. Please activate the option or correct the text field(s) colored in red.';
+// --------- End: New or revised $lang ---- from version 2.20.11
 ?>
Index: /extensions/UserAdvManager/trunk/language/fr_FR/plugin.lang.php
===================================================================
--- /extensions/UserAdvManager/trunk/language/fr_FR/plugin.lang.php	(revision 11317)
+++ /extensions/UserAdvManager/trunk/language/fr_FR/plugin.lang.php	(revision 11318)
@@ -329,3 +329,7 @@
 $lang['UAM_HidePassw'] = 'Mot de passe en clair dans le mail d\'information';
 // --------- End: New or revised $lang ---- from version 2.20.4
+
+// --------- Starting below: New or revised $lang ---- from version 2.20.11
+$lang['UAM_Error_Using_illegal_flag'] = 'Erreur de syntaxe ! Le drapeau d\'insertion automatique [Kdays] est utilisé alors que l\'option "Limitation du délai de validation d\'inscription" n\'a pas été activée. Veuillez activer l\'option ou corriger le(s) champ(s) marqué(s) en rouge.';
+// --------- End: New or revised $lang ---- from version 2.20.11
 ?>
Index: /extensions/UserAdvManager/trunk/language/it_IT/plugin.lang.php
===================================================================
--- /extensions/UserAdvManager/trunk/language/it_IT/plugin.lang.php	(revision 11317)
+++ /extensions/UserAdvManager/trunk/language/it_IT/plugin.lang.php	(revision 11318)
@@ -329,3 +329,8 @@
 $lang['UAM_HidePassw'] = 'Password in chiaro nelle email d\'informazione';
 // --------- End: New or revised $lang ---- from version 2.20.4
+
+
+// --------- Starting below: New or revised $lang ---- from version 2.20.11
+/*TODO*/$lang['UAM_Error_Using_illegal_flag'] = 'Syntax error ! The [Kdays] AutoText flag is used as the "Termine per la validazione dell\'iscrizione limitato" option was not activated. Please activate the option or correct the text field(s) colored in red.';
+// --------- End: New or revised $lang ---- from version 2.20.11
 ?>
Index: /extensions/UserAdvManager/trunk/language/lv_LV/plugin.lang.php
===================================================================
--- /extensions/UserAdvManager/trunk/language/lv_LV/plugin.lang.php	(revision 11317)
+++ /extensions/UserAdvManager/trunk/language/lv_LV/plugin.lang.php	(revision 11318)
@@ -365,3 +365,8 @@
 /*TODO*/$lang['UAM_HidePassw'] = 'Clear password in information email';
 // --------- End: New or revised $lang ---- from version 2.20.4
+
+
+// --------- Starting below: New or revised $lang ---- from version 2.20.11
+/*TODO*/$lang['UAM_Error_Using_illegal_flag'] = 'Syntax error ! The [Kdays] AutoText flag is used as the "Reģistrācijas apstiprināšanas limita robežlīnija" option was not activated. Please activate the option or correct the text field(s) colored in red.';
+// --------- End: New or revised $lang ---- from version 2.20.11
 ?>
Index: /extensions/UserAdvManager/trunk/main.inc.php
===================================================================
--- /extensions/UserAdvManager/trunk/main.inc.php	(revision 11317)
+++ /extensions/UserAdvManager/trunk/main.inc.php	(revision 11318)
@@ -2,5 +2,5 @@
 /*
 Plugin Name: UserAdvManager
-Version: 2.20.10
+Version: 2.20.11
 Description: Renforcer la gestion des utilisateurs - Enforce users management
 Plugin URI: http://piwigo.org/ext/extension_view.php?eid=216
