From: eldy <>
Date: Sat, 12 Jul 2003 15:28:40 +0000 (+0000)
Subject: Reduce awstats.pl code size.
X-Git-Tag: AWSTATS_5_7_BETA~66
X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fd7cd9c970c96228287c92c68eb65fe14b2d6a41;p=thirdparty%2FAWStats.git
Reduce awstats.pl code size.
---
diff --git a/wwwroot/cgi-bin/awstats.pl b/wwwroot/cgi-bin/awstats.pl
index 169f99ee..699621d0 100644
--- a/wwwroot/cgi-bin/awstats.pl
+++ b/wwwroot/cgi-bin/awstats.pl
@@ -3918,7 +3918,7 @@ sub Show_Flag_Links {
if ($flag ne $CurrentLang) {
my %lngtitle=('en','English','fr','French','de','German','it','Italian','nl','Dutch','es','Spanish');
my $lng=($lngtitle{$flag}?$lngtitle{$flag}:$flag);
- print "
\n";
+ print "
\n";
}
}
}
@@ -3941,6 +3941,18 @@ sub Format_Bytes {
return int($bytes).(int($bytes)?" $Message[119]":"");
}
+#--------------------------------------------------------------------
+# Function: Return " alt=string title=string"
+# Parameters: string
+# Input: None
+# Output: None
+# Return: "alt=string title=string"
+#--------------------------------------------------------------------
+sub AltTitle {
+ my $string = shift||'';
+ return " alt='$string' title='$string'";
+}
+
#--------------------------------------------------------------------
# Function: Format a date according to Message[78] (country date format)
# Parameters: String date YYYYMMDDHHMMSS
@@ -6235,7 +6247,7 @@ if (scalar keys %HTMLOutput) {
# Logo and flags
if ($FrameName ne 'mainleft') {
if ($LogoLink =~ "http://awstats.sourceforge.net") {
- print "
\n";
+ print " | \n";
}
else {
print " | \n";
@@ -6275,7 +6287,7 @@ if (scalar keys %HTMLOutput) {
# Logo and flags
if ($FrameName eq 'mainright') {
if ($LogoLink =~ "http://awstats.sourceforge.net") {
- print " | \n";
+ print " | \n";
}
else {
print " | \n";
@@ -6561,12 +6573,12 @@ if (scalar keys %HTMLOutput) {
# if ($max_h > 0) { $bredde_h=int($MonthHits{$YearRequired.$monthix}/$max_h*$BarHeight)+1; }
# if ($max_k > 0) { $bredde_k=int($MonthBytes{$YearRequired.$monthix}/$max_k*$BarHeight)+1; }
# print " | ";
-# if ($ShowMonthDayStats =~ /U/i) { print " "; }
-# if ($ShowMonthDayStats =~ /V/i) { print " "; }
+# if ($ShowMonthDayStats =~ /U/i) { print " "; }
+# if ($ShowMonthDayStats =~ /V/i) { print " "; }
# print " ";
-# if ($ShowMonthDayStats =~ /P/i) { print " "; }
-# if ($ShowMonthDayStats =~ /H/i) { print " "; }
-# if ($ShowMonthDayStats =~ /B/i) { print " "; }
+# if ($ShowMonthDayStats =~ /P/i) { print " "; }
+# if ($ShowMonthDayStats =~ /H/i) { print " "; }
+# if ($ShowMonthDayStats =~ /B/i) { print " "; }
# print " | \n";
# }
# print "\n";
@@ -6666,10 +6678,10 @@ if (scalar keys %HTMLOutput) {
# if ($max_h > 0) { $bredde_h=int(($DayHits{$year.$month.$day}||0)/$max_h*$BarHeight)+1; }
# if ($max_k > 0) { $bredde_k=int(($DayBytes{$year.$month.$day}||0)/$max_k*$BarHeight)+1; }
# print "";
-# if ($ShowMonthDayStats =~ /V/i) { print " "; }
-# if ($ShowMonthDayStats =~ /P/i) { print " "; }
-# if ($ShowMonthDayStats =~ /H/i) { print " "; }
-# if ($ShowMonthDayStats =~ /B/i) { print " "; }
+# if ($ShowMonthDayStats =~ /V/i) { print " "; }
+# if ($ShowMonthDayStats =~ /P/i) { print " "; }
+# if ($ShowMonthDayStats =~ /H/i) { print " "; }
+# if ($ShowMonthDayStats =~ /B/i) { print " "; }
# print " | \n";
# }
# print " | ";
@@ -6683,10 +6695,10 @@ if (scalar keys %HTMLOutput) {
# $average_p=sprintf("%.2f",$average_p);
# $average_h=sprintf("%.2f",$average_h);
# $average_k=sprintf("%.2f",$average_k);
-# if ($ShowMonthDayStats =~ /V/i) { print "
"; }
-# if ($ShowMonthDayStats =~ /P/i) { print "
"; }
-# if ($ShowMonthDayStats =~ /H/i) { print "
"; }
-# if ($ShowMonthDayStats =~ /B/i) { print "
"; }
+# if ($ShowMonthDayStats =~ /V/i) { print "
"; }
+# if ($ShowMonthDayStats =~ /P/i) { print "
"; }
+# if ($ShowMonthDayStats =~ /H/i) { print "
"; }
+# if ($ShowMonthDayStats =~ /B/i) { print "
"; }
# print "";
# print " | \n";
# print "\n";
@@ -6765,18 +6777,18 @@ if (scalar keys %HTMLOutput) {
if ($_domener_k{$key} && $bredde_k==1) { $bredde_k=2; }
my $newkey=lc($key);
if ($newkey eq 'ip' || ! $DomainsHashIDLib{$newkey}) {
- print "![\"$Message[0]\"](\"$DirIcons\/flags\/ip.png\") | $Message[0] | $newkey | ";
+ print "
 | $Message[0] | $newkey | ";
}
else {
- print "
 | $DomainsHashIDLib{$newkey} | $newkey | ";
+ print "
 | $DomainsHashIDLib{$newkey} | $newkey | ";
}
if ($ShowDomainsStats =~ /P/i) { print "$_domener_p{$key} | "; }
if ($ShowDomainsStats =~ /H/i) { print "$_domener_h{$key} | "; }
if ($ShowDomainsStats =~ /B/i) { print "".Format_Bytes($_domener_k{$key})." | "; }
print "";
- if ($ShowDomainsStats =~ /P/i) { print "![\"$Message[56]: \"$Message[56]:](\"$DirIcons\/other\/$BarPng{'hp'}\") \n"; }
- if ($ShowDomainsStats =~ /H/i) { print "![\"$Message[57]: \"$Message[57]:](\"$DirIcons\/other\/$BarPng{'hh'}\") \n"; }
- if ($ShowDomainsStats =~ /B/i) { print " "; }
+ if ($ShowDomainsStats =~ /P/i) { print " \n"; }
+ if ($ShowDomainsStats =~ /H/i) { print " \n"; }
+ if ($ShowDomainsStats =~ /B/i) { print " "; }
print " | ";
print "
\n";
$total_p += $_domener_p{$key};
@@ -7159,10 +7171,6 @@ if (scalar keys %HTMLOutput) {
if ($ShowPagesStats =~ /B/i) { print "
"; }
if ($ShowPagesStats =~ /E/i) { print "
"; }
if ($ShowPagesStats =~ /X/i) { print "
"; }
- #if ($ShowPagesStats =~ /P/i) { print "![\"$Message[29]: \"$Message[29]:](\"$DirIcons\/other\/$BarPng{'hp'}\")
"; }
- #if ($ShowPagesStats =~ /B/i) { print "![\"$Message[106]: \"$Message[106]:](\"$DirIcons\/other\/$BarPng{'hk'}\")
"; }
- #if ($ShowPagesStats =~ /E/i) { print "![\"$Message[104]: \"$Message[104]:](\"$DirIcons\/other\/$BarPng{'he'}\")
"; }
- #if ($ShowPagesStats =~ /X/i) { print "
"; }
print "\n";
$total_p += $_url_p{$key};
$total_e += $_url_e{$key};
@@ -7260,7 +7268,7 @@ if (scalar keys %HTMLOutput) {
if ($_os_h{$key} > $max_h) { $max_h = $_os_h{$key}; }
foreach my $family (@OSFamily) { if ($key =~ /^$family/i) { $totalfamily_h{$family}+=$_os_h{$key}; next OSLOOP; } }
}
- # Write records grouped in a brwoser family
+ # Write records grouped in a browser family
foreach my $family (@OSFamily) {
my $p=' ';
if ($Total) { $p=int($totalfamily_h{$family}/$Total*1000)/10; $p="$p %"; }
@@ -7274,7 +7282,7 @@ if (scalar keys %HTMLOutput) {
my $p=' ';
if ($Total) { $p=int($_os_h{$key}/$Total*1000)/10; $p="$p %"; }
print "";
- print " | ";
+ print ".") | ";
print "$OSHashLib{$key} | ";
my $bredde_h=0;
if ($max_h > 0) { $bredde_h=int($BarWidth*($_os_h{$key}||0)/$max_h)+1; }
@@ -7299,13 +7307,13 @@ if (scalar keys %HTMLOutput) {
if ($Total) { $p=int($_os_h{$key}/$Total*1000)/10; $p="$p %"; }
print "
";
if ($key eq 'Unknown') {
- print " | $Message[0] | ";
+ print ".") | $Message[0] | ";
}
else {
my $keywithoutcumul=$key; $keywithoutcumul =~ s/cumul$//i;
my $libos=$OSHashLib{$keywithoutcumul}||$keywithoutcumul;
my $nameicon=$keywithoutcumul; $nameicon =~ s/[^\w]//g;
- print " | $libos | ";
+ print ".") | $libos | ";
}
my $bredde_h=0;
if ($max_h > 0) { $bredde_h=int($BarWidth*($_os_h{$key}||0)/$max_h)+1; }
@@ -7355,7 +7363,7 @@ if (scalar keys %HTMLOutput) {
my $p=' ';
if ($Total) { $p=int($_browser_h{$key}/$Total*1000)/10; $p="$p %"; }
print "
";
- print " | ";
+ print ".") | ";
print "".ucfirst($family)." ".($ver?"$ver":"?")." | ";
print "".($BrowsersHereAreGrabbers{$family}?"$Message[112]":"$Message[113]")." | ";
my $bredde_h=0;
@@ -7381,13 +7389,13 @@ if (scalar keys %HTMLOutput) {
if ($Total) { $p=int($_browser_h{$key}/$Total*1000)/10; $p="$p %"; }
print "
";
if ($key eq 'Unknown') {
- print " | $Message[0] | ? | ";
+ print ".") | $Message[0] | ? | ";
}
else {
my $keywithoutcumul=$key; $keywithoutcumul =~ s/cumul$//i;
my $libbrowser=$BrowsersHashIDLib{$keywithoutcumul}||$keywithoutcumul;
my $nameicon=$BrowsersHashIcon{$keywithoutcumul}||"notavailable";
- print " | $libbrowser | ".($BrowsersHereAreGrabbers{$key}?"$Message[112]":"$Message[113]")." | ";
+ print ".") | $libbrowser | ".($BrowsersHereAreGrabbers{$key}?"$Message[112]":"$Message[113]")." | ";
}
my $bredde_h=0;
if ($max_h > 0) { $bredde_h=int($BarWidth*($_browser_h{$key}||0)/$max_h)+1; }
@@ -7681,12 +7689,12 @@ if (scalar keys %HTMLOutput) {
if ($max_h > 0) { $bredde_h=int($MonthHits{$YearRequired.$monthix}/$max_h*$BarHeight)+1; }
if ($max_k > 0) { $bredde_k=int($MonthBytes{$YearRequired.$monthix}/$max_k*$BarHeight)+1; }
print "";
- if ($ShowMonthStats =~ /U/i) { print " "; }
- if ($ShowMonthStats =~ /V/i) { print " "; }
+ if ($ShowMonthStats =~ /U/i) { print " "; }
+ if ($ShowMonthStats =~ /V/i) { print " "; }
print " ";
- if ($ShowMonthStats =~ /P/i) { print " "; }
- if ($ShowMonthStats =~ /H/i) { print " "; }
- if ($ShowMonthStats =~ /B/i) { print " "; }
+ if ($ShowMonthStats =~ /P/i) { print " "; }
+ if ($ShowMonthStats =~ /H/i) { print " "; }
+ if ($ShowMonthStats =~ /B/i) { print " "; }
print " | \n";
}
print " | ";
@@ -7835,10 +7843,10 @@ if (scalar keys %HTMLOutput) {
if ($max_h > 0) { $bredde_h=int(($DayHits{$year.$month.$day}||0)/$max_h*$BarHeight)+1; }
if ($max_k > 0) { $bredde_k=int(($DayBytes{$year.$month.$day}||0)/$max_k*$BarHeight)+1; }
print "";
- if ($ShowDaysOfMonthStats =~ /V/i) { print " "; }
- if ($ShowDaysOfMonthStats =~ /P/i) { print " "; }
- if ($ShowDaysOfMonthStats =~ /H/i) { print " "; }
- if ($ShowDaysOfMonthStats =~ /B/i) { print " "; }
+ if ($ShowDaysOfMonthStats =~ /V/i) { print " "; }
+ if ($ShowDaysOfMonthStats =~ /P/i) { print " "; }
+ if ($ShowDaysOfMonthStats =~ /H/i) { print " "; }
+ if ($ShowDaysOfMonthStats =~ /B/i) { print " "; }
print " | \n";
}
print " | ";
@@ -7853,10 +7861,10 @@ if (scalar keys %HTMLOutput) {
$average_p=sprintf("%.2f",$average_p);
$average_h=sprintf("%.2f",$average_h);
$average_k=(int($average_k)?Format_Bytes(sprintf("%.2f",$average_k)):"0.00");
- if ($ShowDaysOfMonthStats =~ /V/i) { print "
"; }
- if ($ShowDaysOfMonthStats =~ /P/i) { print "
"; }
- if ($ShowDaysOfMonthStats =~ /H/i) { print "
"; }
- if ($ShowDaysOfMonthStats =~ /B/i) { print "
"; }
+ if ($ShowDaysOfMonthStats =~ /V/i) { print "
"; }
+ if ($ShowDaysOfMonthStats =~ /P/i) { print "
"; }
+ if ($ShowDaysOfMonthStats =~ /H/i) { print "
"; }
+ if ($ShowDaysOfMonthStats =~ /B/i) { print "
"; }
print "\n";
print "
\n";
# Show lib for day
@@ -7970,9 +7978,9 @@ if (scalar keys %HTMLOutput) {
if ($avg_dayofweek_p[$_] == int($avg_dayofweek_p[$_])) { $avg_dayofweek_p[$_]=int($avg_dayofweek_p[$_]); }
if ($avg_dayofweek_h[$_] == int($avg_dayofweek_h[$_])) { $avg_dayofweek_h[$_]=int($avg_dayofweek_h[$_]); }
print "";
- if ($ShowDaysOfWeekStats =~ /P/i) { print " "; }
- if ($ShowDaysOfWeekStats =~ /H/i) { print " "; }
- if ($ShowDaysOfWeekStats =~ /B/i) { print " "; }
+ if ($ShowDaysOfWeekStats =~ /P/i) { print " "; }
+ if ($ShowDaysOfWeekStats =~ /H/i) { print " "; }
+ if ($ShowDaysOfWeekStats =~ /B/i) { print " "; }
print " | \n";
}
print "\n";
@@ -8028,9 +8036,9 @@ if (scalar keys %HTMLOutput) {
if ($max_h > 0) { $bredde_h=int($BarHeight*$_time_h[$ix]/$max_h)+1; }
if ($max_k > 0) { $bredde_k=int($BarHeight*$_time_k[$ix]/$max_k)+1; }
print "";
- if ($ShowHoursStats =~ /P/i) { print " "; }
- if ($ShowHoursStats =~ /H/i) { print " "; }
- if ($ShowHoursStats =~ /B/i) { print " "; }
+ if ($ShowHoursStats =~ /P/i) { print " "; }
+ if ($ShowHoursStats =~ /H/i) { print " "; }
+ if ($ShowHoursStats =~ /B/i) { print " "; }
print " | \n";
}
print "\n";
@@ -8125,18 +8133,18 @@ if (scalar keys %HTMLOutput) {
if ($_domener_k{$key} && $bredde_k==1) { $bredde_k=2; }
my $newkey=lc($key);
if ($newkey eq 'ip' || ! $DomainsHashIDLib{$newkey}) {
- print "![\"$Message[0]\"](\"$DirIcons\/flags\/ip.png\") | $Message[0] | $newkey | ";
+ print "
 | $Message[0] | $newkey | ";
}
else {
- print "
 | $DomainsHashIDLib{$newkey} | $newkey | ";
+ print "
 | $DomainsHashIDLib{$newkey} | $newkey | ";
}
if ($ShowDomainsStats =~ /P/i) { print "".($_domener_p{$key}?$_domener_p{$key}:' ')." | "; }
if ($ShowDomainsStats =~ /H/i) { print "$_domener_h{$key} | "; }
if ($ShowDomainsStats =~ /B/i) { print "".Format_Bytes($_domener_k{$key})." | "; }
print "";
- if ($ShowDomainsStats =~ /P/i) { print " \n"; }
- if ($ShowDomainsStats =~ /H/i) { print " \n"; }
- if ($ShowDomainsStats =~ /B/i) { print " "; }
+ if ($ShowDomainsStats =~ /P/i) { print " \n"; }
+ if ($ShowDomainsStats =~ /H/i) { print " \n"; }
+ if ($ShowDomainsStats =~ /B/i) { print " "; }
print " | ";
print "
\n";
$total_p += $_domener_p{$key};
@@ -8335,11 +8343,6 @@ if (scalar keys %HTMLOutput) {
if ($ShowAuthenticatedUsers =~ /H/i) { print "$_login_h{$key} | "; }
if ($ShowAuthenticatedUsers =~ /B/i) { print "".Format_Bytes($_login_k{$key})." | "; }
if ($ShowAuthenticatedUsers =~ /L/i) { print "".($_login_l{$key}?Format_Date($_login_l{$key},1):'-')." | "; }
- #print "";
- #print "![\"$Message[56]: \"$Message[56]:](\"$DirIcons\/other\/$BarPng{'hp'}\") \n";
- #print "![\"$Message[57]: \"$Message[57]:](\"$DirIcons\/other\/$BarPng{'hh'}\") \n";
- #print " ";
- #print " | ";
print "\n";
$total_p += $_login_p{$key};
$total_h += $_login_h{$key};
@@ -8461,13 +8464,13 @@ if (scalar keys %HTMLOutput) {
foreach my $key (@keylist) {
my $p=int($_filetypes_h{$key}/$Totalh*1000)/10;
if ($key eq 'Unknown') {
- print " | $Message[0] | ";
+ print "
.") | $Message[0] | ";
print " | ";
}
else {
my $nameicon=$MimeHashIcon{$key}||"notavailable";
my $nametype=$MimeHashLib{$MimeHashFamily{$key}||""}||" ";
- print "
 | $key | ";
+ print "
.") | $key | ";
print "$nametype | ";
}
if ($ShowFileTypesStats =~ /H/i) { print "$_filetypes_h{$key} | $p % | "; }
@@ -8544,10 +8547,10 @@ if (scalar keys %HTMLOutput) {
eval("$function");
}
print "";
- if ($ShowPagesStats =~ /P/i) { print " "; }
- if ($ShowPagesStats =~ /B/i) { print " "; }
- if ($ShowPagesStats =~ /E/i) { print " "; }
- if ($ShowPagesStats =~ /X/i) { print " "; }
+ if ($ShowPagesStats =~ /P/i) { print " "; }
+ if ($ShowPagesStats =~ /B/i) { print " "; }
+ if ($ShowPagesStats =~ /E/i) { print " "; }
+ if ($ShowPagesStats =~ /X/i) { print " "; }
print " |
\n";
$total_p += $_url_p{$key};
$total_e += $_url_e{$key};
@@ -8596,7 +8599,7 @@ if (scalar keys %HTMLOutput) {
my $p=' ';
if ($Totalh) { $p=int($new_os_h{$key}/$Totalh*1000)/10; $p="$p %"; }
if ($key eq 'Unknown') {
- print " | $Message[0] | $_os_h{$key} | $p |
\n";
+ print ".") | $Message[0] | $_os_h{$key} | $p |
\n";
}
else {
my $keywithoutcumul=$key; $keywithoutcumul =~ s/cumul$//i;
@@ -8605,7 +8608,7 @@ if (scalar keys %HTMLOutput) {
# TODO Use OSFamilyLib
if ($libos eq 'win') { $libos="Windows"; }
if ($libos eq 'mac') { $libos="Macintosh"; }
- print " | $libos | $new_os_h{$key} | $p |
\n";
+ print ".") | $libos | $new_os_h{$key} | $p |
\n";
}
$total_h += $new_os_h{$key};
$count++;
@@ -8644,7 +8647,7 @@ if (scalar keys %HTMLOutput) {
my $p=' ';
if ($Totalh) { $p=int($new_browser_h{$key}/$Totalh*1000)/10; $p="$p %"; }
if ($key eq 'Unknown') {
- print " | $Message[0] | ? | $_browser_h{$key} | $p |
\n";
+ print ".") | $Message[0] | ? | $_browser_h{$key} | $p |
\n";
}
else {
my $keywithoutcumul=$key; $keywithoutcumul =~ s/cumul$//i;
@@ -8653,7 +8656,7 @@ if (scalar keys %HTMLOutput) {
# TODO Use BrowsersFamilyLib
if ($libbrowser eq 'netscape') { $libbrowser="Netscape"; }
if ($libbrowser eq 'msie') { $libbrowser="MS Internet Explorer"; }
- print " | $libbrowser | ".($BrowsersHereAreGrabbers{$key}?"$Message[112]":"$Message[113]")." | $new_browser_h{$key} | $p |
\n";
+ print ".") | $libbrowser | ".($BrowsersHereAreGrabbers{$key}?"$Message[112]":"$Message[113]")." | $new_browser_h{$key} | $p |
\n";
}
$total_h += $new_browser_h{$key};
$count++;