~ubuntu-branches/ubuntu/breezy/awstats/breezy

« back to all changes in this revision

Viewing changes to wwwroot/cgi-bin/plugins/timezone.pm

  • Committer: Bazaar Package Importer
  • Author(s): Jonas Smedegaard
  • Date: 2004-05-05 05:12:07 UTC
  • Revision ID: james.westby@ubuntu.com-20040505051207-wfi8hydpa89pvuoi
Tags: upstream-6.0
ImportĀ upstreamĀ versionĀ 6.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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.9 $ - $Author: eldy $ - $Date: 2003/12/06 21:29:14 $
 
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
 
 
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
# 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
sub ChangeTime_timezone {
 
65
        my $dateparts=shift;
 
66
        my ($nsec,$nmin,$nhour,$nmday,$nmon,$nyear,$nwday) = localtime(Time::Local::timelocal(@$dateparts[5], @$dateparts[4], @$dateparts[3], @$dateparts[0], @$dateparts[1]-1, @$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