1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-01 04:10:38 +02:00

Bugtracker #3961 - uninstall plugin from sitelinks by URL comparison

This commit is contained in:
e107steved
2007-05-30 20:35:44 +00:00
parent fc5755f0be
commit 64c294e7a2
2 changed files with 23 additions and 17 deletions

View File

@@ -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.6 $ | $Revision: 1.7 $
| $Date: 2007-05-07 13:38:28 $ | $Date: 2007-05-30 20:35:44 $
| $Author: e107steved $ | $Author: e107steved $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
@@ -218,7 +218,7 @@ if ($action == 'uninstall')
} }
if ($eplug_link) { if ($eplug_link) {
$plugin->manage_link('remove', '', $eplug_link_name); $plugin->manage_link('remove', $eplug_link_url, $eplug_link_name);
} }
if ($eplug_userclass) { if ($eplug_userclass) {

View File

@@ -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.7 $ | $Revision: 1.8 $
| $Date: 2007-05-07 13:38:28 $ | $Date: 2007-05-30 20:35:44 $
| $Author: e107steved $ | $Author: e107steved $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
@@ -53,8 +53,8 @@ class e107plugin
'upgrade_remove_prefs', 'upgrade_remove_prefs',
'upgrade_add_user_prefs', 'upgrade_add_user_prefs',
'upgrade_remove_user_prefs', 'upgrade_remove_user_prefs',
'upgrade_add_array_pref', // missing 'upgrade_add_array_pref',
'upgrade_remove_array_pref' // missing 'upgrade_remove_array_pref'
); );
/** /**
@@ -64,6 +64,7 @@ class e107plugin
*/ */
function getall($flag) function getall($flag)
{ {
global $sql; global $sql;
if ($sql->db_Select("plugin","*","plugin_installflag = '".intval($flag)."' ORDER BY plugin_path ASC")) if ($sql->db_Select("plugin","*","plugin_installflag = '".intval($flag)."' ORDER BY plugin_path ASC"))
{ {
@@ -222,8 +223,9 @@ class e107plugin
global $sql, $tp; global $sql, $tp;
$link_url = $tp -> toDB($link_url, true); $link_url = $tp -> toDB($link_url, true);
$link_name = $tp -> toDB($link_name, true); $link_name = $tp -> toDB($link_name, true);
if ($action == 'add') { $path = str_replace("../", "", $link_url);
$path = str_replace("../", "", $link_url); if ($action == 'add')
{
$link_t = $sql->db_Count('links'); $link_t = $sql->db_Count('links');
if (!$sql->db_Count('links', '(*)', "link_name = '{$link_name}'")) { if (!$sql->db_Count('links', '(*)', "link_name = '{$link_name}'")) {
return $sql->db_Insert('links', "0, '{$link_name}', '{$path}', '', '', '1', '".($link_t + 1)."', '0', '0', '{$link_class}' "); return $sql->db_Insert('links', "0, '{$link_name}', '{$path}', '', '', '1', '".($link_t + 1)."', '0', '0', '{$link_class}' ");
@@ -231,12 +233,15 @@ class e107plugin
return FALSE; return FALSE;
} }
} }
if ($action == 'remove') { if ($action == 'remove')
if ($sql->db_Select('links', 'link_order', "link_name = '{$link_name}'")) { { // Look up by URL if we can - should be more reliable. Otherwise try looking up by name (as previously)
$row = $sql->db_Fetch(); if (($path && $sql->db_Select('links', 'link_id,link_order', "link_url = '{$path}'")) ||
$sql->db_Update('links', "link_order = link_order - 1 WHERE link_order > {$row['link_order']}"); $sql->db_Select('links', 'link_id,link_order', "link_name = '{$link_name}'"))
return $sql->db_Delete('links', "link_name = '{$link_name}'"); {
} $row = $sql->db_Fetch();
$sql->db_Update('links', "link_order = link_order - 1 WHERE link_order > {$row['link_order']}");
return $sql->db_Delete('links', "link_id = '{$row['link_id']}'");
}
} }
} }
@@ -428,7 +433,8 @@ class e107plugin
* *
* @param int $id * @param int $id
*/ */
function install_plugin($id) { function install_plugin($id)
{
global $sql, $ns, $sysprefs,$mySQLprefix, $tp; global $sql, $ns, $sysprefs,$mySQLprefix, $tp;
// install plugin ... // install plugin ...
@@ -521,7 +527,7 @@ class e107plugin
$pref['plug_installed'][$plugin_path] = $plug['plugin_version']; $pref['plug_installed'][$plugin_path] = $plug['plugin_version'];
save_prefs(); save_prefs();
if($rssmess){ $text .= $rssmess; } if($rssmess) { $text .= $rssmess; }
$text .= (isset($eplug_done) ? "<br />{$eplug_done}" : "<br />".LAN_INSTALL_SUCCESSFUL); $text .= (isset($eplug_done) ? "<br />{$eplug_done}" : "<br />".LAN_INSTALL_SUCCESSFUL);
} else { } else {
$text = EPL_ADLAN_21; $text = EPL_ADLAN_21;