]> git.ipfire.org Git - ipfire-2.x.git/commitdiff
ids.cgi: Reimplement function to lock page and show working notice
authorStefan Schantl <stefan.schantl@ipfire.org>
Wed, 14 Feb 2018 13:03:08 +0000 (14:03 +0100)
committerStefan Schantl <stefan.schantl@ipfire.org>
Thu, 26 Jul 2018 09:59:31 +0000 (11:59 +0200)
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
html/cgi-bin/ids.cgi

index 1d61d9119e7ba0a533af189b059657fd606aad23..a9515b72a3c289fdbdc884bebc64682596e00801 100644 (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.
 #