ids.cgi: Reimplement function to lock page and show working notice

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
This commit is contained in:
Stefan Schantl
2018-02-14 14:03:08 +01:00
parent eb5592c1ce
commit 27760092c0

View File

@@ -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 <<END;
<table>
<tr>
<td><img src='/images/indicator.gif' alt='$Lang::tr{'aktiv'}' /></td>
<td>$Lang::tr{'snort working'}</td>
</tr>
</table>
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 <<END;
<table>
<tr>
<td><img src='/images/indicator.gif' alt='$Lang::tr{'aktiv'}' /></td>
<td>$message</td>
</tr>
</table>
END
&Header::closebox();
&Header::closebigbox();
&Header::closepage();
}
#
## A tiny function to perform a reload of the webpage after one second.
#