Index: extensions/event_cats/admin/autolog_entries.inc.php
===================================================================
--- extensions/event_cats/admin/autolog_entries.inc.php	(revision 4114)
+++ extensions/event_cats/admin/autolog_entries.inc.php	(revision 4115)
@@ -55,5 +55,4 @@
 
 $code_list = array();
-build_ec_lists(); // in evntcats_funcs.inc.php
 
 /****************************************************************
Index: extensions/event_cats/admin/autolog_new.inc.php
===================================================================
--- extensions/event_cats/admin/autolog_new.inc.php	(revision 4114)
+++ extensions/event_cats/admin/autolog_new.inc.php	(revision 4115)
@@ -54,27 +54,5 @@
 /****************************************************************************/
 
-build_ec_lists(); // in evntcats_funcs.php
-
-$ec_lists['duplicable_codes'] = array();
-$t = array();
-
-foreach ($ec_lists['ec_table'] as $ec_entry) {
-  if (
-    is_in($ec_entry['action'], 'ec_ok') and
-    $ec_entry['forced'] == 'false'
-  ) {
-    $t[$ec_entry['id']] = $ec_entry['code'];
-    $ec_lists['duplicable_codes']['codes'][$ec_entry['code']]['id'] =
-     $ec_entry['id'];
-    $ec_lists['duplicable_codes']['codes'][$ec_entry['code']]['user_id'] =
-     $ec_entry['user_id'];
-  }
-}
-foreach ($t as $ec_id => $ec_code) {
-  $ec_lists['duplicable_codes']['ids'][$ec_id] =
-   $ec_lists['duplicable_codes']['codes'][$ec_code]['id'];
-}
-
-$ec_def_vals = array();
+build_ec_duplicable_codes();
 
 $ec_default_action = 'create_ask';
Index: extensions/event_cats/admin/evntcats_admin.php
===================================================================
--- extensions/event_cats/admin/evntcats_admin.php	(revision 4114)
+++ extensions/event_cats/admin/evntcats_admin.php	(revision 4115)
@@ -76,4 +76,6 @@
 if ($ec_howto) change_ec_conf('howto', '1');
 
+build_ec_lists(); // in evntcats_funcs.php
+
 // +-----------------------------------------------------------------------+
 // |                            Tabsheet
@@ -105,11 +107,17 @@
     elseif ($_POST['ec_act1'] == 'modify_entry_submit') $page['tab'] =
      (ec_modify_entry_OK()) ? 'autolog_entries' : 'autolog_new';
+    else {
+      $page['tab'] = 'autolog_entries';
+      if ($_POST['ec_act1'] == 'delete') ec_delete_entry();
+    }
   }
 }
