From: eldy <> Date: Sat, 15 Nov 2003 18:22:11 +0000 (+0000) Subject: Try to fix [ 840043 ] past years not included when using Apache::Registry. X-Git-Tag: AWSTATS_6_0_BETA~116 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b9ff802e9be60c002006af0e96d61483cd7bcf84;p=thirdparty%2FAWStats.git Try to fix [ 840043 ] past years not included when using Apache::Registry. --- diff --git a/wwwroot/cgi-bin/awstats.pl b/wwwroot/cgi-bin/awstats.pl index bea109a1..0513e2b2 100644 --- a/wwwroot/cgi-bin/awstats.pl +++ b/wwwroot/cgi-bin/awstats.pl @@ -110,6 +110,8 @@ $MaxLengthOfURL $MaxLengthOfStoredURL $MaxLengthOfStoredUA %BarPng +$BuildReportFormat +$BuildHistoryFormat /; $StaticExt='html'; $DNSStaticCacheFile='dnscache.txt'; @@ -122,6 +124,8 @@ $MaxLengthOfStoredURL=256; # Note: Apache LimitRequestLine is default to 8190 $MaxLengthOfStoredUA=256; %BarPng=('vv'=>'vv.png','vu'=>'vu.png','hu'=>'hu.png','vp'=>'vp.png','hp'=>'hp.png', 'he'=>'he.png','hx'=>'hx.png','vh'=>'vh.png','hh'=>'hh.png','vk'=>'vk.png','hk'=>'hk.png'); +$BuildReportFormat='html'; +$BuildHistoryFormat='text'; use vars qw/ $EnableLockForUpdate $DNSLookup $AllowAccessFromWebToAuthenticatedUsersOnly $BarHeight $BarWidth $CreateDirDataIfNotExists $KeepBackupOfHistoricFiles @@ -132,7 +136,7 @@ $ShowDropped $ShowCorrupted $ShowUnknownOrigin $ShowLinksToWhoIs $ShowEMailSenders $ShowEMailReceivers $ShowClusterStats $AuthenticatedUsersNotCaseSensitive $Expires $UpdateStats $MigrateStats $URLNotCaseSensitive $URLWithQuery $URLReferrerWithQuery -$UseXMLForOutput $UseXMLForHistory $DecodeUA +$DecodeUA /; ($EnableLockForUpdate, $DNSLookup, $AllowAccessFromWebToAuthenticatedUsersOnly, $BarHeight, $BarWidth, $CreateDirDataIfNotExists, $KeepBackupOfHistoricFiles, @@ -143,8 +147,8 @@ $ShowDropped, $ShowCorrupted, $ShowUnknownOrigin, $ShowLinksToWhoIs, $ShowEMailSenders, $ShowEMailReceivers, $ShowClusterStats, $AuthenticatedUsersNotCaseSensitive, $Expires, $UpdateStats, $MigrateStats, $URLNotCaseSensitive, $URLWithQuery, $URLReferrerWithQuery, -$UseXMLForOutput, $UseXMLForHistory, $DecodeUA)= -(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0); +$DecodeUA)= +(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0); use vars qw/ $AllowToUpdateStatsFromBrowser $ArchiveLogRecords $DetailedReportsOnNewWindows @@ -500,7 +504,7 @@ sub html_head { if (scalar keys %HTMLOutput || $PluginMode) { my $AllowIndex=0; # Write head section - if ($UseXMLForOutput) { + if ($BuildReportFormat eq 'xml') { if ($PageCode) { print "\n"; } else { print "\n"; }; if ($FrameName ne 'index') { print "\n"; } @@ -516,7 +520,7 @@ sub html_head { else { print "\n"; } # Affiche tag meta content-type - if ($UseXMLForOutput) { print ($ENV{'HTTP_USER_AGENT'}=~/MSIE|Googlebot/i?"\n":"\n"); } + if ($BuildReportFormat eq 'xml') { print ($ENV{'HTTP_USER_AGENT'}=~/MSIE|Googlebot/i?"\n":"\n"); } else { print "\n"; } if ($Expires) { print "\n"; } @@ -527,10 +531,10 @@ sub html_head { # A STYLE section must be in head section. Do not use " for number in a style section print "\n"; @@ -677,7 +681,7 @@ sub error { } else { # Bad LogFormat parameter - print "AWStats did not found any valid log lines that match your ${tagbold}LogFormat${tagunbold} parameter, in the ${NbOfLinesForCorruptedLog}th first non commented lines read of your log.${tagbr}\n"; + print "AWStats did not find any valid log lines that match your ${tagbold}LogFormat${tagunbold} parameter, in the ${NbOfLinesForCorruptedLog}th first non commented lines read of your log.${tagbr}\n"; print "${tagfontred}Your log file ${tagbold}$thirdmessage${tagunbold} must have a bad format or ${tagbold}LogFormat${tagunbold} parameter setup does not match this format.${tagbr}${tagbr}${tagunfont}\n"; print "Your AWStats ${tagbold}LogFormat${tagunbold} parameter is:\n"; print "${tagbold}$LogFormat${tagunbold}${tagbr}\n"; @@ -1365,8 +1369,8 @@ sub Check_Config { debug(" ValidHTTPCodes ".(join(',',keys %ValidHTTPCodes)),2); debug(" ValidSMTPCodes ".(join(',',keys %ValidSMTPCodes)),2); debug(" UseFramesWhenCGI=$UseFramesWhenCGI",2); - debug(" UseXMLForOutput=$UseXMLForOutput",2); - debug(" UseXMLForHistory=$UseXMLForHistory",2); + debug(" BuildReportFormat=$BuildReportFormat",2); + debug(" BuildHistoryFormat=$BuildHistoryFormat",2); } # Main section @@ -1522,8 +1526,8 @@ sub Check_Config { } if ($FirstDayOfWeek !~ /[01]/) { $FirstDayOfWeek=1; } if ($UseFramesWhenCGI !~ /[01]/) { $UseFramesWhenCGI=1; } - if ($UseXMLForOutput !~ /[01]/) { $UseXMLForOutput=0; } - if ($UseXMLForHistory !~ /[01]/) { $UseXMLForHistory=0; } + if ($BuildReportFormat !~ /html|xml/i) { $BuildReportFormat='html'; } + if ($BuildHistoryFormat !~ /text/) { $BuildHistoryFormat='text'; } if ($DetailedReportsOnNewWindows !~ /[012]/) { $DetailedReportsOnNewWindows=1; } if ($ShowLinksOnUrl !~ /[01]/) { $ShowLinksOnUrl=1; } if ($MaxLengthOfURL !~ /^\d+/ || $MaxLengthOfURL<1) { $MaxLengthOfURL=72; } @@ -3984,7 +3988,7 @@ sub Utf8_To_Ascii { #------------------------------------------------------------------------------ sub XMLEncode { my $string = shift; - if (! $UseXMLForOutput) { return $string; } + if ($BuildReportFormat ne 'xml') { return $string; } $string =~ s/&/&/g; return $string; } @@ -4132,7 +4136,7 @@ sub AltTitle { my $string = shift||''; return " alt='$string' title='$string'"; # return " alt=\"$string\" title=\"$string\""; -# return ($UseXMLForOutput?"":" alt=\"$string\"")." title=\"$string\""; +# return ($BuildReportFormat?"":" alt=\"$string\"")." title=\"$string\""; } #------------------------------------------------------------------------------ @@ -4554,7 +4558,7 @@ sub DefinePerlParsingFormat { if ($LogFormat =~ /^[1-6]$/) { # Pre-defined log format if ($LogFormat eq '1' || $LogFormat eq '6') { # Same than "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"". # %u (user) is "([^\\[]+)" instead of "[^ ]+" because can contain space (Lotus Notes). referer and ua might be "". - $PerlParsingFormat="([^ ]+) [^ ]+ ([^\\[]+) \\[([^ ]+) [^ ]+\\] \\\"([^ ]+) ([^ ]+) [^\\\"]+\\\" ([\\d|-]+) ([\\d|-]+) \\\"(.*)\\\" \\\"([^\\\"]*)\\\""; + $PerlParsingFormat="([^ ]+) [^ ]+ ([^\\[]+) \\[([^ ]+) [^ ]+\\] \\\"([^ ]+) ([^ ]+) [^\\\"]+\\\" ([\\d|-]+) ([\\d|-]+) \\\"([^\\\"]*)\\\" \\\"([^\\\"]*)\\\""; $pos_host=0;$pos_logname=1;$pos_date=2;$pos_method=3;$pos_url=4;$pos_code=5;$pos_size=6;$pos_referer=7;$pos_agent=8; @fieldlib=('host','logname','date','method','url','code','size','referer','ua'); } @@ -4990,7 +4994,7 @@ $QueryString=''; # be set to force AWStats to be ran as CLI even from a web page if ($ENV{'AWSTATS_DEL_GATEWAY_INTERFACE'}) { $ENV{'GATEWAY_INTERFACE'}=''; } if ($ENV{'GATEWAY_INTERFACE'}) { # Run from a browser as CGI - if ($UseXMLForOutput) { print ($ENV{'HTTP_USER_AGENT'}=~/MSIE|Googlebot/i?"Content-type: text/html\n":"Content-type: text/xml\n"); } + if ($BuildReportFormat eq 'xml') { print ($ENV{'HTTP_USER_AGENT'}=~/MSIE|Googlebot/i?"Content-type: text/html\n":"Content-type: text/xml\n"); } else { print "content-type: text/html\n"; } # Expires must be GMT ANSI asctime and must be after Content-type to avoid pb with some servers (SAMBAR)