From 27760092c0a4973a92e1dcea8544866ae29d37da Mon Sep 17 00:00:00 2001 From: Stefan Schantl Date: Wed, 14 Feb 2018 14:03:08 +0100 Subject: [PATCH] ids.cgi: Reimplement function to lock page and show working notice Signed-off-by: Stefan Schantl --- html/cgi-bin/ids.cgi | 48 ++++++++++++++++++++++++++++++-------------- 1 file changed, 33 insertions(+), 15 deletions(-) diff --git a/html/cgi-bin/ids.cgi b/html/cgi-bin/ids.cgi index 1d61d9119e..a9515b72a3 100644 --- a/html/cgi-bin/ids.cgi +++ b/html/cgi-bin/ids.cgi @@ -257,8 +257,14 @@ if ($cgiparams{'RULESET'} eq $Lang::tr{'update'}) { # Close file after writing. close(FILE); + # Lock the webpage and print message. + &working_notice("$Lang::tr{'snort working'}"); + # Call oinkmaster to alter the ruleset. - &oinkmaster(); + &IDS::oinkmaster(); + + # Reload page. + &reload(); # Download new ruleset. } elsif ($cgiparams{'RULESET'} eq $Lang::tr{'download new ruleset'}) { @@ -272,20 +278,9 @@ if ($cgiparams{'RULESET'} eq $Lang::tr{'update'}) { # Check if any errors happend. unless ($errormessage) { - &Header::openpage($Lang::tr{'intrusion detection system'}, 1, ''); - &Header::openbigbox('100%', 'left', '', $errormessage); - &Header::openbox( 'Waiting', 1,); - print < - - $Lang::tr{ - $Lang::tr{'snort working'} - - -END - &Header::closebox(); - &Header::closebigbox(); - &Header::closepage(); + # Lock the webpage and print notice about downloading + # a new ruleset. + &working_notice("$Lang::tr{'snort working'}"); # Call subfunction to download the ruleset. $errormessage = &IDS::downloadruleset(); @@ -581,6 +576,29 @@ END &Header::closebigbox(); &Header::closepage(); +# +## A function to display a notice, to lock the webpage and +## tell the user which action currently will be performed. +# +sub working_notice ($) { + my ($message) = @_; + + &Header::openpage($Lang::tr{'intrusion detection system'}, 1, ''); + &Header::openbigbox('100%', 'left', '', $errormessage); + &Header::openbox( 'Waiting', 1,); + print < + + $Lang::tr{ + $message + + +END + &Header::closebox(); + &Header::closebigbox(); + &Header::closepage(); +} + # ## A tiny function to perform a reload of the webpage after one second. # -- 2.39.5