Index: /extensions/set_plugins/admin.php
===================================================================
--- /extensions/set_plugins/admin.php	(revision 11384)
+++ /extensions/set_plugins/admin.php	(revision 11385)
@@ -2,9 +2,4 @@
 // Chech whether we are indeed included by Piwigo.
 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
-
-// Fetch the template.
-global $template;
-// 
-
     if (PHPWG_VERSION < 2.3 ) 
 $redirect_url = get_root_url().'admin.php?page='.'plugins_list';
@@ -12,6 +7,3 @@
  $redirect_url = get_root_url().'admin.php?page='.'plugins';
   redirect($redirect_url);	  
-
-
-
 ?>
Index: /extensions/set_plugins/admin.tpl
===================================================================
--- /extensions/set_plugins/admin.tpl	(revision 11384)
+++ /extensions/set_plugins/admin.tpl	(revision 11385)
@@ -1,19 +1,11 @@
- {footer_script } 
-<!-- Show the title of the plugin -->
+<meta http-equiv="X-UA-Compatible" content="IE=edge" /> 
+{footer_script } 
 {combine_script id="field_set" load="footer" path=$SET_PLUGINS_PATH|@cat:"js/field_set.js" require="jquery"}
+{/footer_script}
 
-  {/footer_script}
+{foreach from=$list item=plugin_state}1
+{$list}
+{/foreach}
 
-<script type="text/javascript">
-{if isset($liste_plugins)}
- var no_affiche = true;
-{else}
- var no_affiche = false;
-{/if}
-</script> 
-{if !isset($liste_plugins)}
-<div class="infos"></div> 
-<div class="errors"></div> 
-{/if}
 {if isset($liste_plugins)}
 {foreach from=$plugin_states item=plugin_state}
@@ -25,13 +17,18 @@
     {elseif $plugin_state == 'inactive'} 
     {'Last '|@translate} {'Inactive Plugins'|@translate}
-    {/if}
+    {/if} [{$nb_list}]
 </legend>
   <form action="{$action}" method="post" name="form_set_plugins" id="form_set_plugins"> 
-    <input name="unset_plugins" type="submit" value="{'Deactivate'|@translate}" />
-    <input name="set_plugins" type="submit" value="{'Activate'|@translate}" />
-    <input name="nb" type="text" value="{$nb}" />
+ <input class="button" name="unset_plugins" type="submit" value="{'Deactivate'|@translate}" />
+    <input class="button" name="set_plugins" type="submit" value="{'Activate'|@translate}"  />
+
+   
+      <label> {'nb'|@translate}:</label><input name="nb" type="text" value="{$nb}" size="5" />
     <input name="list_visible" id="list_visible" type="hidden" value="{$list_visible}" />
-    </form>
-  <p>
+    
+<input name="add_plugins" type="hidden" id="add_plugins" value="{$add_plugins}" />
+    <input class="button" type="submit" name="init_plugins" value="{'init'|@translate}" />
+<input type="hidden" id="set" name="set" value="{$set}" />
+ <p>
 
   {foreach from=$liste_plugins item=plugin name=plugins_loop}
@@ -50,4 +47,5 @@
       {else} 
       {/if} 
+
 </td>  
 </tr>
@@ -65,13 +63,13 @@
             
              {else}  {/if}
+ 
         </td>
-      </tr>
-    
-</table> 
+      </tr> </table> 
+</div>  
+     
 
-</div>  
 {/foreach}
   </p>
-  
+      </form>
   </fieldset>
 {/if}
Index: /extensions/set_plugins/include/affiche.php
===================================================================
--- /extensions/set_plugins/include/affiche.php	(revision 11384)
+++ /extensions/set_plugins/include/affiche.php	(revision 11385)
@@ -1,45 +1,46 @@
 <?php  
 //=================================================================================================
-global $conf ; 
-global $list_visible, $val_state,$liste_plugins,$nb,$infos_message,$erreur_message,$page;
+global $conf,$template,$page ;
+global $infos_message,$erreur_message,$infos_warning;
 
