mirror of
https://github.com/e107inc/e107.git
synced 2025-08-04 21:57:51 +02:00
Choices for selective delete when uninstalling plugins
This commit is contained in:
@@ -11,8 +11,8 @@
|
|||||||
| GNU General Public License (http://gnu.org).
|
| GNU General Public License (http://gnu.org).
|
||||||
|
|
|
|
||||||
| $Source: /cvs_backup/e107_0.8/e107_admin/plugin.php,v $
|
| $Source: /cvs_backup/e107_0.8/e107_admin/plugin.php,v $
|
||||||
| $Revision: 1.22 $
|
| $Revision: 1.23 $
|
||||||
| $Date: 2008-12-10 22:39:43 $
|
| $Date: 2008-12-30 19:01:09 $
|
||||||
| $Author: e107steved $
|
| $Author: e107steved $
|
||||||
+----------------------------------------------------------------------------+
|
+----------------------------------------------------------------------------+
|
||||||
*/
|
*/
|
||||||
@@ -141,12 +141,11 @@ if (isset($_POST['upload']))
|
|||||||
if ($action == 'uninstall')
|
if ($action == 'uninstall')
|
||||||
{
|
{
|
||||||
if(!isset($_POST['uninstall_confirm']))
|
if(!isset($_POST['uninstall_confirm']))
|
||||||
{
|
{ // $id is already an integer
|
||||||
show_uninstall_confirm();
|
show_uninstall_confirm($id);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$id = intval($id);
|
|
||||||
$plug = $plugin->getinfo($id);
|
$plug = $plugin->getinfo($id);
|
||||||
$text = '';
|
$text = '';
|
||||||
//Uninstall Plugin
|
//Uninstall Plugin
|
||||||
@@ -155,7 +154,12 @@ if ($action == 'uninstall')
|
|||||||
$_path = e_PLUGIN.$plug['plugin_path'].'/';
|
$_path = e_PLUGIN.$plug['plugin_path'].'/';
|
||||||
if(file_exists($_path.'plugin.xml'))
|
if(file_exists($_path.'plugin.xml'))
|
||||||
{
|
{
|
||||||
$text .= $plugin->manage_plugin_xml($id, 'uninstall');
|
$options = array(
|
||||||
|
'del_tables' => varset($_POST['delete_tables'],FALSE),
|
||||||
|
'del_userclasses' => varset($_POST['delete_userclasses'],FALSE),
|
||||||
|
'del_extended' => varset($_POST['delete_xfields'],FALSE)
|
||||||
|
);
|
||||||
|
$text .= $plugin->manage_plugin_xml($id, 'uninstall', $options);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -623,12 +627,10 @@ $ns->tablerender(EPL_ADLAN_16, $text);
|
|||||||
require_once("footer.php");
|
require_once("footer.php");
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
function show_uninstall_confirm()
|
function show_uninstall_confirm($id)
|
||||||
{
|
{
|
||||||
global $plugin, $tp, $id, $ns;
|
global $plugin, $tp, $ns;
|
||||||
$id = intval($id);
|
|
||||||
$plug = $plugin->getinfo($id);
|
$plug = $plugin->getinfo($id);
|
||||||
// $_path = e_PLUGIN.$plug['plugin_path'];
|
|
||||||
|
|
||||||
if ($plug['plugin_installflag'] == true )
|
if ($plug['plugin_installflag'] == true )
|
||||||
{
|
{
|
||||||
@@ -636,6 +638,44 @@ function show_uninstall_confirm()
|
|||||||
{
|
{
|
||||||
$plug_vars = $plugin->plug_vars;
|
$plug_vars = $plugin->plug_vars;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
$userclasses = '';
|
||||||
|
$eufields = '';
|
||||||
|
if (isset($plug_vars['userclass']))
|
||||||
|
{
|
||||||
|
if (isset($plug_vars['userclass']['@attributes']))
|
||||||
|
{
|
||||||
|
$plug_vars['userclass'][0]['@attributes'] = $plug_vars['userclass']['@attributes'];
|
||||||
|
unset($plug_vars['userclass']['@attributes']);
|
||||||
|
}
|
||||||
|
$spacer = '';
|
||||||
|
foreach ($plug_vars['userclass'] as $uc)
|
||||||
|
{
|
||||||
|
$userclasses .= $spacer.$uc['@attributes']['name'].' - '.$uc['@attributes']['description'];
|
||||||
|
$spacer = '<br />';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (isset($plug_vars['extendedField']))
|
||||||
|
{
|
||||||
|
if (isset($plug_vars['extendedField']['@attributes']))
|
||||||
|
{
|
||||||
|
$plug_vars['extendedField'][0]['@attributes'] = $plug_vars['extendedField']['@attributes'];
|
||||||
|
unset($plug_vars['extendedField']['@attributes']);
|
||||||
|
}
|
||||||
|
$spacer = '';
|
||||||
|
foreach ($plug_vars['extendedField'] as $eu)
|
||||||
|
{
|
||||||
|
$eufields .= $spacer.'plugin_'.$plug_vars['folder'].'_'.$eu['@attributes']['name'];
|
||||||
|
$spacer = '<br />';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(is_writable(e_PLUGIN.$plug['plugin_path']))
|
if(is_writable(e_PLUGIN.$plug['plugin_path']))
|
||||||
@@ -658,6 +698,10 @@ function show_uninstall_confirm()
|
|||||||
$text = "
|
$text = "
|
||||||
<form action='".e_SELF."?".e_QUERY."' method='post'>
|
<form action='".e_SELF."?".e_QUERY."' method='post'>
|
||||||
<table style='".ADMIN_WIDTH."' class='fborder'>
|
<table style='".ADMIN_WIDTH."' class='fborder'>
|
||||||
|
<colgroup>
|
||||||
|
<col style='width:75%' />
|
||||||
|
<col style='width:25%' />
|
||||||
|
</colgroup>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan='2' class='forumheader'>".EPL_ADLAN_54." ".$tp->toHtml($plug_vars['name'], "", "defs,emotes_off, no_make_clickable")."</td>
|
<td colspan='2' class='forumheader'>".EPL_ADLAN_54." ".$tp->toHtml($plug_vars['name'], "", "defs,emotes_off, no_make_clickable")."</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -666,7 +710,7 @@ function show_uninstall_confirm()
|
|||||||
<td class='forumheader3'>".LAN_YES."</td>
|
<td class='forumheader3'>".LAN_YES."</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class='forumheader3' style='width:75%'>
|
<td class='forumheader3'>
|
||||||
".EPL_ADLAN_57."<div class='smalltext'>".EPL_ADLAN_58."</div>
|
".EPL_ADLAN_57."<div class='smalltext'>".EPL_ADLAN_58."</div>
|
||||||
</td>
|
</td>
|
||||||
<td class='forumheader3'>
|
<td class='forumheader3'>
|
||||||
@@ -675,8 +719,39 @@ function show_uninstall_confirm()
|
|||||||
<option value='0'>".LAN_NO."</option>
|
<option value='0'>".LAN_NO."</option>
|
||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>";
|
||||||
<tr>
|
|
||||||
|
if ($userclasses)
|
||||||
|
{
|
||||||
|
$text .= " <tr>
|
||||||
|
<td class='forumheader3'>
|
||||||
|
".EPL_ADLAN_78."<div class='indent'>".$userclasses."</div><div class='smalltext'>".EPL_ADLAN_79."</div>
|
||||||
|
</td>
|
||||||
|
<td class='forumheader3'>
|
||||||
|
<select class='tbox' name='delete_userclasses'>
|
||||||
|
<option value='1'>".LAN_YES."</option>
|
||||||
|
<option value='0'>".LAN_NO."</option>
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
|
</tr>";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($eufields)
|
||||||
|
{
|
||||||
|
$text .= " <tr>
|
||||||
|
<td class='forumheader3'>
|
||||||
|
".EPL_ADLAN_80."<div class='indent'>".$eufields."</div><div class='smalltext'>".EPL_ADLAN_79."</div>
|
||||||
|
</td>
|
||||||
|
<td class='forumheader3'>
|
||||||
|
<select class='tbox' name='delete_xfields'>
|
||||||
|
<option value='1'>".LAN_YES."</option>
|
||||||
|
<option value='0'>".LAN_NO."</option>
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
|
</tr>";
|
||||||
|
}
|
||||||
|
|
||||||
|
$text .="<tr>
|
||||||
<td class='forumheader3'>".EPL_ADLAN_59."<div class='smalltext'>".EPL_ADLAN_60."</div></td>
|
<td class='forumheader3'>".EPL_ADLAN_59."<div class='smalltext'>".EPL_ADLAN_60."</div></td>
|
||||||
<td class='forumheader3'>{$del_text}</td>
|
<td class='forumheader3'>{$del_text}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@@ -11,8 +11,8 @@
|
|||||||
| GNU General Public License (http://gnu.org).
|
| GNU General Public License (http://gnu.org).
|
||||||
|
|
|
|
||||||
| $Source: /cvs_backup/e107_0.8/e107_handlers/plugin_class.php,v $
|
| $Source: /cvs_backup/e107_0.8/e107_handlers/plugin_class.php,v $
|
||||||
| $Revision: 1.63 $
|
| $Revision: 1.64 $
|
||||||
| $Date: 2008-12-30 09:44:17 $
|
| $Date: 2008-12-30 19:01:09 $
|
||||||
| $Author: e107steved $
|
| $Author: e107steved $
|
||||||
+----------------------------------------------------------------------------+
|
+----------------------------------------------------------------------------+
|
||||||
*/
|
*/
|
||||||
@@ -340,7 +340,6 @@ class e107plugin
|
|||||||
if ($action == 'remove')
|
if ($action == 'remove')
|
||||||
{
|
{
|
||||||
$classID = $e107->user_class->ucGetClassIDFromName($class_name);
|
$classID = $e107->user_class->ucGetClassIDFromName($class_name);
|
||||||
echo "Class ID: {$classID}, name: {$class_name}<br />";
|
|
||||||
if (($classID !== FALSE)
|
if (($classID !== FALSE)
|
||||||
&& ($e107->user_class->deleteClassAndUsers($classID) === TRUE))
|
&& ($e107->user_class->deleteClassAndUsers($classID) === TRUE))
|
||||||
{
|
{
|
||||||
@@ -722,7 +721,11 @@ class e107plugin
|
|||||||
// 'upgrade'
|
// 'upgrade'
|
||||||
// 'uninstall'
|
// 'uninstall'
|
||||||
// 'refresh' - adds things that are missing, but doesn't change any existing settings
|
// 'refresh' - adds things that are missing, but doesn't change any existing settings
|
||||||
function manage_plugin_xml($id, $function='')
|
// $options is an array of possible options - ATM used only for uninstall:
|
||||||
|
// 'del_userclasses' - to delete userclasses created
|
||||||
|
// 'del_tables' - to delete DB tables
|
||||||
|
// 'del_extended' - to delete extended fields
|
||||||
|
function manage_plugin_xml($id, $function='', $options = FALSE)
|
||||||
{
|
{
|
||||||
global $sql, $pref;
|
global $sql, $pref;
|
||||||
|
|
||||||
@@ -877,8 +880,15 @@ class e107plugin
|
|||||||
case 'refresh' : // Leave things alone
|
case 'refresh' : // Leave things alone
|
||||||
break;
|
break;
|
||||||
case 'uninstall' :
|
case 'uninstall' :
|
||||||
$txt .= "Removing table {$ct[1]} <br />";
|
if (varsettrue($options['del_tables'], FALSE))
|
||||||
$this->manage_tables('remove', array($ct[1])); // Delete the table
|
{
|
||||||
|
$txt .= "Removing table {$ct[1]} <br />";
|
||||||
|
$this->manage_tables('remove', array($ct[1])); // Delete the table
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$txt .= "Table {$ct[1]} left in place<br />";
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1008,8 +1018,15 @@ class e107plugin
|
|||||||
|
|
||||||
//If uninstalling, remove all userclasses (active or inactive)
|
//If uninstalling, remove all userclasses (active or inactive)
|
||||||
case 'uninstall':
|
case 'uninstall':
|
||||||
$txt .= 'Removing userclass '.$attrib['name'].'<br />';
|
if (varsettrue($options['del_userclasses'], FALSE))
|
||||||
$this->manage_userclass('remove', $attrib['name'], $attrib['description']);
|
{
|
||||||
|
$txt .= 'Removing userclass '.$attrib['name'].'<br />';
|
||||||
|
$this->manage_userclass('remove', $attrib['name'], $attrib['description']);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$txt .= 'userclass '.$attrib['name'].' left in place<br />';
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1049,11 +1066,17 @@ class e107plugin
|
|||||||
|
|
||||||
//If uninstalling, remove all extended fields (active or inactive)
|
//If uninstalling, remove all extended fields (active or inactive)
|
||||||
case 'uninstall':
|
case 'uninstall':
|
||||||
$txt .= 'Removing extended field: '.$attrib['name'].' ... ';
|
if (varsettrue($options['del_extended'], FALSE))
|
||||||
$result = $this->manage_extended_field('remove', $attrib['name'], $source);
|
{
|
||||||
$txt .= ($result ? LAN_DELETED : LAN_DELETED_FAILED).'<br />';
|
$txt .= 'Removing extended field: '.$attrib['name'].' ... ';
|
||||||
|
$result = $this->manage_extended_field('remove', $attrib['name'], $source);
|
||||||
break;
|
$txt .= ($result ? LAN_DELETED : LAN_DELETED_FAILED).'<br />';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$txt .= 'Extended field: '.$attrib['name'].' left in place<br />';
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -4,8 +4,8 @@
|
|||||||
| e107 website system - Language File.
|
| e107 website system - Language File.
|
||||||
|
|
|
|
||||||
| $Source: /cvs_backup/e107_0.8/e107_languages/English/admin/lan_plugin.php,v $
|
| $Source: /cvs_backup/e107_0.8/e107_languages/English/admin/lan_plugin.php,v $
|
||||||
| $Revision: 1.7 $
|
| $Revision: 1.8 $
|
||||||
| $Date: 2008-11-23 20:47:55 $
|
| $Date: 2008-12-30 19:01:17 $
|
||||||
| $Author: e107steved $
|
| $Author: e107steved $
|
||||||
+----------------------------------------------------------------------------+
|
+----------------------------------------------------------------------------+
|
||||||
*/
|
*/
|
||||||
@@ -74,7 +74,7 @@ define("EPL_UPGRADE", "Upgrade");
|
|||||||
define("EPL_ADLAN_50", "Comments successfully deleted");
|
define("EPL_ADLAN_50", "Comments successfully deleted");
|
||||||
|
|
||||||
define("EPL_ADLAN_53", "Directory not writable");
|
define("EPL_ADLAN_53", "Directory not writable");
|
||||||
define("EPL_ADLAN_54", "Please select the option for uninstalling the plugin:");
|
define("EPL_ADLAN_54", "Please select the options for uninstalling the plugin:");
|
||||||
define("EPL_ADLAN_55", "Uninstall plugin");
|
define("EPL_ADLAN_55", "Uninstall plugin");
|
||||||
|
|
||||||
define("EPL_ADLAN_57", "Delete plugin tables");
|
define("EPL_ADLAN_57", "Delete plugin tables");
|
||||||
@@ -94,9 +94,14 @@ define ('EPL_ADLAN_74','Newer PHP version required: ');
|
|||||||
define ('EPL_ADLAN_75','Newer MySQL version required: ');
|
define ('EPL_ADLAN_75','Newer MySQL version required: ');
|
||||||
define ('EPL_ADLAN_76','Error in plugin.xml');
|
define ('EPL_ADLAN_76','Error in plugin.xml');
|
||||||
define ('EPL_ADLAN_77','Cannot find plugin.xml');
|
define ('EPL_ADLAN_77','Cannot find plugin.xml');
|
||||||
define ('EPL_ADLAN_78','');
|
define ('EPL_ADLAN_78','Delete User Classes created by plugin:');
|
||||||
define ('EPL_ADLAN_79','');
|
define ('EPL_ADLAN_79','Only delete these if you have not used them for other purposes.');
|
||||||
define ('EPL_ADLAN_80','');
|
define ('EPL_ADLAN_80','Delete extended user fields created by plugin:');
|
||||||
|
define ('EPL_ADLAN_81','');
|
||||||
|
define ('EPL_ADLAN_82','');
|
||||||
|
define ('EPL_ADLAN_83','');
|
||||||
|
define ('EPL_ADLAN_84','');
|
||||||
|
define ('EPL_ADLAN_85','');
|
||||||
|
|
||||||
|
|
||||||
define('LAN_UPGRADE_SUCCESSFUL', 'Upgrade Successful');
|
define('LAN_UPGRADE_SUCCESSFUL', 'Upgrade Successful');
|
||||||
|
Reference in New Issue
Block a user