]> git.ipfire.org Git - thirdparty/AWStats.git/commitdiff
Fix: Restore ability to have path with spaces in it
authoreldy <>
Tue, 25 May 2010 18:50:41 +0000 (18:50 +0000)
committereldy <>
Tue, 25 May 2010 18:50:41 +0000 (18:50 +0000)
wwwroot/cgi-bin/awstats.model.conf
wwwroot/cgi-bin/awstats.pl
wwwroot/cgi-bin/plugins/geoip_asn_maxmind.pm
wwwroot/cgi-bin/plugins/geoip_city_maxmind.pm
wwwroot/cgi-bin/plugins/geoip_isp_maxmind.pm
wwwroot/cgi-bin/plugins/geoip_org_maxmind.pm
wwwroot/cgi-bin/plugins/geoip_region_maxmind.pm

index 26f206f6bfe7f69b3ab7ce3aac88e1cdf86d1369..194f8b78a31ae15799da323342f397c55a84d399 100644 (file)
@@ -1407,6 +1407,7 @@ color_x="C1B2E2"                          # Background color for number of exit pages (Default = "C1B2
 # PARAMETERS: [GEOIP_STANDARD | GEOIP_MEMORY_CACHE] [/pathto/geoip.dat] </pathto/override.txt>
 # DESCRIPTION: Builds a country chart and adds an entry to the hosts 
 # table with country name
+# Replace spaces in the path of geoip data file with string "%20".
 #
 #LoadPlugin="geoip GEOIP_STANDARD /pathto/GeoIP.dat"
 
@@ -1415,6 +1416,7 @@ color_x="C1B2E2"                          # Background color for number of exit pages (Default = "C1B2
 # PARAMETERS: [GEOIP_STANDARD | GEOIP_MEMORY_CACHE] [/pathto/GeoIPCity.dat] </pathto/override.txt>
 # DESCRIPTION: This plugin adds a column under the hosts field and tracks the pageviews
 # and hits by city including regions.
+# Replace spaces in the path of geoip data file with string "%20".
 #
 #LoadPlugin="geoip_city_maxmind GEOIP_STANDARD /pathto/GeoIPCity.dat"
 
@@ -1426,6 +1428,7 @@ color_x="C1B2E2"                          # Background color for number of exit pages (Default = "C1B2
 # This plugin can display some ISP information if included in the database. You can also provide 
 # a link that will be used to lookup additional registration data. Put the link at the end of 
 # the parameter string and the report page will include the link with the full AS number at the end.
+# Replace spaces in the path of geoip data file with string "%20".
 #
 #LoadPlugin="geoip_asn_maxmind GEOIP_STANDARD /usr/local/geoip.dat http://enc.com.au/itools/aut-num.php?autnum="
 
@@ -1434,6 +1437,7 @@ color_x="C1B2E2"                          # Background color for number of exit pages (Default = "C1B2
 # PARAMETERS: [GEOIP_STANDARD | GEOIP_MEMORY_CACHE] [/pathto/GeoIPRegion.dat]
 # DESCRIPTION:This plugin adds a chart of hits by regions. Only regions for US and 
 # Canada can be detected.
+# Replace spaces in the path of geoip data file with string "%20".
 #
 #LoadPlugin="geoip_region_maxmind GEOIP_STANDARD /pathto/GeoIPRegion.dat"
 
@@ -1441,6 +1445,7 @@ color_x="C1B2E2"                          # Background color for number of exit pages (Default = "C1B2
 # REQUIRED MODULES: Geo::IP or Geo::IP::PurePerl (from Maxmind)
 # PARAMETERS: [GEOIP_STANDARD | GEOIP_MEMORY_CACHE] [/pathto/GeoIPISP.dat]
 # DESCRIPTION: This plugin adds a chart of hits by ISP.
+# Replace spaces in the path of geoip data file with string "%20".
 #
 #LoadPlugin="geoip_isp_maxmind GEOIP_STANDARD /pathto/GeoIPISP.dat"
 
@@ -1448,6 +1453,7 @@ color_x="C1B2E2"                          # Background color for number of exit pages (Default = "C1B2
 # REQUIRED MODULES: Geo::IP or Geo::IP::PurePerl (from Maxmind)
 # PARAMETERS: [GEOIP_STANDARD | GEOIP_MEMORY_CACHE] [/pathto/GeoIPOrg.dat]
 # DESCRIPTION: This plugin add a chart of hits by Organization name
+# Replace spaces in the path of geoip data file with string "%20".
 #
 #LoadPlugin="geoip_org_maxmind GEOIP_STANDARD /pathto/GeoIPOrg.dat"
 
