From mboxrd@z Thu Jan  1 00:00:00 1970
From: Stefan Schantl <stefan.schantl@ipfire.org>
To: development@lists.ipfire.org
Subject: [PATCH] tor.cgi: Fix missing country flag icons.
Date: Sat, 10 Oct 2015 18:07:38 +0200
Message-ID: <1444493258-24392-1-git-send-email-stefan.schantl@ipfire.org>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="===============6190392278011123703=="
List-Id: <development.lists.ipfire.org>

--===============6190392278011123703==
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable

The CGI now is using the GeoIP::get_flag_icon function provided by the
geoip-functions.pl, which takes care of the changed flag icons shipped
by core update 90.

Fixes #10919.

Signed-off-by: Stefan Schantl <stefan.schantl(a)ipfire.org>
Tested-by: Jan Paul Tuecking <jan.paul.tuecking(a)ipfire.org>
---
 html/cgi-bin/tor.cgi | 11 ++++++++---
 lfs/tor              |  2 +-
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/html/cgi-bin/tor.cgi b/html/cgi-bin/tor.cgi
index 91f4b45..193e405 100644
--- a/html/cgi-bin/tor.cgi
+++ b/html/cgi-bin/tor.cgi
@@ -27,6 +27,7 @@ use warnings;
 use CGI::Carp 'fatalsToBrowser';
=20
 require '/var/ipfire/general-functions.pl';
+require "${General::swroot}/geoip-functions.pl";
 require "${General::swroot}/lang.pl";
 require "${General::swroot}/header.pl";
=20
@@ -619,10 +620,14 @@ END
 END
=20
 				if (exists($node->{'country_code'})) {
-					if (!$node->{'country_code'} or $node->{'country_code'} eq '??') {
-						print "<img src=3D'/images/flags/blank.png' border=3D'0' align=3D'absm=
iddle'/>";
+					# Get the flag icon of the country.
+					my $flag_icon =3D &GeoIP::get_flag_icon($node->{'country_code'});
+
+					# Check if a flag for the given country is available.
+					if ($flag_icon) {
+						print "<a href=3D'country.cgi#$node->{'country_code'}'><img src=3D'$fl=
ag_icon' border=3D'0' align=3D'absmiddle' alt=3D'$node->{'country_code'}'></a=
>";
 					} else {
-						print "<a href=3D'country.cgi#$node->{'country_code'}'><img src=3D'/im=
ages/flags/$node->{'country_code'}.png' border=3D'0' align=3D'absmiddle' alt=
=3D'$node->{'country_code'}'></a>";
+						print "<img src=3D'/images/flags/blank.png' border=3D'0' align=3D'absm=
iddle'/>";
 					}
 				}
=20
diff --git a/lfs/tor b/lfs/tor
index c21e4b4..91eab09 100644
--- a/lfs/tor
+++ b/lfs/tor
@@ -32,7 +32,7 @@ DL_FROM    =3D $(URL_IPFIRE)
 DIR_APP    =3D $(DIR_SRC)/$(THISAPP)
 TARGET     =3D $(DIR_INFO)/$(THISAPP)
 PROG       =3D tor
-PAK_VER    =3D 14
+PAK_VER    =3D 15
=20
 DEPS       =3D ""
=20
--=20
2.4.3


--===============6190392278011123703==--