Changeset 11484 for extensions/set_plugins/include/affiche.php
- Timestamp:
- Jun 22, 2011, 3:51:47 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/set_plugins/include/affiche.php
r11462 r11484 10 10 if (isset($conf['set_plugins'])) $set_plugins_parametres = unserialize($conf['set_plugins']); 11 11 $nb=set_plugins::set_var('nb','10'); 12 13 $plugins = new plugins(); 14 $plugins->sort_fs_plugins('name'); 15 //$plugins->get_incompatible_plugins(); 16 $redirect_url = get_root_url().'admin.php?page='.$_GET['page']; 17 $base_url = get_root_url().'admin.php?page='.$page['page']; 18 $action_url = $base_url.'&plugin='.'%s'.'&pwg_token='.get_pwg_token(); 12 19 13 $liste = set_plugins::set_var('list ',array());20 $liste = set_plugins::set_var('liste',array()); 14 21 if (isset($liste[0]) && is_array($liste[0])) 15 22 $liste = array(); … … 27 34 $set="false"; 28 35 } 29 30 $dir=realpath('./local/plugins/set_plugins'); 31 if (!is_dir($dir)){ 32 $dir= realpath('./local/plugins'). "\\set_plugins"; 33 $umask = umask(0); 34 $mkd = @mkdir($dir, 0755, true ); 35 umask($umask); 36 if ($mkd==false){ 37 fatal_error( "$dir ".l10n('no write access')); 38 } 39 $file = $dir.'\\.htaccess'; 40 @file_put_contents( $file, 'allow from all' ); 41 } 42 $dir=realpath('./local/plugins/set_plugins'); 43 if(!isset($edited_file) || $edited_file=="") 44 $edited_file=$dir."/config.txt"; 45 $edited_file=str_replace("\\","/", $edited_file); 46 36 global $edited_file; 47 37 if (isset($_POST['submit']) && $_POST['submit']==l10n('save_file')){ 48 if (file_exists($edited_file)){ 49 copy($edited_file, substr_replace($edited_file, '.bak', strrpos($edited_file , '.'), 0) ); 50 51 52 } 53 if ($file = @fopen($edited_file , "w")) { 54 $liste= array_unique($liste); 55 @fwrite($file , serialize($liste)); 56 @fclose($file); 57 $infos_message.=l10n("save config").set_plugins::memo_var($liste); 58 $infos_message.=set_plugins::memo_var($liste); 59 $infos_message.=set_plugins::memo_var($_POST); 60 unset($_POST['submit']); 61 } 62 38 set_plugins::save_to_file($liste); 63 39 } 64 40 65 41 ///================================================================ 66 if (isset($_POST['restore'])){ 67 $content_file = file_get_contents(substr_replace($edited_file, '.bak', strrpos($edited_file , '.'), 0)); 68 $file =array(); 69 $liste= array_unique(unserialize($content_file)); 70 unset($_POST['restore']); 42 if (isset($_POST['restore']) ){ 43 $liste=set_plugins::restore_from_file(); 71 44 } 72 45 73 46 74 if(isset($_POST['add_plugins']) && $add_plugins!="" ){ 75 $liste= array_unique($liste); 47 if($add_plugins!="" ){ 48 49 $infos_message .=$add_plugins; 76 50 if(!array_search($add_plugins, $liste)){ 77 51 array_push($liste, $add_plugins ); 78 52 } 79 $add_plugins="";80 unset( $_POST['add_plugins']);53 // $add_plugins=""; 54 // unset( $_POST['add_plugins']); 81 55 } 56 if (isset($liste_des_plugins)) 57 foreach($liste_des_plugins as $plugin_id) { 58 if(!array_search($plugin_id, $liste)){ 59 array_push($liste, $plugin_id ); 60 } 61 } 62 if(count($liste)>0) $liste= array_unique($liste); 82 63 83 64 if(count($liste )>0) … … 88 69 unset($_POST['list_visible']); 89 70 unset($_POST['nb']); 90 } 91 92 93 94 $plugins = new plugins(); 95 $plugins->sort_fs_plugins('name'); 96 //$plugins->get_incompatible_plugins(); 97 $redirect_url = get_root_url().'admin.php?page='.$_GET['page']; 98 $base_url = get_root_url().'admin.php?page='.$page['page']; 99 $action_url = $base_url.'&plugin='.'%s'.'&pwg_token='.get_pwg_token(); 71 } 72 73 74 100 75 //======================================================= 101 102 76 if($liste) $liste_plugins = array_combine($liste,$liste); 103 77 else $liste_plugins =array(); … … 112 86 if ($key!== false){ 113 87 if(isset( $plugins->db_plugins_by_id[$plugin_id])){ 88 $State_id=$plugins->db_plugins_by_id[$plugin_id]['state'] ; 114 89 $tpl_plugin = array( 115 90 'NAME' => $fs_plugin['name'], 116 91 'U_ACTION' => sprintf($action_url, $plugin_id), 117 'STATE' => $plugins->db_plugins_by_id[$plugin_id]['state']92 'STATE' =>$State_id 118 93 ); 119 94 $liste_tpl[$plugin_id]= $tpl_plugin ; … … 124 99 } 125 100 $template->assign( array( 'liste_plugins' => $liste_tpl)); 101 $edited_file=set_plugins::get_file_name(); 126 102 127 $template->assign( array( 'PHPWG_VERSION' => PHPWG_VERSION , 103 $template->assign( array( 104 'PHPWG_VERSION' => PHPWG_VERSION , 128 105 'cl_plugins' => $cl_set_plugins_plugin , 129 106 'cl_version' => $cl_set_plugins_plugin['version'] , … … 139 116 'nb_list' => count($liste), 140 117 'nb_plugins' => count($plugins->db_plugins_by_id) , 141 'restore' => false,118 'restore' => (file_exists($edited_file)) , 142 119 'edited_file' => $edited_file 143 120 ) … … 145 122 146 123 124 147 125 ?>
Note: See TracChangeset
for help on using the changeset viewer.