Index: /extensions/adult_content/admin/admin.php
===================================================================
--- /extensions/adult_content/admin/admin.php	(revision 9529)
+++ /extensions/adult_content/admin/admin.php	(revision 9530)
@@ -7,7 +7,42 @@
 global $prefixeTable;
 load_language('plugin.lang', $ad_c->plugin_path);
+$conf_ad_c = explode("," , $conf['ad_c_plugin']);
+
 
 $page['infos'] = array();
 
+if (isset($_POST['option_ad_c']))
+{
+	$newconf_plugin = array(
+		$_POST['menublock_for_guest'],
+		$_POST['block_on_index'],
+	);
+	$newconf_plugin = implode ("," , $newconf_plugin);
+	$query = '
+		UPDATE '.CONFIG_TABLE.'
+		SET value="'.$newconf_plugin.'"
+		WHERE param="ad_c_plugin"
+		LIMIT 1';
+	pwg_query($query);
+				
+	array_push($page['infos'], l10n('ad_c_msg_admin_1'));
+}
 
+load_conf_from_db();
+$conf_ad_c = explode("," , $conf['ad_c_plugin']);
+
+$check='checked="checked"';
+if ($conf_ad_c[0]=='true') { $menublock=$check; } else { $menublock=NULL; } 
+if ($conf_ad_c[1]=='true') { $index=$check; } else { $index=NULL; }
+$disabled='disabled="disabled"';
+	$template->assign(
+		array(
+		  'AD_C_menublock_for_guest' => $menublock,
+		  'AD_C_block_on_index' => $index,
+		  'AD_C_block_on_index_disabled' => $disabled,
+		)
+	  );
+
+$template->set_filename('plugin_admin_content', $ad_c->plugin_path.'admin/admin.tpl');
+$template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
 ?>
Index: /extensions/adult_content/admin/admin.tpl
===================================================================
--- /extensions/adult_content/admin/admin.tpl	(revision 9530)
+++ /extensions/adult_content/admin/admin.tpl	(revision 9530)
@@ -0,0 +1,18 @@
+
+{html_head}<link rel="stylesheet" type="text/css" href="./template/admin.css">{/html_head}
+<div class="titrePage">
+  <h2>Adult Content</h2>
+</div>
+<form action="" method="post" name="option_plugin">
+  {'ad_c_menublock_for_guest'|@translate}
+  <input type="checkbox" name="menublock_for_guest" value="true" {$AD_C_menublock_for_guest} />
+  <br />
+  <br />
+  {'ad_c_block_on_index'|@translate}
+  <input type="checkbox" name="block_on_index" value="true" {$AD_C_block_on_index} {$AD_C_block_on_index_disabled}/>  	{'ad_c_block_on_index_error'|@translate}
+
+  <br />
+  <br />
+  <input type="submit" name="option_ad_c" id="button" value="{'ad_c_send'|@translate}" />
+</form>
+</fieldset>
Index: /extensions/adult_content/charte_user.php
===================================================================
--- /extensions/adult_content/charte_user.php	(revision 9529)
+++ /extensions/adult_content/charte_user.php	(revision 9530)
@@ -17,5 +17,5 @@
        ));
 
-   if ($_GET['etat'] == 'not_defined')
+   if (isset($_GET['etat']) and $_GET['etat'] == 'not_defined')
    {
        $template->assign(
@@ -27,5 +27,5 @@
          );
    }
-   elseif ($_GET['etat'] == 'defined')
+   elseif (isset($_GET['etat']) and $_GET['etat'] == 'defined')
    {
    	 $query = '
Index: /extensions/adult_content/class.inc.php
===================================================================
--- /extensions/adult_content/class.inc.php	(revision 9529)
+++ /extensions/adult_content/class.inc.php	(revision 9530)
@@ -124,17 +124,15 @@
 ///////////////////////[début du plug]////////////////////
     $this->loading_lang();
-    global $user, $conf, $page;
-  	global $template;
-
+    global $user, $conf, $page, $template;
     $menu = & $menu_ref_arr[0];
-	
-$template->assign(
-  array(
-    'AC_NAME' => AC_NAME
-    ));
+		$conf_plugin = explode("," , $conf['ad_c_plugin']);
+		$template->assign(
+			array(
+				'AC_NAME' => AC_NAME
+				));
 
 
     //include($this->var_template());
-    if (is_a_guest())
+    if (is_a_guest() and $conf_plugin[0]=='true')
 	{
 	
@@ -181,4 +179,8 @@
 ///////////////////////[FIN fermer/ouvert]////////////////////
     }//fin if guest
+    elseif (is_a_guest() and $conf_plugin[0]!='true')
+    {  
+		  $menu->hide_block('mbAdultContent');
+    }
     elseif ($user['username'] == '18')
     {  
@@ -244,7 +246,8 @@
 			));
 		$menu = & $menu_ref_arr[0];
-		$block = $menu->get_block( 'mbAdultContent' );
-		$block->set_title(l10n('ac_title_choose'));
-		$block->template = $this->get_template('choose.tpl');
+    if (($block = $menu->get_block( 'mbAdultContent' )) != null) {
+			$block->set_title(l10n('ac_title_choose'));
+			$block->template = $this->get_template('choose.tpl');
+        }
 
 	  }
