[11072] | 1 | <?php |
---|
| 2 | //================================================================================================= |
---|
[11385] | 3 | global $conf,$template,$page ; |
---|
| 4 | global $infos_message,$erreur_message,$infos_warning; |
---|
[11276] | 5 | |
---|
[11385] | 6 | global $user, $val; |
---|
| 7 | global $list_visible, $state,$liste_plugins; |
---|
| 8 | global $set_plugins_parametres; |
---|
[11497] | 9 | global $nb,$liste,$state,$list_visible,$add_plugins,$edited_file,$set; |
---|
[11484] | 10 | $plugins = new plugins(); |
---|
[11499] | 11 | $plugins->sort_fs_plugins('name'); |
---|
| 12 | //$plugins->get_incompatible_plugins(); |
---|
[11484] | 13 | $redirect_url = get_root_url().'admin.php?page='.$_GET['page']; |
---|
[11499] | 14 | $base_url = get_root_url().'admin.php?page='.$page['page']; |
---|
[11484] | 15 | $action_url = $base_url.'&plugin='.'%s'.'&pwg_token='.get_pwg_token(); |
---|
[11462] | 16 | |
---|
[11497] | 17 | if (isset($conf['set_plugins'])) $set_plugins_parametres = unserialize($conf['set_plugins']); |
---|
| 18 | |
---|
| 19 | $nb=set_plugins::set_var('nb','10'); |
---|
| 20 | |
---|
[11484] | 21 | $liste = set_plugins::set_var('liste',array()); |
---|
[11499] | 22 | $liste= array_unique($liste); |
---|
| 23 | |
---|
[11462] | 24 | $state=set_plugins::set_var('state',"active"); |
---|
| 25 | $list_visible=set_plugins::set_var('list_visible',"on,on,on,on"); |
---|
| 26 | $add_plugins=set_plugins::set_var('add_plugins',""); |
---|
[11497] | 27 | $set=set_plugins::set_var('set',false); |
---|
| 28 | $edited_file=set_plugins::get_file_name(); |
---|
| 29 | //================================================================ |
---|
[11462] | 30 | |
---|
| 31 | |
---|
[11497] | 32 | if (isset($_POST) && count($_POST)>0){ |
---|
| 33 | if (isset($_POST['submit'])) |
---|
| 34 | switch($_POST['submit']){ |
---|
| 35 | case l10n('save_file'): |
---|
[12081] | 36 | set_plugins::save_to_file($liste_des_plugins_actifs); |
---|
[11497] | 37 | break; |
---|
| 38 | case l10n('restore'): |
---|
[11499] | 39 | $liste_r = set_plugins::restore_from_file(); |
---|
| 40 | if(count($liste_r)>0) |
---|
| 41 | $liste=$liste_r; |
---|
[11497] | 42 | $infos_message .= set_plugins::memo_var($liste); |
---|
| 43 | break; |
---|
| 44 | case l10n('Deactivate'): |
---|
| 45 | // $infos_message .= set_plugins::memo_var("DEACTIVER"); |
---|
| 46 | break; |
---|
| 47 | case l10n('Activate'): |
---|
| 48 | // $infos_message .= set_plugins::memo_var("ACTIVER"); |
---|
| 49 | break; |
---|
| 50 | case l10n('store'): |
---|
| 51 | // $infos_message .= set_plugins::memo_var("STORE"); |
---|
| 52 | break; |
---|
[11499] | 53 | |
---|
| 54 | } |
---|
[11497] | 55 | |
---|
[11462] | 56 | } |
---|
[11499] | 57 | |
---|
| 58 | |
---|
| 59 | if($add_plugins!="" ){ |
---|
[11484] | 60 | $infos_message .=$add_plugins; |
---|
[11385] | 61 | if(!array_search($add_plugins, $liste)){ |
---|
| 62 | array_push($liste, $add_plugins ); |
---|
[11497] | 63 | $set=="true"; |
---|
[11385] | 64 | } |
---|
| 65 | } |
---|
[11497] | 66 | |
---|
| 67 | |
---|
| 68 | $liste_mem=$liste; |
---|
| 69 | |
---|
[12081] | 70 | if (isset($liste_des_plugins_actifs)) |
---|
| 71 | foreach($liste_des_plugins_actifs as $plugin_id) { |
---|
[11484] | 72 | if(!array_search($plugin_id, $liste)){ |
---|
| 73 | array_push($liste, $plugin_id ); |
---|
| 74 | } |
---|
| 75 | } |
---|
[11497] | 76 | if(count($liste)>0) { |
---|
[11499] | 77 | $liste= array_unique($liste); |
---|
| 78 | |
---|
[11497] | 79 | } |
---|
[11499] | 80 | |
---|
[12081] | 81 | //$infos_message .= "liste_des_plugins_actifs".set_plugins::memo_var($liste_des_plugins_actifs); |
---|
[11499] | 82 | //$infos_message .= "liste".set_plugins::memo_var($liste_mem); |
---|
[11072] | 83 | |
---|
[11499] | 84 | |
---|
[11385] | 85 | if ( $set=="true"){ |
---|
[11500] | 86 | //$infos_message .= l10n("save"); |
---|
[11462] | 87 | set_plugins::save_config(); |
---|
[11484] | 88 | } |
---|
[11499] | 89 | |
---|
| 90 | |
---|
| 91 | |
---|
[11100] | 92 | //======================================================= |
---|
[11497] | 93 | if(isset($liste) && count($liste)>0) $liste_plugins =$liste; |
---|
[11462] | 94 | else $liste_plugins =array(); |
---|
[11276] | 95 | //========================================================== |
---|
[11499] | 96 | $plugin_ids = array_intersect(array_keys($plugins->db_plugins_by_id), |
---|
| 97 | array_keys($liste_plugins) |
---|
[11462] | 98 | ); |
---|
[11276] | 99 | $liste_tpl=array(); |
---|
[11499] | 100 | foreach($plugins->fs_plugins as $plugin_id => $fs_plugin) { |
---|
| 101 | //==== test si $plugin_id fait partie de $liste_plugins ============== |
---|
[11100] | 102 | $key = array_search($plugin_id, $liste_plugins,false); |
---|
[11497] | 103 | |
---|
[11100] | 104 | if ($key!== false){ |
---|
[11497] | 105 | |
---|
[11462] | 106 | if(isset( $plugins->db_plugins_by_id[$plugin_id])){ |
---|
[11497] | 107 | $key = array_search($plugin_id, $liste_mem,false); |
---|
| 108 | |
---|
[11484] | 109 | $State_id=$plugins->db_plugins_by_id[$plugin_id]['state'] ; |
---|
[11497] | 110 | if( $key !==false) { |
---|
| 111 | $couleur="black"; |
---|
| 112 | |
---|
| 113 | } |
---|
| 114 | else |
---|
| 115 | $couleur="red"; |
---|
| 116 | |
---|
[11499] | 117 | $tpl_plugin = array( |
---|
| 118 | 'NAME' => $fs_plugin['name'], |
---|
| 119 | 'U_ACTION' => sprintf($action_url, $plugin_id), |
---|
| 120 | 'STATE' =>$State_id, |
---|
| 121 | 'COLOR' => $couleur |
---|
| 122 | ); |
---|
| 123 | $liste_tpl[$plugin_id]= $tpl_plugin ; |
---|
| 124 | } |
---|
| 125 | } |
---|
[11100] | 126 | } |
---|
[11484] | 127 | $edited_file=set_plugins::get_file_name(); |
---|
[11497] | 128 | $template->assign( array( |
---|
[11484] | 129 | 'PHPWG_VERSION' => PHPWG_VERSION , |
---|
[11462] | 130 | 'cl_plugins' => $cl_set_plugins_plugin , |
---|
| 131 | 'cl_version' => $cl_set_plugins_plugin['version'] , |
---|
| 132 | 'name' => $cl_set_plugins_plugin['name'] , |
---|
| 133 | 'Version_pwg' => PHPWG_VERSION, |
---|
| 134 | 'SET_PLUGINS_PATH' => SET_PLUGINS_PATH, |
---|
| 135 | 'SET_PLUGINS_PATH_ABS' => SET_PLUGINS_PATH_ABS, |
---|
[11497] | 136 | 'liste_plugins' => $liste_tpl, |
---|
[11462] | 137 | 'set' => $set , |
---|
| 138 | 'nb' => ($nb>0)?$nb:1, |
---|
| 139 | 'state' => $state , |
---|
| 140 | 'list_visible' => $list_visible, |
---|
| 141 | 'add_plugins' => $add_plugins, |
---|
| 142 | 'nb_list' => count($liste), |
---|
| 143 | 'nb_plugins' => count($plugins->db_plugins_by_id) , |
---|
[11484] | 144 | 'restore' => (file_exists($edited_file)) , |
---|
[11462] | 145 | 'edited_file' => $edited_file |
---|
| 146 | ) |
---|
| 147 | ); |
---|
| 148 | |
---|
| 149 | |
---|
[11484] | 150 | |
---|
[11072] | 151 | ?> |
---|