Index: extensions/event_cats/admin/config.inc.php
===================================================================
--- extensions/event_cats/admin/config.inc.php	(revision 7066)
+++ extensions/event_cats/admin/config.inc.php	(revision 7067)
@@ -40,5 +40,5 @@
 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
 
-global $ec_conf_default, $ec_conf;
+global $ec_conf_possible_values, $ec_conf;
 
 // +-----------------------------------------------------------------------+
@@ -79,5 +79,5 @@
 // Sends configuration values to the template, described per key
 $ec_conf2 = array(); $i = 0;
-foreach ($ec_conf_default as $k => $v) { $ec_conf2[$k] = $ec_conf[$i]; $i++; }
+foreach ($ec_conf_possible_values as $k => $v) { $ec_conf2[$k] = $ec_conf[$i]; $i++; }
 $template->assign('ec_conf', $ec_conf2);
 $template->assign('ec_help_banner1', l10n('ec_help_banner1_config'));
Index: extensions/event_cats/include/ec_conf.inc.php
===================================================================
--- extensions/event_cats/include/ec_conf.inc.php	(revision 7066)
+++ extensions/event_cats/include/ec_conf.inc.php	(revision 7067)
@@ -27,12 +27,13 @@
 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
 
-global $ec_conf, $page, $ec_conf_index, $ec_conf_default,
-       $ec_conf_possible_values;
-
-// $ec_conf initalization
+global $ec_conf, $page, $ec_conf_index, $ec_conf_possible_values, $ec_debug;
+
+// ---------------------------------------------------------------------------
+//                            $ec_conf initalization
+// ---------------------------------------------------------------------------
 
 // $ec_conf has numeric indexes (instead of string keys like 'activated',
 // 'howto'...) because of its first reading, done with the "explode" function.