index 757fa4b10724c2cf018c83cb74897289ac3420f2..68c8471585e0cf307b303fff884d4df17eb7a2df 100644 (file)
@@ -1661,26 +1661,24 @@ sub Read_Config {
        # Other possible directories :                          "/usr/local/etc/awstats", "/etc"
        # FHS standard, Suse package :                          "/etc/opt/awstats"
        my $configdir         = shift;
-       my @PossibleConfigDir = ();
+       my @PossibleConfigDir = (
+                       "$DIR",
+                       "/etc/awstats",
+                       "/usr/local/etc/awstats", "/etc",
+                       "/etc/opt/awstats"
+               ); 
 
        if ($configdir) {
                # If from CGI, overwriting of configdir is only possible if AWSTATS_ENABLE_CONFIG_DIR defined
                if ($ENV{'GATEWAY_INTERFACE'} && ! $ENV{"AWSTATS_ENABLE_CONFIG_DIR"})
                {
-                       error("Sorry, to allow overwriting of configdir parameter from an AWStats CGI usage, environment variable AWSTATS_ENABLE_CONFIG_DIR must be set to 1. For example, by adding the line 'SetEnv AWSTATS_ENABLE_CONFIG_DIR 1' in your Apache config file or into a .htaccess file.");
+                       error("Sorry, to allow overwriting of configdir parameter, from an AWStats CGI page, with a non default value, environment variable AWSTATS_ENABLE_CONFIG_DIR must be set to 1. For example, by adding the line 'SetEnv AWSTATS_ENABLE_CONFIG_DIR 1' in your Apache config file or into a .htaccess file.");
                }
                else
                {
                        @PossibleConfigDir = ("$configdir");
                }
        }
-       else {
-               @PossibleConfigDir = (
-                       "$DIR",                   "/etc/awstats",
-                       "/usr/local/etc/awstats", "/etc",
-                       "/etc/opt/awstats"
-               );
-       }
 
        # Open config file
        $FileConfig = $FileSuffix = '';
index 2c32d6e1fa01c47815a253044384f4eb13c4bc7b..c73b6dc59caee14fa46b04c1145c2d548c2dd9f1 100644 (file)
@@ -81,6 +81,7 @@ sub Init_geoip_asn_maxmind {
        debug(" Plugin $PluginName: InitParams=$InitParams",1);
        my ($mode,$datafile,$override,$link)=split(/\s+/,$InitParams,4);
        if (! $datafile) { $datafile="GeoIPASNum.dat"; }
+       else { $datafile =~ s/%20/ /g; }
        if ($type eq 'geoippureperl') {
                # With pureperl with always use GEOIP_STANDARD.
                # GEOIP_MEMORY_CACHE seems to fail with ActiveState
@@ -91,8 +92,8 @@ sub Init_geoip_asn_maxmind {
                else { $mode=Geo::IP::GEOIP_STANDARD(); }
        }
        # if there is a url in the override field, move it to link
-       if (lc($override) =~ m/^http/){$link = $override;}
-       else{$OverrideFile = $override;}
+       if (lc($override) =~ m/^http/) { $link = $override; }
+       elsif ($override) { $override =~ s/%20/ /g; $OverrideFile=$override; }
        if ($link){$LookupLink=$link;}
        debug(" Plugin $PluginName: GeoIP initialized type=$type mode=$mode, link=$link",1);
        if ($type eq 'geoippureperl') {
index 626914269618d2d26c6699e5480b63bc09b42c59..32da923fc4f6b1bcdf3d76f151ef567e70330e33 100755 (executable)
@@ -4291,6 +4291,7 @@ sub Init_geoip_city_maxmind {
        debug(" Plugin $PluginName: InitParams=$InitParams",1);
        my ($mode,$datafile,$override)=split(/\s+/,$InitParams,3);
        if (! $datafile) { $datafile="GeoIPCity.dat"; }
+       else { $datafile =~ s/%20/ /g; }
        if ($type eq 'geoippureperl') {
                # With pureperl with always use GEOIP_STANDARD.
                # GEOIP_MEMORY_CACHE seems to fail with ActiveState
@@ -4300,7 +4301,7 @@ sub Init_geoip_city_maxmind {
                if ($mode eq '' || $mode eq 'GEOIP_MEMORY_CACHE')  { $mode=Geo::IP::GEOIP_MEMORY_CACHE(); }
                else { $mode=Geo::IP::GEOIP_STANDARD(); }
        }
-       if ($override){$OverrideFile=$override;}
+       if ($override){ $override =~ s/%20/ /g; $OverrideFile=$override; }
        %TmpDomainLookup=();
        debug(" Plugin $PluginName: GeoIP initialized type=$type mode=$mode override=$override",1);
        if ($type eq 'geoippureperl') {
index 398fe151ad569a13b3707f31e8ce941ad20c9eb1..904bc89f6afa50bff1d7c250b3cb117fa90a1f80 100644 (file)
@@ -71,6 +71,7 @@ sub Init_geoip_isp_maxmind {
        debug(" Plugin $PluginName: InitParams=$InitParams",1);
        my ($mode,$datafile,$override)=split(/\s+/,$InitParams,3);
        if (! $datafile) { $datafile="GeoIPIsp.dat"; }
+       else { $datafile =~ s/%20/ /g; }
        if ($type eq 'geoippureperl') {
                # With pureperl with always use GEOIP_STANDARD.
                # GEOIP_MEMORY_CACHE seems to fail with ActiveState
@@ -80,7 +81,7 @@ sub Init_geoip_isp_maxmind {
                if ($mode eq '' || $mode eq 'GEOIP_MEMORY_CACHE')  { $mode=Geo::IP::GEOIP_MEMORY_CACHE(); }
                else { $mode=Geo::IP::GEOIP_STANDARD(); }
        }
-       if ($override){$OverrideFile=$override;}
+       if ($override){ $override =~ s/%20/ /g; $OverrideFile=$override; }
        %TmpDomainLookup=();
        debug(" Plugin $PluginName: GeoIP initialized type=$type mode=$mode",1);
        if ($type eq 'geoippureperl') {
index 6f49862e30d16cb5432108946c7a7822736129f9..cb71f836b19ce0f9812c0b97a90fa6bbdf91e52e 100644 (file)
@@ -71,6 +71,7 @@ sub Init_geoip_org_maxmind {
        debug(" Plugin $PluginName: InitParams=$InitParams",1);
        my ($mode,$datafile,$override)=split(/\s+/,$InitParams,3);
        if (! $datafile) { $datafile="GeoIPOrg.dat"; }
+       else { $datafile =~ s/%20/ /g; }
        if ($type eq 'geoippureperl') {
                # With pureperl with always use GEOIP_STANDARD.
                # GEOIP_MEMORY_CACHE seems to fail with ActiveState
@@ -80,7 +81,7 @@ sub Init_geoip_org_maxmind {
                if ($mode eq '' || $mode eq 'GEOIP_MEMORY_CACHE')  { $mode=Geo::IP::GEOIP_MEMORY_CACHE(); }
                else { $mode=Geo::IP::GEOIP_STANDARD(); }
        }
-       if ($override){$OverrideFile=$override;}
+       if ($override){ $override =~ s/%20/ /g; $OverrideFile=$override; }
        %TmpDomainLookup=();
        debug(" Plugin $PluginName: GeoIP initialized type=$type mode=$mode",1);
        if ($type eq 'geoippureperl') {
index 6e07b2c492ce5782a4db9a954f6f8e8225f76747..4f7004270a64e386b28f7ec958376e2671c5e98e 100755 (executable)
@@ -156,8 +156,9 @@ sub Init_geoip_region_maxmind {
        debug(" Plugin $PluginName: InitParams=$InitParams",1);
        my ($mode,$datafile,$override)=split(/\s+/,$InitParams,3);
        if (! $datafile) { $datafile="GeoIPRegion.dat"; }
+       else { $datafile =~ s/%20/ /g; }
        if ($type eq 'geoippureperl') {
-               # With pureperl with always use GEOIP_STANDARD.
+               # With pureperl we always use GEOIP_STANDARD.
                # GEOIP_MEMORY_CACHE seems to fail with ActiveState
                if ($mode eq '' || $mode eq 'GEOIP_MEMORY_CACHE')  { $mode=Geo::IP::PurePerl::GEOIP_STANDARD(); }
                else { $mode=Geo::IP::PurePerl::GEOIP_STANDARD(); }
@@ -165,7 +166,7 @@ sub Init_geoip_region_maxmind {
                if ($mode eq '' || $mode eq 'GEOIP_MEMORY_CACHE')  { $mode=Geo::IP::GEOIP_MEMORY_CACHE(); }
                else { $mode=Geo::IP::GEOIP_STANDARD(); }
        }
-       if ($override){$OverrideFile=$override;}
+       if ($override){ $override =~ s/%20/ /g; $OverrideFile=$override; }
        %TmpDomainLookup=();
        debug(" Plugin $PluginName: GeoIP initialized type=$type mode=$mode",1);
        if ($type eq 'geoippureperl') {