From: eldy <> Date: Tue, 25 May 2010 18:50:41 +0000 (+0000) Subject: Fix: Restore ability to have path with spaces in it X-Git-Tag: AWSTATS_7_0_BETA2~38 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dcb949d5fc8e05676718d90e445cf6c808016f02;p=thirdparty%2FAWStats.git Fix: Restore ability to have path with spaces in it --- diff --git a/wwwroot/cgi-bin/awstats.model.conf b/wwwroot/cgi-bin/awstats.model.conf index 26f206f6..194f8b78 100644 --- a/wwwroot/cgi-bin/awstats.model.conf +++ b/wwwroot/cgi-bin/awstats.model.conf @@ -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] # 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] # 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" diff --git a/wwwroot/cgi-bin/awstats.pl b/wwwroot/cgi-bin/awstats.pl index 757fa4b1..68c84715 100644 --- a/wwwroot/cgi-bin/awstats.pl +++ b/wwwroot/cgi-bin/awstats.pl @@ -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 = ''; diff --git a/wwwroot/cgi-bin/plugins/geoip_asn_maxmind.pm b/wwwroot/cgi-bin/plugins/geoip_asn_maxmind.pm index 2c32d6e1..c73b6dc5 100644 --- a/wwwroot/cgi-bin/plugins/geoip_asn_maxmind.pm +++ b/wwwroot/cgi-bin/plugins/geoip_asn_maxmind.pm @@ -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') { diff --git a/wwwroot/cgi-bin/plugins/geoip_city_maxmind.pm b/wwwroot/cgi-bin/plugins/geoip_city_maxmind.pm index 62691426..32da923f 100755 --- a/wwwroot/cgi-bin/plugins/geoip_city_maxmind.pm +++ b/wwwroot/cgi-bin/plugins/geoip_city_maxmind.pm @@ -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') { diff --git a/wwwroot/cgi-bin/plugins/geoip_isp_maxmind.pm b/wwwroot/cgi-bin/plugins/geoip_isp_maxmind.pm index 398fe151..904bc89f 100644 --- a/wwwroot/cgi-bin/plugins/geoip_isp_maxmind.pm +++ b/wwwroot/cgi-bin/plugins/geoip_isp_maxmind.pm @@ -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') { diff --git a/wwwroot/cgi-bin/plugins/geoip_org_maxmind.pm b/wwwroot/cgi-bin/plugins/geoip_org_maxmind.pm index 6f49862e..cb71f836 100644 --- a/wwwroot/cgi-bin/plugins/geoip_org_maxmind.pm +++ b/wwwroot/cgi-bin/plugins/geoip_org_maxmind.pm @@ -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') { diff --git a/wwwroot/cgi-bin/plugins/geoip_region_maxmind.pm b/wwwroot/cgi-bin/plugins/geoip_region_maxmind.pm index 6e07b2c4..4f700427 100755 --- a/wwwroot/cgi-bin/plugins/geoip_region_maxmind.pm +++ b/wwwroot/cgi-bin/plugins/geoip_region_maxmind.pm @@ -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') {