-if (isset($conf['set_plugins']))
-$set_plugins_parametres =  unserialize($conf['set_plugins']);
+global $user,  $val;
+global $list_visible, $state,$liste_plugins;
+global $set_plugins_parametres;
+global $nb,$liste,$state,$list_visible,$add_plugins;
+if (isset($conf['set_plugins'])) $set_plugins_parametres =  unserialize($conf['set_plugins']);
+  $nb=set_plugins_controler::set_var('nb','10');
+  $liste = set_plugins_controler::set_var('list',array()); 
+  $state=set_plugins_controler::set_var('state',"active"); 
+  $list_visible=set_plugins_controler::set_var('list_visible',"on,on,on,on"); 
+  $add_plugins=set_plugins_controler::set_var('add_plugins',""); 
+  
+global $set;
+if ( isset($_POST)) {
+      $set="true";
+}else{
+     $set="false";
+}
 
-$nb="10";
-if(isset($set_plugins_parametres) && isset($set_plugins_parametres['nb']))
-    $nb=$set_plugins_parametres['nb'];
-    $nb=isset($_POST['nb'])?$_POST['nb']:$nb ;   
+if(isset($_POST))
 
-    $liste=array();
-  if(isset($set_plugins_parametres['list']))
-    $liste=$set_plugins_parametres['list'];
-    $liste=isset($_POST['liste'])?$_POST['liste']:$liste ;   
+if(isset($_POST['add_plugins']) && $add_plugins!="" ){ 
+$liste= array_unique($liste);
+ if(!array_search($add_plugins, $liste)){ 
+  array_push($liste,  $add_plugins );
+ }
+  $add_plugins="";
+  unset( $_POST['add_plugins']);
+}
 
-  $state="active";
-  if(isset($set_plugins_parametres['state']))
-   $state =$set_plugins_parametres['state'];
-   $state=isset($_POST['state'])?$_POST['state']:$state ;   
+if(count($liste )>0)   
+   $liste_plugins=isset($_POST['liste_plugins'])?$_POST['liste_plugins']:$liste;
 
-   $list_visible="on,on,on,on";
-     if(isset($set_plugins_parametres['list_visible']))
-      $list_visible =$set_plugins_parametres['list_visible'];
-      $list_visible=(isset($_POST['list_visible']))?$_POST['list_visible']:$list_visible ;
+if ( $set=="true"){    
+    set_plugins_controler::save_config();
+    unset($_POST['list_visible']);
+    unset($_POST['nb']);
+ }
 
