Changeset 11462
- Timestamp:
- Jun 21, 2011, 1:54:46 PM (13 years ago)
- Location:
- extensions/set_plugins
- Files:
-
- 4 added
- 1 deleted
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/set_plugins/include/affiche.php
r11385 r11462 9 9 global $nb,$liste,$state,$list_visible,$add_plugins; 10 10 if (isset($conf['set_plugins'])) $set_plugins_parametres = unserialize($conf['set_plugins']); 11 $nb=set_plugins_controler::set_var('nb','10'); 12 $liste = set_plugins_controler::set_var('list',array()); 13 $state=set_plugins_controler::set_var('state',"active"); 14 $list_visible=set_plugins_controler::set_var('list_visible',"on,on,on,on"); 15 $add_plugins=set_plugins_controler::set_var('add_plugins',""); 11 $nb=set_plugins::set_var('nb','10'); 12 13 $liste = set_plugins::set_var('list',array()); 14 if (isset($liste[0]) && is_array($liste[0])) 15 $liste = array(); 16 $liste= array_unique($liste); 17 18 $state=set_plugins::set_var('state',"active"); 19 $list_visible=set_plugins::set_var('list_visible',"on,on,on,on"); 20 $add_plugins=set_plugins::set_var('add_plugins',""); 16 21 17 22 global $set; 23 18 24 if ( isset($_POST)) { 19 25 $set="true"; … … 22 28 } 23 29 24 if(isset($_POST)) 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 47 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 63 } 64 65 ///================================================================ 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']); 71 } 72 25 73 26 74 if(isset($_POST['add_plugins']) && $add_plugins!="" ){ … … 37 85 38 86 if ( $set=="true"){ 39 set_plugins _controler::save_config();87 set_plugins::save_config(); 40 88 unset($_POST['list_visible']); 41 89 unset($_POST['nb']); 42 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(); 100 //======================================================= 43 101 44 $template->assign( array( 102 if($liste) $liste_plugins = array_combine($liste,$liste); 103 else $liste_plugins =array(); 104 //========================================================== 105 $plugin_ids = array_intersect(array_keys($plugins->db_plugins_by_id), 106 array_keys($liste_plugins) 107 ); 108 $liste_tpl=array(); 109 foreach($plugins->fs_plugins as $plugin_id => $fs_plugin) { 110 //==== test si $plugin_id fait partie de $liste_plugins ============== 111 $key = array_search($plugin_id, $liste_plugins,false); 112 if ($key!== false){ 113 if(isset( $plugins->db_plugins_by_id[$plugin_id])){ 114 $tpl_plugin = array( 115 'NAME' => $fs_plugin['name'], 116 'U_ACTION' => sprintf($action_url, $plugin_id), 117 'STATE' => $plugins->db_plugins_by_id[$plugin_id]['state'] 118 ); 119 $liste_tpl[$plugin_id]= $tpl_plugin ; 120 } 121 122 } 123 124 } 125 $template->assign( array( 'liste_plugins' => $liste_tpl)); 126 127 $template->assign( array( 'PHPWG_VERSION' => PHPWG_VERSION , 45 128 'cl_plugins' => $cl_set_plugins_plugin , 46 129 'cl_version' => $cl_set_plugins_plugin['version'] , … … 48 131 'Version_pwg' => PHPWG_VERSION, 49 132 'SET_PLUGINS_PATH' => SET_PLUGINS_PATH, 133 'SET_PLUGINS_PATH_ABS' => SET_PLUGINS_PATH_ABS, 50 134 'set' => $set , 51 'nb' => $nb,135 'nb' => ($nb>0)?$nb:1, 52 136 'state' => $state , 53 137 'list_visible' => $list_visible, 54 138 'add_plugins' => $add_plugins, 55 139 'nb_list' => count($liste), 56 //'action' => '' 140 'nb_plugins' => count($plugins->db_plugins_by_id) , 141 'restore' => false , 142 'edited_file' => $edited_file 57 143 ) 58 ); 59 60 $plugins = new plugins(); 61 $plugins->sort_fs_plugins('name'); 62 $plugins->get_incompatible_plugins(); 63 $redirect_url = get_root_url().'admin.php?page='.$_GET['page']; 64 $base_url = get_root_url().'admin.php?page='.$page['page']; 65 $action_url = $base_url.'&plugin='.'%s'.'&pwg_token='.get_pwg_token(); 66 //======================================================= 67 $liste_plugins = array(); 68 foreach($liste as $liste_id => $liste_plugin) { 69 $liste_plugins[]= $liste_plugin; 70 71 } 72 //========================================================== 73 $liste_tpl=array(); 74 foreach($plugins->fs_plugins as $plugin_id => $fs_plugin) { 75 //==== test si $plugin_id fait partie de $liste_plugins ============== 76 $key = array_search($plugin_id, $liste_plugins,false); 77 if ($key!== false){ 78 $tpl_plugin = array( 79 'NAME' => $fs_plugin['name'], 80 'U_ACTION' => sprintf($action_url, $plugin_id), 81 'STATE' => $plugins->db_plugins_by_id[$plugin_id]['state'] 82 ); 83 $liste_tpl[]= $tpl_plugin ; 84 } 85 } 86 $template->assign( array( 'liste_plugins' => $liste_tpl)); 87 144 ); 145 88 146 89 147 ?> -
extensions/set_plugins/js/field_set.js
r11385 r11462 3 3 // jQuery("#form_set_plugins").submit(); 4 4 } 5 6 7 jQuery().ready(function () { 8 jQuery('.cluetip').tipTip({ maxWidth:'600px' ,'delay': 0, 'fadeIn': 200, 'fadeOut': 200 }); 9 jQuery('.cluetip0').cluetip({ 10 width: 300, 11 splitTitle: '|' , 12 clickThrough: true 13 }); 14 15 16 17 18 }); 19 20 5 21 6 22 … … 34 50 liste = liste_visible.split(reg); 35 51 reg = new RegExp("['off']", "g"); 52 h_min = jQuery("fieldset legend").height(); 53 h_min = 0; 36 54 jQuery("fieldset").each( 37 55 function (i) { … … 48 66 liste[i] = "off"; 49 67 50 h_min = jQuery("#" + this.id + ' legend').height(); 68 51 69 jQuery(this).height(h_min + 0); 52 70 … … 129 147 } // fielset 130 148 //==================================================================== 149 150 jQuery("input").each( 151 function (i) { 152 jQuery(this).click(function (event) { 153 jQuery(this).css("color", "red"); 154 jQuery('#set').val("true"); 155 jQuery.ajax({ 156 type: "POST", 157 async: true, 158 data: { 159 set: "true" 160 } 161 , 162 success: function (data) { 163 // jQuery("#form_set_plugins").submit(); 164 165 } 166 }); 167 }); // click 168 169 }); //each 131 170 jQuery(".pluginBox a").click(function (event) { 132 171 var link = event.target.href; … … 142 181 async: true, 143 182 data: { add_plugins: query.plugin, 144 set: "true",145 list_visible: val146 183 set: "true", 184 list_visible: val 185 } 147 186 , 148 187 success: function (data) { 149 // jQuery("#form_set_plugins").submit();188 // jQuery("#form_set_plugins").submit(); 150 189 151 190 } … … 157 196 158 197 }); // load 159 }); //ready198 }); //ready 160 199 -
extensions/set_plugins/language/fr_FR/plugin.lang.php
r11100 r11462 1 1 <?php 2 2 3 $lang['set_plugins']="active / déactive les plugins"; 3 4 $lang['command']="commande"; 4 5 5 6 $lang['Last ']="Derniers"; 7 $lang['s_pl_title']="Gestion"; 8 $lang['s_pl_action']="Gère la liste des extensions mémorisées"; 9 10 $lang['s_pl_action1']="Nombre d'extensions mémorisées"; 11 12 $lang['s_pl_action2']="Nombre d'extensions installées"; 13 14 $lang['s_pl_action3']="Total des extensions"; 15 $lang['s_pl_action4']="Déactive n extensions" ; 16 $lang['s_pl_action5']="Active n extensions" ; 17 18 $lang['s_pl_action6']="Nombre d'extensions à modifier."; 19 $lang['s_pl_action7']="Mémorisation des extensions actives"; 20 $lang['s_pl_action8']="Sauvegarde de la liste des extensions installées"; 21 $lang['s_pl_action9']="Restitue la liste des extensions mémorisées"; 22 23 $lang['store']="Mémorisation"; 24 25 $lang['restore'] = 'Charger le fichier de sauvegarde'; 26 $lang['save_file'] = 'Enregistrer le fichier'; 27 $lang['restore_confirm'] = 'Souhaitez-vous charger le fichier sauvegardé?'; 28 6 29 ?> -
extensions/set_plugins/main.inc.php
r11385 r11462 13 13 // Define the path to our plugin. 14 14 define('SET_PLUGINS_PATH', PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/'); 15 16 //$SET_PLUGINS_PATH_ABS = str_replace('\\','/',dirname(__FILE__) ); 17 if (!defined('SET_PLUGINS_PATH_ABS')) 18 define( 19 'SET_PLUGINS_PATH_ABS', realpath(SET_PLUGINS_PATH)."\\" 20 ); 21 15 22 load_language('plugin.lang', SET_PLUGINS_PATH); 16 23 // Hook on to an event to show the administration page. … … 20 27 21 28 include_once(SET_PLUGINS_PATH.'set_plugins_class.php'); 22 $set_plugins _controler = new set_plugins_controler();29 $set_plugins = new set_plugins(); 23 30 $infos_message = ""; 24 31 $erreur_message = ""; 25 32 $infos_warning = ""; 26 33 // Add an entry to the 'Plugins' menu. 27 add_event_handler('get_admin_plugin_menu_links', array(&$set_plugins _controler,'set_plugins_admin_menu') );28 add_event_handler('loc_end_admin', array(&$set_plugins _controler,'cl_affiche_messages_admin'));29 add_event_handler('loc_end_page_header',array(&$set_plugins _controler,'set_plugins_add'));34 add_event_handler('get_admin_plugin_menu_links', array(&$set_plugins,'set_plugins_admin_menu') ); 35 add_event_handler('loc_end_admin', array(&$set_plugins,'cl_affiche_messages_admin')); 36 add_event_handler('loc_end_page_header',array(&$set_plugins,'set_plugins_add')); 30 37 31 38 //======================================================= -
extensions/set_plugins/maintain.inc.php
r11093 r11462 30 30 if ( !isset($conf['set_plugins']) ){ 31 31 plugin_uninstall() ; 32 $my_para['nb']="5"; 33 $my_para['list']=array(); 34 $my_para['state']="---"; 32 33 include_once(SET_PLUGINS_PATH.'set_plugins_class.php'); 34 $set_plugins = new set_plugins(); 35 36 $nb=set_plugins::set_var('nb','10'); 37 $liste = set_plugins::set_var('list',array()); 38 $state=set_plugins::set_var('state',"active"); 39 $list_visible=set_plugins::set_var('list_visible',"on,on,on,on"); 40 $add_plugins=set_plugins::set_var('add_plugins',""); 41 set_plugins::save_config(); 35 42 36 $set_plugins_values= pwg_db_real_escape_string(serialize($my_para));37 // conf_update_param('set_plugins', pwg_db_real_escape_string(serialize($config)));38 39 $query = 'INSERT INTO '.CONFIG_TABLE.' (param, value, comment)40 VALUES ("set_plugins", "'.$set_plugins_values.'" ,"Parametres du plugin set_plugins");';41 pwg_query($query);42 43 } 43 44 } -
extensions/set_plugins/set_plugins_class.php
r11386 r11462 1 1 <?php 2 2 /***************************************************************************/ 3 class set_plugins _controler{3 class set_plugins { 4 4 //============================================================================= 5 5 function set_plugins_admin_menu($menu) { … … 23 23 case 'plugins_list': 24 24 if(!isset($template)) return ; 25 set_plugins _controler::Affiche_set_plugins();25 set_plugins::Affiche_set_plugins(); 26 26 break; 27 27 case 'plugins': 28 28 if (!isset($page['tab'])) return; 29 29 if ($page['tab']!="installed") return ; 30 set_plugins _controler::Affiche_set_plugins();30 set_plugins::Affiche_set_plugins(); 31 31 break; 32 32 } … … 34 34 } 35 35 //============================================================================ 36 function cl_affiche_messages_admin() 37 { 36 function cl_affiche_messages_admin(){ 38 37 global $template,$page, $template, $pwg_loaded_plugins,$infos_message,$erreur_message,$infos_warning; 38 39 39 if ( (isset($_GET['page']) AND $_GET['page'] == 'plugins_list') ) { 40 if (!isset($page['infos'])) $page['infos']=array(); 40 41 if ($infos_message != "") { 41 42 array_push($page['infos'], $infos_message); 42 43 $infos_message=""; 43 } 44 45 } 46 if (count($page['infos']) != 0){ 47 $template->assign('infos', $page['infos']); 48 } 49 if (!isset($page['errors'])) $page['errors']=array(); 44 50 if ($erreur_message != "") { 45 51 array_push($page['errors'], $erreur_message); 46 52 $erreur_message=""; 47 } 53 } 54 if (count($page['errors']) != 0){ 55 $template->assign('errors', $page['errors']); 56 } 57 58 if (!isset($page['warnings'])) $page['warnings']=array(); 48 59 if ($infos_warning!= "") { 49 60 array_push($page['warnings'], $infos_warning); 50 61 $infos_warning= ""; 51 } 52 if (count($page['errors']) != 0){ 53 $template->assign('errors', $page['errors']); 54 } 55 if (count($page['infos']) != 0){ 56 $template->assign('infos', $page['infos']); 57 } 62 } 58 63 if (count($page['warnings']) != 0){ 59 64 $template->assign('warnings', $page['warnings']); … … 84 89 'nb' =>$nb 85 90 ); 86 // $infos_warning .="save_config" . set_plugins _controler::memo_var($conf['set_plugins'] );91 // $infos_warning .="save_config" . set_plugins::memo_var($conf['set_plugins'] ); 87 92 $conf['set_plugins']= (serialize($config)); 88 93 conf_update_param('set_plugins', $conf['set_plugins']); 89 94 90 95 91 96 } … … 101 106 } 102 107 //=================================================================== 103 108 function Affiche_set_plugins(){ 104 109 include_once(SET_PLUGINS_PATH."include/constants.php"); 105 110 include(SET_PLUGINS_PATH.'include/affiche.php'); … … 165 170 } 166 171 $nb=count($liste_plugins); 167 } 172 173 } 174 175 176 168 177 if(isset($result) && $result==true){ 169 178 $redirect_url = get_root_url().'admin.php?page='.$_GET['page']; 170 179 //$infos_message .="-----> Mise à jour : " . $nb."<br />"; 171 //$infos_message .="Liste Avant: " . set_plugins _controler::memo_var($liste);172 set_plugins _controler::save_config();180 //$infos_message .="Liste Avant: " . set_plugins::memo_var($liste); 181 set_plugins::save_config(); 173 182 174 183 $_POST['set']=""; … … 183 192 } 184 193 $template->set_filenames( 185 array( 'cl_plugin' => dirname(__FILE__).'/admin.tpl' )194 array( 'cl_plugin' => SET_PLUGINS_PATH_ABS.'template/admin.tpl' ) 186 195 ); 187 196 197 188 198 //=========================================================== 189 199 $header_1='<div id="titrePage"> … … 191 201 </div>'; 192 202 $bpplus=$header_1.$template->parse('cl_plugin', true); 203 193 204 $template-> assign('ADMIN_CONTENT',$bpplus); 194 205 $bpplus=$template->parse('plugins', true);
Note: See TracChangeset
for help on using the changeset viewer.