function getPluginLinks($iconSize = E_16_PLUGMANAGER, $linkStyle = 'adminb') { global $sql, $tp; $plug_id = array(); $plugin_array = array(); e107::getDb()->db_Select("plugin", "*", "plugin_installflag = 1"); // Grab plugin IDs. while ($row = e107::getDb()->db_Fetch()) { $pth = $row['plugin_path']; $plug_id[$pth] = $row['plugin_id']; } $pref = e107::getConfig('core')->getPref(); $text = render_links(e_ADMIN . "plugin.php", ADLAN_98, ADLAN_99, "Z", $iconSize, $linkStyle); $plugs = e107::getObject('e107plugin'); foreach ($pref['plug_installed'] as $plug => $vers) { $plugs->parse_plugin($plug); $plugin_path = $plug; $name = $plugs->plug_vars['@attributes']['name']; /* echo "<h1>".$name." ($plug)</h1>"; print_a($plugs->plug_vars);*/ foreach ($plugs->plug_vars['adminLinks']['link'] as $tag) { if (varset($tag['@attributes']['primary']) != 'true') { continue; } loadLanFiles($plugin_path, 'admin'); $att = $tag['@attributes']; $eplug_name = $tp->toHTML($name, FALSE, "defs, emotes_off"); $eplug_conffile = $att['url']; $eplug_icon_small = $plugin_path . '/' . $att['iconSmall']; $eplug_icon = $plugin_path . '/' . $att['icon']; $eplug_caption = str_replace("'", '', $tp->toHTML($att['description'], FALSE, 'defs, emotes_off')); if (varset($eplug_conffile)) { $eplug_name = $tp->toHTML($eplug_name, FALSE, "defs, emotes_off"); $plugin_icon = $eplug_icon_small ? "<img class='icon S16' src='" . e_PLUGIN . $eplug_icon_small . "' alt='' />" : E_16_PLUGIN; $plugin_icon_32 = $eplug_icon ? "<img class='icon S32' src='" . e_PLUGIN . $eplug_icon . "' alt='' />" : E_32_PLUGIN; $plugin_array['p-' . $plugin_path] = array('link' => e_PLUGIN . $plugin_path . "/" . $eplug_conffile, 'title' => $eplug_name, 'caption' => $eplug_caption, 'perms' => "P" . $plug_id[$plugin_path], 'icon' => $plugin_icon, 'icon_32' => $plugin_icon_32); } } } // print_a($plugs->plug_vars['adminLinks']['link']); /* echo "hello there"; $xml = e107::getXml(); $xml->filter = array('@attributes' => FALSE,'description'=>FALSE,'administration' => FALSE); // .. and they're all going to need the same filter if ($sql->db_Select("plugin", "*", "plugin_installflag=1")) { while ($row = $sql->db_Fetch()) { extract($row); // plugin_id int(10) unsigned NOT NULL auto_increment, // plugin_name varchar(100) NOT NULL default '', // plugin_version varchar(10) NOT NULL default '', // plugin_path varchar(100) NOT NULL default '', // plugin_installflag tinyint(1) unsigned NOT NULL default '0', // plugin_addons text NOT NULL, if (is_readable(e_PLUGIN.$plugin_path."/plugin.xml")) { $readFile = $xml->loadXMLfile(e_PLUGIN.$plugin_path.'/plugin.xml', true, true); if ($readFile === FALSE) { echo 'Error in file: '.e_PLUGIN.$plugin_path.'/plugin.xml'.'<br />'; } else { loadLanFiles($plugin_path, 'admin'); $eplug_name = $tp->toHTML($readFile['@attributes']['name'],FALSE,"defs, emotes_off"); $eplug_conffile = $readFile['administration']['configFile']; $eplug_icon_small = $plugin_path.'/'.$readFile['administration']['iconSmall']; $eplug_icon = $plugin_path.'/'.$readFile['administration']['icon']; $eplug_caption = str_replace("'", '', $tp->toHTML($readFile['description'], FALSE, 'defs, emotes_off')); } } elseif (is_readable(e_PLUGIN.$plugin_path."/plugin.php")) { include(e_PLUGIN.$plugin_path."/plugin.php"); } if (varset($eplug_conffile)) { $eplug_name = $tp->toHTML($eplug_name,FALSE,"defs, emotes_off"); $plugin_icon = $eplug_icon_small ? "<img class='icon S16' src='".e_PLUGIN.$eplug_icon_small."' alt='' />" : E_16_PLUGIN; $plugin_icon_32 = $eplug_icon ? "<img class='icon S32' src='".e_PLUGIN.$eplug_icon."' alt='' />" : E_32_PLUGIN; $plugin_array['p-'.$plugin_path] = array('link' => e_PLUGIN.$plugin_path."/".$eplug_conffile, 'title' => $eplug_name, 'caption' => $eplug_caption, 'perms' => "P".$plugin_id, 'icon' => $plugin_icon, 'icon_32' => $plugin_icon_32); } unset($eplug_conffile, $eplug_name, $eplug_caption, $eplug_icon_small); } } else { $plugin_array = array(); } */ ksort($plugin_array, SORT_STRING); // To FIX, without changing the current key format, sort by 'title' if ($linkStyle == "array") { return $plugin_array; } foreach ($plugin_array as $plug_key => $plug_value) { $the_icon = $iconSize == E_16_PLUGMANAGER ? $plug_value['icon'] : $plug_value['icon_32']; $text .= render_links($plug_value['link'], $plug_value['title'], $plug_value['caption'], $plug_value['perms'], $the_icon, $linkStyle); } return $text; }
/** * Legacy Admin Menu Routine. * Currently Used by Jayya admin. */ function sc_admin_alt_nav($parm) { if (ADMIN) { global $sql, $pref, $tp; parse_str($parm); require e_ADMIN . 'ad_links.php'; require_once e_HANDLER . 'admin_handler.php'; function adnav_cat($cat_title, $cat_link, $cat_img, $cat_id = FALSE) { $cat_link = $cat_link ? $cat_link : "javascript:void(0);"; $text = "<a class='menuButton' href='" . $cat_link . "' style='background-image: url(" . $cat_img . "); background-repeat: no-repeat; background-position: 3px 1px' "; if ($cat_id) { $text .= "onclick=\"return buttonClick(event, '" . $cat_id . "');\" onmouseover=\"buttonMouseover(event, '" . $cat_id . "');\""; } $text .= ">" . $cat_title . "</a>"; return $text; } function adnav_main($cat_title, $cat_link, $cat_img, $cat_id = FALSE, $cat_highlight = '') { $exit = ""; $text = "<a class='menuItem " . $cat_highlight . "' href='" . $cat_link . "' "; if ($cat_id) { $text .= "onclick=\"return false;\" onmouseover=\"menuItemMouseover(event, '" . $cat_id . "');\""; } $text .= "><span class='menuItemBuffer'>" . $cat_img . "</span><span class='menuItemText'>" . $cat_title . "</span>"; if ($cat_id) { $text .= "<span class=\"menuItemArrow\">▶</span>"; } $text .= "</a>"; return $text; } if (file_exists(THEME . 'nav_menu.js')) { $text = "<script type='text/javascript' src='" . THEME_ABS . "nav_menu.js'></script>"; } else { $text = "<script type='text/javascript' src='" . e_JS . "nav_menu.js'></script>"; } $text .= "<div style='width: 100%'><table style='border-collapse: collapse; width: 100%'>\n\t\t\t<tr><td>\n\t\t\t<div class='menuBar' style='width: 100%'>"; $text .= adnav_cat(ADLAN_151, e_ADMIN . 'admin.php', E_16_NAV_MAIN); // Main Link. // Render Settings, Users, Content, Tools, Manage. for ($i = 1; $i < 7; $i++) { $ad_tmpi = 0; $ad_links_array = asortbyindex($array_functions, 1); $nav_main = adnav_cat($admin_cat['title'][$i], '', $admin_cat['img'][$i], $admin_cat['id'][$i]); $ad_texti = "<div id='" . $admin_cat['id'][$i] . "' class='menu' onmouseover=\"menuMouseover(event)\">"; while (list($key, $nav_extract) = each($ad_links_array)) { if ($nav_extract[4] == $i) { if (getperms($nav_extract[3])) { $ad_texti .= adnav_main($nav_extract[1], $nav_extract[0], $nav_extract[5]); $ad_tmpi = 1; } } } $ad_texti .= '</div>'; if ($ad_tmpi == 1) { $text .= $nav_main; $text .= $ad_texti; } } $render_plugins = FALSE; include_once e_HANDLER . 'plugin_class.php'; $plug = new e107plugin(); $plugin_array = array(); // kill php notices if ($sql->db_Select('plugin', '*', 'plugin_installflag=1 ORDER BY plugin_path')) { while ($row = $sql->db_Fetch()) { if (getperms('P' . $row['plugin_id'])) { if ($plug->parse_plugin($row['plugin_path'])) { $plug_vars = $plug->plug_vars; loadLanFiles($row['plugin_path'], 'admin'); if ($plug_vars['administration']['configFile']) { $plug_vars['@attributes']['name'] = $tp->toHTML($plug_vars['@attributes']['name'], FALSE, "defs"); $icon_src = (isset($plug_vars['plugin_php']) ? e_PLUGIN_ABS : e_PLUGIN_ABS . $row['plugin_path'] . '/') . $plug_vars['administration']['iconSmall']; $plugin_icon = $plug_vars['administration']['iconSmall'] ? "<img src='{$icon_src}' alt='" . $plug_vars['administration']['caption'] . "' class='icon S16' />" : E_16_PLUGIN; $plugin_array[ucfirst($plug_vars['@attributes']['name'])] = adnav_main($plug_vars['@attributes']['name'], e_PLUGIN . $row['plugin_path'] . "/" . $plug_vars['administration']['configFile'], $plugin_icon); } $render_plugins = TRUE; $active_plugs = TRUE; } } } ksort($plugin_array, SORT_STRING); $plugs_text = ''; foreach ($plugin_array as $plugin_compile) { $plugs_text .= $plugin_compile; } } /* if (getperms('Z')) { $pclass_extended = $active_plugs ? 'header' : ''; $plugin_text = adnav_main(ADLAN_98, e_ADMIN.'plugin.php', E_16_PLUGMANAGER, FALSE, $pclass_extended); $render_plugins = TRUE; }*/ if ($render_plugins) { $text .= adnav_cat(ADLAN_CL_7, '', E_16_CAT_PLUG, 'plugMenu'); $text .= "<div id='plugMenu' class='menu' onmouseover=\"menuMouseover(event)\">"; $text .= varset($plugin_text) . varset($plugs_text); $text .= "</div>"; } // Render the "About" Menu - Phpinfo, Credits and Docs. $text .= adnav_cat(ADLAN_CL_20, '', E_16_CAT_ABOUT, $admin_cat['id'][20]); //E_16_NAV_DOCS $text .= "<div id='" . $admin_cat['id'][20] . "' class='menu' onmouseover=\"menuMouseover(event)\">"; foreach ($ad_links_array as $key => $nav_extract) { $text .= $nav_extract[4] == 20 ? adnav_main($nav_extract[1], $nav_extract[0], $nav_extract[5]) : ""; } // if (!is_readable(e_DOCS.e_LANGUAGE."/")) // warning killed // { // $handle=opendir(e_DOCS.'English/'); // } // $i=1; // if(varset($handle)) // { // while ($file = readdir($handle)) // { // if ($file != '.' && $file != '..' && $file != 'CVS') // { // $text .= adnav_main(str_replace('_', ' ', $file), e_ADMIN_ABS.'docs.php?'.$i, E_16_DOCS); // $i++; // } // } // closedir($handle); // } $text .= '</div>'; $text .= '</div> </td>'; if (varset($exit) != 'off') { $text .= "<td style='width: 160px; white-space: nowrap'>\n\t\t\t\t<div class='menuBar' style='width: 100%'>"; $text .= adnav_cat(ADLAN_53, e_HTTP . 'index.php', E_16_NAV_LEAV); $text .= adnav_cat(ADLAN_46, e_ADMIN_ABS . 'admin.php?logout', E_16_NAV_LGOT); $text .= '</div> </td>'; } $text .= '</tr> </table> </div>'; return $text; } }