]> git.ipfire.org Git - thirdparty/AWStats.git/commitdiff
Better error report in load of plugin.
authoreldy <>
Sun, 9 Feb 2003 19:08:58 +0000 (19:08 +0000)
committereldy <>
Sun, 9 Feb 2003 19:08:58 +0000 (19:08 +0000)
wwwroot/cgi-bin/plugins/geoip.pm
wwwroot/cgi-bin/plugins/graph3d.pm
wwwroot/cgi-bin/plugins/hashfiles.pm
wwwroot/cgi-bin/plugins/timehires.pm

index 121be42394b236b87cf6b1ba9ba41e41c3021265..5a9bde2ab3f76f04c555e0468003c2aee705a33b 100644 (file)
@@ -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");
index 29b4babb0ccdd18c83a6798ee5b57d45d9ce3efe..1daa5f6503d376333aebff530c6e265a60b83450 100644 (file)
@@ -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 "<APPLET>\n";
+       
+       print "</APPLET>\n";    
 
        return 0;
 }
 
 
 
-
-
 1;     # Do not remove this line
index 310682e8e501340715d45a5694d1b7f28f6dfb12..0e95d675cdd05708cd69fc3c15eae7cda3d426ef 100644 (file)
@@ -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";
 
index 78690e8f2d7eded6863cadaeec5b8aa9174d9d92..d53161b06102cfa777cd83c6e315191da0597b50 100644 (file)
@@ -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;
 }