|
From: David H. <dav...@st...> - 2008-01-31 19:09:31
|
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 |