]> git.ipfire.org Git - people/stevee/ipfire-2.x.git/commitdiff
ids.cgi: Code cleanup
authorStefan Schantl <stefan.schantl@ipfire.org>
Mon, 11 Dec 2017 07:46:18 +0000 (08:46 +0100)
committerStefan Schantl <stefan.schantl@ipfire.org>
Thu, 26 Jul 2018 09:43:22 +0000 (11:43 +0200)
* Drop a lot of unused variables and code.
* Re-ordering some code parts.
* Add a lot of comments.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
html/cgi-bin/ids.cgi

index 40d4b88876dc7ceca7cac669ccc0315128372888..86a469cb2b54cea26b7bc20f4b4670183a83ab27 100644 (file)
@@ -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 <<END
 END
 ;
 
-if ($results ne '') {
-       print "$results";
-}
-
 &Header::closebox();
 
 &Header::openbox('100%', 'LEFT', $Lang::tr{'intrusion detection system rules'});