mirror of
https://github.com/e107inc/e107.git
synced 2025-04-21 21:21:54 +02:00
Introduction of e_navigation class to handle all links site-wide. Large-scale cleanup of global admin links, plugin links etc.
This commit is contained in:
parent
872cd7901b
commit
d20af73bc5
e107_admin
ad_links.phpadmin.phpadmin_log.phpbanlist.phpboot.phpcpage.phpcron.phpdb.phpheader.php
includes
lancheck.phplanguage.phpnewspost.phpplugin.phpprefs.phpsearch.phptheme.phpe107_core/shortcodes/batch
e107_handlers
e107_plugins
_blank
banner
download
gallery
list_new
tinymce
e107_themes
@ -421,6 +421,9 @@ if (!defined('E_32_SYSINFO')) {
|
||||
define('E_32_SYSINFO', "<img class='icon S32' src='".e_IMAGE."admin_images/sysinfo_32.png' alt='' />");
|
||||
}
|
||||
|
||||
|
||||
//XXX Move to e_navigation ?
|
||||
|
||||
$e_icon_array = array(
|
||||
'main' => E_32_MAIN,
|
||||
'admin' => E_32_ADMIN,
|
||||
@ -465,6 +468,8 @@ $e_icon_array = array(
|
||||
'wmessage' => E_32_WELCOME );
|
||||
|
||||
//FIXME array structure - see shortcodes/admin_navigation.php
|
||||
// Moved to sitelinks_class.php - e_navigation;
|
||||
/*
|
||||
$admin_cat['title'][1] = ADLAN_CL_1;
|
||||
$admin_cat['id'][1] = 'setMenu';
|
||||
$admin_cat['img'][1] = E_16_CAT_SETT;
|
||||
@ -522,6 +527,13 @@ $admin_cat['id'][20] = 'aboutMenu';
|
||||
$admin_cat['img'][20] = E_16_CAT_ABOUT;//E_16_NAV_DOCS
|
||||
$admin_cat['lrg_img'][20] = E_32_CAT_ABOUT;
|
||||
$admin_cat['sort'][20] = false;
|
||||
*/
|
||||
|
||||
|
||||
$admin_cat = e107::getNav()->adminCats(); // see e107_handlers/sitelinks.php
|
||||
|
||||
|
||||
|
||||
|
||||
// Info about attributes
|
||||
/*
|
||||
@ -546,12 +558,12 @@ attribute 6 = 16 x 16 image
|
||||
attribute 7 = 32 x 32 image
|
||||
*/
|
||||
|
||||
//FIXME array structure suitable for e_admin_menu - see shortcodes/admin_navigation.php
|
||||
//FIXME array structure suitable for e107::getNav()->admin - see shortcodes/admin_navigation.php
|
||||
//TODO find out where is used $array_functions elsewhere, refactor it
|
||||
|
||||
|
||||
// DO NOT EDIT without first checking user_handler.php
|
||||
|
||||
/*
|
||||
$array_functions = array(
|
||||
0 => array(e_ADMIN.'administrator.php', ADLAN_8, ADLAN_9, '3', 2, E_16_ADMIN, E_32_ADMIN),
|
||||
1 => array(e_ADMIN.'updateadmin.php', ADLAN_10, ADLAN_11, '', 2, E_16_ADPASS, E_32_ADPASS),
|
||||
@ -594,25 +606,11 @@ $array_functions = array(
|
||||
// 37 => array(e_ADMIN.'custom_field.php', ADLAN_161, ADLAN_162, 'U', 4, E_16_CUSTOMFIELD, E_32_CUSTOMFIELD),
|
||||
38 => array(e_ADMIN.'comment.php', LAN_COMMENTMAN, LAN_COMMENTMAN, 'B', 5, E_16_COMMENT, E_32_COMMENT)
|
||||
);
|
||||
*/
|
||||
|
||||
$array_functions = e107::getNav()->adminLinks(); // replacement see e107_handlers/sitelinks.php
|
||||
|
||||
|
||||
//FIXME array structure suitable for e_admin_menu - see shortcodes/admin_navigation.php
|
||||
/*
|
||||
* Info about sublinks array structure
|
||||
*
|
||||
* key = $array_functions key
|
||||
* attribute 1 = link
|
||||
* attribute 2 = title
|
||||
* attribute 3 = description
|
||||
* attribute 4 = perms
|
||||
* attribute 5 = category
|
||||
* attribute 6 = 16 x 16 image
|
||||
* attribute 7 = 32 x 32 image
|
||||
*
|
||||
*/
|
||||
$array_sub_functions = array();
|
||||
$array_sub_functions[17][] = array(e_ADMIN.'newspost.php', LAN_MANAGE, ADLAN_3, 'H', 3, E_16_MANAGE, E_32_MANAGE);
|
||||
$array_sub_functions[17][] = array(e_ADMIN.'newspost.php?create', LAN_CREATE, ADLAN_2, 'H', 3, E_16_CREATE, E_32_CREATE);
|
||||
$array_sub_functions[17][] = array(e_ADMIN.'newspost.php?pref', LAN_PREFS, ADLAN_4, 'H', 3, E_16_SETTINGS, E_32_SETTINGS);
|
||||
|
||||
if(!defset('e_PAGETITLE'))
|
||||
{
|
||||
|
@ -337,142 +337,8 @@ function log_request()
|
||||
}
|
||||
}
|
||||
|
||||
// getPlugLinks() - moved to sitelinks_class.php : pluginLinks();
|
||||
|
||||
// Function renders all the plugin links according to the required icon size and layout style
|
||||
// - common to the various admin layouts.
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
require_once("footer.php");
|
||||
|
@ -1078,7 +1078,7 @@ function admin_log_adminmenu()
|
||||
$var['users']['link'] = "users.php";
|
||||
}
|
||||
*/
|
||||
e_admin_menu(RL_LAN_005, $action, $var);
|
||||
e107::getNav()->admin(RL_LAN_005, $action, $var);
|
||||
}
|
||||
|
||||
require_once (e_ADMIN."footer.php");
|
||||
|
@ -987,7 +987,7 @@ function banlist_adminmenu()
|
||||
$var['banlog']['link'] = e_SELF.'?banlog';
|
||||
$var['banlog']['perm'] = '0';
|
||||
}
|
||||
e_admin_menu(BANLAN_16, $action, $var);
|
||||
e107::getNav()->admin(BANLAN_16, $action, $var);
|
||||
}
|
||||
|
||||
|
||||
|
@ -72,10 +72,13 @@ else
|
||||
// TODO - This function often needs to be available BEFORE header.php is loaded.
|
||||
|
||||
|
||||
// It has been copied to message_handler.php as autoMessage();
|
||||
//XXX DEPRECATED It has been copied to message_handler.php as autoMessage();
|
||||
|
||||
function admin_update($update, $type = 'update', $success = false, $failed = false, $output = true)
|
||||
{
|
||||
return e107::getMessage()->autoMessage($update, $type, $success , $failed , $output);
|
||||
|
||||
/*
|
||||
require_once (e_HANDLER."message_handler.php");
|
||||
$emessage = e107::getMessage();
|
||||
|
||||
@ -121,6 +124,7 @@ function admin_update($update, $type = 'update', $success = false, $failed = fal
|
||||
|
||||
if ($output) echo $emessage->render();
|
||||
return $update;
|
||||
*/
|
||||
}
|
||||
|
||||
function admin_purge_related($table, $id)
|
||||
@ -158,49 +162,38 @@ function admin_purge_related($table, $id)
|
||||
$ns = e107::getRender();
|
||||
$e107_var = array();
|
||||
|
||||
/**
|
||||
* Build admin menus - addmin menus are now supporting unlimitted number of submenus
|
||||
* TODO - add this to a handler for use on front-end as well (tree, sitelinks.sc replacement)
|
||||
*
|
||||
* $e107_vars structure:
|
||||
* $e107_vars['action']['text'] -> link title
|
||||
* $e107_vars['action']['link'] -> if empty '#action' will be added as href attribute
|
||||
* $e107_vars['action']['image'] -> (new) image tag
|
||||
* $e107_vars['action']['perm'] -> permissions via getperms()
|
||||
* $e107_vars['action']['userclass'] -> user class permissions via check_class()
|
||||
* $e107_vars['action']['include'] -> additional <a> tag attributes
|
||||
* $e107_vars['action']['sub'] -> (new) array, exactly the same as $e107_vars' first level e.g. $e107_vars['action']['sub']['action2']['link']...
|
||||
* $e107_vars['action']['sort'] -> (new) used only if found in 'sub' array - passed as last parameter (recursive call)
|
||||
* $e107_vars['action']['link_class'] -> (new) additional link class
|
||||
* $e107_vars['action']['sub_class'] -> (new) additional class used only when sublinks are being parsed
|
||||
*
|
||||
* @param string $title
|
||||
* @param string $active_page
|
||||
* @param array $e107_vars
|
||||
* @param array $tmpl
|
||||
* @param array $sub_link
|
||||
* @param bool $sortlist
|
||||
* @return string parsed admin menu (or empty string if title is empty)
|
||||
*/
|
||||
// Left in for BC for now.
|
||||
|
||||
function e_admin_menu($title, $active_page, $e107_vars, $tmpl = array(), $sub_link = false, $sortlist = false)
|
||||
{
|
||||
|
||||
|
||||
global $E_ADMIN_MENU;
|
||||
if (!$tmpl)
|
||||
$tmpl = $E_ADMIN_MENU;
|
||||
|
||||
|
||||
|
||||
return e107::getNav()->admin($title, $active_page, $e107_vars, $tmpl, $sub_link , $sortlist );
|
||||
|
||||
|
||||
// See e107::getNav()->admin();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Search for id
|
||||
*/
|
||||
/// Search for id
|
||||
|
||||
$temp = explode('--id--', $title, 2);
|
||||
$title = $temp[0];
|
||||
$id = str_replace(array(' ', '_'), '-', varset($temp[1]));
|
||||
|
||||
unset($temp);
|
||||
|
||||
/*
|
||||
* SORT
|
||||
*/
|
||||
// SORT
|
||||
|
||||
|
||||
|
||||
if ($sortlist == TRUE)
|
||||
{
|
||||
$temp = $e107_vars;
|
||||
@ -339,7 +332,7 @@ function e_admin_menu($title, $active_page, $e107_vars, $tmpl = array(), $sub_li
|
||||
$replace[7] = ' '.varset($e107_vars[$act]['link_class'], 'e-expandit');
|
||||
$replace[8] = ' '.varset($e107_vars[$act]['sub_class'], 'e-hideme e-expandme');
|
||||
$replace[4] = preg_replace($search, $replace, $START_SUB);
|
||||
$replace[4] .= e_admin_menu(false, $active_page, $e107_vars[$act]['sub'], $tmpl, true, (isset($e107_vars[$act]['sort']) ? $e107_vars[$act]['sort'] : $sortlist));
|
||||
$replace[4] .= e_ad/min_menu(false, $active_page, $e107_vars[$act]['sub'], $tmpl, true, (isset($e107_vars[$act]['sort']) ? $e107_vars[$act]['sort'] : $sortlist));
|
||||
$replace[4] .= $tmpl['end_sub'];
|
||||
}
|
||||
|
||||
@ -358,17 +351,18 @@ function e_admin_menu($title, $active_page, $e107_vars, $tmpl = array(), $sub_li
|
||||
$ns = e107::getRender();
|
||||
$ns->tablerender($title, $text, array('id'=>$id, 'style'=>'button_menu'));
|
||||
return '';
|
||||
*/
|
||||
}
|
||||
|
||||
/*
|
||||
* DEPRECATED - use e_admin_menu()
|
||||
* DEPRECATED - use e_adm/in_menu() e107::getNav()->admin
|
||||
*/
|
||||
if (!function_exists('show_admin_menu'))
|
||||
{
|
||||
function show_admin_menu($title, $active_page, $e107_vars, $js = FALSE, $sub_link = FALSE, $sortlist = FALSE)
|
||||
{
|
||||
|
||||
return e_admin_menu($title, $active_page, $e107_vars, false, false, $sortlist);
|
||||
return e107::getNav()->admin($title, $active_page, $e107_vars, false, false, $sortlist);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1286,7 +1286,7 @@ class page
|
||||
$var['options']['link'] = e_SELF."?options";
|
||||
$var['options']['perm'] = "0";
|
||||
|
||||
e_admin_menu(CUSLAN_33, $action, $var);
|
||||
e107::getNav()->admin(CUSLAN_33, $action, $var);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
@ -1179,7 +1179,7 @@ class cron
|
||||
|
||||
$action = ($this->cronAction) ? $this->cronAction : 'main';
|
||||
|
||||
e_admin_menu(PAGE_NAME, $action, $var);
|
||||
e107::getNav()->admin(PAGE_NAME, $action, $var);
|
||||
}
|
||||
|
||||
function cronExecuteMethod($class_name, $method_name, $return = 'boolean')
|
||||
|
@ -971,7 +971,7 @@ function db_adminmenu() //FIXME - has problems when navigation is on the LEFT in
|
||||
$var[$key]['link'] = e_SELF."?mode=".$key;
|
||||
}
|
||||
|
||||
e_admin_menu(DBLAN_10, $_GET['mode'], $var);
|
||||
e107::getNav()->admin(DBLAN_10, $_GET['mode'], $var);
|
||||
}
|
||||
|
||||
|
||||
|
@ -416,7 +416,7 @@ if ($e107_popup != 1)
|
||||
//$ns = new e107table;
|
||||
//$e107_var = array();
|
||||
|
||||
// function e_admin_menu moved to boot.php
|
||||
// function e_admin_me/nu moved to boot.php (e107::getNav()->admin)
|
||||
// legacy function show_admin_menu moved to boot.php
|
||||
// include admin_template.php moved to boot.php
|
||||
// function parse_admin moved to boot.php
|
||||
|
@ -58,7 +58,7 @@ if($_GET['mode'] == "e_advanced"){
|
||||
<table style='".ADMIN_WIDTH."'>";
|
||||
|
||||
|
||||
$text .= getPluginLinks(E_32_PLUGMANAGER, "classis");
|
||||
$text .= e107::getNav()->pluginLinks(E_32_PLUGMANAGER, "classis");
|
||||
|
||||
$text .= render_clean();
|
||||
$text .= "</table></div>";
|
||||
|
@ -35,7 +35,7 @@ $text .= "<tr>
|
||||
|
||||
|
||||
|
||||
$text .= getPluginLinks( E_16_PLUGMANAGER, 'adminb');
|
||||
$text .= e107::getNav()->pluginLinks( E_16_PLUGMANAGER, 'adminb');
|
||||
|
||||
$text .= "</table></div>";
|
||||
|
||||
|
@ -21,6 +21,8 @@ $emessage = e107::getMessage();
|
||||
|
||||
$text = "<div style='text-align:center'>
|
||||
<table class='fborder' style='".ADMIN_WIDTH."'>";
|
||||
|
||||
$admin_cat = e107::getNav()->adminCats();
|
||||
|
||||
foreach ($admin_cat['id'] as $cat_key => $cat_id)
|
||||
{
|
||||
|
@ -37,7 +37,7 @@ if($buts != "")
|
||||
$text = "<div style='text-align:center'>
|
||||
<table style='".ADMIN_WIDTH."'>";
|
||||
|
||||
$text .= getPluginLinks(E_32_PLUGMANAGER, "classis");
|
||||
$text .= e107::getNav()->pluginLinks(E_32_PLUGMANAGER, "classis");
|
||||
|
||||
$text .= render_clean();
|
||||
|
||||
|
@ -40,7 +40,7 @@ $text = "<div style='text-align:center'>
|
||||
<table style='".ADMIN_WIDTH."'>";
|
||||
|
||||
|
||||
$text .= getPluginLinks(E_32_PLUGMANAGER, "classis");
|
||||
$text .= e107::getNav()->pluginLinks(E_32_PLUGMANAGER, "classis");
|
||||
|
||||
|
||||
$text .= render_clean();
|
||||
|
@ -45,7 +45,7 @@ $text = "<div style='text-align:center'>
|
||||
<table style='".ADMIN_WIDTH."'>";
|
||||
|
||||
|
||||
$text .= getPluginLinks( E_16_PLUGMANAGER, 'default');
|
||||
$text .= e107::getNav()->pluginLinks( E_16_PLUGMANAGER, 'default');
|
||||
|
||||
|
||||
$text .= "</tr>
|
||||
|
@ -44,7 +44,7 @@ if (isset($_POST['submit-mye107']) || varset($_POST['submit-mymenus']))
|
||||
$user_pref['core-infopanel-mye107'] = $pref['core-infopanel-default'];
|
||||
}
|
||||
|
||||
$iconlist = array_merge($array_functions_assoc, getPluginLinks(E_16_PLUGMANAGER, "array"));
|
||||
$iconlist = array_merge($array_functions_assoc, e107::getNav()->pluginLinks(E_16_PLUGMANAGER, "array"));
|
||||
|
||||
$text .= "
|
||||
<form method='post' action='".e_SELF."?".e_QUERY."'>";
|
||||
|
@ -18,6 +18,8 @@ if (!defined('e107_INIT')) { exit; }
|
||||
|
||||
$mes = e107::getMessage();
|
||||
|
||||
$admin_cat = e107::getNav()->adminCats();
|
||||
|
||||
$text = "<div style='text-align:center'>
|
||||
<div class='admintabs' id='tab-container'>
|
||||
<ul class='e-tabs' id='core-emote-tabs'>";
|
||||
@ -58,7 +60,7 @@ foreach ($admin_cat['id'] as $cat_key => $cat_id)
|
||||
}
|
||||
else // Plugin category.
|
||||
{
|
||||
$text_rend = getPluginLinks(E_32_PLUGMANAGER, "classis");
|
||||
$text_rend = e107::getNav()->pluginLinks(E_32_PLUGMANAGER, "classis");
|
||||
|
||||
if ($text_rend)
|
||||
{
|
||||
|
@ -840,7 +840,7 @@ function lancheck_adminmenu() {
|
||||
$var['tools']['link'] = e_ADMIN_ABS."language.php?tools";
|
||||
|
||||
|
||||
e_admin_menu(ADLAN_132, $action, $var);
|
||||
e107::getNav()->admin(ADLAN_132, $action, $var);
|
||||
}
|
||||
|
||||
$ns -> tablerender(LAN_CHECK_PAGE_TITLE.' - '.LAN_CHECK_1, LAN_CHECK_26);
|
||||
|
@ -843,7 +843,7 @@ function language_adminmenu()
|
||||
$var['tools']['text'] = LANG_LAN_21;
|
||||
$var['tools']['link'] = e_SELF."?tools";
|
||||
// }
|
||||
e_admin_menu(ADLAN_132, $action, $var);
|
||||
e107::getNav()->admin(ADLAN_132, $action, $var);
|
||||
}
|
||||
// Zip up the language pack.
|
||||
// ===================================================
|
||||
|
@ -3066,7 +3066,7 @@ class admin_newspost
|
||||
$var['maint']['perm'] = "N";
|
||||
}
|
||||
|
||||
e_admin_menu(NWSLAN_48, $this->getAction(), $var);
|
||||
e107::getNav()->admin(NWSLAN_48, $this->getAction(), $var);
|
||||
}
|
||||
*/
|
||||
|
||||
|
@ -1277,7 +1277,7 @@ class pluginManager{
|
||||
|
||||
$action = (in_array($this->action,$keys)) ? $this->action : "installed";
|
||||
|
||||
e_admin_menu(ADLAN_98, $action, $var);
|
||||
e107::getNav()->admin(ADLAN_98, $action, $var);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1689,6 +1689,6 @@ function prefs_adminmenu()
|
||||
$var['core-prefs-javascript']['text'] = "Javascript Framework"; // TODO LAN
|
||||
$var['core-prefs-advanced']['text'] = PRFLAN_149;
|
||||
|
||||
e_admin_menu(LAN_OPTIONS.'--id--prev_nav', 'core-prefs-main', $var);
|
||||
e107::getNav()->admin(LAN_OPTIONS.'--id--prev_nav', 'core-prefs-main', $var);
|
||||
}
|
||||
|
||||
|
@ -498,7 +498,7 @@ function search_adminmenu()
|
||||
$var['settings']['text'] = SEALAN_42;
|
||||
$var['settings']['link'] = e_SELF."?settings";
|
||||
|
||||
e_admin_menu(SEALAN_40, $action, $var);
|
||||
e107::getNav()->admin(SEALAN_40, $action, $var);
|
||||
}
|
||||
|
||||
?>
|
@ -148,7 +148,7 @@ function theme_adminmenu()
|
||||
$selected = (e_QUERY) ? e_QUERY : "main";
|
||||
|
||||
|
||||
e_admin_menu(TPVLAN_26, $selected, $var);
|
||||
e107::getNav()->admin(TPVLAN_26, $selected, $var);
|
||||
}
|
||||
|
||||
|
||||
|
@ -498,7 +498,7 @@ class admin_shortcodes
|
||||
if($tmp)
|
||||
{
|
||||
ob_start();
|
||||
// FIXME - renderMenu(), respectively e_admin_menu() should return, not output content!
|
||||
// FIXME - renderMenu(), respectively e_adm/in_menu() should return, not output content!
|
||||
$tmp->renderMenu();
|
||||
$ret = ob_get_contents();
|
||||
ob_end_clean();
|
||||
@ -1248,7 +1248,13 @@ class admin_shortcodes
|
||||
{
|
||||
|
||||
if (!ADMIN) return '';
|
||||
global $admin_cat, $array_functions, $array_sub_functions, $pref;
|
||||
// global $admin_cat, $array_functions, $array_sub_functions, $pref;
|
||||
|
||||
$pref = e107::getPref();
|
||||
|
||||
$admin_cat = e107::getNav()->adminCats();
|
||||
$array_functions = e107::getNav()->adminLinks();
|
||||
$array_sub_functions = e107::getNav()->adminLinks('sub');
|
||||
|
||||
$tp = e107::getParser();
|
||||
$e107 = e107::getInstance();
|
||||
@ -1264,7 +1270,7 @@ class admin_shortcodes
|
||||
if($parm == 'home' || $parm == 'logout' || $parm == 'language' || $parm == 'pm')
|
||||
{
|
||||
$menu_vars = $this->getOtherNav($parm);
|
||||
return e_admin_menu('', '', $menu_vars, $$tmpl, FALSE, FALSE);
|
||||
return e107::getNav()->admin('', '', $menu_vars, $$tmpl, FALSE, FALSE);
|
||||
}
|
||||
|
||||
// MAIN LINK
|
||||
@ -1454,7 +1460,8 @@ class admin_shortcodes
|
||||
}
|
||||
|
||||
// print_a($menu_vars);
|
||||
return e_admin_menu('', e_PAGE, $menu_vars, $$tmpl, FALSE, FALSE);
|
||||
return e107::getNav()->admin('', e_PAGE, $menu_vars, $$tmpl, FALSE, FALSE);
|
||||
//return e_admin_men/u('', e_PAGE, $menu_vars, $$tmpl, FALSE, FALSE);
|
||||
}
|
||||
|
||||
|
||||
@ -1614,7 +1621,8 @@ class admin_shortcodes
|
||||
// $keys = array_keys($var);
|
||||
// $action = (in_array($this->action,$keys)) ? $this->action : "installed";
|
||||
|
||||
e_admin_menu(ADLAN_6,$action, $var);
|
||||
e107::getNav()->admin(ADLAN_6,$action, $var);
|
||||
// e_admin/_menu(ADLAN_6,$action, $var);
|
||||
|
||||
}
|
||||
|
||||
|
@ -987,7 +987,7 @@ class e_admin_dispatcher
|
||||
* Format: 'mode/action' => array('caption' => 'Link title'[, 'perm' => '0', 'url' => '{e_PLUGIN}plugname/admin_config.php'], ...);
|
||||
* Note that 'perm' and 'userclass' restrictions are inherited from the $modes, $access and $perm, so you don't have to set that vars if
|
||||
* you don't need any additional 'visual' control.
|
||||
* All valid key-value pair (see e_admin_menu function) are accepted.
|
||||
* All valid key-value pair (see e107::getNav()->admin function) are accepted.
|
||||
* @var array
|
||||
*/
|
||||
protected $adminMenu = array();
|
||||
@ -1473,7 +1473,7 @@ class e_admin_dispatcher
|
||||
$request = $this->getRequest();
|
||||
if(!$selected) $selected = $request->getMode().'/'.$request->getAction();
|
||||
$selected = vartrue($this->adminMenuAliases[$selected], $selected);
|
||||
return e_admin_menu($this->menuTitle, $selected, $var);
|
||||
return e107::getNav()->admin($this->menuTitle, $selected, $var);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -578,7 +578,7 @@ class e_bbcode
|
||||
$text = preg_replace('/<em([\w :\-_;="]*)?>/i', "[i]",$text);
|
||||
$text = preg_replace('/<li([\w :\-_;="]*)?>/i', "[*]",$text);
|
||||
$text = preg_replace('/<ul([\w :\-_;="]*)?>/i', "[list]",$text);
|
||||
$text = preg_replace('/<ol([\w :\-_;="]*)?>/i', "[list class='ol']",$text);
|
||||
$text = preg_replace('/<ol([\w :\-_;="]*)?>/i', "[list=ol]",$text);
|
||||
$text = preg_replace('/<table([\w :\-_;="]*)?>/i', "[table]",$text);
|
||||
$text = preg_replace('/<tbody([\w :\-_;="]*)?>/i', "[tbody]",$text);
|
||||
$text = preg_replace('/<tr([\w :\-_;="]*)?>/i', "[tr]",$text);
|
||||
|
@ -199,6 +199,7 @@ class e107
|
||||
'rater' => '{e_HANDLER}rate_class.php',
|
||||
'redirection' => '{e_HANDLER}redirection_class.php',
|
||||
'sitelinks' => '{e_HANDLER}sitelinks_class.php',
|
||||
'e_navigation' => '{e_HANDLER}sitelinks_class.php',
|
||||
'themeHandler' => '{e_HANDLER}theme_handler.php',
|
||||
'user_class' => '{e_HANDLER}userclass_class.php',
|
||||
'userlogin' => '{e_HANDLER}login.php',
|
||||
@ -1430,6 +1431,15 @@ class e107
|
||||
{
|
||||
return self::getSingleton('e_media', true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve Navigation Menu handler singleton object
|
||||
* @return e_media
|
||||
*/
|
||||
public static function getNav()
|
||||
{
|
||||
return self::getSingleton('e_navigation', true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve message handler singleton
|
||||
|
@ -540,6 +540,519 @@ class sitelinks
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Class for handling all navigation links site-wide. ie. admin links, admin-menu links, admin-plugin links, front-end sitelinks etc.
|
||||
*/
|
||||
class e_navigation
|
||||
{
|
||||
|
||||
//FIXME array structure - see $this->admin();
|
||||
function adminCats()
|
||||
{
|
||||
$pref = e107::getPref();
|
||||
|
||||
$admin_cat = array();
|
||||
|
||||
$admin_cat['title'][1] = ADLAN_CL_1;
|
||||
$admin_cat['id'][1] = 'setMenu';
|
||||
$admin_cat['img'][1] = E_16_CAT_SETT;
|
||||
$admin_cat['lrg_img'][1] = E_32_CAT_SETT;
|
||||
$admin_cat['sort'][1] = true;
|
||||
|
||||
$admin_cat['title'][2] = ADLAN_CL_2;
|
||||
$admin_cat['id'][2] = 'userMenu';
|
||||
$admin_cat['img'][2] = E_16_CAT_USER;
|
||||
$admin_cat['lrg_img'][2] = E_32_CAT_USER;
|
||||
$admin_cat['sort'][2] = true;
|
||||
|
||||
$admin_cat['title'][3] = ADLAN_CL_3;
|
||||
$admin_cat['id'][3] = 'contMenu';
|
||||
$admin_cat['img'][3] = E_16_CAT_CONT;
|
||||
$admin_cat['lrg_img'][3] = E_32_CAT_CONT;
|
||||
$admin_cat['sort'][3] = true;
|
||||
|
||||
$admin_cat['title'][4] = ADLAN_CL_6;
|
||||
$admin_cat['id'][4] = 'toolMenu';
|
||||
$admin_cat['img'][4] = E_16_CAT_TOOL;
|
||||
$admin_cat['lrg_img'][4] = E_32_CAT_TOOL;
|
||||
$admin_cat['sort'][4] = true;
|
||||
|
||||
// Manage
|
||||
$admin_cat['title'][5] = LAN_MANAGE;
|
||||
$admin_cat['id'][5] = 'managMenu';
|
||||
$admin_cat['img'][5] = E_16_CAT_MANAGE;
|
||||
$admin_cat['lrg_img'][5] = E_32_CAT_MANAGE;
|
||||
$admin_cat['sort'][5] = TRUE;
|
||||
|
||||
if(vartrue($pref['admin_separate_plugins']))
|
||||
{
|
||||
$admin_cat['title'][6] = ADLAN_CL_7;
|
||||
$admin_cat['id'][6] = 'plugMenu';
|
||||
$admin_cat['img'][6] = E_16_CAT_PLUG;
|
||||
$admin_cat['lrg_img'][6] = E_32_CAT_PLUG;
|
||||
$admin_cat['sort'][6] = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Misc.
|
||||
$admin_cat['title'][6] = ADLAN_CL_8;
|
||||
$admin_cat['id'][6] = 'miscMenu';
|
||||
$admin_cat['img'][6] = E_16_CAT_MISC;
|
||||
$admin_cat['lrg_img'][6] = E_32_CAT_MISC;
|
||||
$admin_cat['sort'][6] = TRUE;
|
||||
}
|
||||
|
||||
//About menu - No 20 - leave space for user-categories.
|
||||
$admin_cat['title'][20] = ADLAN_CL_20;
|
||||
$admin_cat['id'][20] = 'aboutMenu';
|
||||
$admin_cat['img'][20] = E_16_CAT_ABOUT;//E_16_NAV_DOCS
|
||||
$admin_cat['lrg_img'][20] = E_32_CAT_ABOUT;
|
||||
$admin_cat['sort'][20] = false;
|
||||
|
||||
|
||||
return $admin_cat;
|
||||
|
||||
}
|
||||
|
||||
|
||||
function adminLinks($sub=false)
|
||||
{
|
||||
|
||||
if($sub==true)
|
||||
{
|
||||
|
||||
//FIXME array structure suitable for e_admin_menu - see shortcodes/admin_navigation.php
|
||||
/*
|
||||
* Info about sublinks array structure
|
||||
*
|
||||
* key = $array_functions key
|
||||
* attribute 1 = link
|
||||
* attribute 2 = title
|
||||
* attribute 3 = description
|
||||
* attribute 4 = perms
|
||||
* attribute 5 = category
|
||||
* attribute 6 = 16 x 16 image
|
||||
* attribute 7 = 32 x 32 image
|
||||
*
|
||||
*/
|
||||
$array_sub_functions = array();
|
||||
$array_sub_functions[17][] = array(e_ADMIN.'newspost.php', LAN_MANAGE, ADLAN_3, 'H', 3, E_16_MANAGE, E_32_MANAGE);
|
||||
$array_sub_functions[17][] = array(e_ADMIN.'newspost.php?create', LAN_CREATE, ADLAN_2, 'H', 3, E_16_CREATE, E_32_CREATE);
|
||||
$array_sub_functions[17][] = array(e_ADMIN.'newspost.php?pref', LAN_PREFS, ADLAN_4, 'H', 3, E_16_SETTINGS, E_32_SETTINGS);
|
||||
|
||||
return $array_sub_functions;
|
||||
}
|
||||
|
||||
|
||||
//FIXME array structure suitable for e_admin_menu (NOW admin() below) - see shortcodes/admin_navigation.php
|
||||
//TODO find out where is used $array_functions elsewhere, refactor it
|
||||
|
||||
//XXX DO NOT EDIT without first checking perms in user_handler.php !!!!
|
||||
$array_functions = array(
|
||||
0 => array(e_ADMIN.'administrator.php', ADLAN_8, ADLAN_9, '3', 2, E_16_ADMIN, E_32_ADMIN),
|
||||
1 => array(e_ADMIN.'updateadmin.php', ADLAN_10, ADLAN_11, '', 2, E_16_ADPASS, E_32_ADPASS),
|
||||
2 => array(e_ADMIN.'banlist.php', ADLAN_34, ADLAN_35, '4', 2, E_16_BANLIST, E_32_BANLIST),
|
||||
4 => array(e_ADMIN.'cache.php', ADLAN_74, ADLAN_75, 'C', 1, E_16_CACHE, E_32_CACHE),
|
||||
5 => array(e_ADMIN.'cpage.php', ADLAN_42, ADLAN_43, '5|J', 3, E_16_CUST, E_32_CUST),
|
||||
6 => array(e_ADMIN.'db.php', ADLAN_44, ADLAN_45, '0', 4, E_16_DATAB, E_32_DATAB),
|
||||
// 7 => array(e_ADMIN.'download.php', ADLAN_24, ADLAN_25, 'R', 3, E_16_DOWNL, E_32_DOWNL),
|
||||
8 => array(e_ADMIN.'emoticon.php', ADLAN_58, ADLAN_59, 'F', 1, E_16_EMOTE, E_32_EMOTE),
|
||||
// 9 => array(e_ADMIN.'filemanager.php', ADLAN_30, ADLAN_31, '6', 5, E_16_FILE, E_32_FILE), // replaced by media-manager
|
||||
10 => array(e_ADMIN.'frontpage.php', ADLAN_60, ADLAN_61, 'G', 1, E_16_FRONT, E_32_FRONT),
|
||||
11 => array(e_ADMIN.'image.php', LAN_MEDIAMANAGER, LAN_MEDIAMANAGER, 'A', 5, E_16_IMAGES, E_32_IMAGES),
|
||||
12 => array(e_ADMIN.'links.php', ADLAN_138, ADLAN_139, 'I', 1, E_16_LINKS, E_32_LINKS),
|
||||
13 => array(e_ADMIN.'wmessage.php', ADLAN_28, ADLAN_29, 'M', 3, E_16_WELCOME, E_32_WELCOME),
|
||||
14 => array(e_ADMIN.'ugflag.php', ADLAN_40, ADLAN_41, '9', 4, E_16_MAINTAIN, E_32_MAINTAIN),
|
||||
15 => array(e_ADMIN.'menus.php', ADLAN_6, ADLAN_7, '2', 5, E_16_MENUS, E_32_MENUS),
|
||||
16 => array(e_ADMIN.'meta.php', ADLAN_66, ADLAN_67, 'T', 1, E_16_META, E_32_META),
|
||||
17 => array(e_ADMIN.'newspost.php', ADLAN_0, ADLAN_1, 'H|N|7', 3, E_16_NEWS, E_32_NEWS),
|
||||
18 => array(e_ADMIN.'phpinfo.php', ADLAN_68, ADLAN_69, '0', 20, E_16_PHP, E_32_PHP),
|
||||
19 => array(e_ADMIN.'prefs.php', ADLAN_4, ADLAN_5, '1', 1, E_16_PREFS, E_32_PREFS),
|
||||
20 => array(e_ADMIN.'search.php', ADLAN_142, ADLAN_143, 'X', 1, E_16_SEARCH, E_32_SEARCH),
|
||||
21 => array(e_ADMIN.'admin_log.php', ADLAN_155, ADLAN_156, 'S', 4, E_16_ADMINLOG, E_32_ADMINLOG),
|
||||
22 => array(e_ADMIN.'theme.php', ADLAN_140, ADLAN_141, '1', 5, E_16_THEMEMANAGER, E_32_THEMEMANAGER),
|
||||
// 23 => array(e_ADMIN.'upload.php', ADLAN_72, ADLAN_73, 'V', 3, E_16_UPLOADS, E_32_UPLOADS),
|
||||
24 => array(e_ADMIN.'users.php', ADLAN_36, ADLAN_37, '4|U0|U1|U2|U3', 2, E_16_USER, E_32_USER),
|
||||
25 => array(e_ADMIN.'userclass2.php', ADLAN_38, ADLAN_39, '4', 2, E_16_USERCLASS, E_32_USERCLASS),
|
||||
26 => array(e_ADMIN.'language.php', ADLAN_132, ADLAN_133, '0', 1, E_16_LANGUAGE, E_32_LANGUAGE),
|
||||
27 => array(e_ADMIN.'mailout.php', ADLAN_136, ADLAN_137, 'W', 2, E_16_MAIL, E_32_MAIL),
|
||||
28 => array(e_ADMIN.'users_extended.php', ADLAN_78, ADLAN_79, '4', 2, E_16_USER_EXTENDED, E_32_USER_EXTENDED),
|
||||
29 => array(e_ADMIN.'fileinspector.php', ADLAN_147, ADLAN_148, 'Y', 4, E_16_INSPECT, E_32_INSPECT),
|
||||
30 => array(e_ADMIN.'notify.php', ADLAN_149, ADLAN_150, 'O', 4, E_16_NOTIFY, E_32_NOTIFY),
|
||||
31 => array(e_ADMIN.'cron.php', ADLAN_157, ADLAN_158, 'U', 4, E_16_CRON, E_32_CRON),
|
||||
|
||||
32 => array(e_ADMIN.'eurl.php', ADLAN_159, ADLAN_160, 'L', 1, E_16_EURL, E_32_EURL),
|
||||
33 => array(e_ADMIN.'plugin.php', ADLAN_98, ADLAN_99, 'Z', 5 , E_16_PLUGMANAGER, E_32_PLUGMANAGER),
|
||||
34 => array(e_ADMIN.'docs.php', ADLAN_12, ADLAN_13, '', 20, E_16_DOCS, E_32_DOCS),
|
||||
// TODO System Info.
|
||||
// 35 => array('#TODO', 'System Info', 'System Information', '', 20, '', ''),
|
||||
36 => array(e_ADMIN.'credits.php', LAN_CREDITS, LAN_CREDITS, '', 20, E_16_CREDITS, E_32_CREDITS),
|
||||
// 37 => array(e_ADMIN.'custom_field.php', ADLAN_161, ADLAN_162, 'U', 4, E_16_CUSTOMFIELD, E_32_CUSTOMFIELD),
|
||||
38 => array(e_ADMIN.'comment.php', LAN_COMMENTMAN, LAN_COMMENTMAN, 'B', 5, E_16_COMMENT, E_32_COMMENT)
|
||||
);
|
||||
|
||||
|
||||
return $array_functions;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Function renders all the plugin links according to the required icon size and layout style
|
||||
// - common to the various admin layouts such as infopanel, classis etc.
|
||||
function pluginLinks($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;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* XXX the NEW version of e_admin_menu();
|
||||
* Build admin menus - addmin menus are now supporting unlimitted number of submenus
|
||||
* TODO - add this to a handler for use on front-end as well (tree, sitelinks.sc replacement)
|
||||
*
|
||||
* $e107_vars structure:
|
||||
* $e107_vars['action']['text'] -> link title
|
||||
* $e107_vars['action']['link'] -> if empty '#action' will be added as href attribute
|
||||
* $e107_vars['action']['image'] -> (new) image tag
|
||||
* $e107_vars['action']['perm'] -> permissions via getperms()
|
||||
* $e107_vars['action']['userclass'] -> user class permissions via check_class()
|
||||
* $e107_vars['action']['include'] -> additional <a> tag attributes
|
||||
* $e107_vars['action']['sub'] -> (new) array, exactly the same as $e107_vars' first level e.g. $e107_vars['action']['sub']['action2']['link']...
|
||||
* $e107_vars['action']['sort'] -> (new) used only if found in 'sub' array - passed as last parameter (recursive call)
|
||||
* $e107_vars['action']['link_class'] -> (new) additional link class
|
||||
* $e107_vars['action']['sub_class'] -> (new) additional class used only when sublinks are being parsed
|
||||
*
|
||||
* @param string $title
|
||||
* @param string $active_page
|
||||
* @param array $e107_vars
|
||||
* @param array $tmpl
|
||||
* @param array $sub_link
|
||||
* @param bool $sortlist
|
||||
* @return string parsed admin menu (or empty string if title is empty)
|
||||
*/
|
||||
function admin($title, $active_page, $e107_vars, $tmpl = array(), $sub_link = false, $sortlist = false)
|
||||
{
|
||||
|
||||
global $E_ADMIN_MENU; //TODO remove me?
|
||||
if (!$tmpl)
|
||||
$tmpl = $E_ADMIN_MENU;
|
||||
|
||||
/*
|
||||
* Search for id
|
||||
*/
|
||||
$temp = explode('--id--', $title, 2);
|
||||
$title = $temp[0];
|
||||
$id = str_replace(array(' ', '_'), '-', varset($temp[1]));
|
||||
|
||||
unset($temp);
|
||||
|
||||
/*
|
||||
* SORT
|
||||
*/
|
||||
if ($sortlist == TRUE)
|
||||
{
|
||||
$temp = $e107_vars;
|
||||
unset($e107_vars);
|
||||
$func_list = array();
|
||||
foreach (array_keys($temp) as $key)
|
||||
{
|
||||
$func_list[] = $temp[$key]['text'];
|
||||
}
|
||||
|
||||
usort($func_list, 'strcoll');
|
||||
|
||||
foreach ($func_list as $func_text)
|
||||
{
|
||||
foreach (array_keys($temp) as $key)
|
||||
{
|
||||
if ($temp[$key]['text'] == $func_text)
|
||||
{
|
||||
$e107_vars[] = $temp[$key];
|
||||
}
|
||||
}
|
||||
}
|
||||
unset($temp);
|
||||
}
|
||||
|
||||
|
||||
|
||||
$kpost = '';
|
||||
$text = '';
|
||||
|
||||
if ($sub_link)
|
||||
{
|
||||
$kpost = '_sub';
|
||||
}
|
||||
else
|
||||
{
|
||||
$text = $tmpl['start'];
|
||||
}
|
||||
|
||||
//FIXME - e_parse::array2sc()
|
||||
$search = array();
|
||||
$search[0] = '/\{LINK_TEXT\}(.*?)/si';
|
||||
$search[1] = '/\{LINK_URL\}(.*?)/si';
|
||||
$search[2] = '/\{ONCLICK\}(.*?)/si';
|
||||
$search[3] = '/\{SUB_HEAD\}(.*?)/si';
|
||||
$search[4] = '/\{SUB_MENU\}(.*?)/si';
|
||||
$search[5] = '/\{ID\}(.*?)/si';
|
||||
$search[6] = '/\{SUB_ID\}(.*?)/si';
|
||||
$search[7] = '/\{LINK_CLASS\}(.*?)/si';
|
||||
$search[8] = '/\{SUB_CLASS\}(.*?)/si';
|
||||
$search[9] = '/\{LINK_IMAGE\}(.*?)/si';
|
||||
|
||||
foreach (array_keys($e107_vars) as $act)
|
||||
{
|
||||
if (isset($e107_vars[$act]['perm']) && !getperms($e107_vars[$act]['perm'])) // check perms first.
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// check class so that e.g. e_UC_NOBODY will result no permissions granted (even for main admin)
|
||||
if (isset($e107_vars[$act]['userclass']) && !e107::getUser()->checkClass($e107_vars[$act]['userclass'], false)) // check userclass perms
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// print_a($e107_vars[$act]);
|
||||
|
||||
$replace = array();
|
||||
|
||||
$rid = str_replace(array(' ', '_'), '-', $act).($id ? "-{$id}" : '');
|
||||
|
||||
if (($active_page == $act && !is_numeric($act))|| (str_replace("?", "", e_PAGE.e_QUERY) == str_replace("?", "", $act)))
|
||||
{
|
||||
$temp = $tmpl['button_active'.$kpost];
|
||||
}
|
||||
else
|
||||
{
|
||||
$temp = $tmpl['button'.$kpost];
|
||||
}
|
||||
|
||||
// $temp = $tmpl['button'.$kpost];
|
||||
// echo "ap = ".$active_page;
|
||||
// echo " act = ".$act."<br /><br />";
|
||||
|
||||
if($rid == 'adminhome')
|
||||
{
|
||||
$temp = $tmpl['button_other'.$kpost];
|
||||
}
|
||||
|
||||
if($rid == 'home')
|
||||
{
|
||||
$temp = $tmpl['button_home'.$kpost];
|
||||
}
|
||||
|
||||
if($rid == 'language')
|
||||
{
|
||||
$temp = $tmpl['button_language'.$kpost];
|
||||
}
|
||||
|
||||
if($rid == 'logout')
|
||||
{
|
||||
$temp = $tmpl['button_logout'.$kpost];
|
||||
}
|
||||
|
||||
$replace[0] = str_replace(" ", " ", $e107_vars[$act]['text']);
|
||||
// valid URLs
|
||||
$replace[1] = str_replace(array('&', '&'), array('&', '&'), varsettrue($e107_vars[$act]['link'], "#{$act}"));
|
||||
$replace[2] = '';
|
||||
if (varsettrue($e107_vars[$act]['include']))
|
||||
{
|
||||
$replace[2] = $e107_vars[$act]['include'];
|
||||
//$replace[2] = $js ? " onclick=\"showhideit('".$act."');\"" : " onclick=\"document.location='".$e107_vars[$act]['link']."'; disabled=true;\"";
|
||||
}
|
||||
$replace[3] = $title;
|
||||
$replace[4] = '';
|
||||
|
||||
$replace[5] = $id ? " id='eplug-nav-{$rid}'" : '';
|
||||
$replace[6] = $rid;
|
||||
|
||||
$replace[7] = varset($e107_vars[$act]['link_class']);
|
||||
$replace[8] = '';
|
||||
$replace[9] = varset($e107_vars[$act]['image']);
|
||||
|
||||
if($rid == 'logout' || $rid == 'home' || $rid == 'language')
|
||||
{
|
||||
$START_SUB = $tmpl['start_other_sub'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$START_SUB = $tmpl['start_sub'];
|
||||
}
|
||||
|
||||
if (varsettrue($e107_vars[$act]['sub']))
|
||||
{
|
||||
$replace[6] = $id ? " id='eplug-nav-{$rid}-sub'" : '';
|
||||
$replace[7] = ' '.varset($e107_vars[$act]['link_class'], 'e-expandit');
|
||||
$replace[8] = ' '.varset($e107_vars[$act]['sub_class'], 'e-hideme e-expandme');
|
||||
$replace[4] = preg_replace($search, $replace, $START_SUB);
|
||||
$replace[4] .= e_admin_menu(false, $active_page, $e107_vars[$act]['sub'], $tmpl, true, (isset($e107_vars[$act]['sort']) ? $e107_vars[$act]['sort'] : $sortlist));
|
||||
$replace[4] .= $tmpl['end_sub'];
|
||||
}
|
||||
|
||||
$text .= preg_replace($search, $replace, $temp);
|
||||
// echo "<br />".$title." act=".$act;
|
||||
//print_a($e107_vars[$act]);
|
||||
}
|
||||
|
||||
$text .= (!$sub_link) ? $tmpl['end'] : '';
|
||||
|
||||
if ($sub_link || empty($title))
|
||||
{
|
||||
return $text;
|
||||
}
|
||||
|
||||
$ns = e107::getRender();
|
||||
$ns->tablerender($title, $text, array('id'=>$id, 'style'=>'button_menu'));
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
|
||||
function frontend() //TODO equivalent for front-end sitelinks etc.
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
@ -42,7 +42,7 @@ class plugin_blank_admin extends e_admin_dispatcher
|
||||
|
||||
/**
|
||||
* Format: 'MODE/ACTION' => array('caption' => 'Menu link title'[, 'url' => '{e_PLUGIN}blank/admin_config.php', 'perm' => '0']);
|
||||
* Additionally, any valid e_admin_menu() key-value pair could be added to the above array
|
||||
* Additionally, any valid e107::getNav()->admin() key-value pair could be added to the above array
|
||||
* @var array
|
||||
*/
|
||||
protected $adminMenu = array(
|
||||
|
@ -884,7 +884,7 @@ function admin_banner_adminmenu()
|
||||
$var['menu']['text'] = BNRLAN_61;
|
||||
$var['menu']['link'] = e_SELF."?menu";
|
||||
|
||||
e_admin_menu(BNRLAN_62, $act, $var);
|
||||
e107::getNav()->admin(BNRLAN_62, $act, $var);
|
||||
}
|
||||
|
||||
require_once(e_ADMIN."footer.php");
|
||||
|
@ -1301,7 +1301,7 @@ function admin_download_adminmenu($parms)
|
||||
$var['limits']['link'] = e_SELF."?limits";
|
||||
$var['mirror']['text'] = DOWLAN_128;
|
||||
$var['mirror']['link'] = e_SELF."?mirror";
|
||||
e_admin_menu(DOWLAN_32, $action, $var);
|
||||
e107::getNav()->admin(DOWLAN_32, $action, $var);
|
||||
|
||||
unset($var);
|
||||
$var['ulist']['text'] = DOWLAN_22;
|
||||
@ -1310,7 +1310,7 @@ function admin_download_adminmenu($parms)
|
||||
$var['filetypes']['link'] = e_SELF."?filetypes";
|
||||
$var['uopt']['text'] = LAN_OPTIONS;
|
||||
$var['uopt']['link'] = e_SELF."?uopt";
|
||||
e_admin_menu(DOWLAN_10, $action, $var);
|
||||
e107::getNav()->admin(DOWLAN_10, $action, $var);
|
||||
}
|
||||
*/
|
||||
|
||||
|
@ -47,7 +47,7 @@ class plugin_download_admin extends e_admin_dispatcher
|
||||
|
||||
/**
|
||||
* Format: 'MODE/ACTION' => array('caption' => 'Menu link title'[, 'url' => '{e_PLUGIN}release/admin_config.php', 'perm' => '0']);
|
||||
* Additionally, any valid e_admin_menu() key-value pair could be added to the above array
|
||||
* Additionally, any valid e107::getNav()->admin() key-value pair could be added to the above array
|
||||
* @var array
|
||||
*/
|
||||
protected $adminMenu = array(
|
||||
@ -76,7 +76,7 @@ class plugin_download_admin extends e_admin_dispatcher
|
||||
$var['limits']['link'] = e_SELF."?limits";
|
||||
$var['mirror']['text'] = DOWLAN_128;
|
||||
$var['mirror']['link'] = e_SELF."?mirror";
|
||||
e_admin_menu(DOWLAN_32, $action, $var);
|
||||
e107::getNav()->admin(DOWLAN_32, $action, $var);
|
||||
|
||||
unset($var);
|
||||
$var['ulist']['text'] = DOWLAN_22;
|
||||
|
@ -58,7 +58,7 @@ class plugin_gallery_admin extends e_admin_dispatcher
|
||||
|
||||
/**
|
||||
* Format: 'MODE/ACTION' => array('caption' => 'Menu link title'[, 'url' => '{e_PLUGIN}release/admin_config.php', 'perm' => '0']);
|
||||
* Additionally, any valid e_admin_menu() key-value pair could be added to the above array
|
||||
* Additionally, any valid e107::getNav()->admin() key-value pair could be added to the above array
|
||||
* @var array
|
||||
*/
|
||||
protected $adminMenu = array(
|
||||
|
@ -79,7 +79,7 @@ function admin_list_config_adminmenu()
|
||||
$var['list-new-recent-menu']['text'] = LIST_ADMIN_OPT_3;
|
||||
$var['list-new-new-page']['text'] = LIST_ADMIN_OPT_4;
|
||||
$var['list-new-new-menu']['text'] = LIST_ADMIN_OPT_5;
|
||||
e_admin_menu(LIST_ADMIN_OPT_6.'--id--list_new', 'list-new-recent-page', $var);
|
||||
e107::getNav()->admin(LIST_ADMIN_OPT_6.'--id--list_new', 'list-new-recent-page', $var);
|
||||
}
|
||||
|
||||
require_once(e_ADMIN."footer.php");
|
||||
|
@ -529,7 +529,7 @@ class tinymce
|
||||
$var['options']['link'] = e_SELF."?options";
|
||||
$var['options']['perm'] = "0";*/
|
||||
|
||||
e_admin_menu($this->pluginTitle, $action, $var);
|
||||
e107::getNav()->admin($this->pluginTitle, $action, $var);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -117,7 +117,7 @@ $ADMIN_FOOTER = "
|
||||
";
|
||||
|
||||
/* NEW ADMIN MENU TEMPLATE
|
||||
* see function e_admin_menu() in e107_admin/header.php
|
||||
* see function e107::getNav()->admin() in e107_admin/header.php
|
||||
*/
|
||||
$E_ADMIN_MENU['start'] = '
|
||||
<ul class="plugin-navigation">
|
||||
|
@ -333,7 +333,7 @@ $ADMIN_FOOTER = "
|
||||
";
|
||||
*/
|
||||
/* NEW ADMIN MENU TEMPLATE
|
||||
* see function e_admin_menu() in e107_admin/header.php
|
||||
* see function e107::getNav()->admin() in e107_admin/header.php
|
||||
*/
|
||||
$E_ADMIN_MENU['start'] = '
|
||||
<ul class="plugin-navigation nav nav-list">
|
||||
|
@ -154,7 +154,7 @@ $ADMIN_FOOTER .= "</tr>
|
||||
|
||||
|
||||
/* NEW ADMIN MENU TEMPLATE
|
||||
* see function e_admin_menu() in e107_admin/header.php
|
||||
* see function e107::getNav()->admin() in e107_admin/header.php
|
||||
*/
|
||||
$E_ADMIN_MENU['start'] = '
|
||||
<ul class="plugin-navigation">
|
||||
|
Loading…
x
Reference in New Issue
Block a user