1 rizwank 1.1 #!/usr/bin/perl
2 #-----------------------------------------------------------------------------
3 # TimeZone AWStats plugin
4 # Allow AWStats to correct a bad timezone for user of IIS that use strange
5 # log format.
6 #-----------------------------------------------------------------------------
7 # Perl Required Modules: None
8 #-----------------------------------------------------------------------------
9 # $Revision: 1.10 $ - $Author: eldy $ - $Date: 2004/07/11 10:44:41 $
10
11
12 # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
13 # !!!!! This plugin reduces AWStats speed by 40% !!!!!
14 # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
15 # <-----
16 # ENTER HERE THE USE COMMAND FOR ALL REQUIRED PERL MODULES
17 #use Time::Local 'timelocal_nocheck';
18 # ----->
19 use strict;no strict "refs";
20
21
22 rizwank 1.1
23 #-----------------------------------------------------------------------------
24 # PLUGIN VARIABLES
25 #-----------------------------------------------------------------------------
26 # <-----
27 # ENTER HERE THE MINIMUM AWSTATS VERSION REQUIRED BY YOUR PLUGIN
28 # AND THE NAME OF ALL FUNCTIONS THE PLUGIN MANAGE.
29 my $PluginNeedAWStatsVersion="5.1";
30 my $PluginHooksFunctions="ChangeTime GetTimeZoneTitle";
31 # ----->
32
33 # <-----
34 # IF YOUR PLUGIN NEED GLOBAL VARIABLES, THEY MUST BE DECLARED HERE.
35 use vars qw/
36 $PluginTimeZoneSeconds
37 /;
38 # ----->
39
40
41
42 #-----------------------------------------------------------------------------
43 rizwank 1.1 # PLUGIN FUNCTION: Init_pluginname
44 #-----------------------------------------------------------------------------
45 sub Init_timezone {
46 my $InitParams=shift;
47
48 # <-----
49 # ENTER HERE CODE TO DO INIT PLUGIN ACTIONS
50 if (! $InitParams || int($InitParams) == 0) { return "Error: Disable plugin if TimeZone is 0 (Plugin useless)"; } # We do not need this plugin if TZ=0
51 $PluginTimeZoneSeconds=(int($InitParams)*3600);
52 # ----->
53
54 my $checkversion=&Check_Plugin_Version($PluginNeedAWStatsVersion);
55 return ($checkversion?$checkversion:"$PluginHooksFunctions");
56 }
57
58
59
60 #-----------------------------------------------------------------------------
61 # PLUGIN FUNCTION: ChangeTime_pluginname
62 # UNIQUE: YES (Only one plugin using this function can be loaded)
63 #-----------------------------------------------------------------------------
64 rizwank 1.1 sub ChangeTime_timezone {
65 my $dateparts=shift;
66 my ($nsec,$nmin,$nhour,$nmday,$nmon,$nyear,$nwday) = localtime(Time::Local::timelocal(int(@$dateparts[5]), int(@$dateparts[4]), int(@$dateparts[3]), int(@$dateparts[0]), int(@$dateparts[1])-1, int(@$dateparts[2])-1900) + $PluginTimeZoneSeconds);
67 return ($nmday, $nmon+1, $nyear+1900, $nhour, $nmin, $nsec);
68 }
69
70
71 #-----------------------------------------------------------------------------
72 # PLUGIN FUNCTION: GetTimeZoneTitle_pluginname
73 # UNIQUE: YES (Only one plugin using this function can be loaded)
74 #-----------------------------------------------------------------------------
75 sub GetTimeZoneTitle_timezone {
76 return ($PluginTimeZoneSeconds/3600);
77 }
78
79
80 1; # Do not remove this line
|