From 99939cd62ba85ea9f269aed17f1a8ad6b92ebfb1 Mon Sep 17 00:00:00 2001 From: e107steved Date: Mon, 25 Aug 2008 13:34:55 +0000 Subject: [PATCH] More plugin.xml support (should be pretty much it), and the odd small bug fix along the way. --- e107_files/shortcode/admin_alt_nav.sc | 11 ++++-- e107_files/shortcode/admin_icon.sc | 37 +++++++++++++++--- e107_files/shortcode/admin_nav.sc | 43 ++++++++++++++++----- e107_files/shortcode/admin_plugins.sc | 10 ++++- e107_plugins/calendar_menu/admin_config.php | 6 +-- 5 files changed, 84 insertions(+), 23 deletions(-) diff --git a/e107_files/shortcode/admin_alt_nav.sc b/e107_files/shortcode/admin_alt_nav.sc index 3cac8ac42..832d1ce2f 100644 --- a/e107_files/shortcode/admin_alt_nav.sc +++ b/e107_files/shortcode/admin_alt_nav.sc @@ -1,4 +1,10 @@ -if (ADMIN) { +/* +* e107 website system (c) 2001-2008 Steve Dunstan (e107.org) +* $Id: admin_alt_nav.sc,v 1.4 2008-08-25 13:34:45 e107steved Exp $ +*/ + +if (ADMIN) +{ global $sql, $pref, $tp; parse_str($parm); require(e_ADMIN.'ad_links.php'); @@ -70,9 +76,6 @@ if (ADMIN) { if($plug->parse_plugin($_path)) { $plug_vars = $plug->plug_vars; -// print_a($plug_vars); -// exit; -// include_once(e_PLUGIN.$row['plugin_path']."/plugin.php"); if($plug_vars['administration']['configFile']) { $plug_vars['name'] = $tp->toHTML($plug_vars['name'], FALSE, "defs"); diff --git a/e107_files/shortcode/admin_icon.sc b/e107_files/shortcode/admin_icon.sc index fc37a06c9..a9bc6ff32 100644 --- a/e107_files/shortcode/admin_icon.sc +++ b/e107_files/shortcode/admin_icon.sc @@ -1,12 +1,39 @@ -if (ADMIN) { +/* +* e107 website system (c) 2001-2008 Steve Dunstan (e107.org) +* $Id: admin_icon.sc,v 1.2 2008-08-25 13:34:45 e107steved Exp $ +*/ +if (ADMIN) +{ global $e_sub_cat, $e_icon_array, $PLUGINS_DIRECTORY; - if (strstr(e_SELF, $PLUGINS_DIRECTORY)) { - include('plugin.php'); + if (strstr(e_SELF, $PLUGINS_DIRECTORY)) + { + if (is_readable('plugin.xml')) + { + require_once(e_HANDLER.'xml_class.php'); + $xml = new xmlClass; + $xml->filter = array('folder' => FALSE, 'administration' => FALSE); // Just need one variable + $readFile = $xml->loadXMLfile('plugin.xml', true, true); + $eplug_icon = $readFile['folder'].'/'.$readFile['administration']['icon']; + $eplug_folder = $readFile['folder']; + } + elseif (is_readable('plugin.php')) + { + include('plugin.php'); + } + else + { + $icon = E_32_CAT_PLUG; + return $icon; + } $icon = ($eplug_icon && file_exists(e_PLUGIN.$eplug_icon)) ? "" : E_32_CAT_PLUG; - } else { + } + else + { $icon = $e_icon_array[$e_sub_cat]; } return $icon; -} else { +} +else +{ return E_32_LOGOUT; } \ No newline at end of file diff --git a/e107_files/shortcode/admin_nav.sc b/e107_files/shortcode/admin_nav.sc index a7aee7511..a3c214ab4 100644 --- a/e107_files/shortcode/admin_nav.sc +++ b/e107_files/shortcode/admin_nav.sc @@ -1,8 +1,16 @@ -if (ADMIN) { - global $ns, $pref, $e107_plug, $array_functions; - if (strstr(e_SELF, "/admin.php")) { +/* +* 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 $ +*/ +if (ADMIN) +{ + global $ns, $pref, $e107_plug, $array_functions, $tp; + if (strstr(e_SELF, "/admin.php")) + { $active_page = 'x'; - } else { + } + else + { $active_page = time(); } $e107_var['x']['text']=ADLAN_52; @@ -13,7 +21,8 @@ if (ADMIN) { $text .= show_admin_menu("",$active_page,$e107_var); unset($e107_var); - foreach ($array_functions as $links_key => $links_value) { + foreach ($array_functions as $links_key => $links_value) + { $e107_var[$links_key]['text'] = $links_value[1]; $e107_var[$links_key]['link'] = $links_value[0]; } @@ -21,17 +30,33 @@ if (ADMIN) { unset($e107_var); // Plugin links menu - $sql = new db; - if ($sql -> db_Select("plugin", "*", "plugin_installflag=1")) { + require_once(e_HANDLER.'xml_class.php'); + $xml = new xmlClass; // We're going to have some plugins with plugin.xml files, surely? So create XML object now + $xml->filter = array('name' => FALSE, 'administration' => FALSE); // .. and they're all going to need the same filter + + $nav_sql = new db; + if ($nav_sql -> db_Select("plugin", "*", "plugin_installflag=1")) + { //Link Plugin Manager $e107_var['x']['text'] = "".ADLAN_98.""; $e107_var['x']['link'] = e_ADMIN."plugin.php"; $e107_var['x']['perm'] = "P"; - while($rowplug = $sql -> db_Fetch()) { + while($rowplug = $nav_sql -> db_Fetch()) + { extract($rowplug); $e107_plug[$rowplug[1]] = $rowplug[3]; - include_once(e_PLUGIN.$plugin_path."/plugin.php"); + if (is_readable(e_PLUGIN.$plugin_path."/plugin.xml")) + { + $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_conffile = $readFile['administration']['configFile']; + } + elseif (is_readable(e_PLUGIN.$plugin_path."/plugin.php")) + { + include(e_PLUGIN.$plugin_path."/plugin.php"); + } // Links Plugins if ($eplug_conffile) { diff --git a/e107_files/shortcode/admin_plugins.sc b/e107_files/shortcode/admin_plugins.sc index ac5f6fca7..29a1d5801 100644 --- a/e107_files/shortcode/admin_plugins.sc +++ b/e107_files/shortcode/admin_plugins.sc @@ -1,6 +1,12 @@ -if (ADMIN) { +/* +* e107 website system (c) 2001-2008 Steve Dunstan (e107.org) +* $Id: admin_plugins.sc,v 1.3 2008-08-25 13:34:45 e107steved Exp $ +*/ +if (ADMIN) +{ global $e107_plug, $ns, $pref; - if ($pref['admin_alerts_ok'] == 1) { + if ($pref['admin_alerts_ok'] == 1) + { ob_start(); $text = ""; $i = 0; diff --git a/e107_plugins/calendar_menu/admin_config.php b/e107_plugins/calendar_menu/admin_config.php index f8af4e710..86c0e85c8 100644 --- a/e107_plugins/calendar_menu/admin_config.php +++ b/e107_plugins/calendar_menu/admin_config.php @@ -11,8 +11,8 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_plugins/calendar_menu/admin_config.php,v $ -| $Revision: 1.8 $ -| $Date: 2008-08-12 19:59:59 $ +| $Revision: 1.9 $ +| $Date: 2008-08-25 13:34:55 $ | $Author: e107steved $ | +----------------------------------------------------------------------------+ @@ -789,12 +789,12 @@ if(!isset($ec_qs[0]) || (isset($ec_qs[0]) && $ec_qs[0] == "config")) { if ($val == 'sun') $val = 0; elseif ($val == 'mon') $val = 1; // Legacy values $ret = "\n"; return $ret; }