From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stefan Schantl <stefan.schantl@ipfire.org> To: development@lists.ipfire.org Subject: [PATCH 05/11] tor.cgi: Use own location functions. Date: Tue, 22 Sep 2020 20:25:03 +0200 Message-ID: <20200922182509.18643-5-stefan.schantl@ipfire.org> In-Reply-To: <20200922182509.18643-1-stefan.schantl@ipfire.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============6875755258375094852==" List-Id: <development.lists.ipfire.org> --===============6875755258375094852== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Signed-off-by: Stefan Schantl <stefan.schantl(a)ipfire.org> --- html/cgi-bin/tor.cgi | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/html/cgi-bin/tor.cgi b/html/cgi-bin/tor.cgi index c9416be01..28dec6cf0 100644 --- a/html/cgi-bin/tor.cgi +++ b/html/cgi-bin/tor.cgi @@ -20,7 +20,6 @@ ############################################################################= ### =20 use strict; -use Locale::Codes::Country; =20 # enable only the following on debugging purpose #use warnings; @@ -31,6 +30,9 @@ require "${General::swroot}/location-functions.pl"; require "${General::swroot}/lang.pl"; require "${General::swroot}/header.pl"; =20 +# Init libloc database connection. +my $db_handle =3D &Location::Functions::init(); + #workaround to suppress a warning when a variable is used only once my @dummy =3D ( ${Header::colouryellow} ); undef (@dummy); @@ -321,10 +323,14 @@ END <option value=3D''>- $Lang::tr{'tor exit country any'} -</option> END =20 - my @country_names =3D Locale::Codes::Country::all_country_names(); - foreach my $country_name (sort @country_names) { - my $country_code =3D Locale::Codes::Country::country2code($country_name); + my @country_codes =3D &Location::database_countries(); + foreach my $country_code (@country_codes) { + # Convert country code into upper case format. $country_code =3D uc($country_code); + + # Get country name. + my $country_name =3D &Location::Functions::get_country_name($country_code= ); + print "<option value=3D'$country_code'"; =20 if ($settings{'TOR_EXIT_COUNTRY'} eq $country_code) { --=20 2.20.1 --===============6875755258375094852==--