summaryrefslogtreecommitdiffstats
path: root/src/usr/local/www/head.inc
diff options
context:
space:
mode:
authorPhil Davis <phil.davis@inf.org>2017-01-19 18:16:52 +0545
committerPhil Davis <phil.davis@inf.org>2017-01-19 18:16:52 +0545
commit7c3f118945930bf7137517a853937b6827310eec (patch)
tree8151cf973a247912ea0ee704424b202527489985 /src/usr/local/www/head.inc
parent71d90bbffa7cd7ac2328580a411afe82cde62826 (diff)
downloadpfsense-7c3f118945930bf7137517a853937b6827310eec.zip
pfsense-7c3f118945930bf7137517a853937b6827310eec.tar.gz
Do not show empty menus
Diffstat (limited to 'src/usr/local/www/head.inc')
-rw-r--r--src/usr/local/www/head.inc17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/usr/local/www/head.inc b/src/usr/local/www/head.inc
index 4abb418..2567c24 100644
--- a/src/usr/local/www/head.inc
+++ b/src/usr/local/www/head.inc
@@ -183,6 +183,8 @@ function return_ext_menu($section) {
}
function output_menu($arrayitem, $target = null, $section = "") {
+ $output = "";
+
foreach ($arrayitem as $item) {
/* If the user has access to help pages, also show the full help menu. See #5909 */
if (isAllowedPage($item[1]) || $item[1] == "/index.php?logout" || (($section == "Help") && isAllowedPage("help.php"))) {
@@ -200,12 +202,14 @@ function output_menu($arrayitem, $target = null, $section = "") {
}
if ($item[0] == '-DIVIDER-') {
- print(' <li class="divider"></li>');
+ $output .= ' <li class="divider"></li>';
} else {
- echo "<li>". sprintf("<a %s>%s</a>", $attr, $item[0]). "</li>\n";
+ $output .= "<li>". sprintf("<a %s>%s</a>", $attr, $item[0]) . "</li>\n";
}
}
}
+
+ return $output;
}
$ext_menu_path_data = read_ext_menu_path_data();
@@ -471,16 +475,21 @@ if (are_notices_pending()) {
if ($item['name'] == 'Help' && $g['disablehelpmenu']) {
continue;
}
+
+ $menu_output = output_menu($item['menu'], $item['href'], $item['name']);
+
+ if (strlen($menu_output) > 0):
?>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
<?=gettext($item['name'])?>
<span class="caret"></span>
</a>
- <ul class="dropdown-menu" role="menu"><?=output_menu($item['menu'], $item['href'], $item['name'])?></ul>
+ <ul class="dropdown-menu" role="menu"><?=$menu_output?></ul>
</li>
<?php
+ endif;
endforeach?>
</ul>
<ul class="nav navbar-nav navbar-right">
@@ -613,7 +622,7 @@ if (('' != ($link = get_shortcut_log_link($shortcut_section, false))) && (isAllo
}
?>
- <?php if (!$g['disablehelpicon']): ?>
+ <?php if (!$g['disablehelpicon'] && isAllowedPage("help.php")): ?>
<li>
<a href="<?=$helpurl?>" target="_blank" title="<?=gettext("Help for items on this page")?>">
<i class="fa fa-question-circle"></i>
OpenPOWER on IntegriCloud