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

Start of mods to handle revised plugin.xml format - still a bit to do/check

This commit is contained in:
e107steved 2008-12-03 22:29:58 +00:00
parent 3ddd9db2af
commit 2b428ccff9
7 changed files with 85 additions and 69 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.19 $
| $Date: 2008-10-11 11:55:18 $
| $Revision: 1.20 $
| $Date: 2008-12-03 22:29:46 $
| $Author: e107steved $
+----------------------------------------------------------------------------+
*/
@ -479,7 +479,7 @@ function render_plugs($pluginList)
if($plug_vars)
{
if ($plug_vars['installRequired'])
if ($plug_vars['@attributes']['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='' />");
}
@ -488,7 +488,7 @@ function render_plugs($pluginList)
$img = "<img src='".e_IMAGE."packs/".$imode."/admin_images/noinstall.png' alt='' />";
}
if ($plug['plugin_version'] != $plug_vars['version'] && $plug['plugin_installflag'])
if ($plug['plugin_version'] != $plug_vars['@attributes']['version'] && $plug['plugin_installflag'])
{
$img = "<img src='".e_IMAGE."packs/".$imode."/admin_images/upgrade.png' alt='' />";
}
@ -498,17 +498,20 @@ function render_plugs($pluginList)
if ($plug_vars['administration']['configFile'] && $plug['plugin_installflag'] == true)
{
$conf_title = LAN_CONFIGURE.' '.$tp->toHtml($plug_vars['name'], "", "defs,emotes_off, no_make_clickable");
$conf_title = LAN_CONFIGURE.' '.$tp->toHtml($plug_vars['@attributes']['name'], "", "defs,emotes_off, no_make_clickable");
$plugin_icon = "<a title='{$conf_title}' href='".e_PLUGIN.$plug['plugin_path'].'/'.$plug_vars['administration']['configFile']."' >".$plugin_icon.'</a>';
}
$plugEmail = varset($plug_vars['author']['@attributes']['email'],'');
$plugAuthor = varset($plug_vars['author']['@attributes']['name'],'');
$plugURL = varset($plug_vars['author']['@attributes']['url'],'');
$text .= "
<tr>
<td class='forumheader3' style='width:160px; text-align:center; vertical-align:top'>
<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 /><b>".EPL_ADLAN_11."</b>&nbsp;{$plug['plugin_version']}
{$img} <b>".$tp->toHTML($plug['plugin_name'], false, "defs,emotes_off, no_make_clickable")."</b><br /><b>".EPL_ADLAN_11."</b>&nbsp;{$plug['plugin_version']}
<br /><br />
<b>".EPL_ADLAN_64."</b>&nbsp;".$plug['plugin_path']."
<br />
@ -517,10 +520,11 @@ function render_plugs($pluginList)
</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:{$plug_vars['authorEmail']}' title='{$plug_vars['authorEmail']}'>{$plug_vars['author']}</a>&nbsp;";
if($plug_vars['authorUrl'])
<tr><td style='vertical-align:top;width:15%'><b>".EPL_ADLAN_12."</b>:</td>
<td style='vertical-align:top'><a href='mailto:{$plugEmail}' title='{$plugEmail}'>{$plugAuthor}</a>&nbsp;";
if($plugURL)
{
$text .= "&nbsp;&nbsp;[ <a href='{$plug_vars['authorUrl']}' title='{$plug_vars['authorUrl']}' >".EPL_WEBSITE."</a> ] ";
$text .= "&nbsp;&nbsp;[ <a href='{$plugURL}' title='{$plugURL}' >".EPL_WEBSITE."</a> ] ";
}
$text .="</td></tr>
<tr><td style='vertical-align:top'><b>".EPL_ADLAN_14."</b>:</td><td style='vertical-align:top'> ".$tp->toHTML($plug_vars['description'], false, "defs,emotes_off, no_make_clickable")."&nbsp;";
@ -530,7 +534,7 @@ function render_plugs($pluginList)
}
$text .="</td></tr>
<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>";
<tr><td style='vertical-align:top'><b>".EPL_ADLAN_13."</b>:</td><td style='vertical-align:top'><span style='vertical-align:top'> ".varset($plug_vars['@attributes']['compatibility'],'')."&nbsp;</span>";
if ($plug_vars['compliant'])
{
@ -541,7 +545,7 @@ function render_plugs($pluginList)
$text .= "</table></td>";
$text .= "<td class='forumheader3' style='width:70px;text-align:center'>";
if ($plug_vars['installRequired'])
if ($plug_vars['@attributes']['installRequired'])
{
$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."' />");
}
@ -562,8 +566,8 @@ function render_plugs($pluginList)
}
}
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".$plug_vars['version']."' value='".EPL_UPGRADE."' />";
if ($plug['plugin_version'] != $plug_vars['@attributes']['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".$plug_vars['@attributes']['version']."' value='".EPL_UPGRADE."' />";
}
$text .="</td>";

View File

@ -1,6 +1,6 @@
/*
* e107 website system (c) 2001-2008 Steve Dunstan (e107.org)
* $Id: admin_nav.sc,v 1.2 2008-08-25 13:34:45 e107steved Exp $
* $Id: admin_nav.sc,v 1.3 2008-12-03 22:29:52 e107steved Exp $
*/
if (ADMIN)
{
@ -50,7 +50,7 @@ if (ADMIN)
{
$readFile = $xml->loadXMLfile(e_PLUGIN.$plugin_path.'/plugin.xml', true, true);
include_lan_admin(e_PLUGIN.$plugin_path.'/');
$eplug_caption = $tp->toHTML($readFile['name'],FALSE,"defs, emotes_off");
$eplug_caption = $tp->toHTML($readFile['@attributes']['name'],FALSE,"defs, emotes_off");
$eplug_conffile = $readFile['administration']['configFile'];
}
elseif (is_readable(e_PLUGIN.$plugin_path."/plugin.php"))

View File

@ -4,8 +4,8 @@
| e107 website system - Converter for plugin.php to plugin.xml
|
| $Source: /cvs_backup/e107_0.8/e107_files/utilities/pluginxmlgen.php,v $
| $Revision: 1.7 $
| $Date: 2008-11-09 18:00:27 $
| $Revision: 1.8 $
| $Date: 2008-12-03 22:29:52 $
| $Author: e107steved $
+----------------------------------------------------------------------------+
*/
@ -80,7 +80,7 @@ define('LAN_XMLGEN_25','Type');
define('LAN_XMLGEN_26','Function');
define('LAN_XMLGEN_27','Class');
define('LAN_XMLGEN_28','File name');
define('LAN_XMLGEN_29','Function name');
define('LAN_XMLGEN_29','Function/method name');
define('LAN_XMLGEN_30','When');
define('LAN_XMLGEN_31','Pre');
define('LAN_XMLGEN_32','Post');
@ -108,6 +108,7 @@ $selectOptions = array(
);
// Writes a single value within open tag and close tag
function writeTag($tag,$value,$level=1)
{
if (!$value) return '';
@ -115,6 +116,24 @@ function writeTag($tag,$value,$level=1)
}
// Writes a tag with some attributes
function writeTagList($tag,$values,$closeTag = TRUE,$level=1)
{
if (!count($values)) return '';
$ret = str_repeat(TAB_CHAR,$level).'<'.$tag;
foreach ($values as $aname => $aval)
{
if ($aval)
{
$ret .= ' '.$aname.'="'.$aval.'"';
}
}
if ($closeTag) { $ret .= ' /'; }
$ret .= ">\n";
return $ret;
}
function listPrefs($prefList, $arrayPrefList)
{
if (!is_array($prefList)) return '';
@ -159,8 +178,8 @@ function makeXML($pluginDir, $extras=array())
$adminText = '';
$mainPrefText = '';
$manageText = '';
$fileText = "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n<e107Plugin>\n";
$fileText .= '<!-- $'.'Id: plugin.xml,v 0.0 2008/06/26 20:44:10 e107steved Exp '.'$ -'."->\n"; // Split it to stop message getting edited when this file committed!
$fileText = "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n\n";
$fileText .= '<!-- $'.'Id: plugin.xml,v 0.0 2008/06/26 20:44:10 e107steved Exp '.'$ -'."->\n\n"; // Split it to stop message getting edited when this file committed!
if (!is_readable($sourceFile))
{
@ -169,15 +188,21 @@ function makeXML($pluginDir, $extras=array())
include_once($sourceFile);
// Transcribe variables
$fileText .= writeTag('name',$eplug_name);
$fileText .= writeTag('version',$eplug_version);
$fileText .= writeTag('author',$eplug_author);
$fileText .= writeTag('authorUrl',$eplug_url);
$fileText .= writeTag('authorEmail',$eplug_email);
$fileText .= writeTagList('e107Plugin',
array('name' => $eplug_name,
'version' => $eplug_version,
'compatibility' => '0.8',
'installRequired' => $extras['installationrequired'] ? 'true' : 'false'
), TRUE);
$fileText .= writeTagList('author',
array('name' => $eplug_author,
'url' => $eplug_url,
'email' => $eplug_email
), TRUE);
$fileText .= writeTag('description',$eplug_description);
$fileText .= writeTag('compatibility',$eplug_compatible);
$fileText .= writeTag('readMe',$eplug_readme);
$fileText .= writeTag('installRequired',$extras['installationrequired'] ? 'true' : 'false');
$fileText .= writeTag('folder',$baseFolder);
if (isset($eplug_comment_ids) && is_array($eplug_comment_ids))
{
@ -191,6 +216,10 @@ function makeXML($pluginDir, $extras=array())
{
if (in_array($k,array('copyright','update_url'))) $fileText .= writeTag($k,$v);
}
if (!varsettrue($extras['copyright']))
{
$fileText .= writeTag('copyright','Copyright e107 Inc e107.org, Licensed under GPL (http://www.gnu.org/licenses/gpl.txt)');
}
$baseFolder .= '/';
// 'commentID' tags needed
$adminText .= writeTag('configFile',$eplug_conffile,2);

View File

@ -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.51 $
| $Date: 2008-12-02 21:51:22 $
| $Revision: 1.52 $
| $Date: 2008-12-03 22:29:46 $
| $Author: e107steved $
+----------------------------------------------------------------------------+
*/
@ -180,9 +180,9 @@ class e107plugin
{ // Update the addons needed by the plugin
$pluginDBList[$plugin_path]['status'] = 'exists';
// If plugin not installed, and version number of files changed, update version as well
if (($pluginDBList[$plugin_path]['plugin_installflag'] == 0) && ($pluginDBList[$plugin_path]['plugin_version'] != $plug_info['version']))
if (($pluginDBList[$plugin_path]['plugin_installflag'] == 0) && ($pluginDBList[$plugin_path]['plugin_version'] != $plug_info['@attributes']['version']))
{ // Update stored version
$pluginDBList[$plugin_path]['plugin_version'] = $plug_info['version'];
$pluginDBList[$plugin_path]['plugin_version'] = $plug_info['@attributes']['version'];
$pluginDBList[$plugin_path]['status'] = 'update';
}
if ($pluginDBList[$plugin_path]['plugin_addons'] != $eplug_addons)
@ -218,7 +218,7 @@ class e107plugin
// Can just add to DB - shouldn't matter that its not in our current table
// echo "Trying to insert: ".$eplug_folder."<br />";
$_installed = ($plug_info['installRequired'] == 'true' || $plug_info['installRequired'] == 1 ? 0 : 1 );
$sql->db_Insert("plugin", "0, '".$tp -> toDB($plug_info['name'], true)."', '".$tp -> toDB($plug_info['version'], true)."', '".$tp -> toDB($plugin_path, true)."', {$_installed}, '{$eplug_addons}' ");
$sql->db_Insert("plugin", "0, '".$tp -> toDB($plug_info['name'], true)."', '".$tp -> toDB($plug_info['@attributes']['version'], true)."', '".$tp -> toDB($plugin_path, true)."', {$_installed}, '{$eplug_addons}' ");
}
}
}
@ -1089,14 +1089,14 @@ class e107plugin
if($function == 'install' || $function == 'upgrade')
{
$sql->db_Update('plugin', "plugin_installflag = 1, plugin_addons = '{$eplug_addons}', plugin_version = '{$plug_vars['version']}' WHERE plugin_id = ".$id);
$pref['plug_installed'][$plug['plugin_path']] = $plug_vars['version'];
$sql->db_Update('plugin', "plugin_installflag = 1, plugin_addons = '{$eplug_addons}', plugin_version = '{$plug_vars['@attributes']['version']}' WHERE plugin_id = ".$id);
$pref['plug_installed'][$plug['plugin_path']] = $plug_vars['@attributes']['version'];
save_prefs();
}
if($function == 'uninstall')
{
$sql->db_Update('plugin', "plugin_installflag = 0, plugin_addons = '{$eplug_addons}', plugin_version = '{$plug_vars['version']}' WHERE plugin_id = ".$id);
$sql->db_Update('plugin', "plugin_installflag = 0, plugin_addons = '{$eplug_addons}', plugin_version = '{$plug_vars['@attributes']['version']}' WHERE plugin_id = ".$id);
unset($pref['plug_installed'][$plug['plugin_path']]);
save_prefs();
}
@ -1510,16 +1510,16 @@ class e107plugin
$ret = array();
// $ret['installRequired'] = ($eplug_conffile || is_array($eplug_table_names) || is_array($eplug_prefs) || is_array($eplug_sc) || is_array($eplug_bb) || $eplug_module || $eplug_userclass || $eplug_status || $eplug_latest);
$ret['installRequired'] = ($eplug_conffile || is_array($eplug_table_names) || is_array($eplug_prefs) || $eplug_module || $eplug_userclass || $eplug_status || $eplug_latest);
$ret['@attributes']['installRequired'] = ($eplug_conffile || is_array($eplug_table_names) || is_array($eplug_prefs) || $eplug_module || $eplug_userclass || $eplug_status || $eplug_latest);
$ret['version'] = varset($eplug_version);
$ret['name'] = varset($eplug_name);
$ret['@attributes']['version'] = varset($eplug_version);
$ret['@attributes']['name'] = varset($eplug_name);
$ret['@attributes']['compatibility'] = varset($eplug_compatible);
$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['author']['@attributes']['name'] = varset($eplug_author);
$ret['author']['@attributes']['url'] = varset($eplug_url);
$ret['author']['@attributes']['email'] = varset($eplug_email);
$ret['readme'] = varset($eplug_readme);
$ret['compliant'] = varset($eplug_compliant);
$ret['menuName'] = varset($eplug_menu_name);
@ -1547,9 +1547,6 @@ class e107plugin
$this->plug_vars = $xml->loadXMLfile($path.'plugin.xml', true, true);
if ($this->plug_vars === FALSE) return FALSE;
// print_a($this->plug_vars);
// $xml->loadXMLfile($path.'plugin.xml', true, true);
// $xml->xmlFileContents = $tp->replaceConstants($xml->xmlFileContents, '', true);
// $this->plug_vars = $xml->parseXml();
return true;
}

View File

@ -1,14 +1,11 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<e107Plugin>
<!-- $Id: plugin.xml,v 1.3 2008-11-20 21:43:57 e107steved Exp $ -->
<name>EC_ADLAN_1</name>
<version>3.70</version>
<author>jalist / cameron / McFly / Barry / Lisa_ / steved</author>
<authorUrl>http://e107.org</authorUrl>
<!-- $Id: plugin.xml,v 1.4 2008-12-03 22:29:58 e107steved Exp $ -->
<e107Plugin name="EC_ADLAN_1" version="3.70" compatibility="0.8" installRequired="true">
<author name="jalist / cameron / McFly / Barry / Lisa_ / steved" url="http://e107.org" />
<description>EC_ADLAN_A206</description>
<compatibility>e107v8</compatibility>
<readMe>readme.pdf</readMe>
<installRequired>true</installRequired>
<folder>calendar_menu</folder>
<installLanguageFile filename="languages/English_install.php" />
<logLanguageFile filename="languages/--LAN--_log.php" />

View File

@ -1,14 +1,8 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<e107Plugin>
<!-- $Id: plugin.xml,v 1.1 2008-08-25 13:43:08 e107steved Exp $ -->
<name>ADSTAT_L3</name>
<version>2.1</version>
<author>jalist</author>
<authorUrl>http://e107.org</authorUrl>
<authorEmail>jalist@e107.org</authorEmail>
<!-- $Id: plugin.xml,v 1.2 2008-12-03 22:29:58 e107steved Exp $ -->
<e107Plugin name="ADSTAT_L3" version="2.1" compatibility="0.8" installRequired="true" >
<author name="jalist" url="http://e107.org" />
<description>ADSTAT_L1</description>
<compatibility>e107v0.7</compatibility>
<installRequired>true</installRequired>
<folder>log</folder>
<logLanguageFile filename="languages/admin/--LAN--.php" />
<administration>

View File

@ -1,13 +1,8 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<e107Plugin>
<!-- $Id: plugin.xml,v 1.2 2008-08-17 11:54:39 e107steved Exp $ -->
<name>POLL_ADLAN01</name>
<version>2.0</version>
<author>Steve Dunstan (jalist)</author>
<authorUrl>http://e107.org</authorUrl>
<!-- $Id: plugin.xml,v 1.3 2008-12-03 22:29:58 e107steved Exp $ -->
<e107Plugin name="POLL_ADLAN01" version="2.0" compatibility="0.8" installRequired="true" >
<author="Steve Dunstan (jalist)" url="http://e107.org" />
<description>POLL_ADLAN02</description>
<compatibility>0.8</compatibility>
<installRequired>true</installRequired>
<folder>poll</folder>
<logLanguageFile filename="languages/admin/--LAN--.php" />
<commentID>poll</commentID>