From: eldy <> Date: Fri, 24 Aug 2001 01:26:48 +0000 (+0000) Subject: New feature: list of all urls scores X-Git-Tag: AWSTATS_1_0~160 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2d442c5ff28c17bc965dcd8ca6d3eadf6f46a1af;p=thirdparty%2FAWStats.git New feature: list of all urls scores --- diff --git a/wwwroot/cgi-bin/awstats.pl b/wwwroot/cgi-bin/awstats.pl index e98cdfe2..d890047b 100644 --- a/wwwroot/cgi-bin/awstats.pl +++ b/wwwroot/cgi-bin/awstats.pl @@ -48,7 +48,7 @@ $DIR, $DNSLookup, $Debug, $DefaultFile, $DirCgi, $DirData, $DirIcons, $DirLang, $Extension, $FileConfig, $FileSuffix, $FirstTime, $HTMLEndSection, $Host, $HostAlias, $LastTime, $LastUpdate, -$LogFile, $LogFormat, $LogFormatString, $Logo, +$LogFile, $LogFormat, $LogFormatString, $Logo, $LogoLink, $MaxNbOfDays, $MaxNbOfHostsShown, $MaxNbOfKeywordsShown, $MaxNbOfPageShown, $MaxNbOfRefererShown, $MaxNbOfRobotShown, $MinHitFile, $MinHitHost, $MinHitKeyword, $MinHitRefer, $MinHitRobot, @@ -72,7 +72,7 @@ $total_h, $total_k, $total_p) = (); %MonthBytes = %MonthHits = %MonthHostsKnown = %MonthHostsUnknown = %MonthPages = %MonthUnique = %MonthVisits = %listofyears = %monthlib = %monthnum = (); -$VERSION="3.1 (build 24)"; +$VERSION="3.1 (build 27)"; $Lang="en"; # Default value @@ -757,7 +757,7 @@ EOF print "AWStats\n"; Show_Flag_Links($Lang); print "\n"; - print "\"$PROG\n"; + print "\"$PROG\n"; #print "HomePage •\; Back
\n"; print "$Message[54]\n"; print "\n"; @@ -977,7 +977,8 @@ sub Read_Config_File { if ($param =~ /^MaxNbOfKeywordsShown/) { $MaxNbOfKeywordsShown=$value; next; } if ($param =~ /^MinHitKeyword/) { $MinHitKeyword=$value; next; } if ($param =~ /^SplitSearchString/) { $SplitSearchString=$value; next; } - if ($param =~ /^Logo/) { $Logo=$value; next; } + if ($param =~ /^Logo$/) { $Logo=$value; next; } + if ($param =~ /^LogoLink/) { $LogoLink=$value; next; } if ($param =~ /^color_Background/) { $color_Background=$value; next; } if ($param =~ /^color_TableTitle/) { $color_TableTitle=$value; next; } if ($param =~ /^color_TableBGTitle/) { $color_TableBGTitle=$value; next; } @@ -1116,8 +1117,10 @@ sub Check_Config { if ($MinHitRefer !~ /^[\d][\d]*/) { $MinHitRefer=1; } if ($MaxNbOfKeywordsShown !~ /^[\d][\d]*/) { $MaxNbOfKeywordsShown=25; } if ($MinHitKeyword !~ /^[\d][\d]*/) { $MinHitKeyword=1; } + if ($MaxNbOfLastHosts !~ /^[\d][\d]*/) { $MaxNbOfLastHosts=1000; } if ($SplitSearchString !~ /[0-1]/) { $SplitSearchString=0; } if ($Logo eq "") { $Logo="awstats_logo1.png"; } + if ($LogoLink eq "") { $LogoLink="http://awstats.sourceforge.net"; } $color_Background =~ s/#//g; if ($color_Background !~ /^[0-9|A-Z][0-9|A-Z]*$/i) { $color_Background="FFFFFF"; } $color_TableBGTitle =~ s/#//g; if ($color_TableBGTitle !~ /^[0-9|A-Z][0-9|A-Z]*$/i) { $color_TableBGTitle="CCCCDD"; } $color_TableTitle =~ s/#//g; if ($color_TableTitle !~ /^[0-9|A-Z][0-9|A-Z]*$/i) { $color_TableTitle="000000"; } @@ -1217,6 +1220,10 @@ sub Check_Config { if ($Message[77] eq "") { $Message[77]="Top"; } if ($Message[78] eq "") { $Message[78]="dd mmm yyyy - HH:MM"; } if ($Message[79] eq "") { $Message[79]="Filter"; } + if ($Message[80] eq "") { $Message[80]="Full list"; } + if ($Message[81] eq "") { $Message[81]="Hosts"; } + if ($Message[82] eq "") { $Message[82]="Known"; } + if ($Message[83] eq "") { $Message[83]="Robots"; } } #-------------------------------------------------------------------- @@ -1272,7 +1279,7 @@ sub Read_History_File { $_hostmachine_p{$field[0]}+=$field[1]; $_hostmachine_h{$field[0]}+=$field[2]; $_hostmachine_k{$field[0]}+=$field[3]; - if (! $_hostmachine_l{$field[0]}) { $_hostmachine_l{$field[0]}=int($field[4]); } + if (! $_hostmachine_l{$field[0]} && $field[4] > 0) { $_hostmachine_l{$field[0]}=int($field[4]); } } $_=; chomp $_; s/\r//; @@ -1292,7 +1299,7 @@ sub Read_History_File { while ($field[0] ne "END_UNKNOWNIP") { $count++; $MonthUnique{$year.$month}++; $MonthHostsUnknown{$year.$month}++; - if ($part && ($UpdateStats || $QueryString =~ /output=unknownip/i)) { # Init of $_unknownip_l not needed in this case + if ($part && ($UpdateStats || $QueryString =~ /output=unknownip/i || $QueryString =~ /output=lasthosts/i)) { # Init of $_unknownip_l not needed in other cases if (! $_unknownip_l{$field[0]}) { $_unknownip_l{$field[0]}=int($field[1]); } } $_=; @@ -1613,10 +1620,10 @@ sub Init_HashArray { %_sider404_h = %_sider_h = %_sider_k = %_sider_p = %_unknownip_l = %_unknownreferer_l = %_unknownrefererbrowser_l = (); } -#------------------------------------------------------------------------------ +#-------------------------------------------------------------------- # Function: Show flags for 5 major languages # Input: Languade id (en, fr, ...) -#------------------------------------------------------------------------------ +#-------------------------------------------------------------------- sub Show_Flag_Links { my $Lang = shift; my @lngcode = (); @@ -1670,18 +1677,20 @@ sub Format_Date { return "$dateformat"; } -#------------------------------------------------------------------------------ +#-------------------------------------------------------------------- # Function: This function do nothing. Can be filled by code to change URL list feature # Input: $URLFilter $QueryString %_sider_p # Output: Modified %_sider_p -#------------------------------------------------------------------------------ +#-------------------------------------------------------------------- sub AddOn_Filter { } -#------------------------------------------------------- + + +#-------------------------------------------------------------------- # MAIN -#------------------------------------------------------- +#-------------------------------------------------------------------- if ($ENV{"GATEWAY_INTERFACE"} ne "") { # Run from a browser print("Content-type: text/html\n\n\n"); if ($ENV{"CONTENT_LENGTH"} ne "") { @@ -1692,8 +1701,8 @@ if ($ENV{"GATEWAY_INTERFACE"} ne "") { # Run from a browser $QueryString = $ENV{"QUERY_STRING"}; } $QueryString =~ s/ EOF - + # INFO #--------------------------------------------------------------------- print "$CENTER 
"; print ""; - print ""; + print ""; print ""; - print "\n"; + my $count=0; my $rest=0; + # Create %lasthost = %_unknownip_l + %_hostmachine_l + %_robot_l + my %lasthosts=%_unknownip_l; + foreach $key (keys %_hostmachine_l) { $lasthosts{$key}=$_hostmachine_l{$key}; } + foreach $key (keys %_robot_l) { $lasthosts{$key}=$_robot_l{$key}; } + foreach my $key (sort { $SortDir*$lasthosts{$a} <=> $SortDir*$lasthosts{$b} } keys %lasthosts) { + if ($count>=$MAXROWS || $count>=$MaxNbOfLastHosts) { $rest++; next; } + $key =~ s/\n"; + $count++; + } + if ($rest) { + print "\n"; + } + &tab_end; + &html_end; + exit(0); + } + if ($QueryString =~ /output=urldetail/i) { + AddOn_Filter(); # This function do nothing in standard version. + print "$CENTER 
"; + &tab_head($Message[19]); + if ($URLFilter) { print "\n"; } + else { print "\n"; } + my $max_p=1; foreach my $key (values %_sider_p) { if ($key > $max_p) { $max_p = $key; } } + my $count=0; my $rest=0; + foreach my $key (sort { $SortDir*$_sider_p{$a} <=> $SortDir*$_sider_p{$b} } keys (%_sider_p)) { + if ($count>=$MAXROWS) { $rest+=$_sider_p{$key}; next; } + if ($_sider_p{$key}<$MinHitFile) { $rest+=$_sider_p{$key}; next; } + print "\n"; + $count++; + } + &tab_end; + &html_end; + exit(0); + } if ($QueryString =~ /output=unknownip/i) { print "$CENTER 
"; &tab_head($Message[45]); print "\n"; my $count=0; my $rest=0; foreach my $key (sort { $SortDir*$_unknownip_l{$a} <=> $SortDir*$_unknownip_l{$b} } keys (%_unknownip_l)) { - if ($count>=$MAXROWS) { $rest+=$_sider404_h{$key}; next; } + if ($count>=$MAXROWS) { $rest++; next; } $key =~ s/\n"; $count++; + } + &tab_end; + &html_end; + exit(0); + } + if ($QueryString =~ /output=browserdetail/i) { + print "$CENTER 
"; + &tab_head("$Message[33]
"); + print "\n"; + for (my $i=1; $i<=$#_nsver_h; $i++) { + my $h=" "; my $p=" "; + if ($_nsver_h[$i] > 0 && $_browser_h{"netscape"} > 0) { + $h=$_nsver_h[$i]; $p=int($_nsver_h[$i]/$_browser_h{"netscape"}*1000)/10; $p="$p %"; } + print "\n"; + } + &tab_end; + print " 
"; + &tab_head("$Message[34]
"); + print "\n"; + for ($i=1; $i<=$#_msiever_h; $i++) { + my $h=" "; my $p=" "; + if ($_msiever_h[$i] > 0 && $_browser_h{"msie"} > 0) { + $h=$_msiever_h[$i]; $p=int($_msiever_h[$i]/$_browser_h{"msie"}*1000)/10; $p="$p %"; + } + print "\n"; + } &tab_end; &html_end; exit(0); @@ -2656,57 +2738,6 @@ EOF &html_end; exit(0); } - if ($QueryString =~ /output=browserdetail/i) { - print "$CENTER 
"; - &tab_head("$Message[33]
"); - print "\n"; - for (my $i=1; $i<=$#_nsver_h; $i++) { - my $h=" "; my $p=" "; - if ($_nsver_h[$i] > 0 && $_browser_h{"netscape"} > 0) { - $h=$_nsver_h[$i]; $p=int($_nsver_h[$i]/$_browser_h{"netscape"}*1000)/10; $p="$p %"; - } - print "\n"; - } - &tab_end; - print " 
"; - &tab_head("$Message[34]
"); - print "\n"; - for ($i=1; $i<=$#_msiever_h; $i++) { - my $h=" "; my $p=" "; - if ($_msiever_h[$i] > 0 && $_browser_h{"msie"} > 0) { - $h=$_msiever_h[$i]; $p=int($_msiever_h[$i]/$_browser_h{"msie"}*1000)/10; $p="$p %"; - } - print "\n"; - } - &tab_end; - &html_end; - exit(0); - } - if ($QueryString =~ /output=urldetail/i) { - AddOn_Filter(); # This function do nothing in standard version. - print "$CENTER 
"; - &tab_head($Message[19]); - if ($URLFilter) { print "\n"; } - else { print "\n"; } - my $max_p=1; foreach my $key (values %_sider_p) { if ($key > $max_p) { $max_p = $key; } } - my $count=0; my $rest=0; - foreach my $key (sort { $SortDir*$_sider_p{$a} <=> $SortDir*$_sider_p{$b} } keys (%_sider_p)) { - if ($count>=$MAXROWS) { $rest+=$_sider_p{$key}; next; } - if ($_sider_p{$key}<$MinHitFile) { $rest+=$_sider_p{$key}; next; } - print "\n"; - $count++; - } - &tab_end; - &html_end; - exit(0); - } if ($QueryString =~ /output=info/i) { # Not yet available print "$CENTER 
"; @@ -2915,15 +2946,15 @@ EOF #-------------------------- print "$CENTER 
"; $MaxNbOfHostsShown = $TotalHostsKnown+($_hostmachine_h{"Unknown"}?1:0) if $MaxNbOfHostsShown > $TotalHostsKnown; - &tab_head("$Message[77] $MaxNbOfHostsShown $Message[55] ".($TotalHostsKnown+$TotalHostsUnknown)." $Message[26] ($TotalUnique $Message[11])"); - print "\n"; + &tab_head("$Message[77] $MaxNbOfHostsShown $Message[55] ".($TotalHostsKnown+$TotalHostsUnknown)." $Message[26] ($TotalUnique $Message[11])   -   $Message[9]"); + print "\n"; my $total_p=0;my $total_h=0;my $total_k=0; my $count=0; foreach my $key (sort { $SortDir*$_hostmachine_p{$a} <=> $SortDir*$_hostmachine_p{$b} } keys (%_hostmachine_p)) { if ($count>=$MaxNbOfPageShown) { last; } if ($_hostmachine_h{$key}<$MinHitHost) { last; } if ($key eq "Unknown") { - print "\n"; + print "\n"; } else { print ""; @@ -2949,7 +2980,7 @@ EOF #---------------------------- print "$CENTER 
"; &tab_head($Message[53]); - print "\n"; + print "\n"; my $count=0; foreach my $key (sort { $SortDir*$_robot_h{$a} <=> $SortDir*$_robot_h{$b} } keys (%_robot_h)) { print "";
$Message[7] : $SiteToAnalyze
$Message[7] : $SiteToAnalyze
$Message[35] : "; + print ""; foreach my $key (sort keys %LastUpdate) { if ($LastUpdate < $LastUpdate{$key}) { $LastUpdate = $LastUpdate{$key}; } } if ($LastUpdate) { print Format_Date($LastUpdate); } else { print "Never updated"; } @@ -2593,17 +2602,90 @@ EOF print "
\n\n"; + if ($QueryString =~ /output=lasthosts/i) { + print "$CENTER 
"; + &tab_head("$Message[9]"); + print "
$Message[81] + $Message[83]$Message[9]
$key ".Format_Date($lasthosts{$key})."
$Message[2]...
$Message[79]: $URLFilter - ".(scalar keys %_sider_p)." $Message[28] $Message[29]  
".(scalar keys %_sider_p)."  $Message[28] $Message[29]  
"; + my $nompage=$Aliases{$key}; + if ($nompage eq "") { $nompage=$key; } + if (length($nompage)>$MaxLengthOfURL) { $nompage=substr($nompage,0,$MaxLengthOfURL)."..."; } + if ($ShowLinksOnUrl) { print "$nompage"; } + else { print "$nompage"; } + my $bredde=int($BarWidth*$_sider_p{$key}/$max_p)+1; + print "$_sider_p{$key}
$Message[48] (".(scalar keys %_unknownip_l).")$Message[9]$key".Format_Date($_unknownip_l{$key})."
$Message[58]$Message[57]$Message[15]
Mozilla/$i.xx$h$p
$Message[58]$Message[57]$Message[15]
MSIE/$i.xx$h$p
$Message[58]$Message[57]$Message[15]
Mozilla/$i.xx$h$p
$Message[58]$Message[57]$Message[15]
MSIE/$i.xx$h$p
$Message[79]: $URLFilter - ".(scalar keys %_sider_p)." $Message[28] $Message[29]  
".(scalar keys %_sider_p)."  $Message[28] $Message[29]  
"; - my $nompage=$Aliases{$key}; - if ($nompage eq "") { $nompage=$key; } - if (length($nompage)>$MaxLengthOfURL) { $nompage=substr($nompage,0,$MaxLengthOfURL)."..."; } - if ($ShowLinksOnUrl) { print "$nompage"; } - else { print "$nompage"; } - my $bredde=int($BarWidth*$_sider_p{$key}/$max_p)+1; - print "$_sider_p{$key}
$Message[18]$Message[56]$Message[57]$Message[75]$Message[9]
$Message[81] : $TotalHostsKnown $Message[82], $TotalHostsUnknown $Message[1]$Message[56]$Message[57]$Message[75]$Message[9]
$Message[1]   ($TotalHostsUnknown)$_hostmachine_p{$key}$_hostmachine_h{$key}".Format_Bytes($_hostmachine_k{$key})."$Message[3]
$Message[1]$_hostmachine_p{$key}$_hostmachine_h{$key}".Format_Bytes($_hostmachine_k{$key})."$Message[3]
$key$_hostmachine_p{$key}$_hostmachine_h{$key}".Format_Bytes($_hostmachine_k{$key})."
Robot$Message[57]$Message[9]
$Message[83]$Message[57]$Message[9]
$RobotHash{$key}$_robot_h{$key}".Format_Date($_robot_l{$key})."