'Set_plugins', 'URL' => get_admin_plugin_menu_link(dirname(__FILE__)).'/admin.php' ) ); return $menu; } //============================================================================ function begin_admin() { global $erreur_message,$liste_des_plugins_actifs,$liste_active_plugins,$page; //========= Liste des plugins actifs ================= if (!isset($page['body_id'])) return; if($page['body_id']!='theAdminPage' ) return ; if($page['page']=='plugins_list' || $page['page']=='plugins'){ $plugins = new plugins(); $plugins->sort_fs_plugins('name'); $liste_des_plugins_actifs = array(); foreach ($plugins->fs_plugins as $plugin_id => $fs_plugin){ if(isset( $plugins->db_plugins_by_id[$plugin_id])){ $State_id=$plugins->db_plugins_by_id[$plugin_id]['state'] ; if($State_id=="active" && $plugin_id!="set_plugins") array_push($liste_des_plugins_actifs,$plugin_id); } } //foreach if (isset($_GET['set'])){ $ret['config']=$_GET; $ret['liste_plugins']=$liste_des_plugins_actifs; // array_push($ret,$liste_des_plugins_actifs); if($_GET['config']['liste_visible']) set_plugins::save_config(); echo json_encode($ret); exit; } $liste_active_plugins=$liste_des_plugins_actifs; } } //============================================================================ function set_plugins_add() { global $user, $template, $val,$page,$conf,$erreur_message,$infos_message; global $liste_des_plugins_actifs,$liste_active_plugins; if (!isset($page['body_id'])) return; switch($page['body_id']){ case 'theAdminPage': switch($page['page']){ case 'plugins_list': if(!isset($template)) return ; set_plugins::Affiche_set_plugins(); break; case 'plugins': if (!isset($page['tab'])) return; if ($page['tab']!="installed") return ; set_plugins::Affiche_set_plugins(); break; } } } //============================================================================ function messages_admin(){ global $template,$page, $template, $pwg_loaded_plugins,$infos_message,$erreur_message,$infos_warning; if ( (isset($_GET['page']) AND ($_GET['page'] == 'plugins' || $_GET['page'] == 'plugins_list' )) ) { if (!isset($page['infos'])) $page['infos']=array(); if ($infos_message != "") { array_push($page['infos'], $infos_message); $infos_message=""; } if (count($page['infos']) != 0){ $template->assign('infos', $page['infos']); } if (!isset($page['errors'])) $page['errors']=array(); if ($erreur_message != "") { array_push($page['errors'], $erreur_message); $erreur_message=""; } if (count($page['errors']) != 0){ $template->assign('errors', $page['errors']); } if (!isset($page['warnings'])) $page['warnings']=array(); if ($infos_warning!= "") { array_push($page['warnings'], $infos_warning); $infos_warning= ""; } if (count($page['warnings']) != 0){ $template->assign('warnings', $page['warnings']); } } } //========================================================================================== function set_var($key,$defaut){ global $set_plugins_parametres; global $infos_message; if(isset($set_plugins_parametres) && isset($set_plugins_parametres[$key])) $ret=$set_plugins_parametres[$key]; $ret= (isset($ret))?$ret:$defaut; $ret=isset($_POST[$key])?$_POST[$key]:$ret; return $ret ; } //================================================================ function save_config(){ global $list_visible, $state,$liste,$nb,$page,$conf ; global $infos_message,$infos_warning,$erreur_message ; $config=array(); $config = array( 'list_visible' => $list_visible, 'state' => $state, 'liste'=>$liste, 'nb' =>$nb ); // $infos_warning .="save_config" . set_plugins::memo_var($conf['set_plugins'] ); $conf['set_plugins']= (serialize($config)); conf_update_param('set_plugins', $conf['set_plugins']); } //================================================================= function memo_var($variables){ ob_start(); echo '
'; print_r($variables); echo ''; $m= ob_get_contents(); ob_end_clean(); return $m; } //=================================================================== function Affiche_set_plugins(){ global $infos_message,$liste_des_plugins_actifs,$erreur_message ; include_once(SET_PLUGINS_PATH."include/constants.php"); include(SET_PLUGINS_PATH.'include/affiche.php'); $all_tpl_vars = $template->get_template_vars('ADMIN_CONTENT'); if( isset($_POST['submit'])){ $state=""; if($_POST['submit']==l10n("Deactivate") ) $state='inactive'; elseif($_POST['submit']==l10n("Activate") ) $state='active'; if($state!=""){ if($state=="inactive") $sens ="DESC"; else $sens="ASC"; //============================ $query = 'SELECT * FROM ' . PLUGINS_TABLE . ' WHERE `state` NOT LIKE "'.$state. '" AND id!="' . "set_plugins" . '" ORDER BY `id` '.$sens.' LIMIT '.$nb.' '; $result = pwg_query($query); //======= mise a jour ========= if($result){ $query = ' UPDATE '.PLUGINS_TABLE.' SET state="'.$state.'" WHERE `state` NOT LIKE "'.$state. '" AND id!="' . "set_plugins" . '" ORDER BY `id` '.$sens.' LIMIT '.$nb.';'; pwg_query($query); } //===================================== if(isset($result) && $result==true){ $liste= array_unique($liste); if(!array_search($add_plugins, $liste)){ array_push($liste, $add_plugins ); } while ($row = pwg_db_fetch_assoc($result)) { $url = $row['id'] ; array_push($liste, $url); } } }else if ($_POST['submit']==l10n('store') ){ $liste = array(); $state="active"; $query = 'SELECT * FROM ' . PLUGINS_TABLE . ' WHERE `state` LIKE "active" AND id!="' . "set_plugins" . '" '; $result = pwg_query($query); if(isset($result) && $result==true){ $liste_plugins = array(); while ($row = pwg_db_fetch_assoc($result)) { $url = $row['id'] ; //array_push($liste_plugins, array('plugin' => $url ) ); array_push($liste, $url ); } } $nb=count($liste_plugins); } if(isset($result) && $result==true){ $redirect_url = get_root_url().'admin.php?page='.$_GET['page']; set_plugins::save_config(); $_POST['set']=""; $set=""; include(SET_PLUGINS_PATH.'include/affiche.php'); // redirect($redirect_url); } } $template->set_filenames( array( 'cl_plugin' => SET_PLUGINS_PATH_ABS.'template/admin.tpl' ) ); //=========================================================== $header_1='