diff --git a/navigation-lib.pl b/navigation-lib.pl
index 475d44805..bf0d04e82 100644
--- a/navigation-lib.pl
+++ b/navigation-lib.pl
@@ -278,28 +278,31 @@ sub nav_webmin_menu
foreach my $menu (@menus) {
next if ($menu->{'id'} eq 'unused' && $unused);
- $rv .= nav_cat($menu->{'id'}, $menu->{'desc'});
- $rv .= "
\n";
}
if (&foreign_available("webmin") &&
$theme_config{'settings_leftmenu_section_hide_refresh_modules'} ne 'true')
@@ -446,6 +449,7 @@ sub nav_detect_script
sub nav_menu_link
{
my ($link, $text, $icon, $hidden, $after) = @_;
+ my $external_link = ($link =~ /^(http:\/\/|https:\/\/|ftp:\/\/|ftps:\/\/)/);
if ($icon !~ /\s+/) {
$icon = "fa fa-fw $icon";
}
@@ -455,17 +459,21 @@ sub nav_menu_link
if ($hidden) {
$hidden = " hidden";
}
+ $link = "/$link" if (!$external_link && $link !~ /^\//);
+ $link = ($external_link ? $link : "$theme_webprefix$link");
return
-" $text\n";
+" $text\n";
}
sub nav_cat_link
{
my ($link, $label, $hidden) = @_;
my $rv;
+ my $external_link = ($link =~ /^(http:\/\/|https:\/\/|ftp:\/\/|ftps:\/\/)/);
+ $link = "/$link" if (!$external_link && $link !~ /^\//);
$rv = '' . "\n";
$rv .= ' ' . $label . '' . "\n";
+ ($external_link ? $link : "$theme_webprefix$link") . '"> ' . $label . '' . "\n";
$rv .= "\n";
return $rv;
}
@@ -834,35 +842,32 @@ sub nav_list_combined_menu
$get_user_level eq '0' &&
!$extra_links++)
{
- $rv .= nav_cat_link($theme_webprefix . "/tconfig.cgi",
- $theme_text{'settings_right_theme_left_configuration_title'}, 'hidden');
- $rv .= nav_cat_link($theme_webprefix . "/settings-editor_read.cgi",
+ $rv .=
+ nav_cat_link("/tconfig.cgi", $theme_text{'settings_right_theme_left_configuration_title'}, 'hidden');
+ $rv .= nav_cat_link("/settings-editor_read.cgi",
$theme_text{'settings_right_theme_left_extensions_title'}, 'hidden');
- $rv .= nav_cat_link($theme_webprefix . "/settings-logos.cgi",
- $theme_text{'settings_right_theme_left_logo_title'}, 'hidden');
- $rv .= nav_cat_link($theme_webprefix . "/settings-backgrounds.cgi",
+ $rv .=
+ nav_cat_link("/settings-logos.cgi", $theme_text{'settings_right_theme_left_logo_title'}, 'hidden');
+ $rv .= nav_cat_link("/settings-backgrounds.cgi",
$theme_text{'theme_xhred_settings_right_theme_bgs_title'}, 'hidden');
if (check_pro_package('vm') eq '1' &&
$item->{'module'} eq 'virtual-server')
{
- $rv .=
- nav_cat_link($theme_webprefix . "/virtual-server/licence.cgi", $theme_text{'right_vlcheck'}, 1);
+ $rv .= nav_cat_link("/virtual-server/licence.cgi", $theme_text{'right_vlcheck'}, 1);
}
if (check_pro_package('cm') eq '1' &&
$item->{'module'} eq 'server-manager')
{
- $rv .=
- nav_cat_link($theme_webprefix . "/server-manager/licence.cgi", $theme_text{'right_slcheck'}, 1);
+ $rv .= nav_cat_link("/server-manager/licence.cgi", $theme_text{'right_slcheck'}, 1);
}
} elsif ($get_user_level ne '0' &&
$theme_config{'settings_theme_config_admins_only_privileged'} ne 'true' &&
!$extra_links++)
{
- $rv .= nav_cat_link($theme_webprefix . "/tconfig.cgi",
- $theme_text{'settings_right_theme_left_configuration_title'}, 1);
+ $rv .= nav_cat_link("/tconfig.cgi", $theme_text{'settings_right_theme_left_configuration_title'}, 1);
}
$rv .= "\n";
} elsif ($item->{'type'} eq 'hr') {