From patchwork Tue Sep 22 18:25:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Schantl X-Patchwork-Id: 3482 Return-Path: Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4BwqW12JbRz3x61 for ; Tue, 22 Sep 2020 18:25:49 +0000 (UTC) Received: from mail02.haj.ipfire.org (mail02.haj.ipfire.org [172.28.1.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail02.haj.ipfire.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4BwqVy1QSFz12m; Tue, 22 Sep 2020 18:25:46 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4BwqVy0Zcdz3072; Tue, 22 Sep 2020 18:25:46 +0000 (UTC) Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4BwqVv139Vz3072 for ; Tue, 22 Sep 2020 18:25:43 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (Client did not present a certificate) by mail01.ipfire.org (Postfix) with ESMTPSA id 4BwqVt5sjnz11Y; Tue, 22 Sep 2020 18:25:42 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1600799143; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8aPwae/chgZu6rVfP5e28c9Zexz3R4JYRLvW9+7cUCM=; b=TrISjTdkV3sDAbiKXdws8GDz7Qebvv/4AqModufolO6H2CWAm21xPko0T71o7VsL/GA03r HTZD+oFtcAb9YsCQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1600799143; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8aPwae/chgZu6rVfP5e28c9Zexz3R4JYRLvW9+7cUCM=; b=AwcMqszdPJgGI7i+hmfhj7JiycUnmeEPMWet7J1mnybfVFw6wFVKuxzvVSqvL/O33MypN/ 6I2gcp2B4uyAKQCLrI09D6x/mmQK+Lz6umeasb+0WRLZ5TodTgusbKmgibRklRdIawCdBB 3I4a0pRR3sUAC2PCNS3SKD/KaQLO12P0DKp6EWM1GWxp0SlncRibCCr4aqzFnckn5MyXeI ZFNyYqZOVMfN9hOvfcpe4e2VcFg8iV0LbGwpg10v7gZ4hzo19TuRdKVAkMFXI9cdr/sOBL GeiK3fvSdsMVjWMTiWzNTXRjPwwJ46QisXFBUOpeHNZQ59xusPE7FAUaybcZSw== From: Stefan Schantl 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> References: <20200922182509.18643-1-stefan.schantl@ipfire.org> MIME-Version: 1.0 Authentication-Results: mail01.ipfire.org; auth=pass smtp.mailfrom=stefan.schantl@ipfire.org X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: IPFire development talk List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: development-bounces@lists.ipfire.org Sender: "Development" Signed-off-by: Stefan Schantl --- 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 @@ ############################################################################### 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 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 "