-// It would be  very easy to build a string keys indexed array, thanks to
+// It would be very easy to build a string keys indexed array, thanks to
 // following instructions :
 /*
@@ -55,73 +56,30 @@
 // quickly.
 
-// Gives configuration items names and default values. Only strings.
-$ec_conf_default = array( // PLUGIN CONFIGURATION ($ec_conf) :
-                          // ---------------------------------
-  'activated'             // plugin activated, 0 or 1
-    => '0',               // 
-                          // 
-  'howto'                 // whether the small aknowledgement message has
-    => '0',               // already been displayed, 0 or 1
-                          // 
-  'dup_allow'             // duplication allowance :
-    => '2',               //   0 : no account ;
-                          //   1 : all accounts ;
-                          //   2 : specified by group and user ids ;
-                          // 
-  'duplic_display'        // duplication link display in the menubar :
-    => '2',               //   0 : "Register" for everybody ;
-                          //   1 : "Duplicate" for everybody ;
-                          //   2 : "Register" only for generic accounts,
-                          //       "Duplicate" for all other accounts ;
-                          // 
-  'auto_code_dg_nb'       // number of digits when creating a new code
-    => '10',              // automatically, several values
-                          // 
-  'unknown_code'          // what to do in case an unknown code is used with
-    => '1',               // "autolog" parameter :
-                          //   0 : nothing (display home page, index.php (not
-                          //       logged in of course)) ;
-                          //   1 : display "access denied" page ;
-                          //   2 : display an Additional Page precised below.
-                          // 
-  'unknown_code_ap_id'    // the id of the Additional Page which must be used
-    => '0',               // in case of usage of an unknow code, several vals.
-                          // 
-  'comment_display'       // the way the comment is displayed in "entries"
-    => '1',               // tab : 0, as tooltip ; 1, on a line under code
-                          // 
-  'in_help_display'       // whether the help banner is displayed.
-    => '1',               // 0: not displayed ; 1 : displayed (surprising !)
-                          // 
-  'display_connection'    // whether the "Connection" link must be displayed
-    => '0',               // for generic users, 0 or 1.
+// Give possible $ec_conf values. In case values cannot be predicted, just
+// provide an empty array : array() .
+$ec_conf_possible_values = array(
+  'activated'           => array('0', '1'),                           //  0
+  'howto'               => array('0', '1'),                           //  1
+  'dup_allow'           => array('0', '1', '2'),                      //  2
+  'duplic_display'      => array('0', '1', '2'),                      //  3
+  'auto_code_dg_nb'     => array( '4',  '5',  '8', '10', '12', '15',
+                                 '16', '20', '24', '25', '30', '32'), //  4
+  'unknown_code'        => array('0', '1', '2'),                      //  5
+  'unknown_code_ap_id'  => array(),                                   //  6
+  'comment_display'     => array('0', '1'),                           //  7
+  'in_help_display'     => array('0', '1'),                           //  8
+  'display_connection'  => array('0', '1'),                           //  9
+  'simple_mode_on'      => array('0', '1'),                           // 10
+  'display_full_button' => array('0', '1'),                           // 11
 );
 
-// Gives possible values. In case values cannot be predicted, just provide an
-// empty array : array() .
-$ec_conf_possible_values = array(
-  'activated'          => array('0', '1'),
-  'howto'              => array('0', '1'),
-  'dup_allow'          => array('0', '1', '2'),
-  'duplic_display'     => array('0', '1', '2'),
-  'auto_code_dg_nb'    => array( '4',  '5',  '8', '10', '12', '15',
-                                '16', '20', '24', '25', '30', '32'),
-  'unknown_code'       => array('0', '1', '2'),
-  'unknown_code_ap_id' => array(),
-  'comment_display'    => array('0', '1'),
-  'in_help_display'    => array('0', '1'),
-  'display_connection' => array('0', '1'),
-);
-
-// Once these lines have been updated, you don't need to change anything
-// else. Everything is managed by the code ; the only effect being that
-// existing configuration values in the DB are reset to their default
-// values -- normally not a harmful effect.
-//----------------------------------------------------------------------------
-
-$ec_conf_index = array_flip(array_keys($ec_conf_default));
-
-$t = array(); $u = '0'; $v = false;
-if ($v = (
+// $ec_conf_index is an array of the indexes of $ec_conf. Thus does it allow
+// to check if X exists when asking for $ec_conf[X].
+$ec_conf_index = array_flip(array_keys($ec_conf_possible_values));
+
+// Get current value of $ec_conf, if the entry in the DB exists.
+$t = array(); $u = '0'; $v = false; $w = false; $ec_conf = array(); $s = '0';
+if ($w = ( // $w becomes true if the query succeeds <=> if EC was already in
+  // $t gets event_cats config value, as an array with one unique entry
   ($t = pwg_db_fetch_row(pwg_query("
     SELECT `value`
@@ -132,20 +90,162 @@
   $v = (count($ec_conf = explode(',', $t[0])) == count($ec_conf_index));
   $u = $ec_conf[0];
+  $s = ($v) ? $ec_conf[1] : '0'; // the aknowledgement message is displayed
+  // again if the configuration changes
 }
-// $v is false
-//   _ if the entry in the table doesn't exist ;
-//   _ if the entry in the table exists, but its number of parameters is
-//     different than the number of default parameters.
+if ($v and !$w) die('$v true with $w false in ec_conf.inc.php');
+// $w is false if the entry in the table doesn't exist;
+// $v is false if the entry in the table doesn't exist; or exists, but its
+// number of parameters is different than the number of default parameters.
 // $u is '0' if the plugin has not yet been activated, '1' if it has been.
+// $s allows to display the aknowledgement message when config changes.
+// If $v or $w are false, all $ec_conf values are set to default values. But
+// default values must first take values specified in $conf, if they are set.
+
+// Determine whether simple mode is ON or OFF
+$simple_mode_on = (
+  (!$v and !$w) or (
+    // $ec_conf[10] <=> read_ec_conf('simple_mode_on')
+    isset($ec_conf[10]) and $ec_conf[10] == '1'
+  ) or (
+    isset($conf['ec_display_full_button']) and
+    $conf['ec_display_full_button'] == false
+  )
+);
+
 if (!$v) {
+  // Give configuration items names and default values. Only strings.
+  $ec_conf_default = array( // PLUGIN CONFIGURATION ($ec_conf) :
+                            // ---------------------------------
+    'activated'       //  0 // plugin activated, 0 or 1
+      => $u,                // 
+                            // 
+    'howto'           //  1 // whether the small aknowledgement message has
+      => $s,                // already been displayed, 0 or 1
+                            // 
+    'dup_allow' => ($simple_mode_on and isset($conf['ec_dup_allow']) and
+                    in_array($conf['ec_dup_allow'],
+                    $ec_conf_possible_values['ec_dup_allow'])) ?
+      $conf['ec_dup_allow'] : (isset($ec_conf[2]) and in_array($ec_conf[2],
+      $ec_conf_possible_values['dup_allow'])) ? $ec_conf[2] : '2',
+                      //  2 // duplication allowance :
+                            //   0 : no account;
+                            //   1 : all accounts;
+                            //   2 : specified by group, type, and user ids.
+                            // If Event Cats is in "simple mode", takes the
+                            // value of $conf['ec_dup_allow'] if it is set;
+                            // and an allowance to duplicate only generic
+                            // accounts will be defined.
+                            // 
+    'duplic_display' => ($simple_mode_on and isset($conf['ec_duplic_display'])
+                    and in_array($conf['ec_duplic_display'],
+                    $ec_conf_possible_values['ec_duplic_display'])) ?
+      $conf['ec_duplic_display'] : (isset($ec_conf[3]) and
+      in_array($ec_conf[3], $ec_conf_possible_values['duplic_display'])) ?
+      $ec_conf[3] : '2',
+                      //  3 // duplication link display in the menubar :
+                            //   0 : "Register" for everybody;
+                            //   1 : "Duplicate" for everybody;
+                            //   2 : "Register" only for generic accounts,
+                            //       "Duplicate" for all other accounts;
+                            // If Event Cats is in "simple mode", takes the
+                            // value of $conf['ec_duplic_display'] if it's set.
+                            // 
+  'auto_code_dg_nb' => ($simple_mode_on and isset($conf['ec_auto_code_dg_nb'])
+                    and in_array($conf['ec_auto_code_dg_nb'],
+                    $ec_conf_possible_values['ec_auto_code_dg_nb'])) ?
+      $conf['ec_auto_code_dg_nb'] : (isset($ec_conf[4]) and
+      in_array($ec_conf[4], $ec_conf_possible_values['auto_code_dg_nb'])) ?
+      $ec_conf[4] : '10',
+                      //  4 // number of digits when creating a new code
+                            // automatically, several values
+                            // If Event Cats is in "simple mode", takes the
+                            // value of $conf['ec_auto_code_dg_nb'] if set.
+                            // 
+    'unknown_code'    //  5 // what to do in case an unknown code is used with
+      => (isset($ec_conf[5]) and in_array($ec_conf[5],
+      $ec_conf_possible_values['unknown_code'])) ? $ec_conf[5] : '1',
+                            // "autolog" parameter :
+                            //   0 : nothing (display home page, index.php
+                            //       (not logged in of course));
+                            //   1 : display "access denied" page;
+                            //   2 : display an A. P. precised below.
+                            // 
+    'unknown_code_ap_id' // 6| the id of the Additional Page which must be
+      => (isset($ec_conf[6])) ? $ec_conf[6] : '0',
+                            // used in case of usage of an unknow code;
+                            // several vals.
+                            // 
+    'comment_display' => ($simple_mode_on and isset($conf['ec_comment_display'])
+                    and in_array($conf['ec_comment_display'],
+                    $ec_conf_possible_values['ec_comment_display'])) ?
+      $conf['ec_comment_display'] : (isset($ec_conf[7]) and
+      in_array($ec_conf[7], $ec_conf_possible_values['comment_display'])) ?
+      $ec_conf[7] : '1',
+                      //  7 // the way the comment is displayed in "entries"
+                            // tab : 0, as tooltip; 1, on a line under code
+                            // If Event Cats is in "simple mode", takes the
+                            // value of $conf['ec_comment_display'] if set.
+                            // 
+    'in_help_display' //  8 // whether the help banner is displayed.
+      => (isset($ec_conf[8]) and in_array($ec_conf[8],
+      $ec_conf_possible_values['in_help_display'])) ? $ec_conf[8] : '1',
+                            // 0: not displayed; 1 : displayed (surprising !)
+                            // 
+    'display_connection' => ($simple_mode_on and
+                    isset($conf['ec_display_connection']) and
+                    in_array($conf['ec_display_connection'],
+                    $ec_conf_possible_values['ec_display_connection'])) ?
+      $conf['ec_display_connection'] : (isset($ec_conf[9]) and
+      in_array($ec_conf[9], $ec_conf_possible_values['display_connection'])) ?
+      $ec_conf[9] : '1',
+                      //  9 // whether the "Connection" link must be displayed
+                            // for generic users, 0 or 1.
+                            // If Event Cats is in "simple mode", takes the
+                            // value of $conf['ec_display_connection'] if set.
+                            // 
+    'simple_mode_on' => ($simple_mode_on) ?
+      '1' : '0',      // 10 // whether the presentation of the plugin is in
+                            // "simple mode" or not.
+                            // 0: normal view; 1 : simple view.
+                            // The default value can be modified to 0 (normal
+                            // view) if Event Cats was already installed
+                            // previously.
+                            // 
+    'display_full_button' => ($simple_mode_on and
+                    isset($conf['ec_display_full_button']) and
+                    in_array($conf['ec_display_full_button'],
+                    $ec_conf_possible_values['ec_display_full_button'])) ?
+      $conf['ec_display_full_button'] : (isset($ec_conf[11]) and
+    in_array($ec_conf[11], $ec_conf_possible_values['display_full_button'])) ?
+       $ec_conf[11] : '1',
+                      // 11 // whether the "Show full features" button must be
+                            // displayed, 0 or 1. The default value can be
+                            // modified to 0 (don't display) if
+                            // $conf['ec_display_full_button'] has val. false.
+  );
+  
+// Once these lines have been updated, you don't need to change anything
+// else. Everything is managed by the code.
+//----------------------------------------------------------------------------
+
+  // Set $ec_conf to proper default values if needed, and writes its values
+  // in the DB
   $ec_conf = array_values($ec_conf_default);
+
   change_ec_conf('activated', $u); // writes in the DB
 }
 // now :
 //   _ the number of parameters is the same in the DB as the number of
-//     default parameters ;
-//   _ the parameters have the default values if needed ;
-//   _ the plugin shows it is active if it is the case.
-unset($t, $u, $v);
+//     default parameters;
+//   _ the parameters have the default values if needed;
+//   _ the plugin shows it is active if it is the case;
+//   _ correct values will be returned when using procedure read_ec_conf($c).
+
+unset($t, $u, $v, $w, $simple_mode_on);
+// And NOW can change_ec_conf and read_ec_conf be used properly...
+
+// ---------------------------------------------------------------------------
+//                  End of $ec_conf initalization
+// ---------------------------------------------------------------------------
 
 /*
@@ -155,5 +255,5 @@
  *
  * @param
- *   $c : conf value to update ;
+ *   $c : conf value to update;
  *   $v : value to give to $ec_conf[$c].
  * @return
@@ -162,4 +262,5 @@
 function change_ec_conf($c, $v) {
   global $ec_conf, $page, $ec_conf_index, $ec_conf_possible_values;
+
   if (array_key_exists($c, $ec_conf_index)) {
     if (
@@ -168,9 +269,9 @@
     ) {
       $ec_conf[$ec_conf_index[$c]] = $v;
-      return (pwg_query("
+      return ($a=(pwg_query("
         UPDATE `".CONFIG_TABLE."`
         SET `value` = \"".implode(',', $ec_conf)."\"
         WHERE `param` = 'event_cats';
-      ") !== false);
+      ") !== false));
     }
     else {
@@ -190,5 +291,5 @@
  *
  * @param
- *   $c : conf value to update ;
+ *   $c : conf value to update;
  * @return
  *   $ec_conf value
