]> git.ipfire.org Git - thirdparty/AWStats.git/commitdiff
Added 'userinfo' plugin to add information from a text file (like lastname, office...
authoreldy <>
Sat, 26 Apr 2003 19:26:38 +0000 (19:26 +0000)
committereldy <>
Sat, 26 Apr 2003 19:26:38 +0000 (19:26 +0000)
docs/awstats_changelog.txt
wwwroot/cgi-bin/awstats.model.conf
wwwroot/cgi-bin/awstats.pl
wwwroot/cgi-bin/plugins/urlalias.pm
wwwroot/cgi-bin/plugins/userinfo.pm [new file with mode: 0644]

index fd09f0bf848e1d924b97d4788c4f36dc5083d3a7..c98c2f0042fd7fd02936ae6ca41b6955bc1a954b 100644 (file)
@@ -15,31 +15,33 @@ Fixes:
 New features/improvments:
 - Added a 'Screen Size' report.
 - Group OS by families. Added a detailed OS version chart.
-- Better 404 errors management. URLs are always cleaned from their
-  parameter to build '404 not found' URLs list (because parameters are not
-  interesting as they can't have effect as page is not found). Referrer
-  URLs list for '404 not found' URLs are kept with parameters only if
-  URLReferrerWithQuery is set to 1. This make this report more useful.
+- Better 404 errors management. URLs are always cleaned from their parameter
+  to build '404 not found' URLs list (because parameters are not interesting
+  as they can't have effect as page is not found). Referrer URLs list for '404
+  not found' URLs are kept with parameters only if URLReferrerWithQuery is set
+  to 1. This make this report more useful.
 - Added 'geoipfree' plugin (same than 'geoip' plugin but using the free
   Perl module Geo::IPfree).
-- 'geoip' plugin can works with Perl module Geo::IP but also with Perl
-  module Geo::IP::PurePerl).
+- 'geoip' plugin can works with Perl module Geo::IP but also with Perl module
+  Geo::IP::PurePerl).
+- Added 'userinfo' plugin to add information from a text file (like lastname,
+  office department,...) in authenticated user chart.
 - month parameter can accept format -month=D, not only -month=DD
 - Optimized code size.
 - Optimized HTML output report size.
 - Added plugin ipv6 to fully support IPv6 (included reverse DNS lookup).
-- Split month summary chart and days of month chart in two different
-  charts in main page. This also means that ShowDaysOfMonthStats and
+- Split month summary chart and days of month chart in two different charts in
+  main page. This also means that ShowDaysOfMonthStats and
   AddDataArrayShowDaysOfMonthStats parameters were added.
 - Added -staticlinksext to build static pages with another extension than
   default .html
 
 Other/Documentation:
 - Added Isle of Man, Monserat, and Palestinian flag icon.
-- Added "local network host" and "Satellite access host" in label of
-  possible countries and icons (They appears when using geoip plugins).
-- Better management of parsed lines counting. The last line number is
-  also stored in history file, for a future use.
+- Added "local network host" and "Satellite access host" in label of possible
+  countries and icons (They appears when using geoip plugins).
+- Better management of parsed lines counting. The last line number is also
+  stored in history file, for a future use.
 - Removed LogFormat=5 option for ISA log file because I am fed up of
   supporting bugged and non standard MS products. Sorry but this takes me too
   many times. To use AWStats with an ISA server, just use now a preprocessor
index 0124e0632216dd3ed3c56a41df9c8f8a2a3547e7..b5769d6af35bbfac956beab2dec065814d1c0fa0 100644 (file)
@@ -1043,27 +1043,14 @@ color_x="C1B2E2"                                # Background color for number of exit pages (Default = "C1B2
 #
 #LoadPlugin="tooltips"
 
-# Plugin: HashFiles
-# Perl modules required: Storable
-# AWStats DNS cache files are read/saved as native hash files. This increase
-# DNS cache files loading speed, above all for very large web sites.
-#
-#LoadPlugin="hashfiles"
-
-# Plugin: TimeHiRes
-# Perl modules required: Time::HiRes
-# Time reported by -showsteps option is in millisecond. For debug purpose.
-#
-#LoadPlugin="timehires"                
-
-# Plugin: TimeZone
-# Perl modules required: Time::Local
-# Allow AWStats to correct a bad timezone for user of some IIS that use
-# GMT date in its log instead of local server time.
-# This module is useless for Apache and most IIS version.
-# This plugin reduces AWStats speed of 40% !!!!!!!
+# Plugin: IPv6
+# Perl modules required: Net::IP and Net::DNS
+# This plugin gives AWStats capability to make reverse DNS lookup on IPv6
+# addresses.
+# Note: If you are interesting in having country report, you should use the
+# geoipfree (or geoip) plugin instead of enabled reverse DNS lookup.
 #
-#LoadPlugin="timezone +2"
+#LoadPlugin="ipv6"
 
 # Plugin: GeoIPfree
 # Perl modules required: Geo::IPfree version 0.2+ (from Graciliano M.P.)
@@ -1094,6 +1081,38 @@ color_x="C1B2E2"                         # Background color for number of exit pages (Default = "C1B2
 #
 #LoadPlugin="urlalias"
 
+# Plugin: UserInfo
+# Perl modules required: None
+# Add a text (Firtname, Lastname, Office Department, ...) in authenticated user
+# reports for each login value.
+# A text file called userinfo.myconfig.txt, with two fields (first is login,
+# second is text to show) separated by a tab char. must be created in plugins
+# directory.
+#
+LoadPlugin="userinfo"
+
+# Plugin: HashFiles
+# Perl modules required: Storable
+# AWStats DNS cache files are read/saved as native hash files. This increase
+# DNS cache files loading speed, above all for very large web sites.
+#
+#LoadPlugin="hashfiles"
+
+# Plugin: TimeHiRes
+# Perl modules required: Time::HiRes
+# Time reported by -showsteps option is in millisecond. For debug purpose.
+#
+#LoadPlugin="timehires"                
+
+# Plugin: TimeZone
+# Perl modules required: Time::Local
+# Allow AWStats to correct a bad timezone for user of some IIS that use
+# GMT date in its log instead of local server time.
+# This module is useless for Apache and most IIS version.
+# This plugin reduces AWStats speed of 40% !!!!!!!
+#
+#LoadPlugin="timezone +2"
+
 # Plugin: Graph3D
 # Perl modules required: None
 # Supported charts are built by a nice 3D graphic applet.
index 33367c0f631a320d91cc80e6a302eaf938147b8d..158bc27a5830e4516d175cf2ad9a0ad663359af1 100644 (file)
@@ -3523,8 +3523,7 @@ sub Save_History {
 # Output:       None
 # Return:       1 Ok, 0 at least one error (tmp files are removed)
 #--------------------------------------------------------------------
-sub Rename_All_Tmp_History()
-{
+sub Rename_All_Tmp_History {
        my $pid=$$;
        my $renameok=1;
 
@@ -3746,8 +3745,7 @@ sub ChangeWordSeparatorsIntoSpace {
 #------------------------------------------------------------------------------
 # Function:     Converts an UTF8 binary string
 #------------------------------------------------------------------------------
-sub Utf8_To_Ascii
-{
+sub Utf8_To_Ascii {
        my $string = shift;
        my $format = $ENV{"UCFORMAT"}||('%lx');
        $string =~ s/([\xC0-\xDF])([\x80-\xBF])/sprintf ("%c", hex(sprintf($format,unpack("c",$1)<<6&0x07C0|unpack("c",$2)&0x003F)))/ge;
@@ -3759,8 +3757,7 @@ sub Utf8_To_Ascii
 #--------------------------------------------------------------------
 # Function:     Encode a binary string into a non binary string
 #--------------------------------------------------------------------
-sub EncodeString
-{
+sub EncodeString {
        my $string = shift;
 #      use bytes;
        $string =~ s/([\x2B\x80-\xFF])/sprintf ("%%%2x", ord($1))/eg;
@@ -3905,36 +3902,6 @@ sub Format_Date {
        return "$dateformat";
 }
 
-#--------------------------------------------------------------------
-# Function:     Write a HTML cell with a WhoIs link to parameter
-# Parameters:   Key to used as WhoIs target
-# Input:        $LinksToWhoIs $LinksToIPWhoIs
-# Output:       None
-# Return:       None
-#--------------------------------------------------------------------
-sub ShowWhoIsCell {
-       my $keyurl=shift;
-       my $keyforwhois;
-       my $linkforwhois;
-       if ($keyurl =~ /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/) {        # IPv4 address
-               $keyforwhois=$keyurl;
-               $linkforwhois=2;
-       }
-       elsif ($keyurl =~ /^[0-9A-F]*:/i) {                                                     # IPv6 address
-               $keyforwhois=$keyurl;
-               $linkforwhois=2;
-       }
-       else {  # Hostname
-               $keyurl =~ /([-\w]+\.[-\w]+\.(au|uk|jp|nz))$/ or $keyurl =~ /([-\w]+\.[-\w]+)$/;
-               $keyforwhois=$1;
-               $linkforwhois=1;
-       }
-       print "<td>";
-       if ($keyforwhois && $linkforwhois) { print "<a href=\"javascript:neww('$keyforwhois',$linkforwhois)\">?</a>"; }
-       else { print "&nbsp;" }
-       print "</td>";
-}
-
 #--------------------------------------------------------------------
 # Function:     Return 1 if string contains only ascii chars
 # Parameters:   string
@@ -4140,7 +4107,7 @@ sub SigHandler {
 # Output:       None
 # Return:       Int
 #--------------------------------------------------------------------
-sub Convert_IP_To_Decimal() {
+sub Convert_IP_To_Decimal {
        my ($IPAddress) = @_;
        my @ip_seg_arr = split(/\./,$IPAddress);
        my $decimal_ip_address = 256 * 256 *256 * $ip_seg_arr[0] + 256 * 256 * $ip_seg_arr[1] + 256 * $ip_seg_arr[2] + $ip_seg_arr[3];
@@ -4154,7 +4121,7 @@ sub Convert_IP_To_Decimal() {
 # Output:       None
 # Return:       1 There is at least one not null value, 0 else
 #--------------------------------------------------------------------
-sub AtLeastOneNotNull() {
+sub AtLeastOneNotNull {
        debug(" Call to AtLeastOneNotNull (".join('-',@_).")",3);
        foreach my $val (@_) { if ($val) { return 1; } }
        return 0;
@@ -4167,7 +4134,7 @@ sub AtLeastOneNotNull() {
 # Output:       HTML Form
 # Return:       None
 #--------------------------------------------------------------------
-sub ShowFormFilter() {
+sub ShowFormFilter {
        my $fieldfiltername=shift;
        my $fieldfiltervalue=shift;
        if (! $StaticLinks) {
@@ -4196,19 +4163,51 @@ sub ShowFormFilter() {
 }
 
 #--------------------------------------------------------------------
-# Function:     Write URL with HTML link or not
+# Function:     Write Host info
+# Parameters:   Key to used as WhoIs target
+# Input:        $ShowLinksToWhoIs
+# Output:       None
+# Return:       None
+#--------------------------------------------------------------------
+sub ShowHostInfo {
+       if ($ShowLinksToWhoIs) {
+               my $keyurl=shift;
+               my $keyforwhois;
+               my $linkforwhois;
+               if ($keyurl =~ /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/) {        # IPv4 address
+                       $keyforwhois=$keyurl;
+                       $linkforwhois=2;
+               }
+               elsif ($keyurl =~ /^[0-9A-F]*:/i) {                                                     # IPv6 address
+                       $keyforwhois=$keyurl;
+                       $linkforwhois=2;
+               }
+               else {  # Hostname
+                       $keyurl =~ /([-\w]+\.[-\w]+\.(au|uk|jp|nz))$/ or $keyurl =~ /([-\w]+\.[-\w]+)$/;
+                       $keyforwhois=$1;
+                       $linkforwhois=1;
+               }
+               print "<td>";
+               if ($keyforwhois && $linkforwhois) { print "<a href=\"javascript:neww('$keyforwhois',$linkforwhois)\">?</a>"; }
+               else { print "&nbsp;" }
+               print "</td>";
+       }
+}
+
+#--------------------------------------------------------------------
+# Function:     Write URL info (with plugins info)
 # Parameters:   $url
 # Input:        %Aliases $MaxLengthOfURL $ShowLinksOnUrl $SiteDomain $UseHTTPSLinkForUrl
 # Output:       URL link
 # Return:       None
 #--------------------------------------------------------------------
-sub ShowURL() {
+sub ShowURLInfo {
        my $url=shift;
        my $nompage=CleanFromCSSA($url);
 
-       # Call to plugins' function ReplaceURL
-       foreach my $pluginname (keys %{$PluginsLoaded{'ReplaceURL'}})  {
-               my $function="ReplaceURL_$pluginname('$url')";
+       # Call to plugins' function ShowInfoURL
+       foreach my $pluginname (keys %{$PluginsLoaded{'ShowInfoURL'}})  {
+               my $function="ShowInfoURL_$pluginname('$url')";
                eval("$function");
        }
 
@@ -4234,6 +4233,22 @@ sub ShowURL() {
        }
 }
 
+#--------------------------------------------------------------------
+# Function:     Write other user info
+# Parameters:   $user
+# Input:        %Aliases $MaxLengthOfURL $ShowLinksOnUrl $SiteDomain $UseHTTPSLinkForUrl
+# Output:       URL link
+# Return:       None
+#--------------------------------------------------------------------
+sub ShowUserInfo {
+       my $user=shift;
+       # Call to plugins' function ShowInfoUser
+       foreach my $pluginname (keys %{$PluginsLoaded{'ShowInfoUser'}})  {
+               my $function="ShowInfoUser_$pluginname('$user')";
+               eval("$function");
+       }
+}
+
 #--------------------------------------------------------------------
 # Function:     Define value for PerlParsingFormat (used for regex log record parsing)
 # Parameters:   -
@@ -4241,7 +4256,7 @@ sub ShowURL() {
 # Output:       @fieldlib
 # Return:       -
 #--------------------------------------------------------------------
-sub DefinePerlParsingFormat() {
+sub DefinePerlParsingFormat {
        # Log records examples:
        # Apache combined: 62.161.78.73 user - [dd/mmm/yyyy:hh:mm:ss +0000] "GET / HTTP/1.1" 200 1234 "http://www.from.com/from.htm" "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)"
        # Apache combined (408 error): my.domain.com - user [09/Jan/2001:11:38:51 -0600] "OPTIONS /mime-tmp/xxx file.doc HTTP/1.1" 408 - "-" "-"
@@ -6687,7 +6702,7 @@ if (scalar keys %HTMLOutput) {
                foreach my $key (@keylist) {
                        my $host=CleanFromCSSA($key);
                        print "<tr><td CLASS=AWL>".($_robot_l{$key}?'<b>':'')."$host".($_robot_l{$key}?'</b>':'')."</td>";
-                       if ($ShowLinksToWhoIs && $LinksToWhoIs) { ShowWhoIsCell($key); }
+                       ShowHostInfo($key);
                        if ($ShowHostsStats =~ /P/i) { print "<TD>".($_host_p{$key}?$_host_p{$key}:"&nbsp;")."</TD>"; }
                        if ($ShowHostsStats =~ /H/i) { print "<TD>$_host_h{$key}</TD>"; }
                        if ($ShowHostsStats =~ /B/i) { print "<TD>".Format_Bytes($_host_k{$key})."</TD>"; }
@@ -6703,7 +6718,7 @@ if (scalar keys %HTMLOutput) {
                $rest_k=$TotalBytes-$total_k;
                if ($rest_p > 0 || $rest_h > 0 || $rest_k > 0) {        # All other visitors (known or not)
                        print "<TR><TD CLASS=AWL><font color=\"#$color_other\">$Message[2]</font></TD>";
-                       if ($ShowLinksToWhoIs && $LinksToWhoIs) { ShowWhoIsCell(''); }
+                       ShowHostInfo('');
                        if ($ShowHostsStats =~ /P/i) { print "<TD>".($rest_p?$rest_p:"&nbsp;")."</TD>"; }
                        if ($ShowHostsStats =~ /H/i) { print "<TD>$rest_h</TD>"; }
                        if ($ShowHostsStats =~ /B/i) { print "<TD>".Format_Bytes($rest_k)."</TD>"; }
@@ -6729,7 +6744,7 @@ if (scalar keys %HTMLOutput) {
                foreach my $key (@keylist) {
                        my $host=CleanFromCSSA($key);
                        print "<tr><td CLASS=AWL>$host</td>";
-                       if ($ShowLinksToWhoIs && $LinksToWhoIs) { ShowWhoIsCell($key); }
+                       ShowHostInfo($key);
                        if ($ShowHostsStats =~ /P/i) { print "<TD>".($_host_p{$key}?$_host_p{$key}:"&nbsp;")."</TD>"; }
                        if ($ShowHostsStats =~ /H/i) { print "<TD>$_host_h{$key}</TD>"; }
                        if ($ShowHostsStats =~ /B/i) { print "<TD>".Format_Bytes($_host_k{$key})."</TD>"; }
@@ -6746,7 +6761,7 @@ if (scalar keys %HTMLOutput) {
                $rest_k=$TotalBytes-$total_k;
                if ($rest_p > 0 || $rest_h > 0 || $rest_k > 0) {        # All other visitors (known or not)
                        print "<TR><TD CLASS=AWL><font color=\"#$color_other\">$Message[82]</font></TD>";
-                       if ($ShowLinksToWhoIs && $LinksToWhoIs) { ShowWhoIsCell(''); }
+                       ShowHostInfo('');
                        if ($ShowHostsStats =~ /P/i) { print "<TD>".($rest_p?$rest_p:"&nbsp;")."</TD>"; }
                        if ($ShowHostsStats =~ /H/i) { print "<TD>$rest_h</TD>"; }
                        if ($ShowHostsStats =~ /B/i) { print "<TD>".Format_Bytes($rest_k)."</TD>"; }
@@ -6859,6 +6874,7 @@ if (scalar keys %HTMLOutput) {
                if ($HTMLOutput{'lastlogins'}) { $title.="$Message[9]"; }
                &tab_head("$title",19);
                print "<TR bgcolor=\"#$color_TableBGRowTitle\"><TH>$Message[94] : ".(scalar keys %_login_h)."</TH>";
+               ShowUserInfo('');
                if ($ShowAuthenticatedUsers =~ /P/i) { print "<TH bgcolor=\"#$color_p\" width=80>$Message[56]</TH>"; }
                if ($ShowAuthenticatedUsers =~ /H/i) { print "<TH bgcolor=\"#$color_h\" width=80>$Message[57]</TH>"; }
                if ($ShowAuthenticatedUsers =~ /B/i) { print "<TH bgcolor=\"#$color_k\" width=80>$Message[75]</TH>"; }
@@ -6870,6 +6886,7 @@ if (scalar keys %HTMLOutput) {
                if ($HTMLOutput{'lastlogins'}) { &BuildKeyList($MaxRowsInHTMLOutput,$MinHit{'Host'},\%_login_h,\%_login_l); }
                foreach my $key (@keylist) {
                        print "<TR><TD CLASS=AWL>$key</TD>";
+                       ShowUserInfo($key);
                        if ($ShowAuthenticatedUsers =~ /P/i) { print "<TD>".($_login_p{$key}?$_login_p{$key}:"&nbsp;")."</TD>"; }
                        if ($ShowAuthenticatedUsers =~ /H/i) { print "<TD>$_login_h{$key}</TD>"; }
                        if ($ShowAuthenticatedUsers =~ /B/i) { print "<TD>".Format_Bytes($_login_k{$key})."</TD>"; }
@@ -6886,6 +6903,7 @@ if (scalar keys %HTMLOutput) {
                $rest_k=$TotalBytes-$total_k;
                if ($rest_p > 0 || $rest_h > 0 || $rest_k > 0) {        # All other logins and/or anonymous
                        print "<TR><TD CLASS=AWL><font color=\"#$color_other\">$Message[125]</font></TD>";
+                       ShowUserInfo('');
                        if ($ShowAuthenticatedUsers =~ /P/i) { print "<TD>".($rest_p?$rest_p:"&nbsp;")."</TD>"; }
                        if ($ShowAuthenticatedUsers =~ /H/i) { print "<TD>$rest_h</TD>"; }
                        if ($ShowAuthenticatedUsers =~ /B/i) { print "<TD>".Format_Bytes($rest_k)."</TD>"; }
@@ -6985,7 +7003,7 @@ if (scalar keys %HTMLOutput) {
                }
                foreach my $key (@keylist) {
                        print "<TR><TD CLASS=AWL>";
-                       &ShowURL($key);
+                       &ShowURLInfo($key);
                        print "</TD>";
                        my $bredde_p=0; my $bredde_e=0; my $bredde_x=0; my $bredde_k=0;
                        if ($max_p > 0) { $bredde_p=int($BarWidth*($_url_p{$key}||0)/$max_p)+1; }
@@ -7308,7 +7326,7 @@ if (scalar keys %HTMLOutput) {
                        if ($TotalRefererPages) { $p_p=int($_pagesrefs_p{$key}/$TotalRefererPages*1000)/10; }
                        if ($TotalRefererHits) { $p_h=int($_pagesrefs_h{$key}/$TotalRefererHits*1000)/10; }
                        print "<TR><TD CLASS=AWL>";
-                       &ShowURL($key);
+                       &ShowURLInfo($key);
                        print "</TD>";
                        print "<TD>".($_pagesrefs_p{$key}?$_pagesrefs_p{$key}:'&nbsp;')."</TD><TD>".($_pagesrefs_p{$key}?"$p_p %":'&nbsp;')."</TD>";
                        print "<TD>".($_pagesrefs_h{$key}?$_pagesrefs_h{$key}:'&nbsp;')."</TD><TD>".($_pagesrefs_h{$key}?"$p_h %":'&nbsp;')."</TD>";
@@ -8000,7 +8018,7 @@ if (scalar keys %HTMLOutput) {
                        foreach my $key (@keylist) {
                                print "<TR>";
                                print "<TD CLASS=AWL>$key</TD>";
-                               if ($ShowLinksToWhoIs && $LinksToWhoIs) { ShowWhoIsCell($key); }
+                               ShowHostInfo($key);
                                if ($ShowHostsStats =~ /P/i) { print "<TD>".($_host_p{$key}||"&nbsp")."</TD>"; }
                                if ($ShowHostsStats =~ /H/i) { print "<TD>$_host_h{$key}</TD>"; }
                                if ($ShowHostsStats =~ /B/i) { print "<TD>".Format_Bytes($_host_k{$key})."</TD>"; }
@@ -8132,6 +8150,7 @@ if (scalar keys %HTMLOutput) {
                        if ($ShowAuthenticatedUsers =~ /L/i) { $title.=" &nbsp; - &nbsp; <a href=\"".($ENV{'GATEWAY_INTERFACE'} || !$StaticLinks?"$AWScript?${NewLinkParams}output=lastlogins":"$PROG$StaticLinks.lastlogins.$StaticExt")."\"$NewLinkTarget>$Message[9]</a>"; }
                        &tab_head("$title",19);
                        print "<TR bgcolor=\"#$color_TableBGRowTitle\"><TH>$Message[94] : ".(scalar keys %_login_h)."</TH>";
+                       ShowUserInfo('');
                        if ($ShowAuthenticatedUsers =~ /P/i) { print "<TH bgcolor=\"#$color_p\" width=80>$Message[56]</TH>"; }
                        if ($ShowAuthenticatedUsers =~ /H/i) { print "<TH bgcolor=\"#$color_h\" width=80>$Message[57]</TH>"; }
                        if ($ShowAuthenticatedUsers =~ /B/i) { print "<TH bgcolor=\"#$color_k\" width=80>$Message[75]</TH>"; }
@@ -8148,6 +8167,7 @@ if (scalar keys %HTMLOutput) {
                                if ($max_h > 0) { $bredde_h=int($BarWidth*$_login_h{$key}/$max_h)+1; }
                                if ($max_k > 0) { $bredde_k=int($BarWidth*$_login_k{$key}/$max_k)+1; }
                                print "<TR><TD CLASS=AWL>$key</TD>";
+                               ShowUserInfo($key);
                                if ($ShowAuthenticatedUsers =~ /P/i) { print "<TD>".($_login_p{$key}?$_login_p{$key}:"&nbsp;")."</TD>"; }
                                if ($ShowAuthenticatedUsers =~ /H/i) { print "<TD>$_login_h{$key}</TD>"; }
                                if ($ShowAuthenticatedUsers =~ /B/i) { print "<TD>".Format_Bytes($_login_k{$key})."</TD>"; }
@@ -8168,6 +8188,7 @@ if (scalar keys %HTMLOutput) {
                        $rest_k=$TotalBytes-$total_k;
                        if ($rest_p > 0 || $rest_h > 0 || $rest_k > 0) {        # All other logins
                                print "<TR><TD CLASS=AWL><font color=\"#$color_other\">$Message[125]</font></TD>";
+                               ShowUserInfo('');
                                if ($ShowAuthenticatedUsers =~ /P/i) { print "<TD>".($rest_p?$rest_p:"&nbsp;")."</TD>"; }
                                if ($ShowAuthenticatedUsers =~ /H/i) { print "<TD>$rest_h</TD>"; }
                                if ($ShowAuthenticatedUsers =~ /B/i) { print "<TD>".Format_Bytes($rest_k)."</TD>"; }
@@ -8339,7 +8360,7 @@ if (scalar keys %HTMLOutput) {
                        }
                        foreach my $key (@keylist) {
                                print "<TR><TD CLASS=AWL>";
-                               &ShowURL($key);
+                               &ShowURLInfo($key);
                                print "</TD>";
                                my $bredde_p=0; my $bredde_e=0; my $bredde_x=0; my $bredde_k=0;
                                if ($max_p > 0) { $bredde_p=int($BarWidth*($_url_p{$key}||0)/$max_p)+1; }
@@ -8586,7 +8607,7 @@ if (scalar keys %HTMLOutput) {
                                &BuildKeyList($MaxNbOf{'RefererShown'},$MinHit{'Refer'},\%_pagesrefs_h,\%_pagesrefs_p);
                                foreach my $key (@keylist) {
                                        print "<TR><TD CLASS=AWL>- ";
-                                       &ShowURL($key);
+                                       &ShowURLInfo($key);
                                        print "</TD>";
                                        print "<TD>".($_pagesrefs_p{$key}?$_pagesrefs_p{$key}:'0')."</TD>";
                                        print "<TD>$_pagesrefs_h{$key}</TD>";
index d9c210ff1d99bead1a66e10b22529acd9988e2bb..bf3aa1660c781dc338063dc0d3b657b8edf11ba9 100644 (file)
@@ -25,15 +25,15 @@ use strict;no strict "refs";
 # <-----
 # ENTER HERE THE MINIMUM AWSTATS VERSION REQUIRED BY YOUR PLUGIN
 # AND THE NAME OF ALL FUNCTIONS THE PLUGIN MANAGE.
-my $PluginNeedAWStatsVersion="5.2";
-my $PluginHooksFunctions="ReplaceURL";
+my $PluginNeedAWStatsVersion="5.5";
+my $PluginHooksFunctions="ShowInfoURL";
 # ----->
 
 # <-----
 # IF YOUR PLUGIN NEED GLOBAL VARIABLES, THEY MUST BE DECLARED HERE.
 use vars qw/
-$urlaliasloaded
-%UrlAliases
+$urlinfoloaded
+%UrlInfo
 /;
 # ----->
 
@@ -49,8 +49,8 @@ sub Init_urlalias {
        # <-----
        # ENTER HERE CODE TO DO INIT PLUGIN ACTIONS
        debug(" InitParams=$InitParams",1);
-       $urlaliasloaded=0;
-       %UrlAliases=();
+       $urlinfoloaded=0;
+       %UrlInfo=();
        # ----->
 
        return ($checkversion?$checkversion:"$PluginHooksFunctions");
@@ -64,22 +64,22 @@ sub Init_urlalias {
 # Function called to add additionnal information for URLs in URLs' report.
 # Parameters: URL
 #-----------------------------------------------------------------------------
-sub ReplaceURL_urlalias {
+sub ShowInfoURL_urlalias {
        # <-----
-       if (! $urlaliasloaded) {
+       if (! $urlinfoloaded) {
                # Load urlalias file
                my $filetoload='';
-               if ($SiteConfig && open(URLALIASFILE,"$PluginDir/urlalias.$SiteConfig.txt"))    { $filetoload="$PluginDir/urlalias.$SiteConfig.txt"; }
-               elsif (open(URLALIASFILE,"$PluginDir/urlalias.txt"))                                                    { $filetoload="$PluginDir/urlalias.txt"; }
+               if ($SiteConfig && open(URLINFOFILE,"$PluginDir/urlalias.$SiteConfig.txt"))     { $filetoload="$PluginDir/urlalias.$SiteConfig.txt"; }
+               elsif (open(URLINFOFILE,"$PluginDir/urlalias.txt"))                                             { $filetoload="$PluginDir/urlalias.txt"; }
                else { error("Couldn't open UrlAlias file \"$PluginDir/urlalias.txt\": $!"); }
                # This is the fastest way to load with regexp that I know
-               %UrlAliases = map(/^([^\t]+)\t+([^\t]+)/o,<URLALIASFILE>);
-               close URLALIASFILE;
-               debug("UrlAlias file loaded: ".(scalar keys %UrlAliases)." aliases found.");
-               $urlaliasloaded=1;
+               %UrlInfo = map(/^([^\t]+)\t+([^\t]+)/o,<URLINFOFILE>);
+               close URLINFOFILE;
+               debug("UrlAlias file loaded: ".(scalar keys %UrlInfo)." entries found.");
+               $urlinfoloaded=1;
        }
        my $urltoreplace="$_[0]";
-       if ($UrlAliases{$urltoreplace}) { print "<font style=\"color: #$color_link; font-weight: bold\">$UrlAliases{$urltoreplace}</font><br>"; }
+       if ($UrlInfo{$urltoreplace}) { print "<font style=\"color: #$color_link; font-weight: bold\">$UrlInfo{$urltoreplace}</font><br>"; }
        else { print ""; }
        return 1;
        # ----->
diff --git a/wwwroot/cgi-bin/plugins/userinfo.pm b/wwwroot/cgi-bin/plugins/userinfo.pm
new file mode 100644 (file)
index 0000000..386e003
--- /dev/null
@@ -0,0 +1,90 @@
+#!/usr/bin/perl
+#-----------------------------------------------------------------------------
+# UserInfo AWStats plugin
+# This plugin allow you to add information on authenticated users chart from
+# a text file. Like full user name and lastname.
+# You must create a file called userinfo.configvalue.txt and store it in
+# plugin directory that contains 2 columns separated by a tab char.
+# First column is authenticated user login and second column is text
+# you want add.
+#-----------------------------------------------------------------------------
+# Perl Required Modules: None
+#-----------------------------------------------------------------------------
+# $Revision$ - $Author$ - $Date$
+
+
+# <-----
+# ENTER HERE THE USE COMMAND FOR ALL REQUIRED PERL MODULES.
+# ----->
+use strict;no strict "refs";
+
+
+
+#-----------------------------------------------------------------------------
+# PLUGIN VARIABLES
+#-----------------------------------------------------------------------------
+# <-----
+# ENTER HERE THE MINIMUM AWSTATS VERSION REQUIRED BY YOUR PLUGIN
+# AND THE NAME OF ALL FUNCTIONS THE PLUGIN MANAGE.
+my $PluginNeedAWStatsVersion="5.5";
+my $PluginHooksFunctions="ShowInfoUser";
+# ----->
+
+# <-----
+# IF YOUR PLUGIN NEED GLOBAL VARIABLES, THEY MUST BE DECLARED HERE.
+use vars qw/
+$userinfoloaded
+%UserInfo
+/;
+# ----->
+
+
+
+#-----------------------------------------------------------------------------
+# PLUGIN FUNCTION: Init_pluginname
+#-----------------------------------------------------------------------------
+sub Init_userinfo {
+       my $InitParams=shift;
+       my $checkversion=&Check_Plugin_Version($PluginNeedAWStatsVersion);
+
+       # <-----
+       # ENTER HERE CODE TO DO INIT PLUGIN ACTIONS
+       debug(" InitParams=$InitParams",1);
+       $userinfoloaded=0;
+       %UserInfo=();
+       # ----->
+
+       return ($checkversion?$checkversion:"$PluginHooksFunctions");
+}
+
+
+
+#-----------------------------------------------------------------------------
+# PLUGIN FUNCTION: ShowInfoUser_pluginname
+# UNIQUE: NO (Several plugins using this function can be loaded)
+# Function called to add additionnal information for Users in users' report.
+# Parameters: URL
+#-----------------------------------------------------------------------------
+sub ShowInfoUser_userinfo {
+       # <-----
+       if (! $userinfoloaded) {
+               # Load userinfo file
+               my $filetoload='';
+               if ($SiteConfig && open(USERINFOFILE,"$PluginDir/userinfo.$SiteConfig.txt"))    { $filetoload="$PluginDir/userinfo.$SiteConfig.txt"; }
+               elsif (open(USERINFOFILE,"$PluginDir/userinfo.txt"))                                                    { $filetoload="$PluginDir/userinfo.txt"; }
+               else { error("Couldn't open UserInfo file \"$PluginDir/userinfo.txt\": $!"); }
+               # This is the fastest way to load with regexp that I know
+               %UserInfo = map(/^([^\t]+)\t+([^\t]+)/o,<USERINFOFILE>);
+               close USERINFOFILE;
+               debug("UserInfo file loaded: ".(scalar keys %UserInfo)." entries found.");
+               $userinfoloaded=1;
+       }
+       my $userinfotoreplace="$_[0]";
+       if ($UserInfo{$userinfotoreplace}) { print "<TD>$UserInfo{$userinfotoreplace}</TD>"; }
+       else { print "<TD>&nbsp;</TD>"; }
+       return 1;
+       # ----->
+}
+
+
+1;     # Do not remove this line