Index: /extensions/adult_content/charte.php
===================================================================
--- /extensions/adult_content/charte.php	(revision 9556)
+++ /extensions/adult_content/charte.php	(revision 9557)
@@ -2,4 +2,10 @@
 define('PHPWG_ROOT_PATH','../../');
 include_once(PHPWG_ROOT_PATH.'include/common.inc.php');
+$conf_ad_c = explode("," , $conf['ad_c_plugin']);
+if ( !is_a_guest() or $conf_ad_c[0]!='true')
+{
+	redirect(make_index_url());
+}
+
 
 $adult_content = get_plugin_data('adult_content');
Index: /extensions/adult_content/charte_user.php
===================================================================
--- /extensions/adult_content/charte_user.php	(revision 9556)
+++ /extensions/adult_content/charte_user.php	(revision 9557)
@@ -3,5 +3,8 @@
 include_once(PHPWG_ROOT_PATH.'include/common.inc.php');
 $adult_content = get_plugin_data('adult_content');
-
+if ( is_a_guest() )
+{
+	redirect(make_index_url());
+}
 if (!isset( $_POST['groupe'] ))
 {
@@ -17,5 +20,5 @@
        ));
 
-   if (isset($_GET['etat']) and $_GET['etat'] == 'not_defined')
+   if (isset($_GET['etat']) and $_GET['etat'] == 'not_defined' and !is_a_guest() )
    {
        $template->assign(
@@ -27,5 +30,5 @@
          );
    }
