Changeset 11093 for extensions/set_plugins
- Timestamp:
- May 29, 2011, 4:04:36 PM (13 years ago)
- Location:
- extensions/set_plugins
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/set_plugins/admin.php
r11072 r11093 5 5 // Fetch the template. 6 6 global $template; 7 $redirect_url = get_root_url().'admin.php?page='.'plugins_list'; 8 redirect($redirect_url); 7 9 8 include_once(SET_PLUGINS_PATH."include/constants.php"); 10 9 include_once(SET_PLUGINS_PATH.'include/affiche.php'); … … 59 58 60 59 // Assign the template contents to ADMIN_CONTENT 61 $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin'); 60 $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin'); 61 // $redirect_url = get_root_url().'admin.php?page='.'plugins_list'; 62 // redirect($redirect_url); 62 63 ?> -
extensions/set_plugins/include/affiche.php
r11074 r11093 5 5 if (isset($conf['set_plugins'])) 6 6 $set_plugins_parametres = unserialize($conf['set_plugins']); 7 7 8 if(isset($set_plugins_parametres) && isset($set_plugins_parametres['nb'])) 8 9 $nb=$set_plugins_parametres['nb']; … … 14 15 $state =$set_plugins_parametres['state']; 15 16 17 $state=isset($state)?$state:"active"; 16 18 17 19 $set=isset($_POST['set'])?$_POST['set']:"true"; -
extensions/set_plugins/main.inc.php
r11074 r11093 15 15 load_language('plugin.lang', SET_PLUGINS_PATH); 16 16 // Hook on to an event to show the administration page. 17 17 18 add_event_handler('get_admin_plugin_menu_links', 'set_plugins_admin_menu'); 18 19 19 // Add an entry to the 'Plugins' menu. 20 20 function set_plugins_admin_menu($menu) { … … 29 29 } 30 30 31 add_event_handler('loc_ after_page_header','set_plugins_add');31 add_event_handler('loc_end_page_header','set_plugins_add'); 32 32 function set_plugins_add() { 33 global $user, $template, $val,$page ;33 global $user, $template, $val,$page,$conf; 34 34 if (!isset($page['body_id'])) return; 35 35 36 36 switch($page['body_id']){ 37 case 'theAdminPage': 38 37 case 'theAdminPage': 39 38 switch($page['page']){ 40 case 'plugins_list': 41 42 include_once(SET_PLUGINS_PATH."include/constants.php"); 43 include_once(SET_PLUGINS_PATH.'include/affiche.php'); 44 45 $val_state=""; 46 47 if( isset($_POST['unset_plugins']) || isset($_POST['set_plugins']) ){ 48 if(isset($_POST['unset_plugins']) ) 49 $val_state='inactive'; 50 elseif(isset($_POST['set_plugins']) ) 51 $val_state='active'; 52 $nb=isset($_POST['nb'])?$_POST['nb']:$nb ; 53 54 if($val_state!=""){ 55 56 $query = 'SELECT * 57 FROM ' . PLUGINS_TABLE . ' 58 WHERE `state` NOT LIKE "'.$val_state. '" AND id!="' . "set_plugins" . '" 59 LIMIT '.$nb.' 60 '; 61 $result = pwg_query($query); 62 63 $query = ' 64 UPDATE '.PLUGINS_TABLE.' 65 SET state="'.$val_state.'" 66 WHERE `state` NOT LIKE "'.$val_state. '" AND id!="' . "set_plugins" . '" 67 LIMIT '.$nb.' 68 ;'; 69 70 pwg_query($query); 71 72 $data = array(); 73 if($result) 74 while ($row = pwg_db_fetch_assoc($result)) 75 { 76 $url = $row['id'] ;$vers= $row['version']; 77 array_push($data, array('plugin' => $url,'version'=>$vers) ); 78 } 79 80 unset ($_POST); 81 $redirect_url = get_root_url().'admin.php?page='.$_GET['page']; 82 $config=array(); 83 $config = array( 84 'state' => $val_state, 85 'list'=>$data, 86 'nb' =>$nb 87 ); 88 89 conf_update_param('set_plugins', pwg_db_real_escape_string(serialize($config))); 90 91 redirect($redirect_url); 92 } 93 } 94 $template->set_filenames( 95 array( 96 'plugin' => dirname(__FILE__).'/admin.tpl' 97 ) 98 ); 99 $template->set_filenames( 100 array( 'cl_plugin' => dirname(__FILE__).'/admin.tpl' ) 101 ); 102 103 104 $bpplus=$template->parse('cl_plugin', true); 105 $template-> assign('ADMIN_CONTENT',$bpplus); 106 $bpplus=$template->parse('plugins', true); 107 $template-> concat('ADMIN_CONTENT',$bpplus); 39 case 'plugins_list': 40 if(!isset($template)) return ; 41 Affiche_set_plugins(); 42 //============================================================ 108 43 break; 109 44 … … 122 57 123 58 124 return ;59 return false; 125 60 } 126 61 62 63 function Affiche_set_plugins(){ 64 global $user, $template, $val,$page,$conf; 65 include_once(SET_PLUGINS_PATH."include/constants.php"); 66 include_once(SET_PLUGINS_PATH.'include/affiche.php'); 67 $all_tpl_vars = $template->get_template_vars('plugins'); 68 69 if(!$all_tpl_vars) return; 70 71 $val_state=""; 127 72 73 if( isset($_POST['unset_plugins']) || isset($_POST['set_plugins']) ){ 74 if(isset($_POST['unset_plugins']) ) 75 $val_state='inactive'; 76 elseif(isset($_POST['set_plugins']) ) 77 $val_state='active'; 78 $nb=isset($_POST['nb'])?$_POST['nb']:$nb ; 79 80 if($val_state!=""){ 81 if($val_state=="activate") 82 $sens ="DESC"; 83 else 84 $sens="ASC"; 85 86 //==== pré-liste === 87 $query = 'SELECT * 88 FROM ' . PLUGINS_TABLE . ' 89 WHERE `state` NOT LIKE "'.$val_state. '" AND id!="' . "set_plugins" . '" 90 ORDER BY `id` '.$sens.' 91 LIMIT '.$nb.' 92 '; 93 $result = pwg_query($query); 94 95 96 97 $query = ' 98 UPDATE '.PLUGINS_TABLE.' 99 SET state="'.$val_state.'" 100 WHERE `state` NOT LIKE "'.$val_state. '" AND id!="' . "set_plugins" . '" 101 ORDER BY `id` '.$sens.' 102 LIMIT '.$nb.' 103 ;'; 104 105 pwg_query($query); 106 107 $data = array(); 108 if($result) 109 while ($row = pwg_db_fetch_assoc($result)) 110 { 111 112 $url = $row['id'] ;$vers= $row['version']; 113 array_push($data, array('plugin' => $url,'version'=>$vers) ); 114 } 115 116 unset ($_POST); 117 $redirect_url = get_root_url().'admin.php?page='.$_GET['page']; 118 $config=array(); 119 $config = array( 120 'state' => $val_state, 121 'list'=>$data, 122 'nb' =>$nb 123 ); 124 125 conf_update_param('set_plugins', pwg_db_real_escape_string(serialize($config))); 126 redirect($redirect_url); 127 } 128 } 129 130 131 $template->set_filenames( 132 array( 133 'plugin' => dirname(__FILE__).'/admin.tpl' 134 ) 135 ); 136 $template->set_filenames( 137 array( 'cl_plugin' => dirname(__FILE__).'/admin.tpl' ) 138 ); 139 140 141 //=========================================================== 142 $bpplus=$template->parse('cl_plugin', true); 143 $template-> assign('ADMIN_CONTENT',$bpplus); 144 145 $bpplus=$template->parse('plugins', true); 146 $template-> concat('ADMIN_CONTENT',$bpplus); 147 148 } 128 149 ?> -
extensions/set_plugins/maintain.inc.php
r11072 r11093 1 function plugin_install() 2 { 3 global $conf; 1 <?php 2 // +-----------------------------------------------------------------------+ 3 // | Piwigo - a PHP based picture gallery | 4 // +-----------------------------------------------------------------------+ 5 // | Copyright(C) 2008-2009 Piwigo Team http://piwigo.org | 6 // | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net | 7 // | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick | 8 // +-----------------------------------------------------------------------+ 9 // | This program is free software; you can redistribute it and/or modify | 10 // | it under the terms of the GNU General Public License as published by | 11 // | the Free Software Foundation | 12 // | | 13 // | This program is distributed in the hope that it will be useful, but | 14 // | WITHOUT ANY WARRANTY; without even the implied warranty of | 15 // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 16 // | General Public License for more details. | 17 // | | 18 // | You should have received a copy of the GNU General Public License | 19 // | along with this program; if not, write to the Free Software | 20 // | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | 21 // | USA. | 22 // +-----------------------------------------------------------------------+ 23 if (!defined('PHPWG_ROOT_PATH')) { die('Hacking attempt!');} 24 if (!defined('SET_PLUGINS_PATH')) define('SET_PLUGINS_PATH' , PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/'); 4 25 5 if (!isset($conf['set_plugins'])) 6 { 7 8 $q = ' 9 INSERT INTO '.CONFIG_TABLE.' (param, value, comment) 10 VALUES ("set_plugins","","set_plugins") 11 ;'; 12 pwg_query($q); 26 27 function plugin_install(){ 28 global $conf ; 29 30 if ( !isset($conf['set_plugins']) ){ 31 plugin_uninstall() ; 32 $my_para['nb']="5"; 33 $my_para['list']=array(); 34 $my_para['state']="---"; 35 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); 13 42 } 14 43 } 44 function plugin_uninstall(){ 45 $query = ' 46 DELETE FROM '.CONFIG_TABLE.' 47 WHERE param="set_plugins" 48 ;'; 49 pwg_query($query); 50 51 } 52 53 function plugin_activate(){ 15 54 16 55 } 17 56 57 function plugin_deactivate(){ 18 58 19 20 function plugin_uninstall()21 {22 global $conf;23 if (isset($conf['set_plugins']))24 {25 $q = '26 DELETE FROM '.CONFIG_TABLE.'27 WHERE param="set_plugins"28 ;';29 pwg_query($q);30 }31 // $query = 'DROP TABLE IF EXISTS '.set_plugins_TABLE.';';32 // pwg_query( $query);33 }34 35 36 function plugin_activate() {37 // Put anything here that should be executed during activation.38 59 } 39 60 61 ?>
Note: See TracChangeset
for help on using the changeset viewer.