1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-17 20:58:30 +01:00

Hard-coded LAN, simplify detection of installed plugins

This commit is contained in:
e107steved 2007-05-07 13:38:34 +00:00
parent 3becfaa636
commit cebc56900b
3 changed files with 51 additions and 16 deletions

View File

@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_admin/plugin.php,v $
| $Revision: 1.5 $
| $Date: 2007-02-04 21:42:48 $
| $Revision: 1.6 $
| $Date: 2007-05-07 13:38:28 $
| $Author: e107steved $
+----------------------------------------------------------------------------+
*/
@ -124,7 +124,8 @@ if ($action == 'uninstall')
$id = intval($id);
$plug = $plugin->getinfo($id);
//Uninstall Plugin
if ($plug['plugin_installflag'] == TRUE ) {
if ($plug['plugin_installflag'] == TRUE )
{
include(e_PLUGIN.$plug['plugin_path'].'/plugin.php');
$func = $eplug_folder.'_uninstall';
@ -149,7 +150,7 @@ if ($action == 'uninstall')
}
else
{
$text .= "Tables not deleted during uninstall process by request<br />";
$text .= EPL_ADLAN_49."<br />";
}
if (is_array($eplug_prefs)) {
@ -229,6 +230,12 @@ if ($action == 'uninstall')
$plugin -> manage_notify('remove', $eplug_folder);
$sql->db_Update('plugin', "plugin_installflag=0, plugin_version='{$eplug_version}' WHERE plugin_id='{$id}' ");
if (isset($pref['plug_installed'][$plug['plugin_path']]))
{
unset($pref['plug_installed'][$plug['plugin_path']]);
save_prefs();
}
if($_POST['delete_files'])
{
@ -371,6 +378,8 @@ if ($action == 'upgrade') {
$text .= (isset($eplug_upgrade_done)) ? '<br />'.$eplug_upgrade_done : "<br />".LAN_UPGRADE_SUCCESSFUL;
$sql->db_Update('plugin', "plugin_version ='{$eplug_version}', plugin_addons='{$eplug_addons}' WHERE plugin_id='$id' ");
$pref['plug_installed'][$plug['plugin_path']] = $eplug_version; // Update the version
save_prefs();
$ns->tablerender(EPL_ADLAN_34, $text);
$plugin -> save_addon_prefs();

View File

@ -11,9 +11,9 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_handlers/plugin_class.php,v $
| $Revision: 1.6 $
| $Date: 2007-03-27 13:48:30 $
| $Author: lisa_ $
| $Revision: 1.7 $
| $Date: 2007-05-07 13:38:28 $
| $Author: e107steved $
+----------------------------------------------------------------------------+
*/
@ -58,7 +58,8 @@ class e107plugin
);
/**
* Returns an array containing details of all plugins in the plugin table - should noramlly use e107plugin::update_plugins_table() first to make sure the table is up to date.
* Returns an array containing details of all plugins in the plugin table - should normally use e107plugin::update_plugins_table() first to
* make sure the table is up to date. (Primarily called from plugin manager to get lists of installed and uninstalled plugins.
* @return array plugin details
*/
function getall($flag)
@ -77,12 +78,13 @@ class e107plugin
*/
function update_plugins_table()
{
global $sql, $sql2, $mySQLprefix, $menu_pref, $tp;
global $sql, $sql2, $mySQLprefix, $menu_pref, $tp, $pref;
require_once(e_HANDLER.'file_class.php');
$fl = new e_file;
$pluginList = $fl->get_files(e_PLUGIN, "^plugin\.php$", "standard", 1);
$sp = FALSE;
// Get rid of any variables previously defined which may occur in plugin.php
foreach($pluginList as $p)
@ -98,6 +100,7 @@ class e107plugin
// We have to include here to set the variables, otherwise we only get uninstalled plugins
// Would be nice to eval() the file contents to pick up errors better, but too many path issues
$plug['plug_action'] = 'scan'; // Make sure plugin.php knows what we're up to
include("{$p['path']}{$p['fname']}");
$plugin_path = substr(str_replace(e_PLUGIN,"",$p['path']),0,-1);
@ -121,6 +124,19 @@ class e107plugin
// If plugin not installed, and version number of files changed, update version as well
if (($ep_row['plugin_installflag'] == 0) && ($ep_row['plugin_version'] != $eplug_version)) $ep_update = ", plugin_version = '{$eplug_version}' ";
$sql->db_Update("plugin", "plugin_addons = '{$eplug_addons}'{$ep_update} WHERE plugin_path = '$plugin_path'");
if (($ep_row['plugin_installflag'] != 0) && (!isset($pref['plug_installed'][$plugin_path]) || ($pref['plug_installed'][$plugin_path] != $ep_row['plugin_version'])))
{
$pref['plug_installed'][$plugin_path] = $ep_row['plugin_version'];
// echo "Add: ".$plugin_path."->".$ep_row['plugin_version']."<br />";
$sp = TRUE;
}
elseif (($ep_row['plugin_installflag'] == 0) && isset($pref['plug_installed'][$plugin_path]))
{
unset($pref['plug_installed'][$plugin_path]);
// echo "Remove: ".$plugin_path."->".$ep_row['plugin_version']."<br />";
$sp = TRUE;
}
unset($ep_row, $ep_update);
}
@ -144,8 +160,11 @@ class e107plugin
$sql2->db_Delete('plugin', "plugin_path = '{$row['plugin_path']}'");
}
}
if ($sp) save_prefs();
}
/**
* Returns deatils of a plugin from the plugin table from it's ID
*
@ -414,6 +433,7 @@ class e107plugin
// install plugin ...
$plug = $this->getinfo($id);
$plug['plug_action'] = 'install';
if ($plug['plugin_installflag'] == FALSE) {
include_once(e_PLUGIN.$plug['plugin_path'].'/plugin.php');
@ -479,6 +499,7 @@ class e107plugin
$plug_perm['everyone'] = e_UC_PUBLIC;
$plug_perm['guest'] = e_UC_GUEST;
$plug_perm['member'] = e_UC_MEMBER;
$plug_perm['mainadmin'] = e_UC_MAINADMIN;
$plug_perm['admin'] = e_UC_ADMIN;
$plug_perm['nobody'] = e_UC_NOBODY;
$eplug_link_perms = strtolower($eplug_link_perms);
@ -497,6 +518,9 @@ class e107plugin
$eplug_addons = $this->getAddons($eplug_folder);
$sql->db_Update('plugin', "plugin_installflag = 1, plugin_addons = '{$eplug_addons}' WHERE plugin_id = '".intval($id)."'");
$pref['plug_installed'][$plugin_path] = $plug['plugin_version'];
save_prefs();
if($rssmess){ $text .= $rssmess; }
$text .= (isset($eplug_done) ? "<br />{$eplug_done}" : "<br />".LAN_INSTALL_SUCCESSFUL);
} else {
@ -567,17 +591,18 @@ class e107plugin
}
else
{
unset($pref['bbcode_list'][$path]);
if (isset($pref['bbcode_list'][$path])) unset($pref['bbcode_list'][$path]);
}
// Build shortcode list
if(count($sc_array) > 0){
ksort($sc_array);
$pref['shortcode_list'][$path] = $sc_array;
if(count($sc_array) > 0)
{
ksort($sc_array);
$pref['shortcode_list'][$path] = $sc_array;
}
else
{
unset($pref['shortcode_list'][$path]);
if(isset($pref['shortcode_list'][$path])) unset($pref['shortcode_list'][$path]);
}
}

View File

@ -4,8 +4,8 @@
| e107 website system - Language File.
|
| $Source: /cvs_backup/e107_0.8/e107_languages/English/admin/lan_plugin.php,v $
| $Revision: 1.2 $
| $Date: 2007-02-04 21:42:55 $
| $Revision: 1.3 $
| $Date: 2007-05-07 13:38:34 $
| $Author: e107steved $
+----------------------------------------------------------------------------+
*/
@ -60,6 +60,7 @@ define("EPL_ADLAN_45", "Your menu item has been uploaded and unzipped, to activa
define("EPL_ADLAN_46", "PCLZIP extract error:");
define("EPL_ADLAN_47", "PCLTAR extract error: ");
define("EPL_ADLAN_48", "code:");
define('EPL_ADLAN_49', "Tables not deleted during uninstall process by request");
// define("EPL_CANCEL", "Cancel"); use LAN_CANCEL instead !!
// define("EPL_EMAIL", "email");