From eaf6929c5a566d855fdb1ab632d060409a594bb2 Mon Sep 17 00:00:00 2001 From: CaMer0n Date: Fri, 14 Aug 2009 21:11:49 +0000 Subject: [PATCH] remove unused code --- class2.php | 12 +---- e107_admin/plugin.php | 114 ++++++++++++++++++++++++------------------ 2 files changed, 68 insertions(+), 58 deletions(-) diff --git a/class2.php b/class2.php index 0de887fc9..6695a02c5 100644 --- a/class2.php +++ b/class2.php @@ -9,8 +9,8 @@ * General purpose file * * $Source: /cvs_backup/e107_0.8/class2.php,v $ -* $Revision: 1.125 $ -* $Date: 2009-08-14 15:57:44 $ +* $Revision: 1.126 $ +* $Date: 2009-08-14 21:11:49 $ * $Author: e107coders $ * */ @@ -1168,7 +1168,6 @@ if(!isset($_E107['no_menus'])) $eMenuList = array(); $eMenuActive = array(); $eMenuArea = array(); - // $eMenuOrder = array(); if(!is_array($menu_data)) { @@ -1176,20 +1175,14 @@ if(!isset($_E107['no_menus'])) $menu_qry = 'SELECT * FROM #menus WHERE menu_location > 0 AND menu_class IN ('.USERCLASS_LIST.') AND menu_layout = "'.$menu_layout_field.'" ORDER BY menu_location,menu_order'; if ($sql->db_Select_gen($menu_qry)) { - $c = 1; while ($row = $sql->db_Fetch()) { - $c = ($prevloc != $row['menu_location']) ? 1 : $c; $eMenuList[$row['menu_location']][] = $row; $eMenuArea[$row['menu_location']][$row['menu_name']] = 1; $eMenuActive[$row['menu_name']] = $row['menu_name']; - // $eMenuOrder[$row['menu_location']][$row['menu_name']] = $c; - // $c++; - // $prevloc = $row['menu_location']; } } $menu_data['menu_area'] = $eMenuArea; - // $menu_data['menu_order'] = $eMenuOrder; $menu_data['menu_list'] = $eMenuList; $menu_data['menu_active'] = $eMenuActive; $menu_data = $eArrayStorage->WriteArray($menu_data, false); @@ -1202,7 +1195,6 @@ if(!isset($_E107['no_menus'])) $eMenuArea = $menu_data['menu_area']; $eMenuList = $menu_data['menu_list']; $eMenuActive = $menu_data['menu_active']; - // $eMenuOrder = $menu_data['menu_order']; unset($menu_data); } diff --git a/e107_admin/plugin.php b/e107_admin/plugin.php index 3585fbc37..6380bb625 100644 --- a/e107_admin/plugin.php +++ b/e107_admin/plugin.php @@ -11,9 +11,9 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_admin/plugin.php,v $ -| $Revision: 1.35 $ -| $Date: 2009-07-22 12:00:51 $ -| $Author: marj_nl_fr $ +| $Revision: 1.36 $ +| $Date: 2009-08-14 21:11:49 $ +| $Author: e107coders $ +----------------------------------------------------------------------------+ */ @@ -29,7 +29,7 @@ define('PLUGIN_SHOW_REFRESH', FALSE); global $user_pref; -require_once("auth.php"); + require_once(e_HANDLER.'plugin_class.php'); require_once(e_HANDLER.'file_class.php'); require_once(e_HANDLER."form_handler.php"); @@ -39,6 +39,12 @@ require_once (e_HANDLER.'message_handler.php'); $plugin = new e107plugin; $frm = new e_form(); $pman = new pluginManager; +define("e_PAGETITLE",ADLAN_98." - ".$pman->pagetitle); +require_once("auth.php"); +$pman->pluginObserver(); + + + require_once("footer.php"); exit; @@ -51,14 +57,20 @@ class pluginManager{ var $frm; var $fields; var $fieldpref; + var $titlearray = array(); + var $pagetitle; function pluginManager() { - global $user_pref,$admin_log,$ns; + global $user_pref,$admin_log; $tmp = explode('.', e_QUERY); $this -> action = ($tmp[0]) ? $tmp[0] : "installed"; $this -> id = varset($tmp[1]) ? intval($tmp[1]) : ""; + $this -> titlearray = array('installed'=>EPL_ADLAN_22,'avail'=>EPL_ADLAN_23, 'upload'=>EPL_ADLAN_38); + + $keys = array_keys($this -> titlearray); + $this->pagetitle = (in_array($this->action,$keys)) ? $this -> titlearray[$this->action] : $this -> titlearray['installed']; $this-> fields = array( @@ -78,19 +90,6 @@ class pluginManager{ "options" => array("title" => LAN_OPTIONS, "width" => "15%", "thclass" => "middle center last", "url" => "") ); - if (isset($_POST['upload'])) - { - $this -> pluginProcessUpload(); - } - - if(isset($_POST['submit-e-columns'])) - { - $user_pref['admin_pluginmanager_columns'] = $_POST['e-columns']; - save_prefs('user'); - } - - $this -> fieldpref = (is_array($user_pref['admin_pluginmanager_columns'])) ? $user_pref['admin_pluginmanager_columns'] : array("plugin_icon","plugin_name","plugin_version","plugin_description","plugin_category","plugin_author","plugin_website","plugin_notes"); - /* if(isset($_POST['uninstall-selected'])) @@ -109,19 +108,37 @@ class pluginManager{ + + + + } + + function pluginObserver() + { + global $user_pref,$admin_log; + if (isset($_POST['upload'])) + { + $this -> pluginProcessUpload(); + } + + if(isset($_POST['submit-e-columns'])) + { + $user_pref['admin_pluginmanager_columns'] = $_POST['e-columns']; + save_prefs('user'); + } + + $this -> fieldpref = (is_array($user_pref['admin_pluginmanager_columns'])) ? $user_pref['admin_pluginmanager_columns'] : array("plugin_icon","plugin_name","plugin_version","plugin_description","plugin_category","plugin_author","plugin_website","plugin_notes"); + + + if($this->action == 'avail' || $this->action == 'installed') // Plugin Check is done during upgrade_routine. { $this -> pluginCheck(); } - - if($this->action == "uninstall") { - $this -> pluginUninstall(); - - } if($this->action == "install") @@ -167,15 +184,11 @@ class pluginManager{ $this -> pluginRenderList(); } - - - } - - + } function pluginUninstall() { - global $plugin,$ns,$admin_log,$pref,$tp,$sql; + global $plugin,$admin_log,$pref,$tp,$sql; if(!isset($_POST['uninstall_confirm'])) { // $id is already an integer @@ -295,11 +308,19 @@ class pluginManager{ } $admin_log->log_event('PLUGMAN_03', $plug['plugin_path'], E_LOG_INFORMATIVE, ''); - + print_a($pref['plug_installed']); if (isset($pref['plug_installed'][$plug['plugin_path']])) { + print_a($plug); unset($pref['plug_installed'][$plug['plugin_path']]); - save_prefs(); + if(save_prefs()) + { + echo "WORKED"; + } + else + { + echo "FAILED"; + } } } @@ -327,7 +348,6 @@ class pluginManager{ function pluginProcessUpload() { - global $ns; if (!$_POST['ac'] == md5(ADMINPWCHANGE)) { exit; @@ -338,7 +358,7 @@ class pluginManager{ if(!is_writable(e_PLUGIN)) { /* still not writable - spawn error message */ - $ns->tablerender(EPL_ADLAN_40, EPL_ADLAN_39); + e107::getRender()->tablerender(EPL_ADLAN_40, EPL_ADLAN_39); } else { @@ -360,7 +380,7 @@ class pluginManager{ else { /* not zip or tar - spawn error message */ - $ns->tablerender(EPL_ADLAN_40, EPL_ADLAN_41); + e107::getRender()->tablerender(EPL_ADLAN_40, EPL_ADLAN_41); require_once("footer.php"); exit; } @@ -400,7 +420,7 @@ class pluginManager{ { $error = EPL_ADLAN_47.PclErrorString().", ".EPL_ADLAN_48.intval(PclErrorCode()); } - $ns->tablerender(EPL_ADLAN_40, EPL_ADLAN_42." ".$archiveName." ".$error); + e107::getRender()->tablerender(EPL_ADLAN_40, EPL_ADLAN_42." ".$archiveName." ".$error); require_once("footer.php"); exit; } @@ -413,12 +433,12 @@ class pluginManager{ if(file_exists(e_PLUGIN.$folderName."/plugin.php") || file_exists(e_PLUGIN.$folderName."/plugin.xml")) { /* upload is a plugin */ - $ns->tablerender(EPL_ADLAN_40, EPL_ADLAN_43); + e107::getRender()->tablerender(EPL_ADLAN_40, EPL_ADLAN_43); } else { /* upload is a menu */ - $ns->tablerender(EPL_ADLAN_40, EPL_ADLAN_45); + e107::getRender()->tablerender(EPL_ADLAN_40, EPL_ADLAN_45); } /* attempt to delete uploaded archive */ @@ -432,13 +452,12 @@ class pluginManager{ function pluginInstall() { - global $ns,$plugin,$admin_log; + global $plugin,$admin_log; $text = $plugin->install_plugin($this->id); if ($text === FALSE) { // Tidy this up $this->show_message("Error messages above this line", E_MESSAGE_ERROR); - // $ns->tablerender(LAN_INSTALL_FAIL, ); } else { @@ -446,7 +465,6 @@ class pluginManager{ // if($eplug_conffile){ $text .= " [".LAN_CONFIGURE."]"; } $admin_log->log_event('PLUGMAN_01', $this->id.':'.$eplug_folder, E_LOG_INFORMATIVE, ''); $this->show_message($text, E_MESSAGE_SUCCESS); - // $ns->tablerender(EPL_ADLAN_33, $text); } } @@ -456,7 +474,7 @@ class pluginManager{ function pluginUpgrade() { - global $plugin,$ns,$pref; + global $plugin,$pref; $plug = $plugin->getinfo($this->id); @@ -574,7 +592,7 @@ class pluginManager{ $pref['plug_installed'][$plug['plugin_path']] = $eplug_version; // Update the version save_prefs(); } - $ns->tablerender(EPL_ADLAN_34, $text); + e107::getRender()->tablerender(EPL_ADLAN_34, $text); $plugin->save_addon_prefs(); @@ -615,13 +633,13 @@ class pluginManager{ function pluginUpload() { - global $plugin,$ns,$frm; + global $plugin,$frm; /* plugin upload form */ if(!is_writable(e_PLUGIN)) { - $ns->tablerender(EPL_ADLAN_40, EPL_ADLAN_44); + e107::getRender()->tablerender(EPL_ADLAN_40, EPL_ADLAN_44); } else { @@ -656,7 +674,7 @@ class pluginManager{ \n"; } - $ns->tablerender(EPL_ADLAN_16, $text); + e107::getRender()->tablerender(ADLAN_98." :: ".EPL_ADLAN_38, $text); } // ----------------------------------------------------------------------------- @@ -713,7 +731,7 @@ class pluginManager{ "; $emessage = &eMessage::getInstance(); - $e107->ns->tablerender(EPL_ADLAN_16." : ".$caption, $emessage->render(). $text); + e107::getRender()->tablerender(ADLAN_98." :: ".$caption, $emessage->render(). $text); } @@ -858,7 +876,7 @@ class pluginManager{ function pluginConfirmUninstall() { - global $plugin, $tp, $ns; + global $plugin, $tp; $plug = $plugin->getinfo($this->id); if ($plug['plugin_installflag'] == true ) @@ -995,7 +1013,7 @@ class pluginManager{ "; - $ns->tablerender(EPL_ADLAN_63." ".$tp->toHtml($plug_vars['@attributes']['name'], "", "defs,emotes_off, no_make_clickable"), $text); + e107::getRender()->tablerender(EPL_ADLAN_63." ".$tp->toHtml($plug_vars['@attributes']['name'], "", "defs,emotes_off, no_make_clickable"), $text); }