Index: /extensions/event_cats/admin/evntcats_admin.php
===================================================================
--- /extensions/event_cats/admin/evntcats_admin.php	(revision 4217)
+++ /extensions/event_cats/admin/evntcats_admin.php	(revision 4218)
@@ -112,13 +112,24 @@
    $page['tab'] = 'autolog_modif';
   elseif ($_POST['ec_act1'] == 'create')
-   $page['tab'] = (ec_create_entry_OK()) ? 'autolog_entries' : 'autolog_new';
-  elseif (isset($_POST['ec_entry_sel']) and is_numeric($_POST['ec_entry_sel'])) {
-    if ($_POST['ec_act1'] == 'duplicate_entry_submit') $page['tab'] =
-     (ec_duplicate_entry_OK()) ? 'autolog_entries' : 'autolog_new';
-    elseif ($_POST['ec_act1'] == 'modify_entry_submit') $page['tab'] =
-     (ec_modify_entry_OK()) ? 'autolog_entries' : 'autolog_modif';
+   $page['tab'] = (ec_create_modify_entry_OK()) ?
+    'autolog_entries' : 'autolog_new';
+  elseif (
+    isset($_POST['ec_entry_sel']) and
+    is_numeric($_POST['ec_entry_sel'])
+  ) {
+    if (
+      $_POST['ec_act1'] == 'duplicate_entry_submit' or
+      $_POST['ec_act1'] == 'modify_entry_submit'
+    ) $page['tab'] = (ec_create_modify_entry_OK()) ?
+     'autolog_entries' : 'autolog_modif';
     else {
       $page['tab'] = 'autolog_entries';
-      if ($_POST['ec_act1'] == 'delete') ec_delete_entry();
+      if ($_POST['ec_act1'] == 'delete') {
+        if (isset($_POST['ec_entry_sel'])) {
+          ec_delete_entry_OK($_POST['ec_entry_sel']);
+          build_ec_table();
+        }
+        else ec_end1('ec_entry_sel', 'ec_bad_argument1');
+      }
       elseif ($_POST['ec_act1'] == 'toggle_forced') ec_toggle_forced_entry();
     }
Index: /extensions/event_cats/admin/template/autolog_new.js
===================================================================
--- /extensions/event_cats/admin/template/autolog_new.js	(revision 4217)
+++ /extensions/event_cats/admin/template/autolog_new.js	(revision 4218)
@@ -798,4 +798,5 @@
     }
     else {                                          // Outdate entry
+      ec_selected_user                            = 'ec_sel_user_none';
       de('ec_in_up_entry_list_id').disabled       = 'disabled';
       de('ec_sel_user_none').disabled             = 'disabled';
Index: /extensions/event_cats/include/evntcats_admin_funcs.inc.php
===================================================================
--- /extensions/event_cats/include/evntcats_admin_funcs.inc.php	(revision 4217)
+++ /extensions/event_cats/include/evntcats_admin_funcs.inc.php	(revision 4218)
@@ -65,4 +65,6 @@
  * ec_create_user_OK()
  * Creates new generic user and eventually new group as described in $_POST.
+ * Assumes that the validity of the different indexes of $_POST it uses, have
+ * already been checked.
  *
  * @param
@@ -74,6 +76,6 @@
   global $page;
   
-  // This function assumes that the validity of the different indexes it uses,
-  // have been checked before it is used.
+  // This function assumes that the validity of the different indexes of
+  // $_POST it uses, have already been checked.
   
   // User creation, as generic
@@ -189,5 +191,5 @@
 
 /*
- * ec_create_entry_OK()
+ * ec_create_modify_entry_OK()
  * returns true or false whether the creation of a new entry described by
  * $_POST was OK or not.
@@ -198,50 +200,91 @@
  *   true if creation was OK ; false if not
  */
-function ec_create_entry_OK() {
+function ec_create_modify_entry_OK() {
   global $page, $ec_lists;
   
-  // $_POST validity checks : creation prevented in case of bad arguments
-  if (
-    !isset($_POST['ec_in_up_code']) or
-    !ereg('^[a-zA-Z0-9_-]{4,32}$', $_POST['ec_in_up_code'])
-  ) return ec_end1('ec_in_up_code', 'ec_bad_argument7');
-  
-  foreach ($ec_lists['ec_table'] as $ec_entry)
-   if ($_POST['ec_in_up_code'] == $ec_entry['code'])
-    return ec_end1('ec_in_up_code', 'ec_bad_argument2');
-  
-  if (
-    !isset($_POST['ec_sel_user']) or (
-      $_POST['ec_sel_user'] != 'new' and
-      $_POST['ec_sel_user'] != 'old'
-    )
-  ) return ec_end1('ec_sel_user', 'ec_bad_argument1');
-  
-  if ($_POST['ec_sel_user'] == 'new') {
-    if (
-      !isset($_POST['login']) or
-      $_POST['login'] == ''
-    ) return ec_end1('login', 'ec_bad_argument1');
-    if (in_array($_POST['login'], $ec_lists['user_ids']))
-     return ec_end1('login', 'ec_bad_argument3');
-  }
-  else {
-    if (!isset($_POST['ec_in_up_usr_list']))
-     return ec_end1('login', 'ec_bad_argument1');
-    $ec_user_id = $_POST['ec_in_up_usr_list'];
-    if (!array_key_exists($ec_user_id, $ec_lists['user_ids']))
-     return ec_end1('ec_in_up_usr_list', 'ec_bad_argument6');
-  }
-  
-  // code and user_id (if needed) are OK, creation can be done
-  
-  // User and eventually group creation, if needed
-  if ($_POST['ec_sel_user'] == 'new')
-   if (!($ec_user_id = ec_create_user_OK())) return false;
+  // $_POST validity checks : action prevented in case of bad arguments
+  
+  if (!isset($_POST['ec_act1']))
+   return ec_end1('ec_act1', 'ec_bad_argument1');
+  
+  if (!isset($_POST['ec_input_action']))
+   return ec_end1('ec_input_action', 'ec_bad_argument1');
+  
+  $is_creation = true;
+  $action = 'ec_ok';
+  $arg1 = '';
+  $arg2 = '';
+  switch ($_POST['ec_act1']) {
+    
+    case 'create':
+      
+      if (
+        !isset($_POST['ec_in_up_code']) or
+        !ereg('^[a-zA-Z0-9_-]{4,32}$', $_POST['ec_in_up_code'])
+      ) return ec_end1('ec_in_up_code', 'ec_bad_argument7');
+      else $ec_code = $_POST['ec_in_up_code'];
+      
+      foreach ($ec_lists['ec_table'] as $ec_entry)
+       if ($ec_code == $ec_entry['code'])
+        return ec_end1('ec_in_up_code', 'ec_bad_argument2');
+      
+      if (
+        !isset($_POST['ec_sel_user']) or (
+          $_POST['ec_sel_user'] != 'new' and
+          $_POST['ec_sel_user'] != 'old'
+        )
+      ) return ec_end1('ec_sel_user', 'ec_bad_argument1');
+    
+    case 'modify_entry_submit':
+      
+      $ec_user_id = '';
+      if (isset($_POST['ec_sel_user'])) {
+        if ($_POST['ec_sel_user'] == 'new') {
+          if (
+            !isset($_POST['login']) or
+            $_POST['login'] == ''
+          ) return ec_end1('login', 'ec_bad_argument1');
+          if (in_array($_POST['login'], $ec_lists['user_ids']))
+           return ec_end1('login', 'ec_bad_argument3');
+        }
+        elseif ($_POST['ec_sel_user'] == 'old') {
+          if (!isset($_POST['ec_in_up_usr_list']))
+           return ec_end1('login', 'ec_bad_argument1');
+          $ec_user_id = $_POST['ec_in_up_usr_list'];
+          if (!array_key_exists($ec_user_id, $ec_lists['user_ids']))
+           return ec_end1('ec_in_up_usr_list', 'ec_bad_argument6');
+        }
+        else $action = 'ec_nok';
+      }
+      else $action = 'ec_nok';
+      
+     if ($_POST['ec_act1'] == 'create') break;
+      
+      $is_creation = false;
+      
+    case 'duplicate_entry_submit':
+      
+      if (
+        !isset($_POST['ec_entry_sel']) or
+        !array_key_exists($_POST['ec_entry_sel'], $ec_lists['ec_table'])
+      ) return ec_end1('ec_entry_sel', 'ec_bad_argument5');
+      
+     if ($_POST['ec_act1'] == 'modify_entry_submit') break;
+      
+      build_ec_duplicable_codes();
+      if (!array_key_exists($_POST['ec_entry_sel'],
+       $ec_lists['duplicable_codes']['ids'])
+      ) return ec_end1('ec_entry_sel', 'ec_bad_argument5');
+      $ec_code    = $ec_lists['ec_table'][$_POST['ec_entry_sel']]['code'];
+      $ec_user_id = $ec_lists['ec_table'][$_POST['ec_entry_sel']]['user_id'];
+      
+    break;
+    default: ec_end1('ec_act1', 'ec_bad_argument1');
+  }
   
   // Preparation of $arg1, $arg2 and $forced
-  $arg1 = ''; $arg2 = '';
-  if (isset($_POST['ec_input_action'])) switch ($_POST['ec_input_action']) {
+  switch ($_POST['ec_input_action']) {
     // case 'home':  // Home : nothing to do : "arg"s are ''
+    // case 'refused': $_POST['ec_sel_user'] unset, nothing to do
     case 'add_p': // Additional Page
       if (isset($_POST['ec_in_up_aps'])) $arg2 = $_POST['ec_in_up_aps'];
@@ -261,98 +304,54 @@
     default: ec_end1('ec_input_action', 'ec_bad_argument1');
   }
-  else ec_end1('ec_input_action', 'ec_bad_argument1');
-  $forced = (isset($_POST['ec_in_up_forced'])) ? 'true' : 'false';
-  
-  // Now we have the code, the user_id, arg1, arg2, and forced arguments
-  if (
-    pwg_query("
-      INSERT INTO `".EVNTCATS_TABLE."` (
-        `code`,
-        `user_id`,
-        `action`,
-        `arg1`, `arg2`, `forced`
-      )
-      VALUES (
-        '".$_POST['ec_in_up_code']."',
-        '".$ec_user_id."',
-        'ec_ok',
-        '".$arg1."', '".$arg2."', '".$forced."'
-      );
-    ") === false
-  ) {
-    $page['errors'][] =
-     l10n('ec_entry_create_pb').
-     'MySQL error '.mysql_errno().', "'.mysql_error().'"'
-    ;
-    return false;
-  }
-  else {
-    build_ec_lists();
-    $forced = ($forced == 'false') ? '' : l10n('ec_cnfrm_forced');
-    $page['infos'][] =
-     l10n('ec_entry_create_OK').mysql_insert_id().' : '.
-     $_POST['ec_in_up_code'].' => '.
-     $ec_lists['user_ids'][$ec_user_id].$forced
-    ;
-    return true;
-  }
-}
-
-/*
- * ec_duplicate_entry_OK()
- * returns true or false whether the duplication of an existing entry which #
- * is given by $_POST['ec_entry_sel'] was OK or not.
- *
- * @param
- *   no param
- * @return
- *   true if creation was OK ; false if not
- */
-function ec_duplicate_entry_OK() {
-  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 'home':  // Home : nothing to do : "arg"s are ''
-      case 'add_p':
-        if (array_key_exists($_POST['ec_in_up_aps'],$ec_lists['add_pages'])) {
-         $arg2 = $_POST['ec_in_up_aps']; }
-        else return ec_end1('ec_in_up_aps', 'ec_bad_argument4');
-      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 return ec_end1('ec_in_up_img', 'ec_bad_argument4');
-          }
-          $arg1 = $_POST['ec_in_up_cat'];
-        }
-        else return ec_end1('ec_in_up_cat', 'ec_bad_argument4');
-      break;
-      default: return ec_end1('ec_input_action', 'ec_bad_argument1');
-    }
+  
+  if (isset($_POST['ec_in_up_forced'])) {
+    if ($_POST['ec_act1'] == 'duplicate_entry_submit')
+     ec_end1('ec_in_up_forced', 'ec_bad_argument1');
+    if (!$is_creation) {
+      if (
+        $t1 = mysql_fetch_row(pwg_query("
+          SELECT `code`
+          FROM `".EVNTCATS_TABLE."`
+          WHERE `id` = '".$_POST['ec_entry_sel']."'
+        ")) === false
+      ) die('Code not found in DB ?!');
+      $r = pwg_query("
+        SELECT `id`
+        FROM `".EVNTCATS_TABLE."`
+        WHERE `code` = '".$t1[0]."'
+         AND `id` <> '".$_POST['ec_entry_sel']."'
+      ");
+      while ($t2 = mysql_fetch_row($r)) if (!ec_delete_entry_OK($t2[0]))
+       return false;
+    }
+    $forced = 'true';
+  }
+  else $forced = 'false';
+  
+  // User and eventually group creation, if needed
+  if ($_POST['ec_act1'] != 'duplicate_entry_submit')
+   if ($_POST['ec_sel_user'] == 'new')
+    if (!($ec_user_id = ec_create_user_OK())) return false;
+  
+  // Now we have all infos
+  if ($is_creation) {
     if (
       pwg_query("
-        INSERT INTO `".EVNTCATS_TABLE."`
-         (`code`, `user_id`, `action`, `arg1`, `arg2`)
+        INSERT INTO `".EVNTCATS_TABLE."` (
+          `code`,
+          `user_id`,
+          `action`,
+          `arg1`, `arg2`, `forced`
+        )
         VALUES (
-          '".$ec_lists['ec_table'][$_POST['ec_entry_sel']]['code']."',
-          '".$ec_lists['ec_table'][$_POST['ec_entry_sel']]['user_id']."',
-          'ec_ok',
-          '".$arg1."',
-          '".$arg2."'
+          '".$ec_code."',
+          '".$ec_user_id."',
+          '".$action."',
+          '".$arg1."', '".$arg2."', '".$forced."'
         );
       ") === false
     ) {
       $page['errors'][] =
-       l10n('ec_entry_dup_nok_pre1').
-       $_POST['ec_entry_sel'].
-       l10n('ec_entry_dup_nok_end1').
+       l10n('ec_entry_create_pb').
        'MySQL error '.mysql_errno().', "'.mysql_error().'"'
       ;
@@ -360,31 +359,38 @@
     }
     else {
+      build_ec_lists();
+      $forced = ($forced == 'false') ? '' : l10n('ec_cnfrm_forced');
       $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')
+       l10n('ec_entry_create_OK').mysql_insert_id().' : '.
+       $_POST['ec_in_up_code'].' => '.
+       $ec_lists['user_ids'][$ec_user_id].$forced
       ;
-      build_ec_table();
-      return true;
-    }
-  }
-  else return ec_end1('ec_entry_sel', 'ec_bad_argument5');
-}
-
-/*
- * ec_modify_entry_OK()
- * returns true or false whether the modification of an existing entry which #
- * is given by $_POST['ec_entry_sel'] was OK or not.
- *
- * @param
- *   no param
- * @return
- *   true if modification was OK ; false if not
- */
-function ec_modify_entry_OK() {
-  global $page;
-  $page['errors'][] = 'Y\'a pas eu une erreur ?...';
-  return false;
+    }
+  }
+  else {
+    if (
+      pwg_query("
+        UPDATE `".EVNTCATS_TABLE."`
+        SET
+          `user_id` = '".$ec_user_id."',
+          `action`  = '".$action."',
+          `arg1`    = '".$arg1."',
+          `arg2`    = '".$arg2."',
+          `forced`  = '".$forced."'
+        WHERE `id`  = '".$_POST['ec_entry_sel']."'
+      ") === false
+    ) {
+      $page['errors'][] =
+       l10n('ec_entry_create_pb').
+       'MySQL error '.mysql_errno().', "'.mysql_error().'"'
+      ;
+      return false;
+    }
+    else {
+      $page['infos'][] = l10n('ec_entry_modify_OK').$_POST['ec_entry_sel'];
+      build_ec_lists();
+    }
+  }
+  return true;
 }
 
@@ -405,36 +411,30 @@
 
 /*
- * 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 ec_end1('ec_entry_sel', 'ec_bad_argument1');
+ * ec_delete_entry_OK($ec_id)
+ * tries to delete an existing entry.
+ *
+ * @param
+ *   $ec_id : the entry to be deleted
+ * @return
+ *   true or false whether deleting succeeded.
+ */
+function ec_delete_entry_OK($ec_id) {
+  global $page;
+  if (!pwg_query("
+    DELETE FROM `".EVNTCATS_TABLE."`
+    WHERE `id` = ".$ec_id
+  )) {
+    $page['errors'][] =
+     l10n('ec_entry_del_nok_pre').
+     $ec_id.
+     l10n('ec_entry_del_nok_end').
+     'MySQL error '.mysql_errno().', "'.mysql_error().'"';
+    return false;
+  }
+  else $page['infos'][] =
+   l10n('ec_entry_del_ok_pre').
+   $ec_id.
+   l10n('ec_entry_del_ok_end');
+  return true;
 }
 
Index: /extensions/event_cats/include/evntcats_main_funcs.inc.php
===================================================================
--- /extensions/event_cats/include/evntcats_main_funcs.inc.php	(revision 4217)
+++ /extensions/event_cats/include/evntcats_main_funcs.inc.php	(revision 4218)
@@ -65,10 +65,10 @@
  */
 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);
+  return (mysql_fetch_row(pwg_query("
+    SELECT *
+    FROM `".IMAGE_CATEGORY_TABLE."` 
+    WHERE `category_id` = ".$cat."
+     AND `image_id` = ".$img."`
+  ")) !== false);
 }
 
@@ -86,5 +86,11 @@
  */
 function str_from_var($var) {
-  return '<p align="left">'.str_replace(chr(10),'<br>',str_replace(' ','&nbsp;', print_r /* var_dump */ ($var,true))).'</p>';
+  return
+   '<p align="left">'.
+   str_replace(
+    chr(10),'<br>',
+    str_replace(' ','&nbsp;', print_r /* var_dump */ ($var,true))
+   ).
+   '</p>';
 }
 
@@ -120,5 +126,5 @@
   */
   
-  foreach ($ec_lists['ec_table'] as &$ec_entry) { // & is not really needed
+  foreach ($ec_lists['ec_table'] as $ec_entry) {
     $ec_current_code = $ec_entry['code'];
     if (
@@ -133,11 +139,8 @@
          $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
+        ) $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];
-      }
+      else $first[$ec_current_code] = $ec_entry[$checked_item];
     }
   }
@@ -145,8 +148,8 @@
     if (isset($to_correct[$ec_entry['code']])) {
       if ($new_action == '') {
-        if (!pwg_query('
-          UPDATE `'.EVNTCATS_TABLE.'`
-          SET `forced` = "false"
-          WHERE `id` = '.$ec_entry['id']
+        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';
@@ -174,8 +177,8 @@
   global $template, $ec_lists;
   $c = array();
-  display_select_cat_wrapper('
-     SELECT id,name,uppercats,global_rank
-     FROM '.CATEGORIES_TABLE,
-   $c, 'category_options', $dsp);
+  display_select_cat_wrapper("
+     SELECT `id`, `name`, `uppercats`, `global_rank`
+     FROM `".CATEGORIES_TABLE."`
+   ", $c, 'category_options', $dsp);
   $ec_lists['categories'] = $template->smarty->_tpl_vars['category_options'];
 }
@@ -197,59 +200,11 @@
   $ec_lists['ec_table'] = array();
   
-  if (isset($conf['auto_log'])) {
-    // For tests purpose : table not in MySQL, but in $conf['xxx'] vars in
-    // config_local.inc.php
-    
-    foreach ($conf['auto_log'] as $ec_current_code => $ec_entry) {
-      $ec_current_entry = array_push($ec_lists['ec_table'], array(
-       'code'    => $ec_current_code,
-       'user_id' => get_userid($ec_entry[$ec_current_code]),
-       'action'  => 'ec_ok',
-       'arg1'    => NULL,
-       'arg2'    => NULL,
-       'forced'  => 'false',
-      )) - 1;
-      $ec_lists['ec_table'][$ec_current_entry]['id'] = $ec_current_entry;
-      if (isset($conf['prior_page']))
-       if (array_key_exists($ec_current_code, $conf['prior_page'])) {
-         $ec_lists['ec_table'][$ec_current_entry]['arg2'] =
-          $conf['prior_page'][$ec_current_code];
-         $ec_lists['ec_table'][$ec_current_entry]['forced'] = 'true';
-       }
-      if (isset($conf['outdated_page']))
-       if (array_key_exists($ec_current_code, $conf['outdated_page'])) {
-         $ec_lists['ec_table'][$ec_current_entry]['action'] = 'ec_nok';
-         $ec_lists['ec_table'][$ec_current_entry]['arg2'] =
-          $conf['outdated_page'][$ec_current_code];
-         $ec_lists['ec_table'][$ec_current_entry]['forced'] = 'true';
-       }
-    }
-    
-    // Inspection of $conf['outdated_page']
-    if (isset($conf['outdated_page']))
-     foreach ($conf['outdated_page'] as $ec_current_code => $ec_current_AP)
-      if (!array_key_exists($ec_current_code, $conf['auto_log'])) {
-        $ec_current_entry = array_push($ec_lists['ec_table'], array(
-         'code'    => $ec_current_code,
-         'user_id' => '',
-         'action'  => 'ec_nok',
-         'arg1'    => NULL,
-         'arg2'    => $ec_current_AP,
-         'forced'  => 'true',
-        )) - 1;
-        $ec_lists['ec_table'][$ec_current_entry]['id'] = $ec_current_entry;
-      }
-    
-  }
-  else { // in "normal" use ($conf['auto_log'] NOT set), $ec_lists['ec_table']
-         // is built thanks to below code only. A little bit more simple...
-    $q = pwg_query("
-     SELECT * FROM `".EVNTCATS_TABLE."`
-     WHERE `code` IS NOT NULL
-     ORDER BY `id`
-    ");
-    while ($r = mysql_fetch_assoc($q))
-     $ec_lists['ec_table'][intval($r['id'])] = $r;
-  }
+  $q = pwg_query("
+    SELECT * FROM `".EVNTCATS_TABLE."`
+    WHERE `code` IS NOT NULL
+    ORDER BY `id`
+  ");
+  while ($r = mysql_fetch_assoc($q))
+   $ec_lists['ec_table'][intval($r['id'])] = $r;
   
   // Construction of behaviour
@@ -275,7 +230,9 @@
     // Check if associated displayed page exists
     $a = 0;
-    if (!empty($ec_entry['arg1']) and
-     is_in($ec_entry['action'], 'ec_ok')) $a++; // Only arg2
-    // is significant if action is ec_nok[_xxx] .
+    if (
+      !empty($ec_entry['arg1']) and
+      // (Only arg2 is significant if action is ec_nok[_xxx] .)
+      is_in($ec_entry['action'], 'ec_ok')
+    ) $a++;
     if (!empty($ec_entry['arg2'])) $a+= 2;
     switch ($a) {
@@ -296,9 +253,7 @@
         if (is_in($ec_entry['action'], 'ec_ok')) {
           if (array_key_exists($ec_entry['arg1'], $ec_lists['categories'])) {
-            if ($a == 3) { // case 3: // Image
-              if (!ec_image_exists($ec_entry['arg1'], $ec_entry['arg2'])) {
-                $ec_entry['action'].= '_img_pb';
-              }
-            }
+           if ($a == 3) // case 3: // Image
+            if (!ec_image_exists($ec_entry['arg1'], $ec_entry['arg2']))
+             $ec_entry['action'].= '_img_pb';
           }
           else $ec_entry['action'].= '_cat_pb';
@@ -328,5 +283,5 @@
   $ec_lists['add_pages'] = array();
   if ($ec_ap_ok) {
-    $res = pwg_query('SELECT id,title FROM '.ADD_PAGES_TABLE);
+    $res = pwg_query("SELECT `id`, `title` FROM `".ADD_PAGES_TABLE."`");
     while ($r = mysql_fetch_assoc($res)) {
       $c = (is_in($r['title'], '/user_id=')) ? '/user_id=' : '/group_id=';
@@ -341,8 +296,11 @@
   // Construction of $ec_lists['user_ids'] array var
   $ec_lists['user_ids'] = array();
-  $q = pwg_query('SELECT id,username FROM '.USERS_TABLE. ' WHERE id > 2');
-  while ($r = mysql_fetch_assoc($q)) {
-    $ec_lists['user_ids'][$r['id']] = $r['username'];
-  }
+  $q = pwg_query("
+    SELECT `id`,`username`
+    FROM `".USERS_TABLE."`
+    WHERE `id` > 2
+  ");
+  while ($r = mysql_fetch_assoc($q))
+   $ec_lists['user_ids'][$r['id']] = $r['username'];
   
   // Construction of $ec_lists['ec_table'] array var
Index: /extensions/event_cats/language/fr_FR/plugin.lang.php
===================================================================
--- /extensions/event_cats/language/fr_FR/plugin.lang.php	(revision 4217)
+++ /extensions/event_cats/language/fr_FR/plugin.lang.php	(revision 4218)
@@ -123,4 +123,5 @@
 $lang['ec_entry_create_pb']       = 'Création nouvelle entrée impossible : ';
 $lang['ec_cnfrm_forced']          = ' (affichage forcé)';
+$lang['ec_entry_modify_OK']       = 'Modification entrée ';
 $lang['ec_bad_argument1']         = 'Mauvais argument : ';
 $lang['ec_bad_argument2']         = 'Code déjà existant : ';
