From: Stefan Schantl Date: Mon, 11 Dec 2017 07:46:18 +0000 (+0100) Subject: ids.cgi: Code cleanup X-Git-Tag: suricata-beta3~33^2~39^2~38 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0b89daee931885a9c34548009a556299d8adc62a;p=people%2Fstevee%2Fipfire-2.x.git ids.cgi: Code cleanup * Drop a lot of unused variables and code. * Re-ordering some code parts. * Add a lot of comments. Signed-off-by: Stefan Schantl --- diff --git a/html/cgi-bin/ids.cgi b/html/cgi-bin/ids.cgi index 40d4b88876..86a469cb2b 100644 --- a/html/cgi-bin/ids.cgi +++ b/html/cgi-bin/ids.cgi @@ -32,22 +32,22 @@ require "${General::swroot}/header.pl"; my %color = (); my %mainsettings = (); -&General::readhash("${General::swroot}/main/settings", \%mainsettings); -&General::readhash("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \%color); - +my %netsettings = (); my %snortsettings=(); my %cgiparams=(); my %checked=(); my %selected=(); -my %netsettings=(); -our $errormessage = ''; -our $results = ''; -our $tempdir = ''; -our $url=''; + +# Read-in main settings, for language, theme and colors. +&General::readhash("${General::swroot}/main/settings", \%mainsettings); +&General::readhash("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \%color); + +# Get netsettings. &General::readhash("${General::swroot}/ethernet/settings", \%netsettings); &Header::showhttpheaders(); +# Default settings for snort. $snortsettings{'ENABLE_SNORT'} = 'off'; $snortsettings{'ENABLE_SNORT_GREEN'} = 'off'; $snortsettings{'ENABLE_SNORT_BLUE'} = 'off'; @@ -56,7 +56,6 @@ $snortsettings{'ACTION'} = ''; $snortsettings{'RULES'} = ''; $snortsettings{'OINKCODE'} = ''; $snortsettings{'INSTALLDATE'} = ''; -$snortsettings{'FILE'} = ''; #Get GUI values &Header::getcgihash(\%cgiparams); @@ -64,15 +63,8 @@ $snortsettings{'FILE'} = ''; my $snortrulepath = "/etc/snort/rules"; my $restartsnortrequired = 0; my %snortrules; -my $rule = ''; -my $table1colour = ''; -my $table2colour = ''; -my $var = ''; -my $value = ''; -my $tmp = ''; -my $linkedrulefile = ''; -my $border = ''; -my $checkboxname = ''; +my $errormessage; +my $url; ## Grab all available snort rules and store them in the snortrules hash. # @@ -412,10 +404,6 @@ print <