]> git.ipfire.org Git - ipfire-2.x.git/commitdiff
tor.cgi: Use own location functions.
authorStefan Schantl <stefan.schantl@ipfire.org>
Tue, 22 Sep 2020 18:25:03 +0000 (20:25 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 24 Sep 2020 17:36:38 +0000 (17:36 +0000)
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
html/cgi-bin/tor.cgi

index c9416be011bbdb76fbb3370aa618e3beed68667e..28dec6cf0d838448646a3d84e5bc744746eb86dd 100644 (file)
@@ -20,7 +20,6 @@
 ###############################################################################
 
 use strict;
-use Locale::Codes::Country;
 
 # 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";
 
+# Init libloc database connection.
+my $db_handle = &Location::Functions::init();
+
 #workaround to suppress a warning when a variable is used only once
 my @dummy = ( ${Header::colouryellow} );
 undef (@dummy);
@@ -321,10 +323,14 @@ END
                                                <option value=''>- $Lang::tr{'tor exit country any'} -</option>
 END
 
-               my @country_names = Locale::Codes::Country::all_country_names();
-               foreach my $country_name (sort @country_names) {
-                       my $country_code = Locale::Codes::Country::country2code($country_name);
+               my @country_codes = &Location::database_countries();
+               foreach my $country_code (@country_codes) {
+                       # Convert country code into upper case format.
                        $country_code = uc($country_code);
+
+                       # Get country name.
+                       my $country_name = &Location::Functions::get_country_name($country_code);
+
                        print "<option value='$country_code'";
 
                        if ($settings{'TOR_EXIT_COUNTRY'} eq $country_code) {