From: eldy <> Date: Sun, 9 Feb 2003 19:08:58 +0000 (+0000) Subject: Better error report in load of plugin. X-Git-Tag: AWSTATS_5_4_BETA~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=90e0cc860d0c2e8403ac44cceae05616e61ec7ac;p=thirdparty%2FAWStats.git Better error report in load of plugin. --- diff --git a/wwwroot/cgi-bin/plugins/geoip.pm b/wwwroot/cgi-bin/plugins/geoip.pm index 121be423..5a9bde2a 100644 --- a/wwwroot/cgi-bin/plugins/geoip.pm +++ b/wwwroot/cgi-bin/plugins/geoip.pm @@ -1,4 +1,5 @@ #!/usr/bin/perl +#!/usr/bin/perl #----------------------------------------------------------------------------- # GeoIp AWStats plugin # This plugin allow you to get AWStats country report with countries detected @@ -15,7 +16,7 @@ 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"; @@ -55,9 +56,13 @@ sub Init_geoip { # <----- # 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"); diff --git a/wwwroot/cgi-bin/plugins/graph3d.pm b/wwwroot/cgi-bin/plugins/graph3d.pm index 29b4babb..1daa5f65 100644 --- a/wwwroot/cgi-bin/plugins/graph3d.pm +++ b/wwwroot/cgi-bin/plugins/graph3d.pm @@ -1,16 +1,16 @@ #!/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"; @@ -22,7 +22,7 @@ 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"; # -----> @@ -44,15 +44,15 @@ sub Init_graph3d { #------------------------------------------------------- -# 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; @@ -61,49 +61,14 @@ sub ShowMonthGraph() { # 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 "\n"; + + print "\n"; return 0; } - - 1; # Do not remove this line diff --git a/wwwroot/cgi-bin/plugins/hashfiles.pm b/wwwroot/cgi-bin/plugins/hashfiles.pm index 310682e8..0e95d675 100644 --- a/wwwroot/cgi-bin/plugins/hashfiles.pm +++ b/wwwroot/cgi-bin/plugins/hashfiles.pm @@ -11,7 +11,7 @@ # <----- # ENTER HERE THE USE COMMAND FOR ALL REQUIRED PERL MODULES -use Storable; +if (!eval ('require "Storable.pm";')) { return "Error: Need Perl module Storable"; } # -----> use strict;no strict "refs"; diff --git a/wwwroot/cgi-bin/plugins/timehires.pm b/wwwroot/cgi-bin/plugins/timehires.pm index 78690e8f..d53161b0 100644 --- a/wwwroot/cgi-bin/plugins/timehires.pm +++ b/wwwroot/cgi-bin/plugins/timehires.pm @@ -8,7 +8,10 @@ # $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"; @@ -45,7 +48,7 @@ sub Init_timehires { # 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; }