Hi,
looking at this patch again, I'm unhappy with the default value operator. The "enabled" field is only numeric everywhere else. So I should prevent the grep output from ending up in this field, altough it would be accepted as a "truthy" value.
I'll send a better patch. Sorry for the noise!
Best regards Leo
Am 06.04.2022 um 15:39 schrieb Leo-Andres Hofmann:
This patch adds default values and removes a missing translation to fix "uninitialized value" and "odd number of elements" warnings.
Removes function calls from functions.pl that have already been handled by the header before it is loaded by eval().
Signed-off-by: Leo-Andres Hofmannhofmann@leo-andres.de
config/cfgroot/header.pl | 4 +++- config/menu/20-status.menu | 4 ++-- config/menu/30-network.menu | 2 +- html/html/themes/ipfire/include/functions.pl | 14 ++++---------- langs/de/cgi-bin/de.pl | 1 - langs/fr/cgi-bin/fr.pl | 1 - 6 files changed, 10 insertions(+), 16 deletions(-)
diff --git a/config/cfgroot/header.pl b/config/cfgroot/header.pl index e6d2b7c78..92e454dd1 100644 --- a/config/cfgroot/header.pl +++ b/config/cfgroot/header.pl @@ -46,7 +46,7 @@ my $menu = %menuhash; %settings = (); %ethsettings = (); %pppsettings = (); -@URI = (); +my @URI = split('?', $ENV{'REQUEST_URI'});
### Make sure this is an SSL request if ($ENV{'SERVER_ADDR'} && $ENV{'HTTPS'} ne 'on') { @@ -596,3 +596,5 @@ sub _read_manualpage_hash() { } close($file); }
+1; # End of package "Header" diff --git a/config/menu/20-status.menu b/config/menu/20-status.menu index 2bcf0d5e8..6ab68ec8c 100644 --- a/config/menu/20-status.menu +++ b/config/menu/20-status.menu @@ -49,7 +49,7 @@ $substatus->{'54.networkovpnsrv'} = { 'caption' => "$Lang::tr{'vpn statistic n2n'}", 'uri' => '/cgi-bin/netovpnsrv.cgi',
'title' => "$Lang::tr{'vpn statistics n2n'}",
$substatus->{'60.hardwaregraphs'} = {'title' => "$Lang::tr{'vpn statistic n2n'}", 'enabled' => 1, };
@@ -90,7 +90,7 @@ $substatus->{'75.atm-status'} = {'caption' => 'Atm-status', 'uri' => '/cgi-bin/atm-status.cgi', 'title' => 'Atm-status',
'enabled' => `find /sys/class/atm/*/device 2>/dev/null`,
$substatus->{'76.mdstat'} = {'caption' => 'Mdstat', 'uri' => '/cgi-bin/mdstat.cgi','enabled' => `find /sys/class/atm/*/device 2>/dev/null` // 0, };
diff --git a/config/menu/30-network.menu b/config/menu/30-network.menu index 19571a870..faef89a41 100644 --- a/config/menu/30-network.menu +++ b/config/menu/30-network.menu @@ -67,7 +67,7 @@ 'caption' => $Lang::tr{'aliases'}, 'uri' => '/cgi-bin/aliases.cgi', 'title' => "$Lang::tr{'aliases'}",
'enabled' => `grep "RED_TYPE=STATIC" /var/ipfire/ethernet/settings`,
$subnetwork->{'80.macadressmenu'} = { 'caption' => $Lang::tr{'mac address menu'},'enabled' => `grep "RED_TYPE=STATIC" /var/ipfire/ethernet/settings` // 0, };
diff --git a/html/html/themes/ipfire/include/functions.pl b/html/html/themes/ipfire/include/functions.pl index 40afb3ce3..5a9ddbf88 100644 --- a/html/html/themes/ipfire/include/functions.pl +++ b/html/html/themes/ipfire/include/functions.pl @@ -31,8 +31,6 @@ # IPFire default theme. # ###############################################################################
-require "${General::swroot}/lang.pl";
- ############################################################################### # # print menu html elements for submenu entries
@@ -103,16 +101,11 @@ sub openpage { my $extrahead = shift; my $suppressMenu = shift;
@URI=split ('?', $ENV{'REQUEST_URI'} );
&General::readhash("${swroot}/main/settings", %settings);
&genmenu();
my $headline = "IPFire"; if (($settings{'WINDOWWITHHOSTNAME'} eq 'on') || ($settings{'WINDOWWITHHOSTNAME'} eq '')) { $headline = "$settings{'HOSTNAME'}.$settings{'DOMAINNAME'}"; }
print <<END;
<!DOCTYPE html>
<html>
@@ -163,7 +156,10 @@ print <<END END ;
-&showmenu() if ($suppressMenu != 1); +unless($suppressMenu) {
- &genmenu();
- &showmenu();
+}
print <<END
<div class="bigbox fixed"> @@ -268,5 +264,3 @@ sub openbox { sub closebox { print "</div>"; } - -1; diff --git a/langs/de/cgi-bin/de.pl b/langs/de/cgi-bin/de.pl index 0be097609..ab9e0d52e 100644 --- a/langs/de/cgi-bin/de.pl +++ b/langs/de/cgi-bin/de.pl @@ -2880,7 +2880,6 @@ 'vpn start action start' => 'Immer An', 'vpn statistic n2n' => 'OpenVPN: Netz-zu-Netz-Statistik', 'vpn statistic rw' => 'OpenVPN: Roadwarrior-Statistik', -'vpn statistics n2n' => 'OpenVPN: Netz-zu-Netz-Statistiken', 'vpn subjectaltname' => 'SubjectAlternativeName', 'vpn subjectaltname missing' => 'SubjectAlternativeName darf nicht leer bleiben.', 'vpn wait' => 'WARTE', diff --git a/langs/fr/cgi-bin/fr.pl b/langs/fr/cgi-bin/fr.pl index 60ea0dcc5..74184a416 100644 --- a/langs/fr/cgi-bin/fr.pl +++ b/langs/fr/cgi-bin/fr.pl @@ -2956,7 +2956,6 @@ 'vpn start action start' => 'Toujours démarré', 'vpn statistic n2n' => 'OpenVPN (site-à-site)', 'vpn statistic rw' => 'OpenVPN (client nomade)', -'vpn statistics n2n' => 'OpenVPN (site-à-site)', 'vpn subjectaltname' => 'Nom de l\'objet', 'vpn subjectaltname missing' => 'Le nom de l\'objet ne peut être vide.', 'vpn wait' => 'ATTENTE',