-else if (isset($_GET['tab'])) switch ($_GET['tab']) {
-  case 'autolog_new':
-  case 'duplication':
-  case 'config':
-   $page['tab'] = $_GET['tab'];
+else {
+  if (isset($_GET['tab'])) switch ($_GET['tab']) {
+    case 'autolog_new':
+    case 'duplication':
+    case 'config':
+     $page['tab'] = $_GET['tab'];
+  }
 }
 
Index: extensions/event_cats/admin/template/autolog_new.js
===================================================================
--- extensions/event_cats/admin/template/autolog_new.js	(revision 4114)
+++ extensions/event_cats/admin/template/autolog_new.js	(revision 4115)
@@ -115,32 +115,31 @@
     ) {
       var t1 = '';
-      if (ec_id == 'ec_sel_code_old' && ec_selected_old_code == '-1') {
+      /* if (ec_id == 'ec_sel_code_old' && ec_selected_old_code == '-1') {
         ec_selected_code = 'ec_sel_code_new';
         ec_selected_old_code = ec_selected_old_code2;
       }
-      else ec_selected_code = ec_id;
+      else */ ec_selected_code = ec_id;
       de(ec_selected_code).checked = 'checked';
       switch (ec_selected_code) {
         case 'ec_sel_code_new':
-          de('ec_act1_id').value = 'create';
+          de('ec_act1_id').value                    = 'create';
           de('ec_in_up_code_list_id').selectedIndex = '-1';
-          de('ec_in_up_code_id').value = ec_new_code_text;
-          de('ec_act2_id').value = '-1';
+          de('ec_in_up_code_id').value              = ec_new_code_text;
+          de('ec_act2_id').value                    = '-1';
         break;
         case 'ec_sel_code_old':
-          de('ec_act1_id').value =
-           'duplicate_entry_submit';
-          de('ec_act2_id').value =
-           ec_selected_old_code;
-          de('ec_in_up_code_list_id').value =
-           ec_selected_old_code;
-          de('ec_in_up_code_id').value = '';
-          t1 = 'disabled';
-          ec_selected_old_user =
+          de('ec_act1_id').value            = 'duplicate_entry_submit';
+          de('ec_act2_id').value            = ec_selected_old_code;
+          de('ec_in_up_code_list_id').value = ec_selected_old_code;
+          de('ec_in_up_code_id').value      = '';
+          t1                                = 'disabled';
+          ec_selected_user                  = 'ec_sel_user_old';
+          ec_selected_old_user              =
            d.ec_new_code.ec_in_up_code_list.options[
             d.ec_new_code.ec_in_up_code_list.selectedIndex
            ].label;
-          de('ec_in_up_usr_list_id').value = ec_selected_old_user;
+          ec_flag1 = ec_flag2;
           ec_mark_user('ec_sel_user_old');
+          ec_flag1 = false;
         break;
       }
@@ -174,10 +173,10 @@
      de('ec_sel_user_old').disabled == true)
     ) {
-      if (ec_id == 'ec_sel_user_old' && ec_selected_old_user == '-1') {
+      /* if (ec_id == 'ec_sel_user_old' && ec_selected_old_user == '-1') {
         ec_selected_user =
          (ec_is_creation) ? 'ec_sel_user_new' : 'ec_sel_user_none';
         ec_selected_old_user = ec_selected_old_user2;
       }
-      else ec_selected_user = ec_id;
+      else */ ec_selected_user = ec_id;
       de(ec_selected_user).checked = 'checked';
       switch (ec_selected_user) {
@@ -193,8 +192,6 @@
           if (ec_selected_action == 'ec_input_action_refused')
            ec_selected_action = 'ec_input_action_home';
-          de('ec_in_up_usr_txt_id').value =
-           ec_new_user_text;
-          de('ec_in_up_psd_txt_id').value =
-           ec_new_psd_text;
+          de('ec_in_up_usr_txt_id').value = ec_new_user_text;
+          de('ec_in_up_psd_txt_id').value = ec_new_psd_text;
           de('ec_in_up_usr_list_id').selectedIndex = '-1';
         break;
@@ -635,8 +632,4 @@
     else {                                          // Duplicate entry
       de('ec_act1_id').value                      = 'duplicate_entry_submit';
-   /* if (ec_default_entry == '-1') 
-       de('ec_in_up_code_list_id').selectedIndex  = '-1';
-      else
-       de('ec_in_up_code_list_id').value          = ec_default_entry; */
       de('ec_submit_gen_full_auto_id').disabled   = 'disabled';
       de('ec_submit_gen_code_id').disabled        = 'disabled';
@@ -705,8 +698,6 @@
       de('ec_in_up_imgs_id').disabled             = 'disabled';
       de('ec_input_action_home').disabled         = 'disabled';
-      if (ec_default_entry == '-1') 
-       de('ec_in_up_entry_list_id').selectedIndex = '-1';
-      else
-       de('ec_in_up_entry_list_id').value         = ec_default_entry;
+      de('ec_in_up_usr_list_id').selectedIndex    = '-1';
+      de('ec_in_up_entry_list_id').value          = ec_default_entry;
     }
     ec_default_action                             = 'modify_entry_ask';
Index: extensions/event_cats/admin/template/autolog_new.tpl
===================================================================
--- extensions/event_cats/admin/template/autolog_new.tpl	(revision 4114)
+++ extensions/event_cats/admin/template/autolog_new.tpl	(revision 4115)
@@ -154,5 +154,5 @@
           </label>
           <span {$ec_hidden_when_no_user} >&nbsp;</span>
-          <label for = "ec_in_up_code_id" style = "margin:0;">
+          <label for = "ec_in_up_usr_txt_id" style = "margin:0;">
             <input class = "submit" type = "button" name = "ec_submit_gen_user" value = "{'ec_up_code_lbl_gen_user'|@translate}"
              id = "ec_submit_gen_user_id" onclick = "ec_gen_user();"
Index: extensions/event_cats/include/evntcats_funcs.inc.php
===================================================================
--- extensions/event_cats/include/evntcats_funcs.inc.php	(revision 4114)
+++ extensions/event_cats/include/evntcats_funcs.inc.php	(revision 4115)
@@ -32,4 +32,72 @@
 
 /*
+ * ec_inspect()
+ * goes through ec_lists['ec_table'] to check errors on (multiple) entries
+ * using the same code. Cannot be used elsewhere than here in
+ * build_ec_table() .
+ *
+ * @param
+ *   
+ * @return
+ *   (no return value)
+ */
+function ec_inspect($checked_item, $new_action, $check_ec_nok = true) {
+  global $ec_lists;
+  $first = array();
+  $to_correct = array();
+  
+  // $to_correct is needed cause following code would not work everywhere :
+  /*
+  foreach ($table as $value) {
+    if ($value == $value_to_check and $value == $problem) {
+      foreach ($table as &$value2) { // key index of $table can be reset
+        if ($value2 == $value_to_check) {
+          $value2 = $better_value;
+        }
+      }
+    }
+  }
+  // It works with WinAmp Server, but not on Apache server of Free (french
+  // Internet provider).
+  */
+  
+  foreach ($ec_lists['ec_table'] as &$ec_entry) { // & is not really needed
+    $ec_current_code = $ec_entry['code'];
+    if (
+     $ec_entry['action'] == 'ec_ok' or
+     ($check_ec_nok and $ec_entry['action'] == 'ec_nok')
+    ) {
+      if (isset($first[$ec_current_code])) {
+        // $first[$ec_current_code] is set <=> code has already been met.
+        // Checked item MUST be equal to the first item (thus all items) for
+        // this code.
+        if (
+         $first[$ec_current_code] != $ec_entry[$checked_item] or
+         ($new_action == '' and $ec_entry[$checked_item] == 'true')
+        ) {
+          $to_correct[$ec_current_code] = true; // value not used in fact
+        } // but using $ec_current_code as a key makes a smaller table
+      } // if the error comes back several times
+      else {
+        $first[$ec_current_code] = $ec_entry[$checked_item];
+      }
+    }
+  }
+  foreach ($ec_lists['ec_table'] as &$ec_entry) { // & is needed here
+    if (isset($to_correct[$ec_entry['code']])) {
+      if ($new_action == '') {
+        if (!pwg_query('
+          UPDATE `'.EVNTCATS_TABLE.'`
+          SET `forced` = "false"
+          WHERE `id` = '.$ec_entry['id']
+        )) die('Could not fix a "_f_pb"');
+        $ec_entry['forced'] = 'false';
+      }
+      else $ec_entry['action'] = $new_action;
+    }
+  }
+}
+
+/*
  * build_ec_table()
  * builds a table showing the content of the <pwg>_event_cats database table,
@@ -110,82 +178,12 @@
   // Construction of behaviour
   
-  /*
-   * ec_inpect()
-   * goes through ec_lists['ec_table'] to check errors on (multiple) entries
-   * using the same code. Cannot be used elsewhere than here in
-   * build_ec_table() .
-   *
-   * @param
-   *   
-   * @return
-   *   (no return value)
-   */
-  function ec_inpect($checked_item, $new_action, $check_ec_nok = true) {
-    global $ec_lists;
-    $first = array();
-    $to_correct = array();
-    
-    // $to_correct is needed cause following code would not work everywhere :
-    /*
-    foreach ($table as $value) {
-      if ($value == $value_to_check and $value == $problem) {
-        foreach ($table as &$value2) { // key index of $table can be reset
-          if ($value2 == $value_to_check) {
-            $value2 = $better_value;
-          }
-        }
-      }
-    }
-    // It works with WinAmp Server, but not on Apache server of Free (french
-    // Internet provider).
-    */
-    
-    foreach ($ec_lists['ec_table'] as &$ec_entry) { // & is not really needed
-      $ec_current_code = $ec_entry['code'];
-      if (
-       $ec_entry['action'] == 'ec_ok' or
-       ($check_ec_nok and $ec_entry['action'] == 'ec_nok')
-      ) {
-        if (isset($first[$ec_current_code])) {
-          // $first[$ec_current_code] is set <=> code has already been met.
-          // Checked item MUST be equal to the first item (thus all items) for
-          // this code.
-          if (
-           $first[$ec_current_code] != $ec_entry[$checked_item] or
-           ($new_action == '' and $ec_entry[$checked_item] == 'true')
-          ) {
-            $to_correct[$ec_current_code] = true; // value not used in fact
-          } // but using $ec_current_code as a key makes a smaller table
-        } // if the error comes back several times
-        else {
-          $first[$ec_current_code] = $ec_entry[$checked_item];
-        }
-      }
-    }
-    foreach ($ec_lists['ec_table'] as &$ec_entry) { // & is needed here
-      if (isset($to_correct[$ec_entry['code']])) {
-        if ($new_action == '') {
-          if (
-            pwg_query('
-              UPDATE `'.EVNTCATS_TABLE.'`
-              SET `forced` = "false"
-              WHERE `id` = '.$ec_entry['id']
-            ) == null
-          ) die('Could not fix a "_f_pb"');
-          $ec_entry['forced'] = 'false';
-        }
-        else $ec_entry['action'] = $new_action;
-      }
-    }
-  }
-
   // Multiple action params for a single code check
-  ec_inpect('action', 'ec_nok_action_pb');
+  ec_inspect('action', 'ec_nok_action_pb');
   
   // Multiple user_ids for a single code check
-  ec_inpect('user_id', 'ec_nok_userid_pb', false);
+  ec_inspect('user_id', 'ec_nok_userid_pb', false);
   
   // Multiple "forced" params for a single code check
-  ec_inpect('forced', '');
+  ec_inspect('forced', '');
   
   // User id and associated page validities checks
@@ -226,10 +224,5 @@
           if (array_key_exists($ec_entry['arg1'], $ec_lists['categories'])) {
             if ($a == 3) { // case 3: // Image
-              if (!mysql_fetch_row(pwg_query('
-               SELECT *
-               FROM `'.IMAGE_CATEGORY_TABLE.'` 
-               WHERE `category_id` = '.$ec_entry['arg1'].'
-                AND `image_id` = '.$ec_entry['arg2']
-              ))) {
+              if (!ec_image_exists($ec_entry['arg1'], $ec_entry['arg2'])) {
                 $ec_entry['action'].= '_img_pb';
               }
@@ -242,4 +235,36 @@
       break;
     }
+  }
+}
+
+/*
+ * build_ec_duplicable_codes()
+ * 
+ *
+ * @param
+ *   no parameter passed, the main material on which works the function, is
+ *   the global array variable $ec_lists.
+ * @return
+ *   (no return value)
+ */
+function build_ec_duplicable_codes() {
+  global $ec_lists;
+  $ec_lists['duplicable_codes'] = array();
+  $t                            = array();
+  foreach ($ec_lists['ec_table'] as $ec_entry) {
+    if (
+      is_in($ec_entry['action'], 'ec_ok') and
+      $ec_entry['forced'] == 'false'
+    ) {
+      $t[$ec_entry['id']] = $ec_entry['code'];
+      $ec_lists['duplicable_codes']['codes'][$ec_entry['code']]['id'] =
+       $ec_entry['id'];
+      $ec_lists['duplicable_codes']['codes'][$ec_entry['code']]['user_id'] =
+       $ec_entry['user_id'];
+    }
+  }
+  foreach ($t as $ec_id => $ec_code) {
+    $ec_lists['duplicable_codes']['ids'][$ec_id] =
+     $ec_lists['duplicable_codes']['codes'][$ec_code]['id'];
   }
 }
@@ -332,6 +357,99 @@
  */
 function ec_duplicate_entry_OK() {
-  global $page;
-  $page['errors'][] = 'Y\'a sûrement eu une erreur...';
+  global $page, $ec_lists;
+  
+  build_ec_duplicable_codes();
+  if (array_key_exists($_POST['ec_entry_sel'],
+   $ec_lists['duplicable_codes']['ids'])) {
+    $arg1 = ''; $arg2 = '';
+    switch ($_POST['ec_input_action']) {
+      case 'add_p':
+        if (array_key_exists($_POST['ec_in_up_aps'], $ec_lists['add_pages'])) {
+         $arg2 = $_POST['ec_in_up_aps']; }
+        else {
+          $page['errors'][] =
+           l10n('ec_bad_argument1').
+           '$_POST[\'ec_in_up_aps\'] = '.
+           $_POST['ec_in_up_aps']
+          ;
+          return false;
+        }
+      case 'home':
+      break;
+      case 'img':
+      case 'cat':
+        if (array_key_exists($_POST['ec_in_up_cat'],
+         $ec_lists['categories'])) {
+          if ($_POST['ec_input_action'] == 'img') {
+            if (
+             ec_image_exists($_POST['ec_in_up_cat'], $_POST['ec_in_up_img'])
+            ) $arg2 = $_POST['ec_in_up_img'];
+            else {
+              $page['errors'][] =
+               l10n('ec_bad_argument1').
+               '$_POST[\'ec_in_up_img\'] = '.
+               $_POST['ec_in_up_img']
+              ;
+              return false;
+            }
+          }
+          $arg1 = $_POST['ec_in_up_cat'];
+        }
+        else {
+          $page['errors'][] =
+           l10n('ec_bad_argument1').
+           '$_POST[\'ec_in_up_cat\'] = '.
+           $_POST['ec_in_up_cat']
+          ;
+          return false;
+        }
+      break;
+      default:
+        $page['errors'][] =
+         l10n('ec_bad_argument1').
+         '$_POST[\'ec_input_action\'] = '.
+         $_POST['ec_input_action']
+        ;
+        return false;
+    }
+    if (pwg_query("
+      INSERT INTO `".EVNTCATS_TABLE."`
+       (`code`, `user_id`, `action`, `arg1`, `arg2`)
+      VALUES (
+        '".$ec_lists['ec_table'][$_POST['ec_entry_sel']]['code']."',
+        '".$ec_lists['ec_table'][$_POST['ec_entry_sel']]['user_id']."',
+        'ec_ok',
+        '".$arg1."',
+        '".$arg2."'
+      );
+    ")) {
+      $page['infos'][] =
+       l10n('ec_entry_dup_ok_pre').
+       $_POST['ec_entry_sel'].' ('.
+       $ec_lists['ec_table'][$_POST['ec_entry_sel']]['code'].')'.
+       l10n('ec_entry_dup_ok_end')
+      ;
+      build_ec_table();
+      return true;
+    }
+    else {
+      $page['errors'][] =
+       l10n('ec_entry_dup_nok_pre1').
+       $_POST['ec_entry_sel'].
+       l10n('ec_entry_dup_nok_end1').
+       'MySQL error '.mysql_errno().', "'.mysql_error().'"'
+      ;
+      return false;
+    }
+  }
+  else {
+    $page['errors'][] =
+     l10n('ec_bad_argument1').
+     '$_POST[\'ec_entry_sel\'] = '.
+     $_POST['ec_entry_sel']
+    ;
+    return false;
+  }
+  $page['errors'][] = '?!';
   return false;
 }
@@ -351,4 +469,64 @@
   $page['errors'][] = 'Y\'a pas eu une erreur ?...';
   return false;
+}
+
+/*
+ * ec_delete_entry()
+ * tries to delete an existing entry which # is given by
+ * $_POST['ec_entry_sel'].
+ *
+ * @param
+ *   no param
+ * @return
+ *   no return value : modifies $page['errors'] or $page['infos']
+ */
+function ec_delete_entry() {
+  global $page, $ec_lists;
+  if (array_key_exists($_POST['ec_entry_sel'], $ec_lists['ec_table'])) {
+    if (!pwg_query('
+      DELETE FROM `'.EVNTCATS_TABLE.'`
+      WHERE `id` = '.$_POST['ec_entry_sel']
+    )) {
+      $page['errors'][] =
+        l10n('ec_entry_del_nok_pre').
+        $_POST['ec_entry_sel'].
+        l10n('ec_entry_del_nok_end').
+        'MySQL error '.mysql_errno().', "'.mysql_error().'"'
+      ;
+    }
+    else {
+      $page['infos'][] =
+        l10n('ec_entry_del_ok_pre').
+        $_POST['ec_entry_sel'].
+        l10n('ec_entry_del_ok_end');
+      build_ec_table();
+    }
+  }
+  else {
+    $page['errors'][] =
+     l10n('ec_bad_argument1').
+     '$_POST[\'ec_entry_sel\'] = '.
+     $_POST['ec_entry_sel']
+    ;
+  }
+}
+
+/*
+ * ec_image_exists($cat, $img)
+ * returns true or false whether the image is associated with the category.
+ *
+ * @param
+ *   $cat : the category
+ *   $img : the image
+ * @return
+ *   treu or false whether the image is associated with the category.
+ */
+function ec_image_exists($cat, $img) {
+  return (mysql_fetch_row(pwg_query('
+   SELECT *
+   FROM `'.IMAGE_CATEGORY_TABLE.'` 
+   WHERE `category_id` = '.$cat.'
+    AND `image_id` = '.$img
+  )) !== false);
 }
 
Index: extensions/event_cats/language/fr_FR/plugin.lang.php
===================================================================
--- extensions/event_cats/language/fr_FR/plugin.lang.php	(revision 4114)
+++ extensions/event_cats/language/fr_FR/plugin.lang.php	(revision 4115)
@@ -95,7 +95,9 @@
 $lang['ec_add_page_miss']         = 'page Additional Pages inexistante (probablement supprimée)';
 $lang['ec_entry_del_nok_pre']     = 'Problème avec suppression entrée ';
-$lang['ec_entry_del_nok_end']     = '';
+$lang['ec_entry_del_nok_end']     = ' : ';
+$lang['ec_entry_dup_nok_pre1']    = 'Problème avec tentative de rendre périmée entrée ';
+$lang['ec_entry_dup_nok_end1']    = ' : ';
 $lang['ec_entry_dis_nok_pre1']    = 'Problème avec tentative de rendre périmée entrée ';
-$lang['ec_entry_dis_nok_end1']    = '';
+$lang['ec_entry_dis_nok_end1']    = ' : ';
 $lang['ec_entry_dis_nok_pre2']    = 'Problème avec tentative de rendre périmée entrée ';
 $lang['ec_entry_dis_nok_mid2']    = ' (lié à Add. Page n°';
@@ -103,7 +105,10 @@
 $lang['ec_entry_dis_nok_pre3']    = 'Problème avec tentative de rendre périmée entrée ';
 $lang['ec_entry_dis_nok_end3']    = ' (arg1 = NULL)';
+$lang['ec_bad_argument1']         = 'Mauvais argument : ';
 // Infos
 $lang['ec_entry_del_ok_pre']      = 'Entrée ';
-$lang['ec_entry_del_ok_end']      = ' supprimée';
+$lang['ec_entry_del_ok_end']      = ' supprimée.';
+$lang['ec_entry_dup_ok_pre']      = 'Entrée ';
+$lang['ec_entry_dup_ok_end']      = ' dupliquée.';
 $lang['ec_entry_dis_ok_pre1']     = 'Entrée ';
 $lang['ec_entry_dis_ok_end1']     = ' maintenant périmée';
@@ -115,12 +120,12 @@
 //   actions
 $lang['ec_ok']                    = 'OUI';
-$lang['ec_ok_ap_pb']              = 'OUI (Add. Page inconnue)';
-$lang['ec_ok_cat_pb']             = 'OUI (catégorie inconnue)';
-$lang['ec_ok_img_pb']             = 'OUI (image inconnue)';
+$lang['ec_ok_ap_pb']              = 'OUI, mais Add. Page inconnue';
+$lang['ec_ok_cat_pb']             = 'OUI, mais catégorie inconnue';
+$lang['ec_ok_img_pb']             = 'OUI, mais image inconnue';
 $lang['ec_nok']                   = 'NON';
 $lang['ec_nok_ap_pb']             = 'NON';
-$lang['ec_nok_userid_miss']       = 'NON (utilisateur inconnu)';
-$lang['ec_nok_action_pb']         = 'NON ("action" corrompu)';
-$lang['ec_nok_userid_pb']         = 'NON ("user_id" corrompu)';
+$lang['ec_nok_userid_miss']       = 'NON : utilisateur inconnu';
+$lang['ec_nok_action_pb']         = 'NON : "action" corrompu';
+$lang['ec_nok_userid_pb']         = 'NON : "user_id" corrompu';
 // Username can't be displayed
 $lang['ec_dspl_nok_actn']         = '"action" inutilisable';
