From: Stefan Schantl Date: Thu, 7 Feb 2019 09:33:29 +0000 (+0100) Subject: ids.cgi: Format and show date of the current ruleset again X-Git-Tag: v2.23-core131~117^2~50 X-Git-Url: http://git.ipfire.org/?p=ipfire-2.x.git;a=commitdiff_plain;h=5fbd7b29829caf0bcadcccd6f56ead51e2fb812e ids.cgi: Format and show date of the current ruleset again Fixes #11992 Signed-off-by: Stefan Schantl --- diff --git a/html/cgi-bin/ids.cgi b/html/cgi-bin/ids.cgi index 11b2e69ab3..3137144865 100644 --- a/html/cgi-bin/ids.cgi +++ b/html/cgi-bin/ids.cgi @@ -783,17 +783,6 @@ END END } -my $rulesdate; - -# Check if a ruleset allready has been downloaded. -if ( -f "$IDS::rulestarball"){ - # Call stat on the filename to obtain detailed information. - my @Info = stat("$IDS::rulestarball"); - - # Grab details about the creation time. - $rulesdate = localtime($Info[9]); -} - # Only show this area, if a ruleset is present. if (%idsrules) { @@ -1069,7 +1058,20 @@ END # Only show the section for configuring the ruleset if one is present. if (%idsrules) { - &Header::openbox('100%', 'LEFT', $Lang::tr{'intrusion detection system rules'}); + # Load neccessary perl modules for file stat and to format the timestamp. + use File::stat; + use POSIX qw( strftime ); + + # Call stat on the rulestarball. + my $stat = stat("$IDS::rulestarball"); + + # Get timestamp the file creation. + my $mtime = $stat->mtime; + + # Convert into human read-able format. + my $rulesdate = strftime('%Y-%m-%d %H:%M:%S', localtime($mtime)); + + &Header::openbox('100%', 'LEFT', "$Lang::tr{'intrusion detection system rules'} ($rulesdate)" ); print"
\n";