From: Stefan Schantl Date: Fri, 12 Jun 2020 15:44:48 +0000 (+0200) Subject: Transform geoip-block.cgi into location-block.cgi X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=273618daf9b19fa5da53a04d9f8d2db7f3e49fb2;p=people%2Fpmueller%2Fipfire-2.x.git Transform geoip-block.cgi into location-block.cgi Signed-off-by: Stefan Schantl --- diff --git a/html/cgi-bin/geoip-block.cgi b/html/cgi-bin/location-block.cgi similarity index 85% rename from html/cgi-bin/geoip-block.cgi rename to html/cgi-bin/location-block.cgi index 056b333e8c..3bc3a1e764 100644 --- a/html/cgi-bin/geoip-block.cgi +++ b/html/cgi-bin/location-block.cgi @@ -2,7 +2,7 @@ ############################################################################### # # # IPFire.org - A linux based firewall # -# Copyright (C) 2014 IPFire Developemnt Team # +# Copyright (C) 2014 - 2020 IPFire Developemnt Team # # # # This program is free software: you can redistribute it and/or modify # # it under the terms of the GNU General Public License as published by # @@ -25,13 +25,13 @@ use strict; #use CGI::Carp 'fatalsToBrowser'; require '/var/ipfire/general-functions.pl'; -require "${General::swroot}/geoip-functions.pl"; +require "${General::swroot}/location-functions.pl"; require "${General::swroot}/lang.pl"; require "${General::swroot}/header.pl"; require "/usr/lib/firewall/firewall-lib.pl"; my $notice; -my $settingsfile = "${General::swroot}/firewall/geoipblock"; +my $settingsfile = "${General::swroot}/firewall/locationblock"; my %color = (); my %mainsettings = (); @@ -50,14 +50,14 @@ my %cgiparams = (); &Header::getcgihash(\%cgiparams); # Call subfunction to get all available locations. -my @locations = &fwlib::get_geoip_locations(); +my @locations = &Location::Functions::get_locations(); if ($cgiparams{'ACTION'} eq $Lang::tr{'save'}) { - # Check if we want to disable geoipblock. - if (exists $cgiparams{'GEOIPBLOCK_ENABLED'}) { - $settings{'GEOIPBLOCK_ENABLED'} = "on"; + # Check if we want to disable locationblock. + if (exists $cgiparams{'LOCATIONBLOCK_ENABLED'}) { + $settings{'LOCATIONBLOCK_ENABLED'} = "on"; } else { - $settings{'GEOIPBLOCK_ENABLED'} = "off"; + $settings{'LOCATIONBLOCK_ENABLED'} = "off"; } # Loop through our locations array to prevent from @@ -81,7 +81,7 @@ if ($cgiparams{'ACTION'} eq $Lang::tr{'save'}) { $notice = $Lang::tr{'p2p block save notice'}; } -&Header::openpage($Lang::tr{'geoipblock configuration'}, 1, ''); +&Header::openpage($Lang::tr{'locationblock configuration'}, 1, ''); # Print notice that a firewall reload is required. if ($notice) { @@ -92,19 +92,19 @@ if ($notice) { # Checkbox pre-selection. my $checked; -if ($settings{'GEOIPBLOCK_ENABLED'} eq "on") { +if ($settings{'LOCATIONBLOCK_ENABLED'} eq "on") { $checked = "checked='checked'"; } -# Print box to enable/disable geoipblock. +# Print box to enable/disable locationblock. print"
\n"; -&Header::openbox('100%', 'center', $Lang::tr{'geoipblock'}); +&Header::openbox('100%', 'center', $Lang::tr{'locationblock'}); print < - $Lang::tr{'geoipblock enable feature'} - + $Lang::tr{'locationblock enable feature'} +
@@ -122,7 +122,7 @@ END &Header::closebox(); -&Header::openbox('100%', 'center', $Lang::tr{'geoipblock block countries'}); +&Header::openbox('100%', 'center', $Lang::tr{'locationblock block countries'}); ### JAVA SCRIPT ### print < @@ -175,10 +175,10 @@ foreach my $location (@locations) { my $ccode_lc = lc($location); # Full name of the country based on the country code. - my $cname = &GeoIP::get_full_country_name($ccode_lc); + my $cname = &Location::Functions::get_full_country_name($ccode_lc); # Get flag icon for of the country. - my $flag_icon = &GeoIP::get_flag_icon($ccode_uc); + my $flag_icon = &Location::Functions::get_flag_icon($ccode_uc); my $flag; # Check if a flag for the country is available. @@ -258,9 +258,9 @@ print < - $Lang::tr{'geoipblock country is blocked'} + $Lang::tr{'locationblock country is blocked'} - $Lang::tr{'geoipblock country is allowed'} + $Lang::tr{'locationblock country is allowed'} END