From 3c75746aba1339c9ad4e36aa48e683de56660aaa Mon Sep 17 00:00:00 2001 From: CaMer0n Date: Mon, 28 Sep 2009 07:17:52 +0000 Subject: [PATCH] db pref editor fix and icon-pool uninstall option added. --- e107_admin/db.php | 10 ++--- e107_admin/image.php | 12 +++-- e107_admin/plugin.php | 80 +++++++++++++++++----------------- e107_handlers/form_handler.php | 8 +++- e107_handlers/plugin_class.php | 43 +++++++++++++----- 5 files changed, 91 insertions(+), 62 deletions(-) diff --git a/e107_admin/db.php b/e107_admin/db.php index 4112ce098..43835cde8 100644 --- a/e107_admin/db.php +++ b/e107_admin/db.php @@ -9,8 +9,8 @@ * Administration - Database Utilities * * $Source: /cvs_backup/e107_0.8/e107_admin/db.php,v $ - * $Revision: 1.35 $ - * $Date: 2009-09-26 18:08:14 $ + * $Revision: 1.36 $ + * $Date: 2009-09-28 07:17:51 $ * $Author: e107coders $ * */ @@ -201,7 +201,7 @@ class system_tools $deleted_list = ""; - $config = ($mode == 'core') ? e107::getConfig('core') : e107::getPlugConfig($mode); + $config = ($mode == 'core' || $mode='') ? e107::getConfig('core') : e107::getPlugConfig($mode); // Single Pref Deletion using button if(varset($_POST['delpref'])) @@ -506,7 +506,7 @@ class system_tools * Preferences Editor * @return */ - private function pref_editor($type='') + private function pref_editor($type='core') { //TODO Add drop-down filter for editing plugin prefs also. @@ -579,7 +579,7 @@ class system_tools
".$frm->admin_button('delpref_checked', DBLAN_21, 'delete')." ".$frm->admin_button('back', DBLAN_13, 'back')." - +
\n\n"; diff --git a/e107_admin/image.php b/e107_admin/image.php index ad3ee17df..06fc3f2d2 100644 --- a/e107_admin/image.php +++ b/e107_admin/image.php @@ -9,9 +9,9 @@ * Image Administration Area * * $Source: /cvs_backup/e107_0.8/e107_admin/image.php,v $ - * $Revision: 1.22 $ - * $Date: 2009-08-28 16:11:01 $ - * $Author: marj_nl_fr $ + * $Revision: 1.23 $ + * $Date: 2009-09-28 07:17:52 $ + * $Author: e107coders $ * */ require_once("../class2.php"); @@ -661,6 +661,10 @@ if(!e_AJAX_REQUEST) require_once("footer.php"); function icon_editor() { global $iconpool, $e107, $emessage, $frm, $tp; + + $ns = e107::getRender(); + $tp = e107::getParser(); + ksort($iconpool); $text = " @@ -734,7 +738,7 @@ function icon_editor() "; //$text .= "
".DBLAN_13."
\n"; - $e107->ns->tablerender(LAN_IMAGEMANAGER." :: ".IMALAN_71, $emessage->render().$text); + $ns->tablerender(LAN_IMAGEMANAGER." :: ".IMALAN_71, $emessage->render().$text); return $text; } diff --git a/e107_admin/plugin.php b/e107_admin/plugin.php index b2dc866c9..989d12a64 100644 --- a/e107_admin/plugin.php +++ b/e107_admin/plugin.php @@ -11,8 +11,8 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_admin/plugin.php,v $ -| $Revision: 1.47 $ -| $Date: 2009-09-25 02:02:38 $ +| $Revision: 1.48 $ +| $Date: 2009-09-28 07:17:52 $ | $Author: e107coders $ +----------------------------------------------------------------------------+ */ @@ -217,7 +217,8 @@ class pluginManager{ $options = array( 'del_tables' => varset($_POST['delete_tables'],FALSE), 'del_userclasses' => varset($_POST['delete_userclasses'],FALSE), - 'del_extended' => varset($_POST['delete_xfields'],FALSE) + 'del_extended' => varset($_POST['delete_xfields'],FALSE), + 'del_ipool' => varset($_POST['delete_ipool'],FALSE) ); $text .= $plugin->manage_plugin_xml($this->id, 'uninstall', $options); } @@ -621,6 +622,8 @@ class pluginManager{ { global $plugin,$frm; + //TODO 'install' checkbox in plugin upload form. (as it is for theme upload) + /* plugin upload form */ if(!is_writable(e_PLUGIN)) @@ -733,10 +736,12 @@ class pluginManager{ function pluginRenderPlugin($pluginList) { - global $tp, $plugin, $frm; + global $plugin, $frm; if (empty($pluginList)) return ''; + $tp = e107::getParser(); + $text = ""; @@ -880,7 +885,9 @@ class pluginManager{ function pluginConfirmUninstall() { - global $plugin, $tp; + global $plugin, $frm; + $tp = e107::getParser(); + $plug = $plugin->getinfo($this->id); if ($plug['plugin_installflag'] == true ) @@ -931,12 +938,7 @@ class pluginManager{ if(is_writable(e_PLUGIN.$plug['plugin_path'])) { - $del_text = " - - "; + $del_text = $frm->selectbox('delete_files','yesno',0); } else { @@ -956,32 +958,22 @@ class pluginManager{ - ".EPL_ADLAN_55." - ".LAN_YES." + ".EPL_ADLAN_55." + ".LAN_YES." - - ".EPL_ADLAN_57."
".EPL_ADLAN_58."
- - - - + ".EPL_ADLAN_57." + ".$frm->selectbox('delete_tables','yesno',1)." +
".EPL_ADLAN_58."
+ "; if ($userclasses) { $text .= " - - ".EPL_ADLAN_78."
".$userclasses."
".EPL_ADLAN_79."
- - - + ".EPL_ADLAN_78."
".$userclasses."
+ ".$frm->selectbox('delete_userclasses','yesno',1)." +
".EPL_ADLAN_79."
"; } @@ -990,20 +982,30 @@ class pluginManager{ { $text .= " - ".EPL_ADLAN_80."
".$eufields."
".EPL_ADLAN_79."
- - - + ".EPL_ADLAN_80."
".$eufields."
+ ".$frm->selectbox('delete_xfields','yesno',0)." +
".EPL_ADLAN_79."
"; } + + if(e107::getConfig('ipool')->getPref('plugin-'.$plug['plugin_path'])) + { + $text .= " + Remove icons from icon-pool
".$eufields."
+ + ".$frm->selectbox('delete_ipool','yesno',1)." +
".EPL_ADLAN_79."
+ "; + } + + $text .=" - ".EPL_ADLAN_59."
".EPL_ADLAN_60."
- {$del_text} + ".EPL_ADLAN_59." + {$del_text} +
".EPL_ADLAN_60."
+
"; diff --git a/e107_handlers/form_handler.php b/e107_handlers/form_handler.php index 4ed907ab7..c08129959 100644 --- a/e107_handlers/form_handler.php +++ b/e107_handlers/form_handler.php @@ -9,8 +9,8 @@ * Form Handler * * $Source: /cvs_backup/e107_0.8/e107_handlers/form_handler.php,v $ - * $Revision: 1.45 $ - * $Date: 2009-09-25 02:02:38 $ + * $Revision: 1.46 $ + * $Date: 2009-09-28 07:17:52 $ * $Author: e107coders $ * */ @@ -308,6 +308,10 @@ class e_form function selectbox($name, $option_array, $selected = false, $options = array()) { + if($option_array == 'yesno') + { + $option_array = array(1=>LAN_YES,0=>LAN_NO); + } return $this->select_open($name, $options)."\n".$this->option_multi($option_array, $selected)."\n".$this->select_close(); } diff --git a/e107_handlers/plugin_class.php b/e107_handlers/plugin_class.php index 44ca34767..9e6ddec0b 100644 --- a/e107_handlers/plugin_class.php +++ b/e107_handlers/plugin_class.php @@ -11,8 +11,8 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_handlers/plugin_class.php,v $ -| $Revision: 1.98 $ -| $Date: 2009-09-26 16:54:09 $ +| $Revision: 1.99 $ +| $Date: 2009-09-28 07:17:52 $ | $Author: e107coders $ +----------------------------------------------------------------------------+ */ @@ -294,13 +294,28 @@ class e107plugin } } - function manage_icons($plugin='') + function manage_icons($plugin='',$function='') { global $iconpool,$pref; - + + $emessage = eMessage::getInstance(); $sql = e107::getDb(); $tp = e107::getParser(); $fl = e107::getFile(); + + if($plugin && ($function == 'uninstall') ) + { + if(vartrue($this->unInstallOpts['del_ipool'], FALSE)) + { + $ipool_entry = 'plugin-'.$plugin; + e107::getConfig('ipool')->remove($ipool_entry); // FIXME - ipool removal issue. + $status = (e107::getConfig('ipool')->save(FALSE)) ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR; + $emessage->add('Removing Icon-Pool entry: '.$ipool_entry, $status); + } + return; + } + + $query = "SELECT * FROM #plugin WHERE plugin_installflag =0 ORDER BY plugin_path ASC"; $sql->db_Select_gen($query); @@ -950,7 +965,7 @@ class e107plugin $tableList = $dbHandler->get_table_def('',$path.$sqlFile); if (!is_array($tableList)) { - $error[] = 'Can\'t read SQL definition: '.$path.$sqlFile; + $emessage->add("Can\'t read SQL definition: ".$path.$sqlFile,E_MESSAGE_ERROR); break; } // Got the required definition here @@ -960,9 +975,9 @@ class e107plugin { case 'install' : $sqlTable = str_replace("CREATE TABLE ".MPREFIX.'`', "CREATE TABLE `".MPREFIX, preg_replace("/create table\s+/si", "CREATE TABLE ".MPREFIX, $ct[0])); - $txt .= "Adding table: {$ct[1]} ... "; - $result = $this->manage_tables('add', array($sqlTable)); // Pass the statement to create the table - $txt .= ($result ? "Success" : "Failed!").'
'; + $txt = "Adding table: {$ct[1]} ... "; + $status = $this->manage_tables('add', array($sqlTable)) ? E_MESSAGE_SUCCESS: E_MESSAGE_ERROR; // Pass the statement to create the table + $emessage->add($txt,$status); break; case 'upgrade' : $tmp = $dbHandler->update_table_structure($ct,FALSE,TRUE, $pref['multilanguage']); @@ -980,12 +995,13 @@ class e107plugin case 'uninstall' : if (varsettrue($options['del_tables'], FALSE)) { - $txt .= "Removing table {$ct[1]}
"; - $this->manage_tables('remove', array($ct[1])); // Delete the table + $txt = "Removing table {$ct[1]}
"; + $status = $this->manage_tables('remove', array($ct[1])) ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR; // Delete the table + $emessage->add($txt,$status); } else - { - $txt .= "Table {$ct[1]} left in place
"; + { + $emessage->add("Table {$ct[1]} left in place.",E_MESSAGE_SUCCESS); } break; } @@ -1023,6 +1039,9 @@ class e107plugin $this->XmlLogLanguageFile($function,$plug_vars['logLanguageFile']); } + $this->manage_icons($this->plugFolder,$function); + + //FIXME //If any commentIDs are configured, we need to remove all comments on uninstall if($function == 'uninstall' && isset($plug_vars['commentID']))