8
8
#-----------------------------------------------------------------------------
9
9
# Perl Required Modules: Geo::IP or Geo::IP::PurePerl
10
10
#-----------------------------------------------------------------------------
11
# $Revision: 1.14 $ - $Author: eldy $ - $Date: 2005/01/22 16:39:53 $
11
# $Revision: 1.15 $ - $Author: eldy $ - $Date: 2005/02/19 13:40:42 $
31
31
# ENTER HERE THE MINIMUM AWSTATS VERSION REQUIRED BY YOUR PLUGIN
32
32
# AND THE NAME OF ALL FUNCTIONS THE PLUGIN MANAGE.
33
33
my $PluginNeedAWStatsVersion="5.4";
34
my $PluginHooksFunctions="GetCountryCodeByAddr GetCountryCodeByName";
34
my $PluginHooksFunctions="GetCountryCodeByAddr GetCountryCodeByName ShowInfoHost";
116
#-----------------------------------------------------------------------------
117
# PLUGIN FUNCTION: ShowInfoHost_pluginname
118
# UNIQUE: NO (Several plugins using this function can be loaded)
119
# Function called to add additionnal columns to the Hosts report.
120
# This function is called when building rows of the report (One call for each
121
# row). So it allows you to add a column in report, for example with code :
122
# print "<TD>This is a new cell for $param</TD>";
123
# Parameters: Host name or ip
124
#-----------------------------------------------------------------------------
125
sub ShowInfoHost_geoip {
128
if ($param eq '__title__') {
129
my $NewLinkParams=${QueryString};
130
$NewLinkParams =~ s/(^|&)update(=\w*|$)//i;
131
$NewLinkParams =~ s/(^|&)output(=\w*|$)//i;
132
$NewLinkParams =~ s/(^|&)staticlinks(=\w*|$)//i;
133
$NewLinkParams =~ s/(^|&)framename=[^&]*//i;
134
my $NewLinkTarget='';
135
if ($DetailedReportsOnNewWindows) { $NewLinkTarget=" target=\"awstatsbis\""; }
136
if (($FrameName eq 'mainleft' || $FrameName eq 'mainright') && $DetailedReportsOnNewWindows < 2) {
137
$NewLinkParams.="&framename=mainright";
138
$NewLinkTarget=" target=\"mainright\"";
140
$NewLinkParams =~ tr/&/&/s; $NewLinkParams =~ s/^&//; $NewLinkParams =~ s/&$//;
141
if ($NewLinkParams) { $NewLinkParams="${NewLinkParams}&"; }
143
print "<th width=\"80\">";
144
print "<a href=\"#countries\">GeoIP<br>Country</a>";
150
if ($param =~ /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/) { # IPv4 address
154
elsif ($param =~ /^[0-9A-F]*:/i) { # IPv6 address
159
if ($key && $ip==4) {
160
my $res=lc($gi->country_code_by_addr($param)) if $gi;
161
if ($Debug) { debug(" Plugin geoip: GetCountryByIp for $param: [$res]",5); }
162
if ($res) { print $DomainsHashIDLib{$res}; }
163
else { print "<span style=\"color: #$color_other\">$Message[0]</span>"; }
165
if ($key && $ip==6) {
166
print "<span style=\"color: #$color_other\">$Message[0]</span>";
169
my $res=lc($gi->country_code_by_addr($param)) if $gi;
170
if ($Debug) { debug(" Plugin geoip: GetCountryByHostname for $param: [$res]",5); }
171
if ($res) { print $DomainsHashIDLib{$res}; }
172
else { print "<span style=\"color: #$color_other\">$Message[0]</span>"; }
177
print "<td> </td>";
116
184
1; # Do not remove this line