Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 269
- Log:
Overdue upgrade to AWStats v6.9, the most recent version
available at the time of writing.
- Author:
- rool
- Date:
- Wed May 27 23:57:15 +0100 2009
- Size:
- 3618 Bytes
- Properties:
- Property svn:executable is set
1 | #!/usr/bin/perl |
2 | #----------------------------------------------------------------------------- |
3 | # UserInfo AWStats plugin |
4 | # This plugin allow you to add information on authenticated users chart from |
5 | # a text file. Like full user name and lastname. |
6 | # You must create a file called userinfo.configvalue.txt wich contains 2 |
7 | # columns separated by a tab char, and store it in DirData directory. |
8 | # First column is authenticated user login and second column is text you want |
9 | # to add. |
10 | #----------------------------------------------------------------------------- |
11 | # Perl Required Modules: None |
12 | #----------------------------------------------------------------------------- |
13 | # $Revision: 1.9 $ - $Author: eldy $ - $Date: 2008/11/15 16:03:42 $ |
14 | |
15 | |
16 | # <----- |
17 | # ENTER HERE THE USE COMMAND FOR ALL REQUIRED PERL MODULES |
18 | #if (!eval ('require "TheModule.pm";')) { return $@?"Error: $@":"Error: Need Perl module TheModule"; } |
19 | # -----> |
20 | #use strict; |
21 | no strict "refs"; |
22 | |
23 | |
24 | |
25 | #----------------------------------------------------------------------------- |
26 | # PLUGIN VARIABLES |
27 | #----------------------------------------------------------------------------- |
28 | # <----- |
29 | # ENTER HERE THE MINIMUM AWSTATS VERSION REQUIRED BY YOUR PLUGIN |
30 | # AND THE NAME OF ALL FUNCTIONS THE PLUGIN MANAGE. |
31 | my $PluginNeedAWStatsVersion="5.5"; |
32 | my $PluginHooksFunctions="ShowInfoUser"; |
33 | # -----> |
34 | |
35 | # <----- |
36 | # IF YOUR PLUGIN NEED GLOBAL VARIABLES, THEY MUST BE DECLARED HERE. |
37 | use vars qw/ |
38 | $userinfoloaded |
39 | %UserInfo |
40 | /; |
41 | # -----> |
42 | |
43 | |
44 | |
45 | #----------------------------------------------------------------------------- |
46 | # PLUGIN FUNCTION: Init_pluginname |
47 | #----------------------------------------------------------------------------- |
48 | sub Init_userinfo { |
49 | my $InitParams=shift; |
50 | my $checkversion=&Check_Plugin_Version($PluginNeedAWStatsVersion); |
51 | |
52 | # <----- |
53 | # ENTER HERE CODE TO DO INIT PLUGIN ACTIONS |
54 | debug(" Plugin userinfo: InitParams=$InitParams",1); |
55 | $userinfoloaded=0; |
56 | %UserInfo=(); |
57 | # -----> |
58 | |
59 | return ($checkversion?$checkversion:"$PluginHooksFunctions"); |
60 | } |
61 | |
62 | |
63 | |
64 | #----------------------------------------------------------------------------- |
65 | # PLUGIN FUNCTION: ShowInfoUser_pluginname |
66 | # UNIQUE: NO (Several plugins using this function can be loaded) |
67 | # Function called to add additionnal columns to Authenticated users report. |
68 | # This function is called when building rows of the report (One call for each |
69 | # row). So it allows you to add a column in report, for example with code : |
70 | # print "<TD>This is a new cell</TD>"; |
71 | # Parameters: User |
72 | #----------------------------------------------------------------------------- |
73 | sub ShowInfoUser_userinfo { |
74 | my $param="$_[0]"; |
75 | # <----- |
76 | my $filetoload=''; |
77 | if ($param && $param ne '__title__' && ! $userinfoloaded) { |
78 | # Load userinfo file |
79 | if ($SiteConfig && open(USERINFOFILE,"$DirData/userinfo.$SiteConfig.txt")) { $filetoload="$DirData/userinfo.$SiteConfig.txt"; } |
80 | elsif (open(USERINFOFILE,"$DirData/userinfo.txt")) { $filetoload="$DirData/userinfo.txt"; } |
81 | else { error("Couldn't open UserInfo file \"$DirData/userinfo.txt\": $!"); } |
82 | # This is the fastest way to load with regexp that I know |
83 | %UserInfo = map(/^([^\t]+)\t+([^\t]+)/o,<USERINFOFILE>); |
84 | close USERINFOFILE; |
85 | debug(" Plugin userinfo: UserInfo file loaded: ".(scalar keys %UserInfo)." entries found."); |
86 | $userinfoloaded=1; |
87 | } |
88 | if ($param eq '__title__') { |
89 | print "<th width=\"80\">$Message[114]</th>"; |
90 | } |
91 | elsif ($param) { |
92 | print "<td>"; |
93 | if ($UserInfo{$param}) { print "$UserInfo{$param}"; } |
94 | else { print " "; } # Undefined user info |
95 | print "</td>"; |
96 | } |
97 | else { |
98 | print "<td> </td>"; |
99 | } |
100 | return 1; |
101 | # -----> |
102 | } |
103 | |
104 | |
105 | 1; # Do not remove this line |