Ignore:
Timestamp:
May 30, 2011, 10:54:16 AM (13 years ago)
Author:
cljosse
Message:

[extensions] set_plugins add listing of last set/unset plugins

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/set_plugins/include/affiche.php

    r11093 r11100  
    2020
    2121
    22                    $template->assign( array(
     22  $template->assign( array(
    2323                   'nb' => isset($_POST['nb'])?$_POST['nb']:$nb,
    2424                   'state' => $state ,
    25                         'set' => $set,
    26                         'liste' => $liste,
     25                        'set' => $set,                     
    2726                        'cl_plugins' => $cl_set_plugins_plugin ,
    2827                        'cl_version' => $cl_set_plugins_plugin['version'] ,
     
    3029                        'Version_pwg' => PHPWG_VERSION
    3130                                                                                        )
    32                                                                         );             
     31                                                                        );               
     32                 
     33            $plugins = new plugins();
     34            $plugins->sort_fs_plugins('name');
     35            $plugins->get_merged_extensions();
     36            $plugins->get_incompatible_plugins();
     37            $merged_plugins = false;
     38
     39            $redirect_url = get_root_url().'admin.php?page='.$_GET['page'];
     40            $base_url = get_root_url().'admin.php?page='.$page['page'];
     41            $action_url = $base_url.'&plugin='.'%s'.'&pwg_token='.get_pwg_token();
     42 //=======================================================
     43
     44
     45
     46$liste_plugins = array();
     47foreach($liste as $liste_id => $liste_plugin) {
     48    $liste_plugins[]=   $liste_plugin['plugin'] ;
     49}
     50
     51$liste_tpl=array();
     52//==========================================================
     53foreach($plugins->fs_plugins as $plugin_id => $fs_plugin) {
     54     
     55    $key = array_search($plugin_id, $liste_plugins,false);
     56
     57    if ($key!== false){
     58    $key = array_search($plugin_id, $liste_plugins);
     59
     60      $tpl_plugin = array(
     61        'NAME' => $fs_plugin['name'],
     62        'VISIT_URL' => $fs_plugin['uri'],
     63        'VERSION' => $fs_plugin['version'],
     64        'DESC' => $fs_plugin['description'],
     65        'AUTHOR' => $fs_plugin['author'],
     66        'AUTHOR_URL' => @$fs_plugin['author uri'],
     67        'U_ACTION' => sprintf($action_url, $plugin_id),
     68        'INCOMPATIBLE' => isset($_SESSION['incompatible_plugins'][$plugin_id]),
     69        );
     70
     71      if (isset($plugins->db_plugins_by_id[$plugin_id]))
     72      {
     73        $tpl_plugin['STATE'] = $plugins->db_plugins_by_id[$plugin_id]['state'];
     74      }
     75      else
     76      {
     77        $tpl_plugin['STATE'] = 'uninstalled';
     78      }
     79
     80      if (isset($fs_plugin['extension']) and in_array($fs_plugin['extension'], $_SESSION['merged_extensions']))
     81      {
     82        switch($tpl_plugin['STATE'])
     83        {
     84          case 'active': $plugins->perform_action('deactivate', $plugin_id);
     85          case 'inactive': $plugins->perform_action('uninstall', $plugin_id);
     86        }
     87        $tpl_plugin['STATE'] = 'merged';
     88        $tpl_plugin['DESC'] = l10n('THIS PLUGIN IS NOW PART OF PIWIGO CORE! DELETE IT NOW.');
     89        $merged_plugins = true;
     90      }
     91   
     92 // $template->append('plugins', $tpl_plugin);
     93$liste_tpl[]=  $tpl_plugin ;
     94  }
     95}           
     96                    $template->assign( array(
     97                                'liste_plugins' => $liste_tpl
     98                         
     99                                                                                        )
     100                                                                        );               
     101   
     102//==========================================================================================
    33103?>
Note: See TracChangeset for help on using the changeset viewer.