[webmin-devel] Regular expression help to fix bug in Sarg module (view.cgi)

David Harrison <[email protected]>
Newsgroups gmane.comp.web.webmin.devel
Message-ID <[email protected]>
Hi,
I am trying to improve the presentation of Sarg reports within Webmin  
but there is a regular expression bug in the Sarg module's view.cgi  
module that is causing me grief.

The Sarg module's view.cgi file reads an html Sarg report and strips  
out the content up to the end of the <body> tag.
The problem is it seems like the regular expression has been written  
with the expectation the the <body> tag of a Sarg report will be on a  
unique line to the rest of the report.

Consequently a Sarg report like the following displays great within  
Webmin:
<body class="body">
<center><table cellpadding=0 cellspacing=0>
<tr>

Whilst a report that doesn't have <body> on a distinct line will not:
<body class="body"><center><table cellpadding=0 cellspacing=0>
<tr>

This is because rather than removing everything up to the end of the  
body tag the regular expression is dropping the entire line :-(
This results in unpaired html tags and varying levels of screen chaos  
depending on the Webmin theme applied.

Lines 27 & 28 of sarg/view.cgi do the dirty work and they are as  
follows:
$data =~ s/^[\000-\377]*<BODY.*>//i;
$data =~ s/<\/BODY>[\000-\377]*$//i;

I've tried on numerous times to understand regular expressions to no  
avail.
Can someone out there suggest a way of tweaking line 27 of view.cgi so  
that it does not remove any report content that proceeds the <body>  
tag if it is on the same line?

Regards,


David Harrison

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
-
Forwarded by the Webmin development list at [email protected]
To remove yourself from this list, go to
http://lists.sourceforge.net/lists/listinfo/webadmin-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.