Index: /extensions/event_cats/event_cats/admin/evntcats_admin.js
===================================================================
--- /extensions/event_cats/event_cats/admin/evntcats_admin.js	(revision 3956)
+++ /extensions/event_cats/event_cats/admin/evntcats_admin.js	(revision 3956)
@@ -0,0 +1,289 @@
+﻿/* Event Cats Javascript functions LucMorizur June - ... 2009 */
+
+var ec_err = '';
+var ec_avoid_infinite_loop = true;
+var ec_checked_line = 0;
+var ec_selected_user = 'ec_sel_user_old';
+var ec_selected_old_user = '-1';
+var ec_selected_AP = '-1';
+var ec_selected_cat = '-1';
+var ec_selected_action = '';
+var ec_selected_img = '';
+var ec_auto_code_digits_nb = '8';
+var ec_new_code_text = '';
+var ec_new_user_text = '';
+var ec_new_psd_text = '';
+var ec_old_new_psd_text = '';
+var ec_checked_URL = new Array();
+var ec_JS_message = new Array();
+var ec_test_reg = '';
+
+function ec_mark_line(ec_id) {
+  ec_checked_line = ec_id;
+  if (ec_checked_line == 0) {
+    document.getElementById('selection--1').checked = 'checked';
+    document.getElementById('selection--1').checked = '';
+    document.getElementById('ec_show_URL').value = '';
+  }
+  else {
+    document.getElementById("selection-" + ec_checked_line).checked = 'checked';
+    document.getElementById('ec_show_URL').value =
+     ec_checked_URL[ec_checked_line];
+  }
+  if (ec_checked_line >= 0) {
+    document.getElementById('ec_sel_user_none').checked = 'checked';
+    document.getElementById('ec_input_action_home').checked = 'checked';
+    document.getElementById('ec_in_up_usr_txt_id').value = '';
+    document.getElementById('ec_in_up_psd_txt_id').value = '';
+    document.getElementById('ec_in_up_usr_list_id').value = '-1';
+    document.getElementById('ec_in_up_code_id').value = '';
+    document.getElementById('ec_in_up_aps_id').value = '-1';
+    document.getElementById('ec_in_up_cats_id').value = '-1';
+    document.getElementById('ec_in_up_imgs_id').value = '';
+    document.getElementById('ec_sel_user_none').checked = '';
+    document.getElementById('ec_input_action_home').checked = '';
+  }
+  else {
+    document.getElementById('ec_in_up_code_id').value = ec_new_code_text;
+    ec_avoid_infinite_loop = true;
+    ec_mark_user(ec_selected_user);
+  }
+}
+
+function ec_mark_user(ec_id) {
+  ec_selected_user = ec_id;
+  document.getElementById(ec_selected_user).checked = 'checked';
+  switch (ec_selected_user) {
+    case 'ec_sel_user_none': // None
+      ec_selected_action =
+       (ec_ap_ok && (ec_selected_action != 'ec_input_action_home')) ?
+       'ec_input_action_add_p' : 'ec_input_action_home';
+      document.getElementById('ec_in_up_usr_txt_id').value = '';
+      document.getElementById('ec_in_up_psd_txt_id').value = '';
+      document.getElementById('ec_in_up_usr_list_id').value = '-1';
+    break;
+    case 'ec_sel_user_new': // New user
+      document.getElementById('ec_in_up_usr_txt_id').value =
+       ec_new_user_text;
+      document.getElementById('ec_in_up_psd_txt_id').value =
+       ec_new_psd_text;
+      document.getElementById('ec_in_up_usr_list_id').value = '-1';
+    break;
+    case 'ec_sel_user_old': // "Old" user
+      document.getElementById('ec_in_up_usr_txt_id').value = '';
+      document.getElementById('ec_in_up_psd_txt_id').value = '';
+      document.getElementById('ec_in_up_usr_list_id').value =
+       ec_selected_old_user;
+    break;
+  }
+  ec_check_pwd_text();
+  if (ec_avoid_infinite_loop) {
+    ec_avoid_infinite_loop = false;
+    ec_mark_action(ec_selected_action);
+    ec_avoid_infinite_loop = true;
+  }
+}
+
+function ec_mark_action(ec_id) {
+  ec_selected_action = ec_id;
+  if (ec_selected_action != '') {
+    document.getElementById(ec_selected_action).checked = 'checked';
+    switch (ec_selected_action) {
+      case 'ec_input_action_add_p': // Additional Page
+        document.getElementById('ec_in_up_aps_id').value = ec_selected_AP;
+        document.getElementById('ec_in_up_cats_id').value = '-1';
+        document.getElementById('ec_in_up_imgs_id').value = '';
+        document.getElementById('ec_in_up_imgs_warn').innerHTML = '';
+      break;
+      case 'ec_input_action_cat': // Category
+        document.getElementById('ec_in_up_aps_id').value = '-1';
+        document.getElementById('ec_in_up_cats_id').value = ec_selected_cat;
+        document.getElementById('ec_in_up_imgs_id').value = '';
+        ec_selected_user = (ec_selected_user == 'ec_sel_user_none') ?
+         'ec_sel_user_old' : ec_selected_user;
+        document.getElementById('ec_in_up_imgs_warn').innerHTML = '';
+      break;
+      case 'ec_input_action_img': // Image
+        document.getElementById('ec_in_up_aps_id').value = '-1';
+        document.getElementById('ec_in_up_cats_id').value = ec_selected_cat;
+        document.getElementById('ec_in_up_imgs_id').value = ec_selected_img;
+        ec_selected_user = (ec_selected_user == 'ec_sel_user_none') ?
+         'ec_sel_user_old' : ec_selected_user;
+        ec_check_img_text();
+      break;
+      case 'ec_input_action_home': // Home
+        document.getElementById('ec_in_up_aps_id').value = '-1';
+        document.getElementById('ec_in_up_cats_id').value = '-1';
+        document.getElementById('ec_in_up_imgs_id').value = '';
+        document.getElementById('ec_in_up_imgs_warn').innerHTML = '';
+      break;
+    }
+    if (ec_avoid_infinite_loop) {
+      ec_avoid_infinite_loop = false;
+      ec_mark_user(ec_selected_user);
+      ec_avoid_infinite_loop = true;
+    }
+  }
+}
+
+function ec_rnd(ec_min, ec_max) {
+  return Math.floor(ec_min + (ec_max - ec_min + 1) * Math.random() );
+}
+
+function ec_gen_txt(ec_length) {
+  var t = '';
+  var ec_reg_A = /[A-Z]+/;
+  var ec_reg_a = /[a-z]+/;
+  var ec_reg_0 = /[0-9]+/;
+  var i = 0;
+  var ec_l = 0;
+  ec_l = parseInt(ec_length);
+  if (ec_l < 3) {
+    ec_err = '< 3';
+    return '';
+  }
+  do {
+    i++;
+    switch (ec_rnd(0, 2)) {
+      case 0: // A - Z
+        t += String.fromCharCode(ec_rnd(65, 90));
+      break;
+      case 1: // a - z
+        t += String.fromCharCode(ec_rnd(97, 122));
+      break;
+      case 2: // 0 - 9
+        t += String.fromCharCode(ec_rnd(48, 57));
+      break;
+    }
+    if (i > 500) {
+      break;
+    }
+    if ((t.length) > (ec_l)) {
+      t = t.substr(1, ec_l);
+    }
+  } while (
+   (t.length < ec_l) ||
+   !( ec_reg_A.test(t) && ec_reg_a.test(t) && ec_reg_0.test(t) )
+  );
+  if (i > 500) {
+    ec_err = '> 500\n' + t;
+    return '';
+  }
+  else {
+    return t;
+  }
+}
+
+function ec_gen_code() {
+  var t = '';
+  t = ec_gen_txt(ec_auto_code_digits_nb);
+  if (t == '') {
+    alert("Raté :\n" + ec_err);
+    ec_new_code_text = 'Raté...';
+  }
+  else {
+    ec_new_code_text = t;
+  }
+  ec_mark_line(-1);
+}
+
+function ec_gen_user() {
+  var ec_reg_ap = /^\S+/;
+  var ec_reg_cat = /\/\s(.+)$/;
+  var ec_word = '';
+  if (
+   ec_selected_action == '' ||
+   (ec_selected_action == 'ec_input_action_cat' && ec_selected_cat == '-1') ||
+   (ec_selected_action == 'ec_input_action_img' &&
+    (ec_selected_img == '' || ec_selected_cat == '-1')) ||
+   (ec_selected_action == 'ec_input_action_add_p' && ec_selected_AP == '-1')
+  ) {
+    alert(ec_JS_message['ec_gen_user_act_miss']);
+    return false;
+  }
+  else {
+    var t = '';
+    t = ec_gen_txt('8');
+    if (t == '') {
+      alert("Raté :\n" + ec_err);
+      ec_new_psd_text = 'Raté...';
+      return false;
+    }
+    else {
+      ec_new_psd_text = t;
+      ec_old_new_psd_text = ec_new_psd_text;
+    }
+    
+   if (false) {
+    ec_new_user_text = 'Nouvel utilisateur !';
+   }
+   else
+   {
+    
+    switch (ec_selected_action) {
+      case 'ec_input_action_add_p': // Additional Page
+        ec_new_user_text = ec_reg_ap.exec(
+document.ec_up_code.ec_in_up_aps.options[document.ec_up_code.ec_in_up_aps.selectedIndex].label
+        );
+      break;
+      case 'ec_input_action_cat': // Category
+      case 'ec_input_action_img': // Image
+        ec_new_user_text = ec_reg_cat.exec(
+document.ec_up_code.ec_in_up_cat.options[document.ec_up_code.ec_in_up_cat.selectedIndex].label
+        )[1];
+      if (ec_selected_action == 'ec_input_action_img') {
+        ec_new_user_text +=  '_' + document.ec_up_code.ec_in_up_imgs_id.value;
+      }
+      break;
+      case 'ec_input_action_home': // Home
+      break;
+    }
+    
+   }
+    
+    ec_mark_user('ec_sel_user_new');
+    return true;
+  }
+}
+
+function ec_gen_full_auto() {
+  if (ec_gen_user()) ec_gen_code();
+}
+
+function ec_check_img_text() {
+  document.getElementById('ec_in_up_imgs_warn').innerHTML =
+   (ec_selected_img != '' && ec_selected_cat == '-1') ?
+   ec_JS_message['ec_act_cat_miss'] : '';
+}
+
+function ec_check_pwd_text() {
+  document.getElementById('ec_in_up_pwd_warn').innerHTML =
+   (ec_new_psd_text == ec_old_new_psd_text &&
+    ec_selected_user == 'ec_sel_user_new') ?
+   ec_JS_message['ec_new_pwd_gen'] : '';
+  // document.getElementById('ec_in_up_pwd_warn').innerHTML = ec_test_reg;
+}
+
+function ec_check_dis(ec_id) {
+  ec_mark_line(ec_id);
+  return confirm(ec_JS_message['ec_confirm_disable']);
+}
+
+function ec_check_del(ec_id) {
+  ec_mark_line(ec_id);
+  return confirm(ec_JS_message['ec_confirm_delete']);
+}
+
+function ec_check_tst(ec_id) {
+  ec_mark_line(ec_id);
+  return confirm(ec_JS_message['ec_confirm_test']);  
+}
+
+function ec_test() {
+  alert('OK.');
+}
+
+function ec_init() {
+  ec_mark_line(0);
+}
+
Index: /extensions/event_cats/event_cats/admin/evntcats_admin.php
===================================================================
--- /extensions/event_cats/event_cats/admin/evntcats_admin.php	(revision 3956)
+++ /extensions/event_cats/event_cats/admin/evntcats_admin.php	(revision 3956)
@@ -0,0 +1,432 @@
+﻿<?php
+// +-----------------------------------------------------------------------+
+// | Plugin Name : Event Cats                                              |
+// | Plugin Version : 1.0                                                  |
+// | File Version : 1.0                                                    |
+// | Plugin Version author : LucMorizur                                    |
+// | Plugin description : (plugin for Piwigo, http://piwigo.org )          |
+// | This plugin allows an account to be automatically logged in ; and to  |
+// | let users duplicate the account they are logged with, to get benefits |
+// | of the groups of the previous account, immediately on their new acc.  |
+// | Ce plugin permet d'identifier automatiquement un compte ; et permet à |
+// | un utilisateur de dupliquer un compte, pour que le nouveau compte     |
+// | bénéficie immédiatement de l'affectation aux groupes de l'ancien cpte |
+// +-----------------------------------------------------------------------+
+
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery                                  |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008-2009 Piwigo Team                  http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify  |
+// | it under the terms of the GNU General Public License as published by  |
+// | the Free Software Foundation                                          |
+// |                                                                       |
+// | This program is distributed in the hope that it will be useful, but   |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
+// | General Public License for more details.                              |
+// |                                                                       |
+// | You should have received a copy of the GNU General Public License     |
+// | along with this program; if not, write to the Free Software           |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA.                                                                  |
+// +-----------------------------------------------------------------------+
+
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+
+global $template, $conf, $lang, $test1, $prefixeTable, $ec_err, $page,
+ $ec_lists,   // array of following arrays :
+              //   $ec_lists['ec_table'] :
+              //     Event Cats table, in function of each entry id
+              //   $ec_lists['ec_codes'] : // Used ?
+              //     array of useful data, in function of entries codes
+              //   $ec_lists['add_pages'] :
+              //     array of Add. Pages names in function of their id
+              //   $ec_lists['categories'] :
+              //     array of category names in function of their id
+              //   $ec_lists['user_ids'] :
+              //     array of usernames in function of their id
+ $ec_ap_ok;   // whether Additional Pages is installed and activated
+
+load_language('plugin.lang', EVNTCATS_PATH);
+
+include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
+include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php');
+include_once(PHPWG_ROOT_PATH.'include/functions_url.inc.php');
+include_once(EVNTCATS_PATH.'include/evntcats_funcs.inc.php');
+$my_base_url = get_admin_plugin_menu_link(__FILE__);
+
+$template->assign( 'EVNTCATS_VERSION' , EVNTCATS_INFO_VERSION);
+$me = get_plugin_data($plugin_id);
+$template->clear_assign('ec_infos');
+$template->append('head_elements',
+  '<link rel="stylesheet" type="text/css" href="'.
+  EVNTCATS_PATH.'admin/evntcats_theme.css">'
+);
+
+// +-----------------------------------------------------------------------+
+// |                            Tabsheet
+// +-----------------------------------------------------------------------+
+if (!isset($_GET['tab']))
+    $page['tab'] = 'autolog';
+else
+    $page['tab'] = $_GET['tab'];
+
+$tabsheet = new tabsheet();
+$tabsheet->add('autolog',
+               l10n('ec_tab_autoid'),
+               $my_base_url.'&amp;tab=autolog');
+$tabsheet->add('config',
+               l10n('ec_tab_config'),
+               $my_base_url.'&amp;tab=config');
+$tabsheet->select($page['tab']);
+$tabsheet->assign();
+
+$template->assign(
+ array('U_HELP' => get_root_url().'popuphelp.php?page=event_cats'));
+
+$template->assign('EVNTCATS_URLS', array (
+ 'ROOT'     => EVNTCATS_PATH,
+ 'DISABLE'  => PHPWG_ROOT_PATH.
+  'admin.php?page=plugin&section=event_cats%2Fadmin%2Fevntcats_admin.php&disable=',
+ 'DELETE'   => PHPWG_ROOT_PATH.
+  'admin.php?page=plugin&section=event_cats%2Fadmin%2Fevntcats_admin.php&delete='
+));
+
+/****************************************************************************/
+
+$code_list = array();
+build_ec_lists(); // in evntcats_funcs.php
+
+if (isset($_GET['delete'])) {
+  if (array_key_exists($_GET['delete'],$ec_lists['ec_table'])) {
+    $t = $ec_lists['ec_table'][$_GET['delete']]['code'];
+    $q = pwg_query('
+     DELETE FROM '.EVNTCATS_TABLE.' 
+     WHERE id = '.$_GET['delete']
+    );
+    if ($q = 1) {
+      $page['infos']['infos'] = l10n('ec_entry_del_ok_pre').$t.
+       l10n('ec_entry_del_ok_end');
+    }
+    else {
+      $page['errors'][] = l10n('ec_entry_del_nok_pre').$t.
+       l10n('ec_entry_del_nok_end');
+    }
+    build_ec_table();
+  }
+}
+
+if (isset($_GET['disable'])) {
+  if (array_key_exists($_GET['disable'],$ec_lists['ec_table'])) {
+    $t = $ec_lists['ec_table'][$_GET['disable']]['code'];
+    $q = pwg_query('
+     UPDATE '.EVNTCATS_TABLE.' 
+     SET action = \'ec_outdated\' 
+     WHERE id = '.$_GET['disable']
+    );
+    if ($q = 1) {
+      $page['infos']['infos'] = l10n('ec_entry_dis_ok_pre1').$t.
+       l10n('ec_entry_dis_ok_end1');
+      if (isset($_GET['add_p'])) {
+        if (array_key_exists($_GET['add_p'],$ec_lists['add_pages'])) {
+          $q = pwg_query('
+           UPDATE '.EVNTCATS_TABLE.' 
+           SET arg1 = '.$_GET['add_p'].' 
+           WHERE id = '.$_GET['disable']
+          );
+          if ($q = 1) {
+            $page['infos']['infos'].=
+             l10n('ec_entry_dis_ok_pre2').
+             $_GET['add_p'].
+             l10n('ec_entry_dis_ok_mid2').
+             $ec_lists['add_pages'][$_GET['add_p']].
+             l10n('ec_entry_dis_ok_end2');
+          }
+          else {
+            $page['errors'][] =
+             l10n('ec_entry_dis_nok_pre2').
+             $t.
+             l10n('ec_entry_dis_nok_mid2').
+             $_GET['add_p'].
+             l10n('ec_entry_dis_nok_end2');
+          }
+        }
+      }
+      else {
+        $q = pwg_query('
+         UPDATE '.EVNTCATS_TABLE.' 
+         SET arg1 = NULL 
+         WHERE id = '.$_GET['disable']
+        );
+        if ($q != 1) {
+          $page['errors'][] =
+           l10n('ec_entry_dis_nok_pre3').
+           $t.
+           l10n('ec_entry_dis_nok_end3');
+        }
+      }
+    }
+    else {
+      $page['errors'][] = l10n('ec_entry_dis_nok_pre1').$t.
+       l10n('ec_entry_dis_nok_end1');
+    }
+    build_ec_table();
+  }
+}
+
+if (isset($_GET[''])) {
+}
+
+if (isset($_GET[''])) {
+}
+
+if (isset($_GET[''])) {
+}
+
+if (isset($_GET[''])) {
+}
+
+/****************************************************************
+* Construction of array var to be transmitted to tpl file,      *
+* containing all infos to be displayed in the code array table. *
+****************************************************************/
+
+$span_err_pre = '<span style = "color: red; font-weight: bold;">';
+$span_err_end = '</span>';
+
+foreach ($ec_lists['ec_table'] as $ec_entry) {
+    
+  $a = NULL;
+  $dspl     = '';
+  $url_end  = '';
+  $i        = intval($ec_entry['id']);
+  $arg1     = $ec_entry['arg1'];
+  $arg1_int = intval($arg1);
+  $arg2     = $ec_entry['arg2'];
+  $arg2_int = intval($arg2);
+  $log_OK   = (strpos($ec_entry['action'], 'ec_ok') !== false);
+  
+  // No specific need for "code" displaying
+  
+  // "username" displaying
+  $username = ($log_OK) ?
+   $ec_lists['user_ids'][intval($ec_entry['user_id'])] : '';
+  
+  // No specific need for "action" displaying
+  
+  // "displayed page" : # of the AP, or of the category...
+  switch ($ec_entry['action']) {
+    
+    case 'ec_ok_forced_pb' :
+      $page['errors'][$ec_entry['code']] = l10n('ec_forced_pb');
+    case 'ec_ok' :
+    case 'ec_ok_img_pb' :
+      $a = 0;
+      if (!empty($ec_entry['arg1'])) $a++;
+      if (!empty($ec_entry['arg2'])) $a+= 2;
+      switch ($a) {
+        case 0: // Home
+          $dspl = l10n('ec_dspl_ok_home');
+        break;
+        case 1: // Category
+        case 3: // Image
+          $url_end = '&cat='.$arg1;
+          $dspl =
+           l10n('ec_dspl_ok_cat_pre').
+           $arg1.
+           l10n('ec_dspl_ok_cat_mid').
+           $ec_lists['categories'][$arg1_int].
+           l10n('ec_dspl_ok_cat_end')
+          ;
+          if ($ec_entry['action'] == 'ec_ok_img_pb') {
+            $url_end.= '&img='.$arg2;
+            $page['errors'][] = l10n('ec_image_miss');
+            $dspl.=
+             '<br>'.$span_err_pre.
+             l10n('ec_dspl_nok_img2_pre').
+             $arg2.
+             l10n('ec_dspl_nok_img2_mid').
+             $arg1.
+             l10n('ec_dspl_nok_img2_end').
+             $span_err_end
+            ;
+          }
+          elseif ($a == 3) { // Image
+            $url_end.= '&img='.$arg2;
+            $t = mysql_fetch_row(pwg_query('
+             SELECT `name`, `file`
+             FROM `'.IMAGES_TABLE.'`
+             WHERE `id` = "'.$arg2.'"
+            '));
+            $dspl.=
+             '<br>'.
+             l10n('ec_dspl_ok_img2_pre').
+             $arg2.
+             l10n('ec_dspl_ok_img2_mid1').
+             $t[0].
+             l10n('ec_dspl_ok_img2_mid2').
+             $t[1].
+             l10n('ec_dspl_ok_img2_end')
+            ;
+          }
+        break;
+        case 2: // Additional Page
+          $url_end = '&ap='.$arg2;
+          $dspl = ($ec_ap_ok) ?
+           l10n('ec_dspl_ok_ap_pre').
+           $arg2.
+           l10n('ec_dspl_ok_ap_mid').
+           $ec_lists['add_pages'][$arg2_int].
+           l10n('ec_dspl_ok_ap_end')
+          :
+           l10n('ec_dspl_ok_home')
+          ;
+        break;
+      }
+    break;
+    
+    case 'ec_nok' :
+      if (empty($ec_entry['arg2'])) {
+        $dspl = l10n('ec_dspl_ok_acc_denied');
+      }
+      else {
+        $url_end = '&ap='.$arg2;
+        $dspl = ($ec_ap_ok) ?
+         l10n('ec_dspl_ok_ap_pre').
+         $arg2.
+         l10n('ec_dspl_ok_ap_mid').
+         $ec_lists['add_pages'][$arg2_int].
+         l10n('ec_dspl_ok_ap_end')
+        :
+         l10n('ec_dspl_ok_acc_denied')
+        ;
+      }
+    break;
+    
+    case 'ec_nok_ap_pb' : // No need to check here if Additional Pages is
+    case 'ec_ok_ap_pb' :  // active : we can arrive here only when it is.
+      $url_end = '&ap='.$arg2;
+      $page['errors'][] = l10n('ec_add_page_miss');
+      $dspl = ($ec_entry['action'] == 'ec_ok_ap_pb') ?
+       l10n('ec_dspl_ok_home') : l10n('ec_dspl_nok_acc_denied');
+      $dspl.=
+       $span_err_pre.
+       l10n('ec_dspl_nok_ap_pre').
+       $arg2.
+       l10n('ec_dspl_nok_ap_end').
+       $span_err_end
+      ;
+    break;
+    
+    case 'ec_ok_cat_pb' :
+      $url_end = '&cat='.$arg1;
+      $page['errors'][] = l10n('ec_category_miss');
+      $dspl =
+       l10n('ec_dspl_nok_home').
+       $span_err_pre.
+       l10n('ec_dspl_nok_img1_pre').
+       $arg1.
+       l10n('ec_dspl_nok_img1_end').
+       $span_err_end
+      ;
+    break;
+    
+    case 'ec_nok_action_pb' :
+      $page['errors'][$ec_entry['code']] = l10n('ec_action_pb');
+      $username =
+       $span_err_pre.
+       l10n('ec_dspl_nok_actn').
+       $span_err_end
+      ;
+      $dspl = l10n('ec_dspl_ok_home');
+    break;
+    
+    case 'ec_nok_userid_pb' :
+      $page['errors'][$ec_entry['code']] = l10n('ec_username_pb');
+      $username =
+       $span_err_pre.
+       l10n('ec_dspl_usr_pb').
+       $span_err_end
+      ;
+      $dspl = l10n('ec_dspl_ok_home');
+    break;
+    
+    case 'ec_nok_userid_miss' :
+      $page['errors'][$ec_entry['code']] = l10n('ec_username_miss');
+      $username =
+       $span_err_pre.
+       l10n('ec_dspl_nok_usr_pre').
+       $ec_entry['user_id'].
+       l10n('ec_dspl_nok_usr_end').
+       $span_err_end
+      ;
+      $dspl = l10n('ec_dspl_ok_home');
+    break;
+  }
+  
+  // construction of $code_URL
+  $code_URL =
+   ROOT_URL.
+   'index.php?autolog='.
+   $ec_entry['code'].
+   $url_end
+  ;
+  
+  $code_list[$i] = array(
+   'id'       => $i,
+   'Code'     => $ec_entry['code'],
+   'Username' => $username,
+   'Action'   => $ec_entry['action'],
+   'Arg1'     => $dspl,
+   'Forced'   => $ec_entry['forced'],
+   'code_URL' => $code_URL,
+   'log_OK'   => $log_OK,
+  );
+}
+
+/*
+print '<pre>';
+//print_r('ROOT_URL : '.ROOT_URL.'<br>EVNTCATS_PATH : '.EVNTCATS_PATH);
+print('ROOT_URL : '.ROOT_URL.'<br>EVNTCATS_PATH : '.EVNTCATS_PATH);
+print '</pre>';
+*/
+
+$template->assign('ec_howto', (count($page['errors']) == 0 and count($page['infos']) == 0));
+
+$template->assign('ec_ap_ok',$ec_ap_ok);
+$template->assign('code_list',$code_list);
+$template->assign('ec_lists',$ec_lists);
+$template->assign('EVNTCATS_PATH',EVNTCATS_PATH);
+$template->assign('RACINE_URL',ROOT_URL);
+
+// $template->assign('test0tpl',str_from_var($ec_lists['ec_codes']));
+$template->assign('test1tpl',str_from_var($ec_lists));
+$template->assign('test2tpl',str_from_var($page['errors']));
+$template->assign('test3tpl',str_from_var($code_list));
+
+/* C'est quoi, ça ?...
+if ( isset($_POST['submit']) )
+  {
+    if (isset($_POST['account']) and isset($_POST['code']))
+      {
+        $conf['auto_log'][$_POST['code']] = $_POST['account'];
+      }
+    else
+      {
+        $page['errors']='arg_missing';
+      }
+
+    if (isset($_POST['duplication']))
+      {
+        $conf['allow_user_registration'] = ($_POST['duplication'] == '1');
+      }
+  }
+*/
+
+$template->set_filenames(array('evntcats_admin_content' => dirname(__FILE__).'/evntcats_admin.tpl'));
+$template->assign_var_from_handle('ADMIN_CONTENT','evntcats_admin_content');
+?>
Index: /extensions/event_cats/event_cats/admin/evntcats_admin.tpl
===================================================================
--- /extensions/event_cats/event_cats/admin/evntcats_admin.tpl	(revision 3956)
+++ /extensions/event_cats/event_cats/admin/evntcats_admin.tpl	(revision 3956)
@@ -0,0 +1,371 @@
+﻿{* <!-- Event Cats (event categories) LucMorizur June - ... 2009 --> *}
+
+{* <!-- Tabs for admin page surfing --> *} {*
+<ul class = "tabsheet">
+  <li class = "selected_tab">
+    <a href = "??...">
+      <span>{'ec_tab_autoid'|@translate}</span>
+    </a>
+  </li>
+  <li class = "normal_tab">
+    <a href = "??...">
+      <span>{'ec_tab_config'|@translate}</span>
+    </a>
+  </li>
+</ul> *}
+
+{* <!-- Help button --> *} {*
+<ul class = "HelpActions">
+  <li>
+    <a href = "aide" onclick = "popuphelp(this.href); return false;" title = "{'ec_help'|@translate}" style = "margin-top: -28px;" >
+      <img src = "{$ROOT_URL}{$themeconf.admin_icon_dir}/help.png" class = "button" alt = "(?)" />
+    </a>
+  </li>
+</ul> *}
+
+{* <!-- Page title --> *}
+<div class = "titrePage" style="margin-top: -20px;">
+  <h2>{'ec_admin_page_title'|@translate} {$EVNTCATS_VERSION}</h2>
+</div>
+
+{* <!-- JavaScript warning message --> *}
+<div id = "ec_js_warn">
+  {'ec_javascript_needed'|@translate}<br><br>
+</div>
+<script type = "text/javascript"><!-- // Removes JavaScript warning message
+  document.getElementById('ec_js_warn').innerHTML = ''; //-->
+</script>
+
+{* <!-- Upper banner : infos, errors... --> *}
+{if $ec_howto}
+  <div>
+    {'ec_admin_page_howto'|@translate}
+  </div>
+{/if}
+
+<p>
+  <hr width = 75% size = 3 />
+</p>
+
+{* <!-- First section : form to view and modify codes, or create a new one --> *}
+<form class = "filter" method = "post" name = "ec_up_code" action = "">
+  
+  <div style = "text-align:right; font-style:italic;">
+    {if $ec_ap_ok}
+      {'ec_plugin_ap_ok'|@translate}
+      <script type = "text/javascript"><!--
+        var ec_ap_ok = true; //-->
+      </script>
+    {else}
+      {'ec_plugin_ap_nok'|@translate}
+      <script type = "text/javascript"><!--
+        var ec_ap_ok = false; //-->
+      </script>
+    {/if}
+  </div>
+  
+  <div style = "text-align:center; font-weight:bold; font-size:120%;">{'ec_entry_table_title'|@translate}</div><br>
+  
+  <table class = "table2" width = "97%"> {* <!-- Table to show codes present in MySQL table --> *}
+    <thead>
+      <tr class = "throw">
+        <td>{'ec_col_name_entry'|@translate}</td>
+        <td>{'ec_col_name_code'|@translate}</td>
+        <td>{'ec_col_name_user'|@translate}</td>
+        <td>{'ec_col_name_bhvr'|@translate}</td>
+        <td>{'ec_col_name_dspl'|@translate}</td>
+        <td>{'ec_col_name_actn'|@translate}</td>
+      </tr>
+    </thead>
+    
+    {foreach from=$code_list item=code_line name=code_loop}
+      <tr class = "{if $smarty.foreach.code_loop.index is odd}row1{else}row2{/if}">
+        <td>
+          <input type = "radio" name = "ec_entry_sel" value = "{$code_line.id}" id = "selection-{$code_line.id}"
+           onclick = "ec_mark_line({$code_line.id});"
+          />
+          <label for = "selection-{$code_line.id}">&nbsp;{$code_line.id}</label>
+        </td>
+        <td><label for = "selection-{$code_line.id}">{$code_line.Code}</label></td>
+        <td><label for = "selection-{$code_line.id}">{$code_line.Username}</label></td>
+        <td><label for = "selection-{$code_line.id}">{$code_line.Action|@translate}</label></td>
+        <td><label for = "selection-{$code_line.id}">{$code_line.Arg1}</label></td>
+        <td>
+          <a
+           href = "{$code_line.code_URL}" title = "{'ec_test_tooltip'|@translate}"
+           name = "ec_code_URL" onclick = "return ec_check_tst({$code_line.id});"
+          />
+            <img src = "{$EVNTCATS_URLS.ROOT}icon/url2.png" class = "button" style = "border:none"
+             alt = "{'ec_test_tooltip'|@translate}" title = "{'ec_test_tooltip'|@translate}" />
+          </a>
+          &nbsp;
+          <a href = "javascript:void()" onclick = "return ec_check_del({$code_line.id});">
+     {* envoi formulaire par JS : document.forms[nom_formulaire].submit() ( http://www.toutjavascript.com/reference/reference.php?iref=178 ) *}
+            <img src = "{$EVNTCATS_URLS.ROOT}icon/delete.png" class = "button" style = "border:none"
+             alt = "{'ec_url_delete'|@translate}" title = "{'ec_url_delete'|@translate}" />
+          </a>
+          {if $code_line.log_OK}
+            &nbsp;
+            <a href = "javascript:void()" onclick = "return ec_check_dis({$code_line.id});">
+              <img src = "{$EVNTCATS_URLS.ROOT}icon/disable.png" class = "button" style = "border:none"
+               alt = "{'ec_url_disable'|@translate}" title = "{'ec_url_disable'|@translate}" />
+            </a>
+            {if $code_line.Forced == 'true'}
+              &nbsp;
+              <a href = "javascript:void()" title = "{'ec_toggle_forced'|@translate}" onclick = "return ec_toggle_forced({$code_line.id});">
+                <img class = "button" style = "border:none" src = "{$EVNTCATS_URLS.ROOT}icon/forced.png"
+                 alt = "{'ec_url_forced'|@translate}" title = "{'ec_url_forced'|@translate}"/>
+              </a>
+            {else}
+              &nbsp;
+              <a href = "javascript:void()" title = "{'ec_toggle_forced'|@translate}" onclick = "return ec_toggle_forced({$code_line.id});">
+                <img class = "button" style = "border:none" src = "{$EVNTCATS_URLS.ROOT}icon/nforced.png"
+                 alt = "{'ec_url_nforced'|@translate}" title = "{'ec_url_nforced'|@translate}"/>
+              </a>
+              &nbsp;
+              <a href = "javascript:void()" title = "{'ec_duplicate_entry'|@translate}" onclick = "return ec_duplicate_entry({$code_line.id});">
+                <img src = "{$EVNTCATS_URLS.ROOT}icon/duplicate.png" class = "button" style = "border:none"
+                 alt = "{'ec_url_duplicate'|@translate}" title = "{'ec_url_duplicate'|@translate}" />
+              </a>
+            {/if}
+          {/if}
+        </td>
+      </tr>
+    {/foreach}
+  </table>
+  
+  {* <!-- This is not really a table, looks like a unique cell at the end of previous table,
+  to show URL for currently selected line in above table --> *}
+  <table class = "table2" width = "97%">
+    <tr class = "row2">
+      <td style = "text-align:center; padding-top:5px; padding-bottom:5px;">
+        <label title = "{'ec_url_tooltip'|@translate}">
+          {'ec_show_URL'|@translate}
+          <input type = "text" id = "ec_show_URL" size = "100%" title = "{'ec_url_tooltip'|@translate}" readonly = "readonly" />
+        </label>
+      </td>
+    </tr>
+  </table><br>
+  
+  {* <!-- Parameters list --> *}
+  <table style="border-spacing:30px" width = "97%">
+    
+    {* <!-- New entry --> *}
+    <tr>
+      <td>
+        <label for = "selection--1" onclick = "ec_mark_line(-1);">
+          <input type = "radio" name = "ec_entry_sel" value = "-1" id = "selection--1" onclick = "ec_mark_line(-1);" />
+          <span style = "font-weight:bold; font-style:italic; font-size:120%; text-decoration:underline;">{'ec_create_modify_code'|@translate}</span>
+        </label>
+      </td>
+      <td>
+        <input class = "submit" type = "button" name = "ec_submit_gen_full_auto" value = "{'ec_new_full_auto'|@translate}"
+         id = "ec_submit_gen_full_auto_id" onclick = "ec_gen_full_auto();" style = "margin-top:0;"
+        /><br>
+      </td>
+    </tr>
+    
+    {* <!-- Code selection --> *}
+    <tr>
+      <td><strong><span onclick = "Test();">{'ec_new_entry'|@translate}</span></strong></td>
+      <td>
+        <input type = "text" name = "ec_in_up_code" maxlength = "32" size = "40"
+         id = "ec_in_up_code_id" onclick = "ec_mark_line(-1);" onblur = "ec_new_code_text = this.value;"
+        />
+        &nbsp;
+        <label for = "ec_in_up_code_id" style = "margin:0;">
+          <input class = "submit" type = "button" name = "ec_submit_gen_code" value = "{'ec_new_entry_button'|@translate}"
+           id = "ec_submit_gen_code_id" onclick = "ec_gen_code();" style = "margin:0;"
+          />
+        </label>
+        {'ec_gen_code_nb_pre'|@translate}
+        <select name = "ec_in_up_auto_code_length" id = "ec_in_up_auto_code_length_id" onchange = "ec_auto_code_digits_nb = this.value;">
+          <option value = "4">4</option>
+          <option value = "5">5</option>
+          <option value = "8">8</option>
+          <option value = "10" selected = "selected">10</option>
+          <option value = "12">12</option>
+          <option value = "15">15</option>
+          <option value = "16">16</option>
+          <option value = "20">20</option>
+          <option value = "24">24</option>
+          <option value = "25">25</option>
+          <option value = "30">30</option>
+          <option value = "32">32{'ec_gen_code_nb_max'|@translate}</option>
+        </select>
+        {'ec_gen_code_nb_end'|@translate}
+      </td>
+    </tr>
+    
+    {* <!-- User to identify --> *}
+    <tr>
+      <td style = "vertical-align:top;"><strong>{'ec_up_code_lbl_user'|@translate}</strong></td>
+      <td>
+      <li>
+        {* <!-- None --> *}
+        <label onclick = "ec_mark_user('ec_sel_user_none');">
+          <input type = "radio" name = "ec_sel_user" value = "none" id = "ec_sel_user_none"
+           onclick = "ec_mark_user('ec_sel_user_none');"
+          />
+          {'ec_up_code_lbl_user_none'|@translate}
+        </label><br>
+      </li>
+        
+      <li>
+        {* <!-- New user (to create) --> *}
+        <label for = "ec_in_up_usr_txt_id" onclick = "ec_mark_user('ec_sel_user_new');">
+          <input type = "radio" name = "ec_sel_user" for = "ec_in_up_usr_txt_id" value = "new"
+           id = "ec_sel_user_new" onclick = "ec_mark_user('ec_sel_user_new');"
+          />
+          {'ec_up_code_lbl_user_new'|@translate}
+        </label>
+        &nbsp;
+        <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();"
+        /><br>
+        <ul><li>
+          <label class = "ec_block">{'ec_new_user_name'|@translate}<br>
+            <input type = "text" name = "ec_in_up_usr_txt" id = "ec_in_up_usr_txt_id" maxlength = "32"
+             size = "20" onclick = "ec_mark_user('ec_sel_user_new');" onblur = "ec_new_user_text = this.value;"
+            />
+          </label>
+          <label class = "ec_block">{'ec_new_user_pswd'|@translate}<br>
+            <input type = "text" name = "ec_in_up_psd_txt" id = "ec_in_up_psd_txt_id" maxlength = "32"
+             size = "20" onclick = "ec_mark_user('ec_sel_user_new');" onblur = "ec_new_psd_text = this.value; ec_check_pwd_text();"
+            />
+          </label>
+          <label class = "ec_block">&nbsp;<br>
+            <span style = "font-weight:bold; color:red;" id = "ec_in_up_pwd_warn">&nbsp;</span>
+          </label>
+          
+        </li></ul><br>
+      </li>
+      
+      <li>
+        {* <!-- Known user --> *}
+        <label for = "ec_in_up_usr_list_id" onclick = "ec_mark_user('ec_sel_user_old');">
+          <input type = "radio" name = "ec_sel_user" for = "ec_in_up_usr_list_id"
+           value = "old" id = "ec_sel_user_old" onclick = "ec_mark_user('ec_sel_user_old');"
+          />
+          {'ec_up_code_lbl_user_old'|@translate}
+        </label>
+        <select name = "ec_in_up_usr_list" id = "ec_in_up_usr_list_id" onclick = "ec_mark_user('ec_sel_user_old');"
+         onchange = "ec_selected_old_user = this.value;"
+        >
+          <option label = "------------" value = "-1" id = "ec_old_user_-1">------------</option>
+          {foreach from=$ec_lists.user_ids key=ec_key item=ec_val name=opt_loop}
+            <option label = "{$ec_val}" value = "{$ec_key}" id = "ec_old_user_{$ec_key}">{$ec_val}</option>
+          {/foreach}
+        </select><br>
+      </li>
+      </td>
+    </tr>
+    
+    {* <!-- Page to display --> *}
+    <tr>
+      <td style = "vertical-align:top;"><strong>{'ec_up_code_lbl_action'|@translate}</strong></td>
+      <td>
+        
+        {* <!-- Additionnal Page, provided the plugin is activated --> *}
+        <label class = "ec_block" for = "ec_in_up_aps_id" onclick = "ec_mark_action('ec_input_action_add_p');"
+         {if !$ec_ap_ok}style = "display:none;"{/if}
+        >
+          <input type = "radio" name = "ec_input_action" value = "add_p" id = "ec_input_action_add_p" for = "ec_in_up_aps_id"
+           onclick = "ec_mark_action('ec_input_action_add_p');"
+          />
+          {'ec_up_code_lbl_aps'|@translate}<br>
+          <select class = "categoryList" name = "ec_in_up_aps" size="30" id = "ec_in_up_aps_id"
+           onclick = "ec_mark_action('ec_input_action_add_p');" onchange = "ec_selected_AP = this.value;"
+          >
+            <option label = "------------" value = "-1" style = "display:none;">------------</option>
+            {html_options options=$ec_lists.add_pages}
+          </select>
+        </label>
+        
+        {* <!-- Category --> *}
+        <label class = "ec_block" for = "ec_in_up_cats_id" onclick = "ec_mark_action('ec_input_action_cat');">
+          <input type = "radio" name = "ec_input_action" value = "cat" id = "ec_input_action_cat" for = "ec_in_up_cats_id"
+           onclick = "ec_mark_action('ec_input_action_cat');"
+          />
+          {'ec_up_code_lbl_cats'|@translate}<br>
+          <select class = "categoryList" name = "ec_in_up_cat" size = "30" id = "ec_in_up_cats_id"
+           onclick = "ec_mark_action('ec_input_action_cat');" onchange = "ec_selected_cat = this.value;"
+          >
+            <option label = "------------" value = "-1" style = "display:none;">------------</option>
+            {html_options options=$ec_lists.categories}
+          </select>
+        </label>
+        
+        {* <!-- Image --> *}
+        <label class = "ec_block" for = "ec_in_up_imgs_id" onclick = "ec_mark_action('ec_input_action_img');">
+          <input type = "radio" name = "ec_input_action" value = "img" id = "ec_input_action_img" for = "ec_in_up_imgs_id"
+           onclick = "ec_mark_action('ec_input_action_img');"
+          />
+          {'ec_up_code_lbl_img'|@translate}<br>
+          <input type = "text" name = "ec_in_up_imgs" id = "ec_in_up_imgs_id" maxlength = "6"
+           size = "10" onblur = "ec_selected_img = this.value; ec_check_img_text();" onfocus = "ec_mark_action('ec_input_action_img');"
+          /><br>
+          <span id = "ec_in_up_imgs_warn">&nbsp;</span>
+        </label>
+        
+        {* <!-- Index page --> *}
+        <label class = "ec_block" onclick = "ec_mark_action('ec_input_action_home');">
+          <input type = "radio" name = "ec_input_action" value = "home" id = "ec_input_action_home"
+           onclick = "ec_mark_action('ec_input_action_home');"
+          />
+          {'ec_up_code_lbl_home'|@translate}
+        </label>
+      </td>
+    </tr>
+  </table>
+</form>
+
+{* <!-- JavaScript functions --> *}
+<script type = "text/javascript" src = "{$RACINE_URL}{$EVNTCATS_PATH}admin/evntcats_admin.js"></script>
+<script type = "text/javascript">
+  <!--
+  
+  // ec_test();
+  
+  ec_checked_URL[-1] = '';
+  {foreach from=$code_list key=ec_key item=code_line name=code_loop}
+    ec_checked_URL[{$ec_key}] = '{$code_line.code_URL}';
+  {/foreach}
+  
+  ec_JS_message['ec_confirm_disable'] = "{'ec_confirm_disable'|@translate|@escape:javascript}";
+  ec_JS_message['ec_confirm_delete'] = "{'ec_confirm_delete'|@translate|@escape:javascript}";
+  ec_JS_message['ec_confirm_test'] = "{'ec_confirm_test'|@translate|@escape:javascript}";
+  ec_JS_message['ec_gen_user_act_miss'] = "{'ec_gen_user_act_miss'|@translate|@escape:javascript}";
+  ec_JS_message['ec_act_cat_miss'] = "{'ec_act_cat_miss'|@translate|@escape:javascript}";
+  ec_JS_message['ec_new_pwd_gen'] = "{'ec_new_pwd_gen'|@translate|@escape:javascript}";
+  
+  ec_init();
+  
+  {literal}
+  
+  function Test() {                                                /*
+    document.getElementById('ec_sel_user_none').checked = '';
+    document.getElementById('ec_sel_user_new').checked = '';
+    document.getElementById('ec_sel_user_old').checked = '';       */
+  }
+  
+  //-->{/literal}
+</script>
+
+{* <!-- {$test0tpl} --> *}
+{$test1tpl}
+{$test2tpl}
+{$test3tpl}
+
+{* <!--
+--> *}
+
+{* Peut-être utile ?
+
+Colonne "outils" :
+Titre colonne :
+Cellules :
+          <td style = "text-align:center;">
+          </td>
+
+*}
Index: /extensions/event_cats/event_cats/admin/evntcats_theme.css
===================================================================
--- /extensions/event_cats/event_cats/admin/evntcats_theme.css	(revision 3956)
+++ /extensions/event_cats/event_cats/admin/evntcats_theme.css	(revision 3956)
@@ -0,0 +1,69 @@
+#ec_js_warn {
+  text-align:center;
+  font-weight:bold;
+  font-size:120%;
+  color:red;
+}
+
+.infos {
+  text-align:left;
+  padding-left:45px;
+  font-size:14px;
+}
+
+.errors {
+  text-align:left;
+  padding-left:45px;
+  font-size:14px;
+  color:red;
+}
+
+form.filter label {
+  display:inline;
+  float:none;
+}
+
+form.filter label.ec_block {
+  display:inline;
+  float:left;
+  text-align:left;
+  margin-right: 1em;
+}
+
+form.filter ul {
+  margin: 5px 0 0 35px;
+  display:block;
+  float:left;
+  margin-right:1em;
+  padding:0;
+}
+
+form.filter li {
+  list-style-type:none;
+  list-style-position:outside;
+  float:left;
+  clear:left;
+  margin-bottom:0.5em;
+}
+
+form.filter * label input {
+  vertical-align:middle;
+}
+
+input, select {
+  vertical-align:middle;
+}
+
+form.filter label input, form.filter label select, form.filter label span {
+  display:inline;
+}
+
+a.ec_forced {
+  font-weight:bold;
+  color:red;
+}
+
+a.ec_nforced {
+  font-weight:bold;
+  color:green;
+}
Index: /extensions/event_cats/event_cats/include/ec_conf.inc.php
===================================================================
--- /extensions/event_cats/event_cats/include/ec_conf.inc.php	(revision 3956)
+++ /extensions/event_cats/event_cats/include/ec_conf.inc.php	(revision 3956)
@@ -0,0 +1,121 @@
+﻿<?php
+
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery                                  |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008-2009 Piwigo Team                  http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify  |
+// | it under the terms of the GNU General Public License as published by  |
+// | the Free Software Foundation                                          |
+// |                                                                       |
+// | This program is distributed in the hope that it will be useful, but   |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
+// | General Public License for more details.                              |
+// |                                                                       |
+// | You should have received a copy of the GNU General Public License     |
+// | along with this program; if not, write to the Free Software           |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA.                                                                  |
+// +-----------------------------------------------------------------------+
+
+/*****************************************************************************
+Parameters ($ec_conf) :
+ _ plugin activated ($ec_conf[0]) yes/no ;
+ _ duplication allowance ($ec_conf[1]) :
+   0 : no account ;
+   1 : all accounts ;
+   2 : no account but those specified ;    \
+   3 : all accounts but those specified.   | could be different finally
+ _ what to do in case an unknown code is used with "autolog" parameter
+   ($ec_conf[2]) :
+   0 : nothing ("goto" home page, index.php (not logged in of course)) ;
+   1 : redirected to "access denied" page ;
+   2 : redirected to an Additional Page precised below.
+ _ the id of the Additional Page which must be used in case of usage of an
+   unknow code ($ec_conf[3]).
+*****************************************************************************/
+
+global $ec_conf;
+
+// $ec_conf initalization / check
+if ($t = mysql_fetch_row(pwg_query("
+ SELECT `value`
+ FROM `".CONFIG_TABLE."`
+ WHERE `param` = 'event_cats';
+"))) {
+  $ec_conf = explode(',' , $t[0]);
+}
+else {
+  $ec_conf = explode(',' , '0,1,0,0');
+  change_ec_conf('activated', 0);
+}
+
+/*
+ * change_ec_conf($c, $v)
+ * updates Event Cats configuration values in the database as well as in
+ * $ec_conf.
+ *
+ * @param
+ *   $c : conf value to update ;
+ *   $v : value to give to $ec_conf[$c].
+ * @return
+ *   true or false whether the change was OK or not
+ */
+function change_ec_conf($c, $v) {
+  global $ec_conf;
+  switch ($c) {
+    case 'activated':
+      $d = 0;
+    break;
+    case 'dup_allow':
+      $d = 1;
+    break;
+    case 'unknown_code':
+      $d = 2;
+    break;
+    case 'unknown_code_ap_id':
+      $d = 3;
+    break;
+    default: return false;
+  }
+  $ec_conf[$d] = $v;
+  return pwg_query("
+   UPDATE `".CONFIG_TABLE."`
+   SET `value` = '".implode(',', $ec_conf)."'
+   WHERE `param` = 'event_cats';
+  ");
+}
+
+/*
+ * read_ec_conf($c)
+ * returns the value in $ec_conf using string keys.
+ *
+ * @param
+ *   $c : conf value to update ;
+ * @return
+ *   $ec_conf value
+ */
+function read_ec_conf($c) {
+  global $ec_conf;
+  switch ($c) {
+    case 'activated':
+      return $d[0];
+    break;
+    case 'dup_allow':
+      return $d[1];
+    break;
+    case 'unknown_code':
+      return $d[2];
+    break;
+    case 'unknown_code_ap_id':
+      return $d[3];
+    break;
+    default: return false;
+  }
+}
+
+?>
Index: /extensions/event_cats/event_cats/include/evntcats_funcs.inc.php
===================================================================
--- /extensions/event_cats/event_cats/include/evntcats_funcs.inc.php	(revision 3956)
+++ /extensions/event_cats/event_cats/include/evntcats_funcs.inc.php	(revision 3956)
@@ -0,0 +1,317 @@
+﻿<?php
+
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery                                  |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008-2009 Piwigo Team                  http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify  |
+// | it under the terms of the GNU General Public License as published by  |
+// | the Free Software Foundation                                          |
+// |                                                                       |
+// | This program is distributed in the hope that it will be useful, but   |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
+// | General Public License for more details.                              |
+// |                                                                       |
+// | You should have received a copy of the GNU General Public License     |
+// | along with this program; if not, write to the Free Software           |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA.                                                                  |
+// +-----------------------------------------------------------------------+
+
+// ***************************************************************************
+// ** evntcats_funcs.php : Functions (include) for Piwigo plugin Event Cats **
+// ***************************************************************************
+
+global $conf, $ec_conf;
+
+include_once(EVNTCATS_PATH.'include/ec_conf.inc.php');
+
+/*
+ * build_ec_table()
+ * builds a table showing the content of the <pwg>_event_cats database table,
+ * and a table showing the eventual errors.
+ *
+ * @param
+ *   no parameters passed ; the main material on which works the function, is
+ *   the global array variable $ec_lists.
+ * @return
+ *   (no return value)
+ */
+function build_ec_table() {
+  global $ec_lists, $conf, $ec_ap_ok;
+  
+  $ec_lists['ec_table'] = array();
+  // $ec_lists['ec_codes'] = array(); // Useful ?
+  
+  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; // key($ec_lists['ec_table']) does not work as expected
+      $ec_lists['ec_table'][$ec_current_entry]['id'] = $ec_current_entry;
+      /* $ec_lists['ec_codes'][$ec_current_code] = array(
+       'count' => 1,
+       '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; // key($ec_lists['ec_table']) problem
+          $ec_lists['ec_table'][$ec_current_entry]['id'] = $ec_current_entry;
+          /* $ec_lists['ec_codes'][$ec_current_code] = array(
+           'id'     => $ec_current_entry,
+           'count'  => 1
+          ); */
+        }
+      }
+    }
+    
+  }
+  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;
+      /* $ec_current_entry = intval($r['id']);
+      $ec_current_code = $r['code'];
+      if (array_key_exists($ec_current_code, $ec_lists['ec_codes'])) {
+        $ec_lists[$ec_current_code]['count']++;
+      }
+      else {
+        $ec_lists['ec_codes'][$ec_current_code] = array(
+         'id'     => $ec_current_entry,
+         'count'  => 1
+        ); */
+    }
+  }
+  
+  // 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 = false, $check_forced = false) {
+    global $ec_lists;
+    $first = array();
+    $to_correct = array();
+    // $to_correct is needed because following code would not work anywhere :
+    /*
+    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
+           ($check_forced 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']])) {
+        $ec_entry['action'] = $new_action;
+      }
+    }
+  }
+
+  // Multiple action params for a single code check
+  ec_inpect('action', 'ec_nok_action_pb', true);
+  
+  // Multiple user_ids for a single code check
+  ec_inpect('user_id', 'ec_nok_userid_pb');
+  
+  // Multiple "forced" params for a single code check
+  ec_inpect('forced', 'ec_ok_forced_pb', true, true);
+  
+  // User id and associated page validities checks
+  foreach ($ec_lists['ec_table'] as &$ec_entry) {
+    
+    // Check if associated user_id exists
+    if (
+     $ec_entry['action'] == 'ec_ok' and
+     !array_key_exists($ec_entry['user_id'], $ec_lists['user_ids'])
+    ) {
+      $ec_entry['action'] = 'ec_nok_userid_miss';
+    }
+    
+    // Check if associated displayed page exists
+    $a = 0;
+    if (!empty($ec_entry['arg1']) and
+     (strpos($ec_entry['action'], 'ec_ok') !== false)) $a++; // Only arg2
+    // is significant if action is ec_nok[_xxx] .
+    if (!empty($ec_entry['arg2'])) $a+= 2;
+    switch ($a) {
+      // case 0 : home, nothing to check
+      
+      case 2: // Additional Page
+        if (
+          $ec_ap_ok and (
+            $ec_entry['action'] == 'ec_ok' or
+            $ec_entry['action'] == 'ec_nok'
+          ) and
+          !array_key_exists($ec_entry['arg2'], $ec_lists['add_pages'])
+        ) {
+          $ec_entry['action'].= '_ap_pb';
+        }
+      break;
+      
+      case 1: // Category
+      case 3: // Image
+        if ($ec_entry['action'] == 'ec_ok') {
+          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']
+              ))) {
+                $ec_entry['action'].= '_img_pb';
+              }
+            }
+          }
+          else {
+            $ec_entry['action'].= '_cat_pb';
+          }
+        }
+      break;
+    }
+  }
+}
+
+/*
+ * build_ec_lists()
+ * builds the main array variable contaning all informations for the plugin
+ *
+ * @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_lists() {
+  
+  global $ec_ap_ok, $template, $ec_lists;
+  
+  $ec_lists = array();
+
+  // Construction of $ec_lists['add_pages'] array var
+  $ec_lists['add_pages'] = array();
+  if ($ec_ap_ok) {
+    $res = pwg_query('SELECT id,title FROM '.ADD_PAGES_TABLE);
+    while ($r = mysql_fetch_assoc($res)) {
+      $c = (strpos($r['title'], '/user_id=')) ? '/user_id=' : '/group_id=';
+      $a = explode($c ,$r['title']);
+      $ec_lists['add_pages'][$r['id']] = $a[0];
+    }
+  }
+  
+  // Construction of $ec_lists['categories'] array var
+  $c = array();
+  display_select_cat_wrapper('
+     SELECT id,name,uppercats,global_rank
+     FROM '.CATEGORIES_TABLE,
+   $c, 'category_options', true);
+  $ec_lists['categories'] = $template->smarty->_tpl_vars['category_options'];
+  
+  // Construction of $ec_lists['user_ids'] array var
+  $ec_lists['user_ids'] = array();
+  $q = pwg_query('SELECT id,username FROM '.USERS_TABLE. ' WHERE id > 3');
+  while ($r = mysql_fetch_assoc($q)) {
+    $ec_lists['user_ids'][$r['id']] = $r['username'];
+  }
+  
+  // Construction of $ec_lists['ec_table'] array var
+  build_ec_table();
+}
+
+/*
+ * str_from_var($var)
+ * returns a string easing array var informations displaying in Piwigo :
+ *   _ the string return value starts with"<p align="left">" ;
+ *   _ all "TAB" characters (chr(10)) are replaced by "<br>" ;
+ *   _ all spaces are replaced by "&nbsp;".
+ *
+ * @param
+ *   $var : variable to display
+ * @return
+ *   string easy to display in Piwigo
+ */
+function str_from_var($var) {
+  return '<p align="left">'.str_replace(chr(10),'<br>',str_replace(' ','&nbsp;', print_r /* var_dump */ ($var,true))).'</p>';
+}
+
+?>
Index: /extensions/event_cats/event_cats/language/en_UK/help.html
===================================================================
--- /extensions/event_cats/event_cats/language/en_UK/help.html	(revision 3956)
+++ /extensions/event_cats/event_cats/language/en_UK/help.html	(revision 3956)
@@ -0,0 +1,30 @@
+<h2>Event Cats</h2>
+
+<p>Identify an account thanks to a single URL</p>
+
+<!--
+<p>Pour pouvoir fonctionner correctement javascript doit être activé sur 
+votre navigateur.</p>
+
+<h3>Utilisation</h3>
+
+<p>Pour télécharger les images de votre choix il faut les séléctionner en cochant
+la case sous la vignette, ou bien cliquer sur le bouton <span class="pwgScreen">Tout cocher</span>.
+Ensuite il faut cliquer sur le bouton <span class="pwgScreen">Ajouter au panier</span>. Un message
+apparait en bas de la page :
+<blockquote>Vous avez actuelement 10 image(s) dans votre panier.
+Merci de vider le panier avant de commencer une nouvelle sélection.</blockquote></p>
+
+<p>Pour voir le contenu de votre panier, cliquer sur le bouton <span class="pwgScreen">Voir le panier</span>.
+Depuis cet écran vous pouvez connaitre le type d'images dans votre panier et en supprimer (une à une) en
+cliquant sur la croix rouge.</p>
+
+<p>Pour télécharger votre panier, cliquer sur le bouton <span class="pwgScreen">Télécharger le panier</span>.
+Il vous est demandez de préciser un préfixe pour les fichiers zip, vous pouvez laissé celui par défaut. 
+Pour passer à l'étape suivante cliquer sur le bouton <span class="pwgScreen">Envoyer</span>. Une liste de fichier
+apparait. Pour récupérer les fichiers archives il suffit de cliquer sur le nom des fichiers, votre navigateur 
+vous proposera une action. Depuis cet écran vous pouvez supprimer les archives zip. Soit vous sélectionner toute
+les archives en cliquant sur le bouton <span class="pwgSreen">Sélectioner</span>, ou alors fichier par fichier en 
+cochant la case à côté du nom du fichier. Ensuite cliquer sur le bouton <span class="pwgScreen">Supprimer</span> pour
+supprimer les fichiers sélectionner.</p>
+-->
Index: /extensions/event_cats/event_cats/language/en_UK/plugin.lang.php
===================================================================
--- /extensions/event_cats/event_cats/language/en_UK/plugin.lang.php	(revision 3956)
+++ /extensions/event_cats/event_cats/language/en_UK/plugin.lang.php	(revision 3956)
@@ -0,0 +1,25 @@
+<?php
+
+/*
+Language module for plugin Even Cats
+English
+LucMorizur June - ... 2009
+*/
+
+// $ec_err :
+$lang['ec_err_AP_fail'] = 'Reference to an Additional Page which doesn\'t exist'; // 1
+$lang['ec_err_cod_dupl_frbdn'] = 'Code should be unique '; // 2
+$lang['ec_err_AP_miss'] = 'Redirection to Additional Page, but AP not specified'; // 3
+$lang['ec_err_USR_fail'] = 'An entry associates a code to an unknown user_id or username'; // 4
+$lang['ec_err_CAT_fail'] = 'An unknown category has been given as arg1'; // 5
+$lang['ec_err_IMG_fail'] = 'An image id not found in a certain category, has been given as arg2'; // 6
+$lang['ec_err_USR_prbl'] = 'User not clear'; // 7
+$lang['ec_err_USR_dupl'] = 'Code is associated to more than one user_id'; // 8
+$lang['ec_err_CAT_miss'] = 'Category id misses'; // 9
+$lang['ec_err_IMG_miss'] = 'Image id misses'; // 10
+$lang['ec_err_forced_prbl'] = 'Outdated code should always be forced'; // 11
+
+
+// $lang[''] = '';
+
+?>
Index: /extensions/event_cats/event_cats/language/fr_FR/help.html
===================================================================
--- /extensions/event_cats/event_cats/language/fr_FR/help.html	(revision 3956)
+++ /extensions/event_cats/event_cats/language/fr_FR/help.html	(revision 3956)
@@ -0,0 +1,30 @@
+<h2>Event Cats</h2>
+
+<p>Identifier un compte sur un seul URL</p>
+
+<!--
+<p>Pour pouvoir fonctionner correctement javascript doit être activé sur 
+votre navigateur.</p>
+
+<h3>Utilisation</h3>
+
+<p>Pour télécharger les images de votre choix il faut les séléctionner en cochant
+la case sous la vignette, ou bien cliquer sur le bouton <span class="pwgScreen">Tout cocher</span>.
+Ensuite il faut cliquer sur le bouton <span class="pwgScreen">Ajouter au panier</span>. Un message
+apparait en bas de la page :
+<blockquote>Vous avez actuelement 10 image(s) dans votre panier.
+Merci de vider le panier avant de commencer une nouvelle sélection.</blockquote></p>
+
+<p>Pour voir le contenu de votre panier, cliquer sur le bouton <span class="pwgScreen">Voir le panier</span>.
+Depuis cet écran vous pouvez connaitre le type d'images dans votre panier et en supprimer (une à une) en
+cliquant sur la croix rouge.</p>
+
+<p>Pour télécharger votre panier, cliquer sur le bouton <span class="pwgScreen">Télécharger le panier</span>.
+Il vous est demandez de préciser un préfixe pour les fichiers zip, vous pouvez laissé celui par défaut. 
+Pour passer à l'étape suivante cliquer sur le bouton <span class="pwgScreen">Envoyer</span>. Une liste de fichier
+apparait. Pour récupérer les fichiers archives il suffit de cliquer sur le nom des fichiers, votre navigateur 
+vous proposera une action. Depuis cet écran vous pouvez supprimer les archives zip. Soit vous sélectionner toute
+les archives en cliquant sur le bouton <span class="pwgSreen">Sélectioner</span>, ou alors fichier par fichier en 
+cochant la case à côté du nom du fichier. Ensuite cliquer sur le bouton <span class="pwgScreen">Supprimer</span> pour
+supprimer les fichiers sélectionner.</p>
+-->
Index: /extensions/event_cats/event_cats/language/fr_FR/plugin.lang.php
===================================================================
--- /extensions/event_cats/event_cats/language/fr_FR/plugin.lang.php	(revision 3956)
+++ /extensions/event_cats/event_cats/language/fr_FR/plugin.lang.php	(revision 3956)
@@ -0,0 +1,141 @@
+﻿<?php
+
+/*
+Language module for plugin Even Cats
+French (Français)
+LucMorizur June - ... 2009
+*/
+
+// In template
+// Upper banner
+$lang['ec_tab_autoid']            = 'Identification automatique';
+$lang['ec_tab_config']            = 'Configuration générale';
+$lang['ec_help']                  = 'A l\'aide !';
+// Autolog area
+$lang['ec_javascript_needed']     = 'Javascript DOIT être activé sur votre navigateur pour un fonctionnement correct de cette page !';
+$lang['ec_admin_page_title']      = 'Event Categories';
+$lang['ec_admin_page_howto']      = 'Event Categories, pour catégories événementielles :<br>cette extension permet d\'identifier automatiquement un compte ("autolog"), et de dupliquer le compte sous lequel un visiteur est identifié ("duplication").<br><br>Merci au Forum, plg, ddtddt, flipflip, P@t pour le code principal :-) !';
+$lang['ec_plugin_ap_ok']          = 'Plugin Additional Pages : actif';
+$lang['ec_plugin_ap_nok']         = 'Plugin <a href = "http://fr.piwigo.org/ext/extension_view.php?eid=153" title = "Ouvrir une nouvelle fenêtre sur le plugin Additional Pages" target = "_blank">Additional Pages</a> : inactif';
+$lang['ec_entry_table_title']     = 'Entrées du paramètre "autolog"';
+// Table
+$lang['ec_col_name_entry']        = 'Entrée';
+$lang['ec_col_name_code']         = 'Code';
+$lang['ec_col_name_user']         = 'Utilisateur';
+$lang['ec_col_name_bhvr']         = 'Identification ?';
+$lang['ec_col_name_dspl']         = 'Page affichée';
+$lang['ec_col_name_actn']         = 'Outils';
+$lang['ec_show_URL']              = 'URL : ';
+$lang['ec_url_tooltip']           = 'Copiez l\'adresse du lien pour le transmettre';
+$lang['ec_test_tooltip']          = 'Tester l\'URL ( => déconnexion admin.)';
+$lang['ec_url_delete']            = 'Supprimer l\'entrée';
+$lang['ec_url_disable']           = 'Rendre l\'entrée périmée';
+$lang['ec_url_forced']            = 'Ne plus forcer ce code à afficher cette page';
+$lang['ec_url_nforced']           = 'Forcer ce code à afficher cette page';
+$lang['ec_url_duplicate']         = 'Recopier ce code pour une nouvelle entrée';
+// New entry
+$lang['ec_create_modify_code']    = 'Nouvelle entrée';
+$lang['ec_new_full_auto']         = 'Tout automatique : nouveau code et nouvel utilisateur d\'après page à afficher ci-dessous';
+$lang['ec_new_entry']             = 'Code';
+$lang['ec_new_entry_button']      = 'Générer un code automatiquement';
+$lang['ec_gen_code_nb_pre']       = 'de';
+$lang['ec_gen_code_nb_max']       = ' (max)';
+$lang['ec_gen_code_nb_end']       = 'caractères';
+$lang['ec_up_code_lbl_user']      = 'Utilisateur identifié';
+$lang['ec_up_code_lbl_user_none'] = 'Aucun (accès refusé)';
+$lang['ec_up_code_lbl_user_new']  = 'Nouvel utilisateur :';
+$lang['ec_new_user_name']         = 'Nom d\'utilisateur';
+$lang['ec_new_user_pswd']         = 'Mot de passe';
+$lang['ec_up_code_lbl_gen_user']  = 'Générer un nom d\'utilisateur d\'après l\'action choisie';
+$lang['ec_up_code_lbl_user_old']  = 'Utilisateur existant :';
+$lang['ec_up_code_lbl_home']      = 'Accueil';
+$lang['ec_up_code_lbl_action']    = 'Page affichée';
+$lang['ec_up_code_lbl_aps']       = 'Additional Page';
+$lang['ec_up_code_lbl_cats']      = 'Catégorie';
+$lang['ec_up_code_lbl_img']       = 'Image';
+// JS checks
+$lang['ec_confirm_test']          = "Vraiment tester le code sélectionné ?\n\rCela terminera votre session d'administration.";
+$lang['ec_confirm_disable']       = "Vraiment rendre périmé le code sélectionné ?\n\rCela supprimera toutes les autres entrées utilisant le même code, s'il y en a.";
+$lang['ec_confirm_delete']        = "Vraiment supprimer le code sélectionné ?\n\rCela supprimera toutes les autres entrées utilisant le même code, s'il y en a.";
+$lang['ec_gen_user_act_miss']     = 'Sélectionnez d\'abord une page à afficher';
+$lang['ec_act_cat_miss']          = 'Catégorie ?';
+$lang['ec_new_pwd_gen']           = 'Pensez à NOTER le mot de passe !';
+
+// In PHP files
+// Errors
+$lang['ec_action_pb']             = 'Champ "action" corrompu (plusieurs valeurs pour un même code dans la base de données)';
+$lang['ec_username_pb']           = 'Champ "user_id" corrompu (plusieurs valeurs pour un même code dans la base de données)';
+$lang['ec_forced_pb']             = 'Champ "forced" corrompu (au moins une fois "true" pour un même code dans la base de données)';
+$lang['ec_username_miss']         = 'Utilisateur inexistant (probablement supprimé)';
+$lang['ec_category_miss']         = 'Catégorie inexistante (probablement supprimée)';
+$lang['ec_image_miss']            = 'Image inexistante (probablement supprimée)';
+$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_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_pre2']    = 'Problème avec tentative de rendre périmée entrée ';
+$lang['ec_entry_dis_nok_mid2']    = ' (lié à Add. Page n°';
+$lang['ec_entry_dis_nok_end2']    = ')';
+$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)';
+// Infos
+$lang['ec_entry_del_ok_pre']      = 'Entrée ';
+$lang['ec_entry_del_ok_end']      = ' supprimée';
+$lang['ec_entry_dis_ok_pre1']     = 'Entrée ';
+$lang['ec_entry_dis_ok_end1']     = ' maintenant périmée';
+$lang['ec_entry_dis_ok_pre2']     = ', renvoie vers Additional Page n°';
+$lang['ec_entry_dis_ok_mid2']     = ' : ';
+$lang['ec_entry_dis_ok_end2']     = '';
+
+// Table
+//   actions
+$lang['ec_ok']                    = 'OUI';
+$lang['ec_ok_forced_pb']          = 'OUI (page non forcée)';
+$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_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)';
+// Username can't be displayed
+$lang['ec_dspl_nok_actn']         = '"action" inutilisable';
+$lang['ec_dspl_usr_pb']           = '"user_id" inutilisable';
+$lang['ec_dspl_nok_usr_pre']      = 'Utilisateur n°';
+$lang['ec_dspl_nok_usr_mid1']     = ' (';
+$lang['ec_dspl_nok_usr_mid2']     = ' )';
+$lang['ec_dspl_nok_usr_end']      = ' n\'existe pas';
+//   displayed pages
+$lang['ec_dspl_ok_home']          = 'Accueil';
+$lang['ec_dspl_ok_acc_denied']    = 'Accès refusé';
+$lang['ec_dspl_ok_cat_pre']       = 'Catégorie n°';
+$lang['ec_dspl_ok_cat_mid']       = ' : ';
+$lang['ec_dspl_ok_cat_end']       = '';
+$lang['ec_dspl_ok_img1_pre']      = 'Catégorie n°';
+$lang['ec_dspl_ok_img1_mid']      = ' : ';
+$lang['ec_dspl_ok_img1_end']      = ' ; ';
+$lang['ec_dspl_ok_img2_pre']      = 'image n°';
+$lang['ec_dspl_ok_img2_mid1']     = ' : ';
+$lang['ec_dspl_ok_img2_mid2']     = ' (';
+$lang['ec_dspl_ok_img2_end']      = ')';
+$lang['ec_dspl_ok_ap_pre']        = 'Additional Page n°';
+$lang['ec_dspl_ok_ap_mid']        = ' : ';
+$lang['ec_dspl_ok_ap_end']        = '';
+$lang['ec_dspl_nok_home']         = 'Accueil';
+$lang['ec_dspl_nok_acc_denied']   = 'Accès refusé';
+$lang['ec_dspl_nok_ap_pre']       = ' (Additional Page n°';
+$lang['ec_dspl_nok_ap_end']       = ' n\'existe pas)';
+$lang['ec_dspl_nok_cat_pre']      = ' (catégorie n°';
+$lang['ec_dspl_nok_cat_end']      = ' n\'existe pas)';
+$lang['ec_dspl_nok_img1_pre']     = ' (catégorie n°';
+$lang['ec_dspl_nok_img1_end']     = ' n\'existe pas)';
+$lang['ec_dspl_nok_img2_pre']     = ' (image n°';
+$lang['ec_dspl_nok_img2_mid']     = ' n\'existe pas dans catégorie n°';
+$lang['ec_dspl_nok_img2_end']     = ')';
+
+
+// $lang['']   = '';
+
+?>
Index: /extensions/event_cats/event_cats/main.inc.php
===================================================================
--- /extensions/event_cats/event_cats/main.inc.php	(revision 3956)
+++ /extensions/event_cats/event_cats/main.inc.php	(revision 3956)
@@ -0,0 +1,297 @@
+﻿<?php
+
+/*
+Plugin Name: Event Cats
+Version: 1.0.0
+Description: A single URL can be enough to be identified, and a user can duplicate his account to create a new one getting immediately the same properties. / On peut être identifié grâce à un simple URL, et on peut dupliquer son compte pour créer un nouveau compte ayant immédiatement les mêmes propriétés.
+Plugin URI: (Doesn't exist for the moment)
+Author: P@t, LucMorizur
+Author URI: http://www.gauchon.fr, http://lucmorizur.free.fr
+*/
+
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery                                  |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008-2009 Piwigo Team                  http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify  |
+// | it under the terms of the GNU General Public License as published by  |
+// | the Free Software Foundation                                          |
+// |                                                                       |
+// | This program is distributed in the hope that it will be useful, but   |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
+// | General Public License for more details.                              |
+// |                                                                       |
+// | You should have received a copy of the GNU General Public License     |
+// | along with this program; if not, write to the Free Software           |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA.                                                                  |
+// +-----------------------------------------------------------------------+
+
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+
+// pour faciliter le debug - make debug easier :o)
+//ini_set('error_reporting', E_ALL);
+//ini_set('display_errors', true);
+
+global
+  $conf, $prefixeTable, $ec_conf,
+  $ec_ap_ok;   // whether Additional Pages is installed and activated
+
+define('EVNTCATS_INFO_VERSION','1.0.0');
+define('EVNTCATS_PATH',PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)). '/');
+define('EVNTCATS_TABLE',$prefixeTable.'event_cats');
+define('ROOT_URL',get_absolute_root_url());
+
+$ec_ap_ok = defined('AP_DIR');
+
+if (!isset($ec_lists)) {
+  $ec_lists = array();
+}
+
+// $ec_conf initalization / check
+if ($t = mysql_fetch_row(pwg_query("
+ SELECT `value`
+ FROM `".CONFIG_TABLE."`
+ WHERE `param` = 'event_cats';
+"))) {
+  $ec_conf = explode(',' , $t[0]);
+}
+else {
+  $ec_conf = array();
+}
+
+include_once(EVNTCATS_PATH.'include/evntcats_funcs.inc.php');
+
+class event_cats {
+// Sets the administration panel of the plugin
+  function plugin_admin_menu($menu) {
+    array_push($menu,
+      array(
+        'NAME' => 'Event Cats',
+        'URL'  => get_admin_plugin_menu_link(dirname(__FILE__).
+                  '/admin/evntcats_admin.php')
+      )
+    );
+    return $menu;
+  }
+} // End class
+
+$obj = new event_cats();
+
+// Admin help management
+add_event_handler('get_popup_help_content', 'ec_popup_help_content',
+ EVENT_HANDLER_PRIORITY_NEUTRAL, 2);
+
+function ec_popup_help_content($popup_help_content, $page) {
+  return (
+   $help_content = ($page == 'event_cats' and is_admin()) ?
+    load_language('help.html', EVNTCATS_PATH, array('return' => true)) : false
+  ) ? $popup_help_content.$help_content : $popup_help_content;
+}
+                                                                                     // Mettre en place l'autoid, qu'on voie si ça marche !
+
+//----------------------------------
+
+/**
+ *
+ * auto_log_user()
+ * the function uses the value of the argument "autolog" of the posted URL, as a code
+ * to know which username has to be logged in.
+ *
+ * @param no parameter
+ * @return no return value
+ */
+
+add_event_handler('init', 'auto_log_user');
+
+function auto_log_user() {
+  global $ec_conf, $ec_lists;
+
+  $ec_ap  = NULL;
+  $ec_cat = NULL;
+  $ec_img = NULL;
+
+  if (isset($_GET['autolog']) and ($ec_conf['activated'] == 1)) {
+    if (!is_a_guest()) logout_user();
+    build_ec_lists();
+    foreach ($ec_lists['ec_table'] as $ec_entry) {
+      if ($code_exists = ($ec_entry['code'] == $_GET['autolog'])) break;
+    }
+    if ($code_exists) {
+      if (isset($_GET['ap'])) $ec_ap = $_GET['ap'];
+      if (strpos($ec_entry['action'], 'ec_ok') !== false) {
+        log_user($ec_entry['user_id'], false);
+        if (isset($_GET['cat'])) $ec_cat = $_GET['cat'];
+        if (isset($_GET['img'])) $ec_img = $_GET['img'];
+        if (
+         $ec_entry['forced'] == 'true' and
+         $ec_entry['action'] != 'ec_forced_pb'
+        ) {
+          if (empty($ec_entry['arg1']) and !empty($ec_entry['arg2'])) {
+            $ec_ap = $ec_entry['arg2'];
+          }
+          elseif (!empty($ec_entry['arg1'])) {
+            $ec_cat = $ec_entry['arg1'];
+            if (!empty($ec_entry['arg2'])) $ec_img = $ec_entry['arg2'];
+          }
+        }
+        if (isset($ec_ap)) {
+          if (array_key_exists($ec_ap,$ec_lists['add_pages'])) {
+            redirect(
+             PHPWG_ROOT_PATH.'index.php?/additional_page/'.$ec_ap);
+          }
+        }
+        elseif (isset($ec_cat)) {
+          if (array_key_exists($ec_cat, $ec_lists['categories'])) {
+            if (isset($ec_img)) {
+              if (mysql_fetch_row(pwg_query('
+               SELECT *
+               FROM `'.IMAGE_CATEGORY_TABLE.'` 
+               WHERE `category_id` = '.$ec_cat.'
+                AND `image_id` = '.$ec_img
+              ))) {
+                redirect(PHPWG_ROOT_PATH.'picture.php?/'.$ec_img.'/category/'.$ec_cat);
+              }
+            }
+            redirect(PHPWG_ROOT_PATH.'index.php?/category/'.$ec_cat);
+          }
+        }
+        else {
+          redirect(make_index_url());
+        }
+      }
+      else {
+        if ($ec_entry['action'] == 'ec_nok') {
+          if (isset($ec_ap)) {
+            if (array_key_exists($ec_ap,$ec_lists['add_pages'])) {
+              redirect(
+               PHPWG_ROOT_PATH.'index.php?/additional_page/'.$ec_ap);
+            }
+          }
+          access_denied();
+        }
+        else {
+          redirect(make_index_url());
+        }
+      }
+    }
+    else {
+      if (
+       $ec_conf['unknown_code'] == 2 and
+        array_key_exists(
+         $ec_conf['unknown_code_ap_id'], $ec_lists['add_pages']
+        )
+       ) {
+        redirect(
+         PHPWG_ROOT_PATH.
+         'index.php?/additional_page/'.$ec_conf['unknown_code_ap_id']
+        );
+      }
+      elseif ($ec_conf['unknown_code'] == 1 or
+       $ec_conf['unknown_code'] == 2) {
+        access_denied();
+      }
+      else {
+        redirect(make_index_url());
+      }
+    }
+  }
+}
+
+/**
+ *
+ * assign_perm_for_new_user()
+ * copies/paste groups+access+properties associations of previously connected
+ * username, to newly created username.
+ *
+ * @param no parameter
+ * @return no return value
+ */
+
+add_event_handler('register_user', 'assign_perm_for_new_user');
+
+function assign_perm_for_new_user($new_user)
+{ /*
+  global $user;
+
+  if (!is_a_guest() and !is_admin())
+  {
+    // User access
+    $query = 'SELECT cat_id FROM '.USER_ACCESS_TABLE.' WHERE user_id = '.$user['id'].';';
+    $result = pwg_query($query);
+    $insert = array();
+    while ($row = mysql_fetch_assoc($result))
+    {
+      $insert[] = '('.$new_user['id'].','.$row['cat_id'].')';
+    }
+    if (!empty($insert))
+    {
+      pwg_query('INSERT INTO '.USER_ACCESS_TABLE.' VALUES '.implode(',', $insert).';');
+    }
+
+    // User groups
+    $query = 'SELECT group_id FROM '.USER_GROUP_TABLE.' WHERE user_id = '.$user['id'].';';
+    $result = pwg_query($query);
+    $insert = array();
+    while ($row = mysql_fetch_assoc($result))
+    {
+      $insert[] = '('.$new_user['id'].','.$row['group_id'].')';
+    }
+    if (!empty($insert))
+    {
+      pwg_query('INSERT INTO '.USER_GROUP_TABLE.' VALUES '.implode(',', $insert).';');
+    }
+
+    // User infos
+    $query = 'SELECT level FROM '.USER_INFOS_TABLE.' WHERE user_id = '.$user['id'].';';
+    $result = pwg_query($query);
+    $insert = array();
+    while ($row = mysql_fetch_assoc($result))
+    {
+      $insert[] = '('.$new_user['id'].','.$row['level'].')';
+    }
+    if (!empty($insert))
+    {
+      $query = 'UPDATE '.USER_INFOS_TABLE.' SET level = '.$user['level'].' WHERE user_id = '.$new_user['id'].';';
+      pwg_query($query);
+    }
+  }  */
+}
+
+/**
+ *
+ * duplicate_account_url()
+ * adds a link "Duplicate" in Identification block menu.
+ *
+ * @param no parameter
+ * @return no return value
+ */
+
+add_event_handler('blockmanager_apply', 'duplicate_account_url');
+
+function duplicate_account_url()
+{ /*
+  global $conf, $lang, $template;
+
+  if ($conf['allow_user_registration'] and !is_admin() and !is_a_guest())
+    and !is_admin() and !is_a_guest())
+  {
+    $template->assign( 'U_REGISTER', get_root_url().'register.php');
+    $lang['Create a new account'] = l10n('Duplicate account');
+    $lang['Register'] = l10n('Duplicate');
+  } */
+}
+
+// copying/pasting the following lines from same file in plugin LLGBO2,
+// because it looks like it's useful :-/ .....   
+               /*
+add_event_handler('render_element_content',
+  array(&$obj,'MyPictureOptions'),  EVENT_HANDLER_PRIORITY_NEUTRAL-1,  2  );   */
+add_event_handler('get_admin_plugin_menu_links', array(&$obj, 'plugin_admin_menu') );
+set_plugin_data($plugin['id'], $obj);
+
+?>
Index: /extensions/event_cats/event_cats/maintain.inc.php
===================================================================
--- /extensions/event_cats/event_cats/maintain.inc.php	(revision 3956)
+++ /extensions/event_cats/event_cats/maintain.inc.php	(revision 3956)
@@ -0,0 +1,157 @@
+﻿<?php
+
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery                                  |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008-2009 Piwigo Team                  http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify  |
+// | it under the terms of the GNU General Public License as published by  |
+// | the Free Software Foundation                                          |
+// |                                                                       |
+// | This program is distributed in the hope that it will be useful, but   |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
+// | General Public License for more details.                              |
+// |                                                                       |
+// | You should have received a copy of the GNU General Public License     |
+// | along with this program; if not, write to the Free Software           |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA.                                                                  |
+// +-----------------------------------------------------------------------+
+
+// ***********************************************************************
+// ** maintain.inc.php : Installation page for Piwigo plugin Event Cats **
+// ***********************************************************************
+
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+
+global $ec_conf;
+
+if (!defined('EVNTCATS_PATH'))
+ define('EVNTCATS_PATH',PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)). '/');
+
+include_once(EVNTCATS_PATH.'include/ec_conf.inc.php');
+
+function plugin_uninstall() {
+
+  global $prefixeTable, $conf, $ec_conf;
+
+  unset($ec_conf);
+	pwg_query("DELETE FROM `".CONFIG_TABLE."` WHERE `param` = 'event_cats' LIMIT 1;");
+	return pwg_query('DROP TABLE IF EXISTS `'.$prefixeTable.'event_cats`;');
+}
+
+function plugin_install() {
+
+  global $prefixeTable;
+  
+  plugin_uninstall();
+  // create table for plugin, if it doesn't exist yet
+  $q = pwg_query("
+    CREATE TABLE `".$prefixeTable."event_cats` (
+      `id`      SMALLINT(5)             UNSIGNED NOT NULL     AUTO_INCREMENT ,
+      `code`    VARCHAR(32)                               DEFAULT NULL ,
+      `user_id` SMALLINT(5)             UNSIGNED          DEFAULT NULL ,
+      `action`  ENUM('ec_ok', 'ec_nok')                   DEFAULT NULL ,
+      `arg1`    SMALLINT(5)             UNSIGNED          DEFAULT NULL ,
+      `arg2`    SMALLINT(5)             UNSIGNED          DEFAULT NULL ,
+      `forced`  ENUM('true', 'false')            NOT NULL DEFAULT 'false' ,
+      PRIMARY KEY (`id`),
+      INDEX (`code`) ,
+      INDEX (`user_id`)
+    )
+    DEFAULT CHARACTER SET utf8;
+  ");
+
+/*
+Explanations on table structure :
+
+code    : the code used as "autolog" argument. If thie code provided by the
+          visitor does not exist in the table, the administrator can choose
+          whether the visitor is redirected to the home page (nothing
+          happens) or to the "access denied" page ;
+user_id : the account concerned in following values ;
+action  : the action to perform :
+   ec_nok : code disabled : account not logged in, visitor (guest) redirected
+            to an explaining Additional Page (arg2 field). If Additional Page
+            plugin is not activated, redirection to the "access denied" page ;
+   ec_ok  : code OK, account logged in. Redirection depends on arg1 and arg2
+            values. There are four cases :
+     arg1 and arg2 are both NULL : home page ;
+     arg1 not NULL and arg2 NULL : category ;
+     arg1 NULL and arg2 not NULL : Additional Page ;
+     arg1 and arg2 both not NULL : Image page.
+            If arg1 is a valid category id, and arg2 is not a valid image id,
+            redirection to category. In all other cases where the arg1 or arg2
+            is not valid, redirection to home page.
+arg1    : (described above) ;
+arg2    : (described above) ;
+forced  : allows the administrator to impose that, for certain codes, the
+          settings specified in the database ("action", "arg1", "arg2") are
+          applied, whatever can be the arguments given in the URL.
+           
+* As a precision :
+    in the PHP code, the "action" can also have the following values, so to
+    display accurate messages in the admin page :
+  ec_nok_action_pb   : the same "code" is used in more than one entries in the
+                       DB (which is allowed) and is not always associated to
+                       the same action ('ec_ok' in one or more entries, and
+                       'ec_nok' in one or more other entries). This is
+                       confusing and makes impossible to log in using this
+                       code ;
+  ec_nok_userid_pb   : the same "code" is used in more than one entries in the
+                       DB (which is allowed) and is not always associated to
+                       the same user id. This is confusing and makes
+                       impossible to log in using this code ;
+  ec_nok_userid_miss : the user id associated to this code does not exist in
+                       the user ids table ;
+  ec_nok_ap_pb       : not valid Additional Page id -> access denied ;
+  ec_ok_forced_pb    : the same "code" is used in more than one entries in the
+                       DB (which is allowed) and the "forced" argument is
+                       "true" for at least one of these entries, which should
+                       not be possible, as a "forced" code can occur only once
+                       in the DB. User is logged in and the code behaves as a
+                       not "forced" code ;
+  ec_ok_ap_pb        : not valid Additional Page id -> home page ;
+  ec_ok_cat_pb       : not valid category id -> home page ;
+  ec_ok_img_pb       : not valid image id -> category page ;
+
+_ the two main fields are "user_id" and "code", as the main purpose of the
+  plugin, and thus of the table, is to establish a relationship between a
+  code and an account on the gallery -- a user_id. "action" is an important
+  field too, as it tells which action to perform.
+_ though, even if "action", "user_id" and "code" are important, all of them
+  can be omitted (thus can be NULL), and both "user_id" and "code" can be
+  repeated (thus are not UNIQUE). This because :
+  _ the same code can automatically log in ("autolog") the same account
+    following several ways, depending on "cat", "img", and "ap" arguments of
+    the URL ; and thus different ways can be stored in the DB ;
+  _ a "disabled" code (the user tries to "autolog", but (s)he's not allowed
+    to) does not need a corresponding "user_id", thus "user_id" can be NULL ;
+  _ "user_id" field is used to store groups ids when "code" is NULL, to
+    identify groups authorized to duplication ;
+_ "code" does not have the MySQL UNIQUE attribute, but it has to be unique
+  when the "forced" Event Cats parameter is true, which is the case when this
+  code is disabled (outdated).
+
+*/
+  pwg_query('
+   INSERT INTO '.CONFIG_TABLE.' (param,value,comment)
+   VALUES ("event_cats","0,1,0,0","Paramètres du plugin Event Cats");
+  ');
+  change_ec_conf('activated', 0);
+  return $q;
+}
+
+function plugin_activate() {
+  change_ec_conf('activated', 1);
+}
+
+function plugin_deactivate() {
+  change_ec_conf('activated', 0);
+}
+
+?>
