Re: [webmin-devel] Patch for regular expression bug in Sarg module(view.cgi)

"Jamie Cameron" <[email protected]>
Newsgroups gmane.comp.web.webmin.devel
Message-ID <[email protected]>
Hi David,

Thanks for the patch - I will include this in the next Webmin release.

 - Jamie

On 31/Jan/2008 12:17 David Harrison wrote ..
> Hi,
> This is a tiny patch that takes on board Colm's correct advice about  
> the regular expression and adds an encapsulating div block around the  
> Sarg report data.
> I've never submitted a patch before so this maybe the completely wrong  
> way of going about doing it :-)
> 
> It changes no functionality but makes the job of theming Sarg reports  
> within Webmin a whole lot easier.
> 
> 
> David
> 
> 
> 
> 
> --- sarg/view.cgi    2008-02-01 08:46:40.000000000 +1300
> +++ sarg/view.cgi    2008-02-01 08:46:29.000000000 +1300
> @@ -24,11 +24,13 @@ if ($full =~ /\.(html|htm)$/i && !$confi
>          if ($data =~ /<TITLE>(.*)<\/TITLE>/i) {
>                  $title = $1;
>                  }
> -	$data =~ s/^[\000-\377]*<BODY.*>//i;
> +	$data =~ s/^[\000-\377]*<BODY.*?>//i;
>          $data =~ s/<\/BODY>[\000-\377]*$//i;
> 
>          &header($title || $text{'view_title'}, "");
> +	print "<div id=\"sarg-report\">\n";
>          print $data;
> +	print "</div>\n";
>          &footer("", $text{'index_return'});
>          }
>   else {
> 
> 
> 
> 
> 
> On 1/02/2008, at 8:17 AM, Colm Dougan wrote:
> 
> > On Jan 31, 2008 7:09 PM, David Harrison
> > <[email protected]> wrote:
> >>
> >> 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;
> >
> > If i understand the problem correctly, I think making the .* after the
> > BODY non-greedy, by adding a question mark, will solve it, i.e. :
> >
> > $data =~ s/^[\000-\377]*<BODY.*?>//i;
> >
> > Colm
> >
> > -------------------------------------------------------------------------
> > 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
> 
> 
> -------------------------------------------------------------------------
> 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

-------------------------------------------------------------------------
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.