@@ -279,7 +282,8 @@
 			));
 		$menu = & $menu_ref_arr[0];
-		$block = $menu->get_block( 'mbAdultContent' );
-		$block->set_title(l10n('ac_title_menu_statut'));
-		$block->template = $this->get_template('choose.tpl');
+    if (($block = $menu->get_block( 'mbAdultContent' )) != null) {
+			$block->set_title(l10n('ac_title_menu_statut'));
+			$block->template = $this->get_template('choose.tpl');
+		}
 
 	  }
Index: /extensions/adult_content/language/fr_FR/plugin.lang.php
===================================================================
--- /extensions/adult_content/language/fr_FR/plugin.lang.php	(revision 9529)
+++ /extensions/adult_content/language/fr_FR/plugin.lang.php	(revision 9530)
@@ -38,3 +38,11 @@
 $lang['ac_def'] = 'Voulez-vous changez votre statut ?';
 
+$lang['ad_c_menublock_for_guest'] = 'Permettre aux visiteurs non-enregistrés de sélectionner leur âge ?';
+$lang['ad_c_block_on_index'] = 'Afficher un encart sur la page d\'accueil ? (Nécessite le plugin PWG Stuffs)';
+//$lang['ad_c_block_on_index_error'] = 'PWG Stuffs dans une version supérieure à 2.1.l est nécessaire';
+$lang['ad_c_block_on_index_error'] = 'fonction non disponible pour l\'instant';
+$lang['ad_c_send'] = 'Enregistrer les changements';
+$lang['ad_c_msg_admin_1'] = 'Configuration du plugin mise à jour avec succès !';
+
+
 ?>
Index: /extensions/adult_content/main.inc.php
===================================================================
--- /extensions/adult_content/main.inc.php	(revision 9529)
+++ /extensions/adult_content/main.inc.php	(revision 9530)
@@ -21,5 +21,5 @@
 
 include_once(dirname(__FILE__).'/class.inc.php');
-//add_event_handler('get_admin_plugin_menu_links', array(&$adult_content, 'ac_lien_menu') );
+add_event_handler('get_admin_plugin_menu_links', array(&$adult_content, 'ac_lien_menu') );
 add_event_handler('register_user', array(&$adult_content, 'on_register') );
 // Ajout une entrée dans le menubar
@@ -27,6 +27,9 @@
 add_event_handler('blockmanager_apply', array(&$adult_content, 'placer_identification'));
 //block on index
-//add_event_handler('loc_begin_index', array(&$adult_content, 'set_block_on_index'));
 
+/*
+global $conf;
+add_event_handler('loc_begin_index', array(&$adult_content, 'set_block_on_index'));
+*/
 
 add_event_handler('loc_end_picture', 'comment_manage');
Index: /extensions/adult_content/maintain.inc.php
===================================================================
--- /extensions/adult_content/maintain.inc.php	(revision 9529)
+++ /extensions/adult_content/maintain.inc.php	(revision 9530)
@@ -41,4 +41,11 @@
   $data_group = mysql_fetch_array($result);
 	  pwg_query('INSERT INTO '.USER_GROUP_TABLE.' VALUES(\''.get_userid('18').'\', \''.$data_group['id'].'\' )' );
+
+/////////////Config plugin
+    $q = '
+INSERT INTO ' . CONFIG_TABLE . ' (param,value,comment)
+	VALUES
+	("ad_c_plugin" , "true,false" , "Plugin adult_content : menublock_for_guest, block_on_index");';
+    pwg_query($q);
 
 }
@@ -181,4 +188,40 @@
 	pwg_query($query);
 
+//////////// Check Config
+   $query = '
+SELECT COUNT(*) AS result FROM '.CONFIG_TABLE.'
+  WHERE param IN (\'ad_c_plugin\')
+;';
+   $data_table = mysql_fetch_array(pwg_query($query));
+   $exist = $data_table['result'];
+   if ( $exist == 0 )
+   {
+    $q = '
+INSERT INTO ' . CONFIG_TABLE . ' (param,value,comment)
+	VALUES
+	("ad_c_plugin" , "true,false" , "Plugin adult_content : menublock_for_guest, block_on_index");';
+    pwg_query($q);
+   } 
+   else {
+      $query = '
+SELECT value FROM '.CONFIG_TABLE.'
+  WHERE param IN (\'ad_c_plugin\')
+;';
+   $data_conf = mysql_fetch_array(pwg_query($query));
+   $conf=explode(',', $data_conf['value']);
+   $nbr=count($conf);
+   
+     if ($nbr!=2)
+     {
+      pwg_query('DELETE FROM '.CONFIG_TABLE.' WHERE param IN (\'ad_c_plugin\')');
+      pwg_query($q);
+    $q = '
+INSERT INTO ' . CONFIG_TABLE . ' (param,value,comment)
+	VALUES
+	("ad_c_plugin" , "true,false" , "Plugin adult_content : menublock_for_guest, block_on_index");';
+    pwg_query($q);
+     }
+   }
+
 }//fin active
 
@@ -236,4 +279,6 @@
   pwg_query($query);
 
+//////////////// Delete config
+  pwg_query('DELETE FROM '.CONFIG_TABLE.' WHERE param IN (\'ad_c_plugin\')');
 }//fin uninstall
 