-   elseif (isset($_GET['etat']) and $_GET['etat'] == 'defined')
+   elseif (isset($_GET['etat']) and $_GET['etat'] == 'defined' and !is_a_guest() )
    {
    	 $query = '
@@ -39,16 +42,16 @@
 ;';
      $data_group_n = mysql_fetch_array(pwg_query($query));
-	 if ($data_group_n['name'] == '+18')
-	 {
-	 $statut = $lang['ac_statut'].$lang['ac_user_text_18'];
-	 }
-	 if ($data_group_n['name'] == '16-17')
-	 {
-	 $statut = $lang['ac_statut'].$lang['ac_user_text_16'];
-	 }
-	 if ($data_group_n['name'] == 'nothing')
-	 {
-	 $statut = $lang['ac_user_no'];
-	 }
+		 if ($data_group_n['name'] == '+18')
+		 {
+			 $statut = $lang['ac_statut'].$lang['ac_user_text_18'];
+		 }
+		 if ($data_group_n['name'] == '16-17')
+		 {
+			 $statut = $lang['ac_statut'].$lang['ac_user_text_16'];
+		 }
+		 if ($data_group_n['name'] == 'nothing')
+		 {
+			 $statut = $lang['ac_user_no'];
+		 }
 	 
      $main = '<p>'.$statut.'</p>'
@@ -64,5 +67,5 @@
    else
    {
-   die('Hacking attempt!');
+		redirect(make_index_url());
    }
 
Index: /extensions/adult_content/maintain.inc.php
===================================================================
--- /extensions/adult_content/maintain.inc.php	(revision 9556)
+++ /extensions/adult_content/maintain.inc.php	(revision 9557)
@@ -55,173 +55,170 @@
 function plugin_activate()
 {
-    global $conf;
-include_once(PHPWG_ROOT_PATH.'include/functions_user.inc.php');
-   ///user exist ?///
-   $query = '
-SELECT COUNT(*) AS result FROM '.USERS_TABLE.'
-  WHERE username IN (\'18\')
-;';
-   $data_user = mysql_fetch_array(pwg_query($query));
-   $exist = $data_user['result'];
-   if ( $exist == 0 )
-   {
-	register_user('18', 'adult_content', '');
-   }
-   
-   $query = '
-SELECT COUNT(*) AS result FROM '.USERS_TABLE.'
-  WHERE username IN (\'16\')
-;';
-   $data_user = mysql_fetch_array(pwg_query($query));
-   $exist = $data_user['result'];
-   if ( $exist == 0 )
-   {
-	register_user('16', 'adult_content', '');
-   }
-   ///group exist ?///
-   $query = '
-SELECT COUNT(*) AS result FROM '.GROUPS_TABLE.'
-  WHERE name IN (\'+18\')
-;';
-   $data_user = mysql_fetch_array(pwg_query($query));
-   $exist = $data_user['result'];
-   if ( $exist == 0 )
-   {
-      $query = '
-INSERT INTO '.GROUPS_TABLE.'
-  (name)
-  VALUES
-  (\'+18\')
-;';
-      pwg_query($query);
-////////////placer dans group 18////////////
-      $result = pwg_query('SELECT id FROM '.GROUPS_TABLE.' WHERE name IN (\'+18\') ;');
-      $data_group = mysql_fetch_array($result);
-	  pwg_query('INSERT INTO '.USER_GROUP_TABLE.' VALUES(\''.get_userid('18').'\', \''.$data_group['id'].'\' )' );
-   }
-   
-   $query = '
-SELECT COUNT(*) AS result FROM '.GROUPS_TABLE.'
-  WHERE name IN (\'16-17\')
-;';
-   $data_user = mysql_fetch_array(pwg_query($query));
-   $exist = $data_user['result'];
-   if ( $exist == 0 )
-   {
-      $query = '
-INSERT INTO '.GROUPS_TABLE.'
-  (name)
-  VALUES
-  (\'16-17\')
-;';
-      pwg_query($query);
+	///user exist ?///
+	$query = '
+	SELECT COUNT(*) AS result FROM '.USERS_TABLE.'
+	WHERE username IN (\'18\')
+	;';
+	$data_user = mysql_fetch_array(pwg_query($query));
+	$exist = $data_user['result'];
+	if ( $exist == 0 )
+	{
+		register_user('18', 'adult_content', '');
+	}
+	
+	$query = '
+	SELECT COUNT(*) AS result FROM '.USERS_TABLE.'
+	WHERE username IN (\'16\')
+	;';
+	$data_user = mysql_fetch_array(pwg_query($query));
+	$exist = $data_user['result'];
+	if ( $exist == 0 )
+	{
+		register_user('16', 'adult_content', '');
+	}
+	///group exist ?///
+	$query = '
+	SELECT COUNT(*) AS result FROM '.GROUPS_TABLE.'
+	WHERE name IN (\'+18\')
+	;';
+	$data_user = mysql_fetch_array(pwg_query($query));
+	$exist = $data_user['result'];
+	if ( $exist == 0 )
+	{
+		$query = 'INSERT INTO '.GROUPS_TABLE.'
+							(name)
+							VALUES
+							(\'+18\')
+							;';
+		pwg_query($query);
+	////////////placer dans group 18////////////
+		$result = pwg_query('SELECT id FROM '.GROUPS_TABLE.' WHERE name IN (\'+18\') ;');
+		$data_group = mysql_fetch_array($result);
+		pwg_query('INSERT INTO '.USER_GROUP_TABLE.' VALUES(\''.get_userid('18').'\', \''.$data_group['id'].'\' )' );
+	}
+	
+	$query = '
+	SELECT COUNT(*) AS result FROM '.GROUPS_TABLE.'
+	WHERE name IN (\'16-17\')
+	;';
+	$data_user = mysql_fetch_array(pwg_query($query));
+	$exist = $data_user['result'];
+	if ( $exist == 0 )
+	{
+		$query = '
+		INSERT INTO '.GROUPS_TABLE.'
+		(name)
+		VALUES
+		(\'16-17\')
+		;';
+		pwg_query($query);
 ////////////placer dans group 16////////////
-      $result = pwg_query('SELECT id FROM '.GROUPS_TABLE.' WHERE name IN (\'16-17\') ;');
-      $data_group = mysql_fetch_array($result);
-	  pwg_query('INSERT INTO '.USER_GROUP_TABLE.' VALUES(\''.get_userid('16').'\', \''.$data_group['id'].'\' )' );
-	  
-   }
-      //grp nothing
-	  $query = '
-SELECT COUNT(*) AS result FROM '.GROUPS_TABLE.'
-  WHERE name IN (\'nothing\')
-;';
-   $data_user = mysql_fetch_array(pwg_query($query));
-   $exist = $data_user['result'];
-   if ( $exist == 0 )
-   {
-      $query = '
-INSERT INTO '.GROUPS_TABLE.'
-  (name)
-  VALUES
-  (\'nothing\')
-;';
-      pwg_query($query);
-	}
-
-   ///assoc user/group exist ?///
-   
-   $n_query = '
-SELECT id FROM '.GROUPS_TABLE.'
-  WHERE name IN (\'16-17\')
-;';
-   $data_group = mysql_fetch_array(pwg_query($n_query));
-   $query = '
-SELECT COUNT(*) AS result FROM '.USER_GROUP_TABLE.'
-  WHERE group_id IN (\''.$data_group['id'].'\') AND user_id IN (\''.get_userid('16').'\')
-;';
-   $data_user_group = mysql_fetch_array(pwg_query($query));
-   $exist = $data_user_group['result'];
-   if ( $exist == 0 )
-   {
-	    pwg_query('INSERT INTO '.USER_GROUP_TABLE.' VALUES(\''.get_userid('16').'\', \''.$data_group['id'].'\' )' );
-   }
-   $n_query = '
-SELECT id FROM '.GROUPS_TABLE.'
-  WHERE name IN (\'+18\')
-;';
-   $data_group = mysql_fetch_array(pwg_query($n_query));
-   $query = '
-SELECT COUNT(*) AS result FROM '.USER_GROUP_TABLE.'
-  WHERE group_id IN (\''.$data_group['id'].'\') AND user_id IN (\''.get_userid('18').'\')
-;';
-   $data_user_group = mysql_fetch_array(pwg_query($query));
-   $exist = $data_user_group['result'];
-   if ( $exist == 0 )
-   {
-	    pwg_query('INSERT INTO '.USER_GROUP_TABLE.' VALUES(\''.get_userid('18').'\', \''.$data_group['id'].'\' )' );
-   }
-
-  ////////////mis en generic////////////
-	$query = '
-UPDATE '.USER_INFOS_TABLE.'
-  SET status=\'generic\'
-  WHERE user_id IN (\''.get_userid('16').'\')
-;';
+		$result = pwg_query('SELECT id FROM '.GROUPS_TABLE.' WHERE name IN (\'16-17\') ;');
+		$data_group = mysql_fetch_array($result);
+		pwg_query('INSERT INTO '.USER_GROUP_TABLE.' VALUES(\''.get_userid('16').'\', \''.$data_group['id'].'\' )' );
+	
+	}
+		//grp nothing
+	$query = '
+	SELECT COUNT(*) AS result FROM '.GROUPS_TABLE.'
+	WHERE name IN (\'nothing\')
+	;';
+	$data_user = mysql_fetch_array(pwg_query($query));
+	$exist = $data_user['result'];
+	if ( $exist == 0 )
+	{
+		$query = '
+		INSERT INTO '.GROUPS_TABLE.'
+		(name)
+		VALUES
+		(\'nothing\')
+		;';
+		pwg_query($query);
+	}
+	
+	///assoc user/group exist ?///
+	
+	$n_query = '
+	SELECT id FROM '.GROUPS_TABLE.'
+	WHERE name IN (\'16-17\')
+	;';
+	$data_group = mysql_fetch_array(pwg_query($n_query));
+	$query = '
+	SELECT COUNT(*) AS result FROM '.USER_GROUP_TABLE.'
+	WHERE group_id IN (\''.$data_group['id'].'\') AND user_id IN (\''.get_userid('16').'\')
+	;';
+	$data_user_group = mysql_fetch_array(pwg_query($query));
+	$exist = $data_user_group['result'];
+	if ( $exist == 0 )
+	{
+		pwg_query('INSERT INTO '.USER_GROUP_TABLE.' VALUES(\''.get_userid('16').'\', \''.$data_group['id'].'\' )' );
+	}
+	$n_query = '
+	SELECT id FROM '.GROUPS_TABLE.'
+	WHERE name IN (\'+18\')
+	;';
+	$data_group = mysql_fetch_array(pwg_query($n_query));
+	$query = '
+	SELECT COUNT(*) AS result FROM '.USER_GROUP_TABLE.'
+	WHERE group_id IN (\''.$data_group['id'].'\') AND user_id IN (\''.get_userid('18').'\')
+	;';
+	$data_user_group = mysql_fetch_array(pwg_query($query));
+	$exist = $data_user_group['result'];
+	if ( $exist == 0 )
+	{
+		pwg_query('INSERT INTO '.USER_GROUP_TABLE.' VALUES(\''.get_userid('18').'\', \''.$data_group['id'].'\' )' );
+	}
+	
+	////////////mis en generic////////////
+	$query = '
+	UPDATE '.USER_INFOS_TABLE.'
+	SET status=\'generic\'
+	WHERE user_id IN (\''.get_userid('16').'\')
+	;';
 	pwg_query($query);
 	
 	$query = '
-UPDATE '.USER_INFOS_TABLE.'
-  SET status=\'generic\'
-  WHERE user_id IN (\''.get_userid('18').'\')
-;';
+	UPDATE '.USER_INFOS_TABLE.'
+	SET status=\'generic\'
+	WHERE user_id IN (\''.get_userid('18').'\')
+	;';
 	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)
+	
+	//////////// 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);
-     }
-   }
-
+	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
 
