1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-04 21:57:51 +02:00

Beginning support for plugin.xml files to replace plugin.php files

This commit is contained in:
mcfly
2008-01-26 04:47:27 +00:00
parent c37a317af2
commit 86a1606e1d
4 changed files with 367 additions and 167 deletions

View File

@@ -11,9 +11,9 @@
| 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.7 $ | $Revision: 1.8 $
| $Date: 2007-05-30 20:35:44 $ | $Date: 2008-01-26 04:47:27 $
| $Author: e107steved $ | $Author: mcfly_e107 $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
@@ -32,17 +32,22 @@ $tmp = explode('.', e_QUERY);
$action = $tmp[0]; $action = $tmp[0];
$id = intval($tmp[1]); $id = intval($tmp[1]);
if (isset($_POST['upload'])) { if (isset($_POST['upload']))
if (!$_POST['ac'] == md5(ADMINPWCHANGE)) { {
if (!$_POST['ac'] == md5(ADMINPWCHANGE))
{
exit; exit;
} }
extract($_FILES); extract($_FILES);
/* check if e_PLUGIN dir is writable ... */ /* check if e_PLUGIN dir is writable ... */
if(!is_writable(e_PLUGIN)) { if(!is_writable(e_PLUGIN))
{
/* still not writable - spawn error message */ /* still not writable - spawn error message */
$ns->tablerender(EPL_ADLAN_40, EPL_ADLAN_39); $ns->tablerender(EPL_ADLAN_40, EPL_ADLAN_39);
} else { }
else
{
/* e_PLUGIN is writable - continue */ /* e_PLUGIN is writable - continue */
$pref['upload_storagetype'] = "1"; $pref['upload_storagetype'] = "1";
require_once(e_HANDLER."upload_handler.php"); require_once(e_HANDLER."upload_handler.php");
@@ -50,18 +55,24 @@ if (isset($_POST['upload'])) {
$fileSize = $file_userfile['size'][0]; $fileSize = $file_userfile['size'][0];
$fileType = $file_userfile['type'][0]; $fileType = $file_userfile['type'][0];
if(strstr($file_userfile['type'][0], "gzip")) { if(strstr($file_userfile['type'][0], "gzip"))
{
$fileType = "tar"; $fileType = "tar";
} else if (strstr($file_userfile['type'][0], "zip")) { }
else if (strstr($file_userfile['type'][0], "zip"))
{
$fileType = "zip"; $fileType = "zip";
} else { }
else
{
/* not zip or tar - spawn error message */ /* not zip or tar - spawn error message */
$ns->tablerender(EPL_ADLAN_40, EPL_ADLAN_41); $ns->tablerender(EPL_ADLAN_40, EPL_ADLAN_41);
require_once("footer.php"); require_once("footer.php");
exit; exit;
} }
if ($fileSize) { if ($fileSize)
{
$opref = $pref['upload_storagetype']; $opref = $pref['upload_storagetype'];
$pref['upload_storagetype'] = 1; /* temporarily set upload type pref to flatfile */ $pref['upload_storagetype'] = 1; /* temporarily set upload type pref to flatfile */
@@ -72,20 +83,27 @@ if (isset($_POST['upload'])) {
/* attempt to unarchive ... */ /* attempt to unarchive ... */
if($fileType == "zip") { if($fileType == "zip")
{
require_once(e_HANDLER."pclzip.lib.php"); require_once(e_HANDLER."pclzip.lib.php");
$archive = new PclZip(e_PLUGIN.$archiveName); $archive = new PclZip(e_PLUGIN.$archiveName);
$unarc = ($fileList = $archive -> extract(PCLZIP_OPT_PATH, e_PLUGIN, PCLZIP_OPT_SET_CHMOD, 0666)); $unarc = ($fileList = $archive -> extract(PCLZIP_OPT_PATH, e_PLUGIN, PCLZIP_OPT_SET_CHMOD, 0666));
} else { }
else
{
require_once(e_HANDLER."pcltar.lib.php"); require_once(e_HANDLER."pcltar.lib.php");
$unarc = ($fileList = PclTarExtract($archiveName, e_PLUGIN)); $unarc = ($fileList = PclTarExtract($archiveName, e_PLUGIN));
} }
if(!$unarc) { if(!$unarc)
{
/* unarc failed ... */ /* unarc failed ... */
if($fileType == "zip") { if($fileType == "zip")
{
$error = EPL_ADLAN_46." '".$archive -> errorName(TRUE)."'"; $error = EPL_ADLAN_46." '".$archive -> errorName(TRUE)."'";
} else { }
else
{
$error = EPL_ADLAN_47.PclErrorString().", ".EPL_ADLAN_48.intval(PclErrorCode()); $error = EPL_ADLAN_47.PclErrorString().", ".EPL_ADLAN_48.intval(PclErrorCode());
} }
$ns->tablerender(EPL_ADLAN_40, EPL_ADLAN_42." ".$archiveName." ".$error); $ns->tablerender(EPL_ADLAN_40, EPL_ADLAN_42." ".$archiveName." ".$error);
@@ -98,10 +116,13 @@ if (isset($_POST['upload'])) {
/* get folder name ... */ /* get folder name ... */
$folderName = substr($fileList[0]['stored_filename'], 0, (strpos($fileList[0]['stored_filename'], "/"))); $folderName = substr($fileList[0]['stored_filename'], 0, (strpos($fileList[0]['stored_filename'], "/")));
if(file_exists(e_PLUGIN.$folderName."/plugin.php")) { if(file_exists(e_PLUGIN.$folderName."/plugin.php") || file_exists(e_PLUGIN.$folderName."/plugin.xml"))
{
/* upload is a plugin */ /* upload is a plugin */
$ns->tablerender(EPL_ADLAN_40, EPL_ADLAN_43); $ns->tablerender(EPL_ADLAN_40, EPL_ADLAN_43);
} else { }
else
{
/* upload is a menu */ /* upload is a menu */
$ns->tablerender(EPL_ADLAN_40, EPL_ADLAN_45); $ns->tablerender(EPL_ADLAN_40, EPL_ADLAN_45);
} }
@@ -124,12 +145,13 @@ if ($action == 'uninstall')
$id = intval($id); $id = intval($id);
$plug = $plugin->getinfo($id); $plug = $plugin->getinfo($id);
//Uninstall Plugin //Uninstall Plugin
if ($plug['plugin_installflag'] == TRUE ) if ($plug['plugin_installflag'] == TRUE )
{ {
include(e_PLUGIN.$plug['plugin_path'].'/plugin.php'); include(e_PLUGIN.$plug['plugin_path'].'/plugin.php');
$func = $eplug_folder.'_uninstall'; $func = $eplug_folder.'_uninstall';
if (function_exists($func)) { if (function_exists($func))
{
$text .= call_user_func($func); $text .= call_user_func($func);
} }
@@ -153,25 +175,30 @@ if ($action == 'uninstall')
$text .= EPL_ADLAN_49."<br />"; $text .= EPL_ADLAN_49."<br />";
} }
if (is_array($eplug_prefs)) { if (is_array($eplug_prefs))
{
$plugin->manage_prefs('remove', $eplug_prefs); $plugin->manage_prefs('remove', $eplug_prefs);
$text .= EPL_ADLAN_29."<br />"; $text .= EPL_ADLAN_29."<br />";
} }
if (is_array($eplug_comment_ids)) { if (is_array($eplug_comment_ids))
{
$text .= ($plugin->manage_comments('remove', $eplug_comment_ids)) ? EPL_ADLAN_50."<br />" : ""; $text .= ($plugin->manage_comments('remove', $eplug_comment_ids)) ? EPL_ADLAN_50."<br />" : "";
} }
if ($eplug_module) { if ($eplug_module)
{
$plugin->manage_plugin_prefs('remove', 'modules', $eplug_folder); $plugin->manage_plugin_prefs('remove', 'modules', $eplug_folder);
} }
if ($eplug_status) { if ($eplug_status)
{
$plugin->manage_plugin_prefs('remove', 'plug_status', $eplug_folder); $plugin->manage_plugin_prefs('remove', 'plug_status', $eplug_folder);
} }
if ($eplug_latest) { if ($eplug_latest)
{
$plugin->manage_plugin_prefs('remove', 'plug_latest', $eplug_folder); $plugin->manage_plugin_prefs('remove', 'plug_latest', $eplug_folder);
} }
@@ -195,33 +222,41 @@ if ($action == 'uninstall')
$plugin->manage_plugin_prefs('remove', 'plug_bb', $eplug_folder, $eplug_bb); $plugin->manage_plugin_prefs('remove', 'plug_bb', $eplug_folder, $eplug_bb);
} }
if (is_array($eplug_user_prefs)) { if (is_array($eplug_user_prefs))
{
if (!is_object($sql)){ $sql = new db; } if (!is_object($sql)){ $sql = new db; }
$sql->db_Select("core", " e107_value", " e107_name='user_entended'"); $sql->db_Select("core", " e107_value", " e107_name='user_entended'");
$row = $sql->db_Fetch(); $row = $sql->db_Fetch();
$user_entended = unserialize($row[0]); $user_entended = unserialize($row[0]);
$user_entended = array_values(array_diff($user_entended, array_keys($eplug_user_prefs))); $user_entended = array_values(array_diff($user_entended, array_keys($eplug_user_prefs)));
if ($user_entended == NULL) { if ($user_entended == NULL)
{
$sql->db_Delete("core", "e107_name='user_entended'"); $sql->db_Delete("core", "e107_name='user_entended'");
} else { }
else
{
$tmp = addslashes(serialize($user_entended)); $tmp = addslashes(serialize($user_entended));
$sql->db_Update("core", "e107_value='$tmp' WHERE e107_name='user_entended' "); $sql->db_Update("core", "e107_value='$tmp' WHERE e107_name='user_entended' ");
} }
while (list($key, $e_user_pref) = each($eplug_user_prefs)) { while (list($key, $e_user_pref) = each($eplug_user_prefs))
{
unset($user_pref[$key]); unset($user_pref[$key]);
} }
save_prefs("user"); save_prefs("user");
} }
if ($eplug_menu_name) { if ($eplug_menu_name)
{
$sql->db_Delete('menus', "menu_name='$eplug_menu_name' "); $sql->db_Delete('menus', "menu_name='$eplug_menu_name' ");
} }
if ($eplug_link) { if ($eplug_link)
{
$plugin->manage_link('remove', $eplug_link_url, $eplug_link_name); $plugin->manage_link('remove', $eplug_link_url, $eplug_link_name);
} }
if ($eplug_userclass) { if ($eplug_userclass)
{
$plugin->manage_userclass('remove', $eplug_userclass); $plugin->manage_userclass('remove', $eplug_userclass);
} }
@@ -232,8 +267,8 @@ if ($action == 'uninstall')
$sql->db_Update('plugin', "plugin_installflag=0, plugin_version='{$eplug_version}' WHERE plugin_id='{$id}' "); $sql->db_Update('plugin', "plugin_installflag=0, plugin_version='{$eplug_version}' WHERE plugin_id='{$id}' ");
if (isset($pref['plug_installed'][$plug['plugin_path']])) if (isset($pref['plug_installed'][$plug['plugin_path']]))
{ {
unset($pref['plug_installed'][$plug['plugin_path']]); unset($pref['plug_installed'][$plug['plugin_path']]);
save_prefs(); save_prefs();
} }
@@ -254,44 +289,60 @@ if ($action == 'uninstall')
} }
} }
if ($action == 'install') { if ($action == 'install')
{
$plugin->install_plugin(intval($id)); $plugin->install_plugin(intval($id));
$plugin ->save_addon_prefs(); $plugin ->save_addon_prefs();
} }
if ($action == 'upgrade') { if ($action == 'upgrade')
{
$plug = $plugin->getinfo($id); $plug = $plugin->getinfo($id);
include(e_PLUGIN.$plug['plugin_path'].'/plugin.php'); include(e_PLUGIN.$plug['plugin_path'].'/plugin.php');
$func = $eplug_folder.'_upgrade'; $func = $eplug_folder.'_upgrade';
if (function_exists($func)) { if (function_exists($func))
{
$text .= call_user_func($func); $text .= call_user_func($func);
} }
if (is_array($upgrade_alter_tables)) { if (is_array($upgrade_alter_tables))
{
$result = $plugin->manage_tables('upgrade', $upgrade_alter_tables); $result = $plugin->manage_tables('upgrade', $upgrade_alter_tables);
if (!$result) { if (!$result)
{
$text .= EPL_ADLAN_9.'<br />'; $text .= EPL_ADLAN_9.'<br />';
} else { }
else
{
$text .= EPL_ADLAN_7."<br />"; $text .= EPL_ADLAN_7."<br />";
} }
} }
if ($eplug_module) { if ($eplug_module)
{
$plugin->manage_plugin_prefs('add', 'modules', $eplug_folder); $plugin->manage_plugin_prefs('add', 'modules', $eplug_folder);
} else { }
else
{
$plugin->manage_plugin_prefs('remove', 'modules', $eplug_folder); $plugin->manage_plugin_prefs('remove', 'modules', $eplug_folder);
} }
if ($eplug_status) { if ($eplug_status)
{
$plugin->manage_plugin_prefs('add', 'plug_status', $eplug_folder); $plugin->manage_plugin_prefs('add', 'plug_status', $eplug_folder);
} else { }
else
{
$plugin->manage_plugin_prefs('remove', 'plug_status', $eplug_folder); $plugin->manage_plugin_prefs('remove', 'plug_status', $eplug_folder);
} }
if ($eplug_latest) { if ($eplug_latest)
{
$plugin->manage_plugin_prefs('add', 'plug_latest', $eplug_folder); $plugin->manage_plugin_prefs('add', 'plug_latest', $eplug_folder);
} else { }
else
{
$plugin->manage_plugin_prefs('remove', 'plug_latest', $eplug_folder); $plugin->manage_plugin_prefs('remove', 'plug_latest', $eplug_folder);
} }
@@ -315,57 +366,68 @@ if ($action == 'upgrade') {
$plugin->manage_plugin_prefs('remove', 'plug_bb', $eplug_folder, $eplug_bb); $plugin->manage_plugin_prefs('remove', 'plug_bb', $eplug_folder, $eplug_bb);
} }
if (is_array($upgrade_add_prefs)) { if (is_array($upgrade_add_prefs))
{
$plugin->manage_prefs('add', $upgrade_add_prefs); $plugin->manage_prefs('add', $upgrade_add_prefs);
$text .= EPL_ADLAN_8.'<br />'; $text .= EPL_ADLAN_8.'<br />';
} }
if (is_array($upgrade_remove_prefs)) { if (is_array($upgrade_remove_prefs))
{
$plugin->manage_prefs('remove', $upgrade_remove_prefs); $plugin->manage_prefs('remove', $upgrade_remove_prefs);
} }
if (is_array($upgrade_add_array_pref)) if (is_array($upgrade_add_array_pref))
{ {
foreach($upgrade_add_array_pref as $key => $val) foreach($upgrade_add_array_pref as $key => $val)
{ {
$plugin->manage_plugin_prefs('add', $key, $eplug_folder, $val); $plugin->manage_plugin_prefs('add', $key, $eplug_folder, $val);
} }
} }
if (is_array($upgrade_remove_array_pref)) if (is_array($upgrade_remove_array_pref))
{ {
foreach($upgrade_remove_array_pref as $key => $val) foreach($upgrade_remove_array_pref as $key => $val)
{ {
$plugin->manage_plugin_prefs('remove', $key, $eplug_folder, $val); $plugin->manage_plugin_prefs('remove', $key, $eplug_folder, $val);
} }
} }
if (is_array($upgrade_add_user_prefs)) { if (is_array($upgrade_add_user_prefs))
{
if (!is_object($sql)){ $sql = new db; } if (!is_object($sql)){ $sql = new db; }
$sql->db_Select("core", " e107_value", " e107_name='user_entended'"); $sql->db_Select("core", " e107_value", " e107_name='user_entended'");
$row = $sql->db_Fetch(); $row = $sql->db_Fetch();
$user_entended = unserialize($row[0]); $user_entended = unserialize($row[0]);
while (list($key, $e_user_pref) = each($eplug_user_prefs)) { while (list($key, $e_user_pref) = each($eplug_user_prefs))
{
$user_entended[] = $e_user_pref; $user_entended[] = $e_user_pref;
} }
$tmp = addslashes(serialize($user_entended)); $tmp = addslashes(serialize($user_entended));
if ($sql->db_Select("core", " e107_value", " e107_name='user_entended'")) { if ($sql->db_Select("core", " e107_value", " e107_name='user_entended'"))
{
$sql->db_Update("core", "e107_value='$tmp' WHERE e107_name='user_entended' "); $sql->db_Update("core", "e107_value='$tmp' WHERE e107_name='user_entended' ");
} else { }
else
{
$sql->db_Insert("core", "'user_entended', '$tmp' "); $sql->db_Insert("core", "'user_entended', '$tmp' ");
} }
$text .= EPL_ADLAN_8."<br />"; $text .= EPL_ADLAN_8."<br />";
} }
if (is_array($upgrade_remove_user_prefs)) { if (is_array($upgrade_remove_user_prefs))
if (!is_object($sql)){ $sql = new db; } {
if (!is_object($sql)){ $sql = new db; }
$sql->db_Select("core", " e107_value", " e107_name='user_entended'"); $sql->db_Select("core", " e107_value", " e107_name='user_entended'");
$row = $sql->db_Fetch(); $row = $sql->db_Fetch();
$user_entended = unserialize($row[0]); $user_entended = unserialize($row[0]);
$user_entended = array_values(array_diff($user_entended, $eplug_user_prefs)); $user_entended = array_values(array_diff($user_entended, $eplug_user_prefs));
if ($user_entended == NULL) { if ($user_entended == NULL)
{
$sql->db_Delete("core", "e107_name='user_entended'"); $sql->db_Delete("core", "e107_name='user_entended'");
} else { }
else
{
$tmp = addslashes(serialize($user_entended)); $tmp = addslashes(serialize($user_entended));
$sql->db_Update("core", "e107_value='$tmp' WHERE e107_name='user_entended' "); $sql->db_Update("core", "e107_value='$tmp' WHERE e107_name='user_entended' ");
} }
@@ -374,12 +436,12 @@ if ($action == 'upgrade') {
$plugin -> manage_search('upgrade', $eplug_folder); $plugin -> manage_search('upgrade', $eplug_folder);
$plugin -> manage_notify('upgrade', $eplug_folder); $plugin -> manage_notify('upgrade', $eplug_folder);
$eplug_addons = $plugin -> getAddons($eplug_folder); $eplug_addons = $plugin -> getAddons($eplug_folder);
$text .= (isset($eplug_upgrade_done)) ? '<br />'.$eplug_upgrade_done : "<br />".LAN_UPGRADE_SUCCESSFUL; $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' "); $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 $pref['plug_installed'][$plug['plugin_path']] = $eplug_version; // Update the version
save_prefs(); save_prefs();
$ns->tablerender(EPL_ADLAN_34, $text); $ns->tablerender(EPL_ADLAN_34, $text);
$plugin -> save_addon_prefs(); $plugin -> save_addon_prefs();
@@ -395,9 +457,12 @@ $plugin->update_plugins_table();
/* plugin upload form */ /* plugin upload form */
if(!is_writable(e_PLUGIN)) { if(!is_writable(e_PLUGIN))
{
$ns->tablerender(EPL_ADLAN_40, EPL_ADLAN_44); $ns->tablerender(EPL_ADLAN_40, EPL_ADLAN_44);
} else { }
else
{
$text = "<div style='text-align:center'> $text = "<div style='text-align:center'>
<form enctype='multipart/form-data' method='post' action='".e_SELF."'> <form enctype='multipart/form-data' method='post' action='".e_SELF."'>
<table style='".ADMIN_WIDTH."' class='fborder'> <table style='".ADMIN_WIDTH."' class='fborder'>
@@ -429,102 +494,116 @@ $text .= "<tr><td class='fcaption' colspan='3'>".EPL_ADLAN_23."</td></tr>";
$text .= render_plugs($uninstalled); $text .= render_plugs($uninstalled);
function render_plugs($pluginList){ function render_plugs($pluginList)
global $tp, $imode; {
global $tp, $imode, $plugin;
foreach($pluginList as $plug) { foreach($pluginList as $plug)
//Unset any possible eplug_ variables set by last plugin.php {
$defined_vars = array_keys(get_defined_vars()); $_path = e_PLUGIN.$plug['plugin_path'].'/';
foreach($defined_vars as $varname) { $plug_vars = $plugin->parse_plugin($_path);
if (substr($varname, 0, 6) == 'eplug_' || substr($varname, 0, 8) == 'upgrade_') {
unset($$varname); if($plug_vars)
{
if ($plug_vars['installRequired'])
{
$img = (!$plug['plugin_installflag'] ? "<img src='".e_IMAGE."packs/".$imode."/admin_images/uninstalled.png' alt='' />" : "<img src='".e_IMAGE."packs/".$imode."/admin_images/installed.png' alt='' />");
}
else
{
$img = "<img src='".e_IMAGE."packs/".$imode."/admin_images/noinstall.png' alt='' />";
} }
}
include(e_PLUGIN.$plug['plugin_path'].'/plugin.php'); if ($plug['plugin_version'] != $plug_vars['version'] && $plug['plugin_installflag'])
{
$img = "<img src='".e_IMAGE."packs/".$imode."/admin_images/upgrade.png' alt='' />";
}
if ($eplug_conffile || is_array($eplug_table_names) || is_array($eplug_prefs) || is_array($eplug_user_prefs) || is_array($eplug_sc) || is_array($eplug_bb) || $eplug_module || $eplug_userclass || $eplug_status || $eplug_latest) { $plugin_icon = $plug_vars['administration']['icon'] ? "<img src='".e_PLUGIN.$plug_vars['administration']['icon']."' alt='' style='border:0px;vertical-align: bottom; width: 32px; height: 32px' />" : E_32_CAT_PLUG;
$img = (!$plug['plugin_installflag'] ? "<img src='".e_IMAGE."packs/".$imode."/admin_images/uninstalled.png' alt='' />" : "<img src='".e_IMAGE."packs/".$imode."/admin_images/installed.png' alt='' />");
} else {
$img = "<img src='".e_IMAGE."packs/".$imode."/admin_images/noinstall.png' alt='' />";
}
if ($plug['plugin_version'] != $eplug_version && $plug['plugin_installflag']) { if ($plug_vars['configFile'] && $plug['plugin_installflag'] == true)
$img = "<img src='".e_IMAGE."packs/".$imode."/admin_images/upgrade.png' alt='' />"; {
} $conf_title = LAN_CONFIGURE.' '.$tp->toHtml($plug_vars['name'], "", "defs,emotes_off, no_make_clickable");
$plugin_icon = "<a title='{$conf_title}' href='".e_PLUGIN.$plug_vars['folder'].'/'.$plug_vars['configFile']."' >".$plugin_icon.'</a>';
}
$plugin_icon = $eplug_icon ? "<img src='".e_PLUGIN.$eplug_icon."' alt='' style='border:0px;vertical-align: bottom; width: 32px; height: 32px' />" : E_32_CAT_PLUG; $text .= "
if ($eplug_conffile && $plug['plugin_installflag'] == TRUE) { <tr>
$conf_title = LAN_CONFIGURE.' '.$tp->toHtml($eplug_name,"","defs,emotes_off, no_make_clickable"); <td class='forumheader3' style='width:160px; text-align:center; vertical-align:top'>
$plugin_icon = "<a title='{$conf_title}' href='".e_PLUGIN.$eplug_folder.'/'.$eplug_conffile."' >".$plugin_icon.'</a>'; <table style='width:100%'><tr><td style='text-align:left;width:40px;vertical-align:top'>
} ".$plugin_icon."
</td><td>
$img <b>".$tp->toHTML($plug['plugin_name'], false, "defs,emotes_off, no_make_clickable")."</b><br />".EPL_ADLAN_11." {$plug['plugin_version']}
<br />";
$text .= " $text .="</td>
<tr> </tr></table>
<td class='forumheader3' style='width:160px; text-align:center; vertical-align:top'> </td>
<table style='width:100%'><tr><td style='text-align:left;width:40px;vertical-align:top'> <td class='forumheader3' style='vertical-align:top'>
".$plugin_icon." <table cellspacing='3' style='width:98%'>
</td><td> <tr><td style='vertical-align:top;width:15%'><b>".EPL_ADLAN_12."</b>:</td><td style='vertical-align:top'><a href='mailto:{$plug_vars['authorEmail']}' title='{$plug_vars['authorEmail']}'>{$plug_vars['author']}</a>&nbsp;";
$img <b>".$tp->toHTML($plug['plugin_name'],FALSE,"defs,emotes_off, no_make_clickable")."</b><br />".EPL_ADLAN_11." {$plug['plugin_version']} if($plug_vars['authorUrl'])
<br />"; {
$text .= "&nbsp;&nbsp;[ <a href='{$plug_vars['authorUrl']}' title='{$plug_vars['authorUrl']}' >".EPL_WEBSITE."</a> ] ";
}
$text .="</td></tr>
<tr><td style='vertical-align:top'><b>".EPL_ADLAN_14."</b>:</td><td style='vertical-align:top'> {$plug_vars['description']}&nbsp;";
if ($plug_vars['readme'])
{
$text .= "[ <a href='".e_PLUGIN.$plug_vars['folder']."/".$plug_vars['readme']."'>".$plug_vars['readme']."</a> ]";
}
$text .="</td> $text .="</td></tr>
</tr></table> <tr><td style='vertical-align:top'><b>".EPL_ADLAN_13."</b>:</td><td style='vertical-align:top'><span style='vertical-align:top'> {$plug_vars['compatibility']}&nbsp;</span>";
</td>
<td class='forumheader3' style='vertical-align:top'>
<table cellspacing='3' style='width:98%'>
<tr><td style='vertical-align:top;width:15%'><b>".EPL_ADLAN_12."</b>:</td><td style='vertical-align:top'><a href='mailto:$eplug_email' title='$eplug_email'>$eplug_author</a>&nbsp;";
if($eplug_url){
$text .= "&nbsp;&nbsp;[ <a href='$eplug_url' title='$eplug_url' >".EPL_WEBSITE."</a> ] ";
}
$text .="</td></tr>
<tr><td style='vertical-align:top'><b>".EPL_ADLAN_14."</b>:</td><td style='vertical-align:top'> $eplug_description&nbsp;";
if ($eplug_readme) {
$text .= "[ <a href='".e_PLUGIN.$eplug_folder."/".$eplug_readme."'>".$eplug_readme."</a> ]";
}
$text .="</td></tr> if ($plug_vars['compliant'])
<tr><td style='vertical-align:top'><b>".EPL_ADLAN_13."</b>:</td><td style='vertical-align:top'><span style='vertical-align:top'> $eplug_compatible&nbsp;</span>"; {
if ($eplug_compliant) { $text .= "&nbsp;&nbsp;<img src='".e_IMAGE."generic/valid-xhtml11_small.png' alt='' style='margin-top:0px' />";
$text .= "&nbsp;&nbsp;<img src='".e_IMAGE."generic/valid-xhtml11_small.png' alt='' style='margin-top:0px' />"; }
} $text .="</td></tr>\n";
$text .="</td></tr>\n";
$text .= "</table></td>";
$text .= "<td class='forumheader3' style='width:70px;text-align:center'>";
$text .= "</table></td>"; if ($plug_vars['installRequired'])
$text .= "<td class='forumheader3' style='width:70px;text-align:center'>"; {
if ($eplug_conffile || $eplug_module || is_array($eplug_table_names) || is_array($eplug_prefs) || is_array($eplug_user_prefs) || is_array($eplug_sc) || is_array($eplug_bb) || $eplug_status || $eplug_latest) { $text .= ($plug['plugin_installflag'] ? "<input type='button' class='button' onclick=\"location.href='".e_SELF."?uninstall.{$plug['plugin_id']}'\" title='".EPL_ADLAN_1."' value='".EPL_ADLAN_1."' /> " : "<input type='button' class='button' onclick=\"location.href='".e_SELF."?install.{$plug['plugin_id']}'\" title='".EPL_ADLAN_0."' value='".EPL_ADLAN_0."' />");
$text .= ($plug['plugin_installflag'] ? "<input type='button' class='button' onclick=\"location.href='".e_SELF."?uninstall.{$plug['plugin_id']}'\" title='".EPL_ADLAN_1."' value='".EPL_ADLAN_1."' /> " : "<input type='button' class='button' onclick=\"location.href='".e_SELF."?install.{$plug['plugin_id']}'\" title='".EPL_ADLAN_0."' value='".EPL_ADLAN_0."' />"); }
} else { else
if ($eplug_menu_name) { {
$text .= EPL_NOINSTALL.str_replace("..", "", e_PLUGIN.$plug['plugin_path'])."/ ".EPL_DIRECTORY; if ($plug_vars['menuName'])
} else { {
$text .= EPL_NOINSTALL_1.str_replace("..", "", e_PLUGIN.$plug['plugin_path'])."/ ".EPL_DIRECTORY; $text .= EPL_NOINSTALL.str_replace("..", "", e_PLUGIN.$plug['plugin_path'])."/ ".EPL_DIRECTORY;
if($plug['plugin_installflag'] == FALSE){ }
global $sql; else
$sql->db_Delete('plugin', "plugin_installflag=0 AND (plugin_path='{$plug['plugin_path']}' OR plugin_path='{$plug['plugin_path']}/' ) "); {
$text .= EPL_NOINSTALL_1.str_replace("..", "", e_PLUGIN.$plug['plugin_path'])."/ ".EPL_DIRECTORY;
if($plug['plugin_installflag'] == false)
{
global $sql;
$sql->db_Delete('plugin', "plugin_installflag=0 AND (plugin_path='{$plug['plugin_path']}' OR plugin_path='{$plug['plugin_path']}/' ) ");
}
} }
} }
}
if ($plug['plugin_version'] != $eplug_version && $plug['plugin_installflag']) { if ($plug['plugin_version'] != $plug_vars['version'] && $plug['plugin_installflag']) {
$text .= "<br /><input type='button' class='button' onclick=\"location.href='".e_SELF."?upgrade.{$plug['plugin_id']}'\" title='".EPL_UPGRADE." to v".$eplug_version."' value='".EPL_UPGRADE."' />"; $text .= "<br /><input type='button' class='button' onclick=\"location.href='".e_SELF."?upgrade.{$plug['plugin_id']}'\" title='".EPL_UPGRADE." to v".$plug_vars['version']."' value='".EPL_UPGRADE."' />";
} }
$text .="</td>"; $text .="</td>";
$text .= "</tr>"; $text .= "</tr>";
}
} }
return $text;
return $text;
} }
$text .= "</table> $text .= "</table>
<div style='text-align:center'><br /> <div style='text-align:center'><br />
<img src='".e_IMAGE."packs/".$imode."/admin_images/uninstalled.png' alt='' /> ".EPL_ADLAN_23."&nbsp;&nbsp; <img src='".e_IMAGE."packs/".$imode."/admin_images/uninstalled.png' alt='' /> ".EPL_ADLAN_23."&nbsp;&nbsp;
<img src='".e_IMAGE."packs/".$imode."/admin_images/installed.png' alt='' /> ".EPL_ADLAN_22."&nbsp;&nbsp; <img src='".e_IMAGE."packs/".$imode."/admin_images/installed.png' alt='' /> ".EPL_ADLAN_22."&nbsp;&nbsp;
<img src='".e_IMAGE."packs/".$imode."/admin_images/upgrade.png' alt='' /> ".EPL_ADLAN_24."&nbsp;&nbsp; <img src='".e_IMAGE."packs/".$imode."/admin_images/upgrade.png' alt='' /> ".EPL_ADLAN_24."&nbsp;&nbsp;
<img src='".e_IMAGE."packs/".$imode."/admin_images/noinstall.png' alt='' /> ".EPL_ADLAN_25."</div></div>"; <img src='".e_IMAGE."packs/".$imode."/admin_images/noinstall.png' alt='' /> ".EPL_ADLAN_25."</div></div>";
$ns->tablerender(EPL_ADLAN_16, $text); $ns->tablerender(EPL_ADLAN_16, $text);
// ---------------------------------------------------------- // ----------------------------------------------------------
@@ -532,16 +611,15 @@ $ns->tablerender(EPL_ADLAN_16, $text);
require_once("footer.php"); require_once("footer.php");
exit; exit;
function show_uninstall_confirm() function show_uninstall_confirm()
{ {
global $plugin, $tp, $id, $ns; global $plugin, $tp, $id, $ns;
$id = intval($id); $id = intval($id);
$plug = $plugin->getinfo($id); $plug = $plugin->getinfo($id);
if ($plug['plugin_installflag'] == TRUE ) if ($plug['plugin_installflag'] == true )
{ {
include(e_PLUGIN.$plug['plugin_path'].'/plugin.php'); $plug_vars = $plugin->parse_plugin($_path);
} }
if(is_writable(e_PLUGIN.$plug['plugin_path'])) if(is_writable(e_PLUGIN.$plug['plugin_path']))
@@ -565,36 +643,36 @@ function show_uninstall_confirm()
<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'>
<tr> <tr>
<td colspan='2' class='forumheader'>".EPL_ADLAN_54." ".$tp->toHtml($eplug_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>
<tr> <tr>
<td class='forumheader3'>".EPL_ADLAN_55."</td> <td class='forumheader3'>".EPL_ADLAN_55."</td>
<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' style='width:75%'>
".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'>
<select class='tbox' name='delete_tables'> <select class='tbox' name='delete_tables'>
<option value='1'>".LAN_YES."</option> <option value='1'>".LAN_YES."</option>
<option value='0'>".LAN_NO."</option> <option value='0'>".LAN_NO."</option>
</select> </select>
</td> </td>
</tr> </tr>
<tr> <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>
<tr> <tr>
<td colspan='2' class='forumheader' style='text-align:center'><input class='button' type='submit' name='uninstall_confirm' value=\"".EPL_ADLAN_3."\" />&nbsp;&nbsp;<input class='button' type='submit' name='uninstall_cancel' value='".EPL_ADLAN_62."' onclick=\"location.href='".e_SELF."'; return false;\"/></td> <td colspan='2' class='forumheader' style='text-align:center'><input class='button' type='submit' name='uninstall_confirm' value=\"".EPL_ADLAN_3."\" />&nbsp;&nbsp;<input class='button' type='submit' name='uninstall_cancel' value='".EPL_ADLAN_62."' onclick=\"location.href='".e_SELF."'; return false;\"/></td>
</tr> </tr>
</table> </table>
</form> </form>
"; ";
$ns->tablerender(EPL_ADLAN_63." ".$tp->toHtml($eplug_name,"","defs,emotes_off, no_make_clickable"), $text); $ns->tablerender(EPL_ADLAN_63." ".$tp->toHtml($plug_vars['name'], "", "defs,emotes_off, no_make_clickable"), $text);
require_once(e_ADMIN."footer.php"); require_once(e_ADMIN."footer.php");
exit; exit;
} }
?> ?>

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.15 $ | $Revision: 1.16 $
| $Date: 2008-01-20 15:01:19 $ | $Date: 2008-01-26 04:47:27 $
| $Author: mcfly_e107 $ | $Author: mcfly_e107 $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
@@ -875,6 +875,63 @@ class e107plugin
} }
return 2; return 2;
} }
function parse_plugin($path)
{
if(file_exists($_path.'plugin.xml'))
{
return $this->parse_plugin_xml($path);
}
elseif(file_exists($_path.'plugin.php'))
{
return $this->parse_plugin_php($path);
}
return false;
}
function parse_plugin_php($path)
{
include($path.'plugin.php');
$ret = array();
$ret['installRequired'] = ($eplug_conffile || is_array($eplug_table_names) || is_array($eplug_prefs) || is_array($eplug_user_prefs) || is_array($eplug_sc) || is_array($eplug_bb) || $eplug_module || $eplug_userclass || $eplug_status || $eplug_latest);
$ret['version'] = varset($eplug_version);
$ret['name'] = varset($eplug_name);
$ret['folder'] = varset($eplug_folder);
$ret['description'] = varset($eplug_description);
$ret['author'] = varset($eplug_author);
$ret['authorUrl'] = varset($eplug_url);
$ret['authorEmail'] = varset($eplug_email);
$ret['compatibility'] = varset($eplug_compatible);
$ret['readme'] = varset($eplug_readme);
$ret['compliant'] = varset($eplug_compliant);
$ret['menuName'] = varset($eplug_menu_name);
$ret['administration']['icon'] = varset($eplug_icon);
$ret['administration']['caption'] = varset($eplug_caption);
$ret['administration']['iconSmall'] = varset($eplug_icon_small);
$ret['administration']['configFile'] = varset($eplug_conffile);
// Set this key so we know the vars came from a plugin.php file
$ret['plugin_php'] = true;
return $ret;
}
function parse_plugin_xml($path)
{
global $tp;
include_lan($path.'languages/'.e_LANGUAGE.'/lan_config.php');
include_lan($path.'languages/admin/'.e_LANGUAGE.'.php');
require_once(e_HANDLER.'xml_class.php');
$xml = new xmlClass;
$xml->loadXMLfile($path.'plugin.xml', true, true);
$xml->xmlFileContents = $tp->replaceConstants($xml->xmlFileContents, '', true);
return $xml->parseXml();
}
} }
?> ?>

42
e107_plugins/forum/plugin.xml Executable file
View File

@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<e107Plugin>
<name>Forum</name>
<version>1.2</version>
<author>e107dev</author>
<authorUrl>http://e107.org</authorUrl>
<description>This plugin is a fully featured Forum system</description>
<compatibility>0.8</compatibility>
<installRequired>true</installRequired>
<folder>forum</folder>
<administration>
<configFile>forum_admin.php</configFile>
<icon>forum/images/forums_32.png</icon>
<iconSmall>forum/images/images/forums_16.png</iconSmall>
<caption>Configure Forum</caption>
<latest>true</latest>
<status>true</status>
</administration>
<menuLink name="Forum" value="forum/forum.php" perm='everyone'/>
<mainPrefs>
<pref name="forum_show_topics" value="1" />
<pref name="forum_postfix" value="[more...]" />
<pref name="forum_poll" value="0" />
<pref name="forum_popular" value="10" />
<pref name="forum_track" value="0" />
<pref name="forum_eprefix" value="[forum]" />
<pref name="forum_enclose" value="1" />
<pref name="forum_title" value="Forums" />
<pref name="forum_postspage" value="10" />
<pref name="forum_hilightsticky" value="1" />
<pref name="forum_obsolete_pref" value="1" active="false"/>
</mainPrefs>
<userclasses>
<userclass name="forum_moderator" description="Moderator of all forums" />
</userclasses>
<sqlFile>forum_sql.php</sqlFile>
<management>
<install type="classFunction" file="forum_management.php" class="forum_management" function="forum_install" />
<uninstall type="classFunction" file="forum_management.php" class="forum_management" function="forum_uninstall" />
<upgrade type="classFunction" file="forum_management.php" class="forum_management" function="forum_upgrade" />
</management>
</e107Plugin>

23
e107_plugins/pm/plugin.xml Executable file
View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<e107Plugin>
<name>{ADLAN_PM}</name>
<version>3.0</version>
<author>McFly</author>
<authorEmail>mcfly@e107.org</authorEmail>
<description>{ADLAN_PM_57}</description>
<compatibility>0.8</compatibility>
<installRequired>true</installRequired>
<folder>pm</folder>
<administration>
<configFile>pm_conf.php</configFile>
<icon>pm/images/pvt_message_32.png</icon>
<iconSmall>pm/images/pvt_message_16.png</iconSmall>
<caption>{ADLAN_PM_2}</caption>
</administration>
<sqlFile>pm_sql.php</sqlFile>
<management>
<install type="fileFunction" file="pm_install.php" function="forum_install" />
<uninstall type="fileFunction" file="pm_uninstall.php" function="forum_uninstall" />
<upgrade type="fileFunction" file="pm_uninstall" function="forum_upgrade" />
</management>
</e107Plugin>