From e472a10de91406b6440add5245de388cb4ab34f5 Mon Sep 17 00:00:00 2001 From: Stefan Schantl Date: Sun, 8 Feb 2015 18:24:51 +0100 Subject: [PATCH] geoip-block.cgi: Use geoip-functions.pl. --- html/cgi-bin/geoip-block.cgi | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/html/cgi-bin/geoip-block.cgi b/html/cgi-bin/geoip-block.cgi index 6a7d1d96ef..ccbfa926a0 100644 --- a/html/cgi-bin/geoip-block.cgi +++ b/html/cgi-bin/geoip-block.cgi @@ -25,15 +25,11 @@ use strict; #use CGI::Carp 'fatalsToBrowser'; require '/var/ipfire/general-functions.pl'; +require "${General::swroot}/geoip-functions.pl"; require "${General::swroot}/lang.pl"; require "${General::swroot}/header.pl"; require "/usr/lib/firewall/firewall-lib.pl"; -# Directory which contains flag icons. -my $flagdir = "/srv/web/ipfire/html/images/flags"; -# File extension of the country flags. -my $extension = "png"; - my $notice; my $settingsfile = "${General::swroot}/firewall/geoipblock"; @@ -179,20 +175,15 @@ foreach my $location (@locations) { my $ccode_lc = lc($location); # Full name of the country based on the country code. - my $cname = &General::get_full_country_name($ccode_lc); - - # Generate flag filename, based on the lower case written contry code - # and the defined file extension of the image files. (de.png) - my $flagfile = join('.', $ccode_lc,$extension); + my $cname = &GeoIP::get_full_country_name($ccode_lc); - # Generate the full path to the flagfile, based on the given path and - # the previously generated filename. - my $flagpath = join('/', $flagdir,$flagfile); + # Get flag icon for of the country. + my $flag_icon = &GeoIP::get_flag_icon($ccode_uc); my $flag; # Check if a flag for the country is available. - if (-e "$flagpath") { - $flag="$ccode_uc"; + if ($flag_icon) { + $flag="$ccode_uc"; } else { $flag="N/A"; } -- 2.39.5