#!/usr/bin/perl
+#!/usr/bin/perl
#-----------------------------------------------------------------------------
# GeoIp AWStats plugin
# This plugin allow you to get AWStats country report with countries detected
if (!eval ('require "Geo/IP.pm";')) { return "Error: Need Perl module Geo::IP"; } # For GeoIP
#if (!eval ('require "Geo/IPfree.pm";')) { return "Error: Need Perl module Geo::IPfree"; } # For GeoIPfree
# ----->
-#use strict;no strict "refs";
+use strict;no strict "refs";
# <-----
# ENTER HERE CODE TO DO INIT PLUGIN ACTIONS
debug(" InitParams=$InitParams",1);
+ my $mode=$InitParams;
+ if ($mode eq '' || $mode eq 'GEOIP_MEMORY_CACHE') { $mode=Geo::IP::GEOIP_MEMORY_CACHE(); }
+ else { $mode=Geo::IP::GEOIP_STANDARD(); }
%TmpDomainLookup=();
- $gi = Geo::IP->new(GEOIP_MEMORY_CACHE); # For GeoIP (Can also use GEOIP_STANDARD)
-# $gi = Geo::IPfree::new(); # For GeoIPfree
+ debug(" GeoIP working in mode $mode",1);
+ $gi = Geo::IP->new($mode); # For GeoIP
+# $gi = Geo::IPfree::new(); # For GeoIPfree
# ----->
return ($checkversion?$checkversion:"$PluginHooksFunctions");
#!/usr/bin/perl
#-----------------------------------------------------------------------------
# Graph3d AWStats plugin
-# Allow AWStats to use 3D graphs in its report
+# Allow AWStats to replace bar graphs with an Applet (graph3Dapplet) that draw
+# 3D graphs instead.
#-----------------------------------------------------------------------------
-# Perl Required Modules: GD::Graph
+# Perl Required Modules: None
#-----------------------------------------------------------------------------
# $Revision$ - $Author$ - $Date$
# <-----
# ENTER HERE THE USE COMMAND FOR ALL REQUIRED PERL MODULES
-if (!eval ('require "GD/Graph/bars3d.pm";')) { return "Error: Need Perl module GD::Graph"; }
# ----->
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.1";
+my $PluginNeedAWStatsVersion="5.4";
my $PluginHooksFunctions="ShowMonthGraph";
# ----->
#-------------------------------------------------------
-# PLUGIN FUNCTION: ShowMonthGraph
+# PLUGIN FUNCTION: ShowMonthGraph_pluginname
# UNIQUE: YES (Only one plugin using this function can be loaded)
-# Build an image file.
+# Add the code for graph3Dapplet
# Parameters: $max_value, @data
# Input: None
-# Output: Png file
+# Output: HTML code for graph3Dapplet insertion
# Return: 0 OK, 1 Error
#-------------------------------------------------------
-sub ShowMonthGraph() {
+sub ShowMonthGraph_graph3d() {
my $max_value=shift;
my $graphwidth=780;
my $graphheight=400;
# Si tableau de données vide
return 1;
}
-
- $max_value = (int($max_value/100)+1)*100;
-
- # Make a new graph object that is 900 pixels wide by 500 pixels high
- my $graph = new GD::Graph::bars3d($graphwidth, $graphheight);
-
- # Set some labels
- $graph->set(
- x_label => 'xxx',
- y_label => 'yyy',
- title => '',
- overwrite => 1,
- long_ticks => 0,
- legend_placement => 'RC',
- legend_spacing => 10,
- x_ticks => 1,
- dclrs => ['#0000FF', '#9900FF', '#CC00FF', '#FF0099'],
- bar_spacing => 1,
- title => 'aaaaaaaa',
- y_max_value => $max_value
- );
-
- $graph->set_legend('xxx', 'yyy', 'zzz', 'www');
- $graph->set_legend_font(GD::Font->MediumBold);
- $graph->set_x_label_font(GD::Font->MediumBold);
- $graph->set_y_label_font(GD::Font->MediumBold);
- $graph->set_title_font(GD::Font->Giant);
-
- # Plot the graph to a GD object
- my $gd = $graph->plot( \@data );
-
- # Figure out what the default output format is
- my $format = $graph->export_format;
-
- # Now write image to output
- print IMG $gd->png();
+ print "<APPLET>\n";
+
+ print "</APPLET>\n";
return 0;
}
-
-
1; # Do not remove this line
# $Revision$ - $Author$ - $Date$
-use Time::HiRes qw( gettimeofday );
+# <-----
+# ENTER HERE THE USE COMMAND FOR ALL REQUIRED PERL MODULES
+if (!eval ('require "Time/HiRes.pm"')) { return "Error: Need Perl module Time::HiRes"; }
+# ----->
use strict;no strict "refs";
# UNIQUE: YES (Only one plugin using this function can be loaded)
#-----------------------------------------------------------------------------
sub GetTime_timehires {
- my ($sec,$msec)=&gettimeofday();
+ my ($sec,$msec)=Time::HiRes::gettimeofday();
$_[0]=$sec;
$_[1]=$msec;
}