-  $set=isset($_POST['set'])?$_POST['set']:"true";
-
-   $liste_plugins=$set=isset($_POST['liste_plugins'])?$_POST['liste_plugins']:$liste;
-
-
-
- 
-
- if (isset($_POST['set']) || isset($_POST['list_visible']) || isset($_POST['nb'])){
-    save_config();
- }
-  $template->assign( array(  
-                    'nb' => $nb,
-                    'state' => $state ,
-                    'set' => $set,                      
+  $template->assign( array(   
                     'cl_plugins' => $cl_set_plugins_plugin ,
                     'cl_version' => $cl_set_plugins_plugin['version'] ,
@@ -47,110 +48,42 @@
                     'Version_pwg' => PHPWG_VERSION,
                     'SET_PLUGINS_PATH' => SET_PLUGINS_PATH,
-                    'list_visible' => $list_visible
+                    'set' => $set ,
+                    'nb' => $nb,
+                    'state' => $state ,
+                    'list_visible' => $list_visible,
+                    'add_plugins' => $add_plugins,
+                    'nb_list' => count($liste),
+                    //'action' => ''
 											)
 									);	         
                   
-            $plugins = new plugins();
-            $plugins->sort_fs_plugins('name');
-            $plugins->get_merged_extensions();
-            $plugins->get_incompatible_plugins();
-            $merged_plugins = false;
+  $plugins = new plugins();
+  $plugins->sort_fs_plugins('name');
+  $plugins->get_incompatible_plugins();
+  $redirect_url = get_root_url().'admin.php?page='.$_GET['page'];
+  $base_url = get_root_url().'admin.php?page='.$page['page'];
+  $action_url = $base_url.'&amp;plugin='.'%s'.'&amp;pwg_token='.get_pwg_token();
+ //=======================================================
+  $liste_plugins = array();
+  foreach($liste as $liste_id => $liste_plugin) { 
+  $liste_plugins[]=    $liste_plugin;
 
-            $redirect_url = get_root_url().'admin.php?page='.$_GET['page'];
-            $base_url = get_root_url().'admin.php?page='.$page['page'];
-            $action_url = $base_url.'&amp;plugin='.'%s'.'&amp;pwg_token='.get_pwg_token();
- //=======================================================
-$liste_plugins = array();
-
-foreach($liste as $liste_id => $liste_plugin) {
-    $liste_plugins[]=   $liste_plugin['plugin'] ;
-}
-
+  }
 //==========================================================
 $liste_tpl=array();
-
 foreach($plugins->fs_plugins as $plugin_id => $fs_plugin) {   
 //==== test si $plugin_id fait partie de $liste_plugins ==============  
     $key = array_search($plugin_id, $liste_plugins,false); 
-
     if ($key!== false){
-    $key = array_search($plugin_id, $liste_plugins); 
-
       $tpl_plugin = array(
         'NAME' => $fs_plugin['name'],
-        'VISIT_URL' => $fs_plugin['uri'],
-        'VERSION' => $fs_plugin['version'],
-        'DESC' => $fs_plugin['description'],
-        'AUTHOR' => $fs_plugin['author'],
-        'AUTHOR_URL' => @$fs_plugin['author uri'],
-        'U_ACTION' => sprintf($action_url, $plugin_id),
-        'INCOMPATIBLE' => isset($_SESSION['incompatible_plugins'][$plugin_id]),
-        );
-
-      if (isset($plugins->db_plugins_by_id[$plugin_id]))
-      {
-        $tpl_plugin['STATE'] = $plugins->db_plugins_by_id[$plugin_id]['state'];
-      }
-      else
-      {
-        $tpl_plugin['STATE'] = 'uninstalled';
-      }
-    
-     if(isset($_SESSION['merged_extensions']))
-      if (isset($fs_plugin['extension']) and in_array($fs_plugin['extension'], $_SESSION['merged_extensions']))
-      {
-        switch($tpl_plugin['STATE'])
-        {
-          case 'active': $plugins->perform_action('deactivate', $plugin_id);
-          case 'inactive': $plugins->perform_action('uninstall', $plugin_id);
-        }
-        $tpl_plugin['STATE'] = 'merged';
-        $tpl_plugin['DESC'] = l10n('THIS PLUGIN IS NOW PART OF PIWIGO CORE! DELETE IT NOW.');
-        $merged_plugins = true;
-      }
-    
- // $template->append('plugins', $tpl_plugin);
-$liste_tpl[]=  $tpl_plugin ;
+        'U_ACTION' => sprintf($action_url, $plugin_id),        
+        'STATE' => $plugins->db_plugins_by_id[$plugin_id]['state']
+      );
+      $liste_tpl[]=  $tpl_plugin ;
   }
 }           
-                    $template->assign( array( 
-                                'liste_plugins' => $liste_tpl
-                         
-											)
-									);	        
+$template->assign( array(  'liste_plugins' => $liste_tpl));	     
+ 
 
-//================================================================
-if (!isset($infos_message)){
-		  $infos_message = "";
-		}  		  
-		if  ($infos_message != "")  {
-		   array_push($page['infos'],  $infos_message);
-		   $infos_message="";
-		 }
-		if (!isset($erreur_message)){
-		  $erreur_message = "";
-		} 		 
-		if  ($erreur_message != "")  {
-	
-		  array_push($page['errors'], $erreur_message);
-		  $erreur_message="";
-	
-		 
-		 }		 
-		 
-//================================================================
-function save_config(){
-  global $list_visible, $val_state,$liste_plugins,$nb,$page ;
-  global $infos_message;
-  $infos_message=l10n("save_config");
-  $config=array();
-  $config = array(
-                'list_visible' => $list_visible,
-                'state' => $val_state,
-                'list'=>$liste_plugins,
-                'nb' =>$nb
-            );
-        conf_update_param('set_plugins', pwg_db_real_escape_string(serialize($config)));
-    }
-//==========================================================================================
 ?>
Index: /extensions/set_plugins/js/field_set.js
===================================================================
--- /extensions/set_plugins/js/field_set.js	(revision 11384)
+++ /extensions/set_plugins/js/field_set.js	(revision 11385)
@@ -1,2 +1,9 @@
+function raffraichir() {
+  n = 1;
+ // jQuery("#form_set_plugins").submit();
+}
+
+
+
 jQuery("fieldset").hide();
 jQuery(document).ready(function () {
@@ -10,14 +17,20 @@
   }
   var h_min = 0;
+  var liste_des_plugins = {};
+  jQuery(window).load(function () {
+    if (jQuery(".titrePage").length >= 1) {
+      if (jQuery("span.sort").length >= 1)
+        jQuery("#titrePage").before(jQuery("span.sort"));
+      jQuery(".titrePage ").hide();
+    }
 
-  jQuery(window).load(function () {
     if (jQuery("fieldset").length >= 1) {
-
-      jQuery("div.titrePage h2").parent().hide();
-
       var reg = new RegExp("[,]", "g");
       liste_visible = jQuery("input[name=list_visible]").val();
-      n1 = liste_visible;
-      liste = n1.split(reg);
+      if (typeof liste_visible == "undefined") {
+        liste_visible = "on,on,on,on";
+        jQuery("input[name=list_visible]").val(liste_visible);
+      }
+      liste = liste_visible.split(reg);
       reg = new RegExp("['off']", "g");
       jQuery("fieldset").each(
@@ -35,6 +48,6 @@
             liste[i] = "off";
 
-           h_min = jQuery("#" + this.id + ' legend').height();
-            jQuery(this).height(h_min + 5);
+            h_min = jQuery("#" + this.id + ' legend').height();
+            jQuery(this).height(h_min + 0);
 
             jQuery("#" + this.id + ' legend').prepend(
@@ -58,13 +71,21 @@
 
             n = jQuery(this).parent().hasClass("visible");
-            jQuery(this).css("color", "red");
+            //   jQuery(this).css("color", "red");
 
             i = jQuery(jQuery(this).parent()).attr("rel");
             liste_visible = jQuery("input[name=list_visible]").val();
-            liste = liste_visible.split(",");
+            if (typeof liste_visible == "undefined") {
+              liste_visible = "on,on,on,on";
+              jQuery("input[name=list_visible]").val(liste_visible);
+            }
+            // src = jQuery(this).find("img").attr("src");
             if (n) {
-              jQuery(this).parent().height(h_min + 5);
+              jQuery(this).parent().height(h_min + 0);
               jQuery(this).parent().removeClass("visible");
               liste[i] = "off";
+              jQuery(this).find("img").attr({
+                src: plus_path
+
+              });
             }
             else {
@@ -72,16 +93,19 @@
               jQuery(this).parent().addClass("visible");
               liste[i] = "on";
+              jQuery(this).find("img").attr({
+                src: minus_path
+
+              });
             }
-
-
             val = liste.join(",");
             jQuery("input[name=list_visible]").val(val);
+            jQuery('#set').val("true");
 
             jQuery.ajax({
               type: "POST",
               async: true,
-              data: "list_visible=" + val,
+              data: { list_visible: val, set: "true" },
               success: function (msg) {
-                jQuery("#form_set_plugins").submit();
+                // jQuery("#form_set_plugins").submit();
               }
             });
@@ -97,47 +121,40 @@
           jQuery(this).click(function (event) {
             jQuery(this).css("color", "red");
-            action = jQuery(this).attr('rel');
-            if (action == "Deactivate")
-              liste_plugins = jQuery(this).parent().parent().text();
-            else if (action == "Activate")
-              liste_plugins = jQuery(this).parent().parent().text();
-
+            jQuery('#set').val("true");
           }); // click
 
         }); //each
-
       jQuery("input[name=list_visible]").val(liste.join(","));
       jQuery("fieldset").show();
     } // fielset
     //====================================================================
-    jQuery("td a").click(function (event) {
-      l1 = jQuery('#liste').text();
-      l = l1.split(new RegExp("\n", "g"));
+    jQuery(".pluginBox a").click(function (event) {
+      var link = event.target.href;
+      if (link.indexOf("?") != -1) {
+        var query = link.split("?")[1];
+        eval("query = {" + query.replace(/&/ig, "\",").replace(/=/ig, ":\"") + "\"};");
+        jQuery('#add_plugins').val(query.plugin);
+        jQuery('#set').val("true");
+        val = liste.join(",");
 
-      list = jQuery('liste_plugins');
+        jQuery.ajax({
+          type: "POST",
+          async: true,
+          data: { add_plugins: query.plugin,
+           set: "true",
+           list_visible: val
+            }
+           ,
+          success: function (data) {
+          //  jQuery("#form_set_plugins").submit();
 
-      var reg = new RegExp("[?]", "g");
-      ret_args = new Array;
-      var args = event.target.href.split(reg)[1];
-      reg = new RegExp("[&]", "g");
-      var tableau = args.split(reg);
-      for (i = 0; i < tableau.length; i++) {
-        vals = tableau[i].split("=");
-        ret_args[vals[0]] = vals[1];
+          }
+        });
+
       }
-      if (ret_args['action'] == "deactivate") {
-
-        list = jQuery('list');
-        n = 1;
-      } else if (ret_args['action'] == "activate") {
-
-        list = jQuery('liste_plugins');
-        n = 0;
-      }
-
 
     })
 
   }); // load
-});                     //ready           
+});                                                               //ready           
            
Index: /extensions/set_plugins/main.inc.php
===================================================================
--- /extensions/set_plugins/main.inc.php	(revision 11384)
+++ /extensions/set_plugins/main.inc.php	(revision 11385)
@@ -15,135 +15,19 @@
 load_language('plugin.lang', SET_PLUGINS_PATH);
 // Hook on to an event to show the administration page.
-
-add_event_handler('get_admin_plugin_menu_links', 'set_plugins_admin_menu');
-// Add an entry to the 'Plugins' menu.
-function set_plugins_admin_menu($menu) {
-  array_push(
-    $menu,
-    array(
-      'NAME'  => 'Set_plugins',
-      'URL'   => get_admin_plugin_menu_link(dirname(__FILE__)).'/admin.php'
-    )
-  );
-  return $menu;
-}
-
-add_event_handler('loc_end_page_header','set_plugins_add'); 
-function set_plugins_add() {
-  global $user, $template, $val,$page,$conf;
-  if (!isset($page['body_id'])) return;
-   if (!isset($page['body_id'])) return;
-
-  
-
-  
-  switch($page['body_id']){
-	  case  'theAdminPage':     
-      switch($page['page']){
-	 	    case 'plugins_list':	 	      
-            if(!isset($template)) return ;     
-             Affiche_set_plugins();
-//============================================================
-          	break;
-
- case 'plugins':	  
- if (!isset($page['tab'])) return;
- if ($page['tab']!="installed") return ; 
-  Affiche_set_plugins();
- 	break;
-
-				//==============================================================================
- 				} 
-  		 
-		break;
+    global $infos_message,$erreur_message,$infos_warning;
 
 
-}
 
-	
-return false;
- }
+include_once(SET_PLUGINS_PATH.'set_plugins_class.php');  
+$set_plugins_controler = new set_plugins_controler();     
+     $infos_message = "";
+     $erreur_message = "";
+     $infos_warning = "";
+// Add an entry to the 'Plugins' menu.
+add_event_handler('get_admin_plugin_menu_links', array(&$set_plugins_controler,'set_plugins_admin_menu')  );
+add_event_handler('loc_end_admin', array(&$set_plugins_controler,'cl_affiche_messages_admin'));
+add_event_handler('loc_end_page_header',array(&$set_plugins_controler,'set_plugins_add')); 
 
- 
-function Affiche_set_plugins(){
-  global $user, $template, $val,$page,$conf;
-    include_once(SET_PLUGINS_PATH."include/constants.php"); 	   
+ //=======================================================
 
-    $all_tpl_vars = $template->get_template_vars('plugins');  
-    if(!$all_tpl_vars)  return;    
-
-    include_once(SET_PLUGINS_PATH.'include/affiche.php');      
-    $val_state=""; 
-    if(  isset($_POST['unset_plugins']) || isset($_POST['set_plugins'])  ){
-     if(isset($_POST['unset_plugins'])  ) 
-		    $val_state='inactive';
-      elseif(isset($_POST['set_plugins'])  ) 
-        $val_state='active';
-   
-
-    if($val_state!=""){  
-      if($val_state=="activate")
-          $sens ="DESC";
-      else
-          $sens="ASC";
-    //==== pré-liste ===
-      $query = 'SELECT *
-                FROM ' . PLUGINS_TABLE . ' 
-           WHERE `state` NOT LIKE "'.$val_state. '" AND id!="' . "set_plugins" . '"
-            ORDER BY `id` '.$sens.'
-           LIMIT '.$nb.'
-      ';
-          $result = pwg_query($query); 
-       
-      $query = '
-      UPDATE '.PLUGINS_TABLE.'
-      SET state="'.$val_state.'" 
-      WHERE `state` NOT LIKE "'.$val_state. '" AND id!="' . "set_plugins" . '"
-      ORDER BY `id`  '.$sens.'
-      LIMIT '.$nb.';';
-      pwg_query($query); 
- //=====================================
-
-      $liste_plugins = array();
-      if($result)
-        while ($row = pwg_db_fetch_assoc($result)) { 
-        
-         $url =  $row['id'] ;
-         $vers= $row['version'];
-         $state=$row['state'];
-         array_push($liste_plugins, array('plugin' => $url,'version'=>$vers,'state' =>$state ) );
-        }    
-  //=====================================       
-        
-       
-        $redirect_url = get_root_url().'admin.php?page='.$_GET['page'];
-        save_config();  
-        unset ($_POST); 
-        redirect($redirect_url);
-      }
-    }
-               $template->set_filenames(
-                array(
-                  'plugin' => dirname(__FILE__).'/admin.tpl'
-                )         
-              );
-              $template->set_filenames(
-              array(    'cl_plugin' => dirname(__FILE__).'/admin.tpl'  )         
-              );
-
-  
- //===========================================================
- $header_1='<div class="titlePage">
-  <h2>'.l10n("set_plugins").l10n("Version").": ".$cl_set_plugins_plugin['version'] .'</h2>
-';
-
-              $bpplus=$header_1.$template->parse('cl_plugin', true);
-             
-              $template-> assign('ADMIN_CONTENT',$bpplus); 
-              
-              $bpplus=$template->parse('plugins', true);
-              $template-> concat('ADMIN_CONTENT',$bpplus); 
-
-
-}
 ?>
Index: /extensions/set_plugins/set_plugins_class.php
===================================================================
--- /extensions/set_plugins/set_plugins_class.php	(revision 11385)
+++ /extensions/set_plugins/set_plugins_class.php	(revision 11385)
@@ -0,0 +1,201 @@
+﻿<?php 
+/***************************************************************************/
+class set_plugins_controler  { 
+  //=============================================================================
+  function set_plugins_admin_menu($menu) {
+    array_push(
+      $menu,
+      array(
+        'NAME'  => 'Set_plugins',
+        'URL'   => get_admin_plugin_menu_link(dirname(__FILE__)).'/admin.php'
+      )
+    );
+    return $menu;
+  }
+  //============================================================================
+  function set_plugins_add() {
+    global $user, $template, $val,$page,$conf;
+    if (!isset($page['body_id'])) return;
+    if (!isset($page['body_id'])) return;   
+    switch($page['body_id']){
+	    case  'theAdminPage':     
+        switch($page['page']){
+	 	      case 'plugins_list':	 	      
+              if(!isset($template)) return ;     
+                set_plugins_controler::Affiche_set_plugins();
+              break;
+          case 'plugins':	  
+            if (!isset($page['tab'])) return;
+            if ($page['tab']!="installed") return ; 
+              set_plugins_controler::Affiche_set_plugins();
+ 	          break;
+		    } 
+    }	
+  }
+//============================================================================
+  function cl_affiche_messages_admin() 
+  {
+    global $template,$page, $template, $pwg_loaded_plugins,$infos_message,$erreur_message,$infos_warning;
+    if ( (isset($_GET['page']) AND $_GET['page'] == 'plugins_list') ) {  
+        if  ($infos_message != "")  {
+	        array_push($page['infos'],  $infos_message);
+	        $infos_message="";
+        }
+        if  ($erreur_message != "")  {	
+	        array_push($page['errors'], $erreur_message);
+	        $erreur_message="";
+        }	
+        if  ($infos_warning!= "")  {
+            array_push($page['warnings'], $infos_warning);
+            $infos_warning= "";
+        }
+        if (count($page['errors']) != 0){
+          $template->assign('errors', $page['errors']);
+        }
+        if (count($page['infos']) != 0){
+          $template->assign('infos', $page['infos']);
+        }
+        if (count($page['warnings']) != 0){
+          $template->assign('warnings', $page['warnings']);
+        }
+    }
+  }
+  //==========================================================================================
+  function set_var($key,$defaut){
+     global   $set_plugins_parametres;
+      global $infos_message; 
+
+      if(isset($set_plugins_parametres) && isset($set_plugins_parametres[$key]))
+          $ret=$set_plugins_parametres[$key];
+
+          $ret= (isset($ret))?$ret:$defaut;
+          $ret=isset($_POST[$key])?$_POST[$key]:$ret;       
+       return $ret ;
+  }		 
+  //================================================================
+  function save_config(){
+    global $list_visible, $state,$liste,$nb,$page,$conf ; 
+    global $infos_message,$infos_warning,$erreur_message ; 
+    $config=array();
+    $config = array(
+                  'list_visible' => $list_visible,
+                  'state' => $state,
+                  'list'=>$liste,
+                  'nb' =>$nb
+              );   
+        // $infos_warning .="save_config" . set_plugins_controler::memo_var($conf['set_plugins'] );
+         $conf['set_plugins']= (serialize($config));
+         conf_update_param('set_plugins', $conf['set_plugins']);
+
+
+      }
+  //=================================================================
+   function memo_var($variables){
+    ob_start();
+    echo '<pre>';
+    print_r($variables);
+    echo '</pre>';
+    $m= ob_get_contents();
+    ob_end_clean();
+    return $m;		
+  } 
+  //===================================================================
+   function Affiche_set_plugins(){
+  include_once(SET_PLUGINS_PATH."include/constants.php"); 	   
+  include(SET_PLUGINS_PATH.'include/affiche.php');    
+  $all_tpl_vars = $template->get_template_vars('plugins');  
+  if(!$all_tpl_vars)  return;  
+  if( $set=="true" ){
+    $state=""; 
+    if(isset($_POST['unset_plugins'])  ) 
+	    $state='inactive';
+    elseif(isset($_POST['set_plugins'])  ) 
+      $state='active';    
+    if($state!=""){    
+      if($state=="inactive")
+          $sens ="DESC";
+      else
+          $sens="ASC";
+      //============================
+      $query = 'SELECT *
+      FROM ' . PLUGINS_TABLE . ' 
+      WHERE `state` NOT LIKE "'.$state. '" AND id!="' . "set_plugins" . '"
+      ORDER BY `id` '.$sens.'
+      LIMIT '.$nb.'
+      ';
+      $result = pwg_query($query); 
+      //======= mise à jour =========   
+      if($result){
+        $query = '
+        UPDATE '.PLUGINS_TABLE.'
+        SET state="'.$state.'" 
+        WHERE `state` NOT LIKE "'.$state. '" AND id!="' . "set_plugins" . '"
+        ORDER BY `id`  '.$sens.'
+        LIMIT '.$nb.';';
+        pwg_query($query); 
+      }
+      //=====================================
+      if(isset($result) && $result==true){
+       $liste= array_unique($liste);
+       if(!array_search($add_plugins, $liste)){ 
+        array_push($liste,  $add_plugins );
+       }
+        while ($row = pwg_db_fetch_assoc($result)) {         
+          $url =  $row['id'] ;
+          array_push($liste,  $url);     
+        }     
+      }
+
+
+    }else if  (isset($_POST['init_plugins'])){  
+      $liste = array();   
+      $state="active";
+      $query = 'SELECT *
+      FROM ' . PLUGINS_TABLE . ' 
+      WHERE `state` LIKE "active" AND id!="' . "set_plugins" . '"    
+      ';
+      $result = pwg_query($query);
+     if(isset($result) && $result==true){
+         $liste_plugins = array();   
+          while ($row = pwg_db_fetch_assoc($result)) {         
+            $url =  $row['id'] ;
+            //array_push($liste_plugins, array('plugin' => $url ) );
+            array_push($liste,  $url );             
+          } 
+      }     
+      $nb=count($liste_plugins);    
+    }
+   if(isset($result) && $result==true){
+      $redirect_url = get_root_url().'admin.php?page='.$_GET['page'];  
+      //$infos_message .="-----> Mise à jour : " . $nb."<br />";
+      //$infos_message .="Liste Avant: " . set_plugins_controler::memo_var($liste);
+      set_plugins_controler::save_config(); 
+     
+      $_POST['set']="";
+      $set="";
+      include(SET_PLUGINS_PATH.'include/affiche.php');    
+      
+     // redirect($redirect_url);
+    }
+      //
+   
+
+  }
+  $template->set_filenames(
+    array(    'cl_plugin' => dirname(__FILE__).'/admin.tpl'  )         
+  );
+
+  //===========================================================
+  $header_1='<div id="titrePage">
+  <h2>'.l10n("set_plugins").l10n("Version").": ".$cl_set_plugins_plugin['version'] .'</h2>
+  </div>';
+  $bpplus=$header_1.$template->parse('cl_plugin', true);             
+  $template-> assign('ADMIN_CONTENT',$bpplus);               
+  $bpplus=$template->parse('plugins', true);
+  $template-> concat('ADMIN_CONTENT',$bpplus);               
+              
+}
+
+
+}// fin classe
+?>
