From: eldy <> Date: Wed, 10 Nov 2004 21:25:24 +0000 (+0000) Subject: Fix pb when there is spaces in key of ExtraSections X-Git-Tag: AWSTATS_6_3_RELEASE~65 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=13d6d76528ec1142d59ffc4ff5cce11709cd947f;p=thirdparty%2FAWStats.git Fix pb when there is spaces in key of ExtraSections --- diff --git a/wwwroot/cgi-bin/awstats.pl b/wwwroot/cgi-bin/awstats.pl index 81166d44..e8d087e2 100644 --- a/wwwroot/cgi-bin/awstats.pl +++ b/wwwroot/cgi-bin/awstats.pl @@ -3940,14 +3940,14 @@ sub Save_History { my $page=${'_section_' . $extranum . '_p'}{$_}||0; my $bytes=${'_section_' . $extranum . '_k'}{$_}||0; my $lastaccess=${'_section_' . $extranum . '_l'}{$_}||''; - print HISTORYTMP "${xmlrb}$_${xmlrs}$page${xmlrs}", ${'_section_' . $extranum . '_h'}{$_}, "${xmlrs}$bytes${xmlrs}$lastaccess${xmlre}\n"; next; + print HISTORYTMP "${xmlrb}".XMLEncodeForHisto($_)."${xmlrs}$page${xmlrs}", ${'_section_' . $extranum . '_h'}{$_}, "${xmlrs}$bytes${xmlrs}$lastaccess${xmlre}\n"; next; } foreach (keys %{'_section_' . $extranum . '_h'}) { if ($keysinkeylist{$_}) { next; } my $page=${'_section_' . $extranum . '_p'}{$_}||0; my $bytes=${'_section_' . $extranum . '_k'}{$_}||0; my $lastaccess=${'_section_' . $extranum . '_l'}{$_}||''; - print HISTORYTMP "${xmlrb}$_${xmlrs}$page${xmlrs}", ${'_section_' . $extranum . '_h'}{$_}, "${xmlrs}$bytes${xmlrs}$lastaccess${xmlre}\n"; next; + print HISTORYTMP "${xmlrb}".XMLEncodeForHisto($_)."${xmlrs}$page${xmlrs}", ${'_section_' . $extranum . '_h'}{$_}, "${xmlrs}$bytes${xmlrs}$lastaccess${xmlre}\n"; next; } print HISTORYTMP "${xmleb}END_EXTRA_$extranum${xmlee}\n"; } @@ -4204,7 +4204,7 @@ sub ChangeWordSeparatorsIntoSpace { } #------------------------------------------------------------------------------ -# Function: Transforms & into & as needed in XML/XHTML +# Function: Transforms special chars by entities as needed in XML/XHTML # Parameters: stringtoencode # Return: encodedstring #------------------------------------------------------------------------------ @@ -4212,11 +4212,15 @@ sub XMLEncode { if ($BuildReportFormat ne 'xhtml' && $BuildReportFormat ne 'xml') { return shift; } my $string = shift; $string =~ s/&/&/g; + $string =~ s//>/g; + $string =~ s/\"/&aquot;/g; + $string =~ s/\'/'/g; return $string; } #------------------------------------------------------------------------------ -# Function: Transforms & into & as needed in XML/XHTML +# Function: Transforms spaces into %20 and special chars by entities as needed in XML/XHTML # Parameters: stringtoencode # Return: encodedstring #------------------------------------------------------------------------------ @@ -4227,6 +4231,8 @@ sub XMLEncodeForHisto { $string =~ s/&/&/g; $string =~ s//>/g; + $string =~ s/\"/&aquot;/g; + $string =~ s/\'/'/g; return $string; }