tor.cgi: Fix missing country flag icons.

Message ID 1444493258-24392-1-git-send-email-stefan.schantl@ipfire.org
State Accepted
Commit a9a28430b5bce4f43fafd13f60b2e068eca1ea9a
Headers

Message

Stefan Schantl Oct. 11, 2015, 3:07 a.m. UTC
  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@ipfire.org>
Tested-by: Jan Paul Tuecking <jan.paul.tuecking@ipfire.org>
---
 html/cgi-bin/tor.cgi | 11 ++++++++---
 lfs/tor              |  2 +-
 2 files changed, 9 insertions(+), 4 deletions(-)
  

Comments

Michael Tremer Oct. 16, 2015, 1:43 a.m. UTC | #1
Merged. Thanks.

On Sat, 2015-10-10 at 18:07 +0200, Stefan Schantl wrote:
> 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@ipfire.org>
> Tested-by: Jan Paul Tuecking <jan.paul.tuecking@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';
>  
>  require '/var/ipfire/general-functions.pl';
> +require "${General::swroot}/geoip-functions.pl";
>  require "${General::swroot}/lang.pl";
>  require "${General::swroot}/header.pl";
>  
> @@ -619,10 +620,14 @@ END
>  END
>  
>  				if (exists($node->{'country_code'}))
> {
> -					if (!$node->{'country_code'}
> or $node->{'country_code'} eq '??') {
> -						print "<img
> src='/images/flags/blank.png' border='0' align='absmiddle'/>";
> +					# Get the flag icon of the
> country.
> +					my $flag_icon =
> &GeoIP::get_flag_icon($node->{'country_code'});
> +
> +					# Check if a flag for the
> given country is available.
> +					if ($flag_icon) {
> +						print "<a
> href='country.cgi#$node->{'country_code'}'><img src='$flag_icon'
> border='0' align='absmiddle' alt='$node->{'country_code'}'></a>";
>  					} else {
> -						print "<a
> href='country.cgi#$node->{'country_code'}'><img
> src='/images/flags/$node->{'country_code'}.png' border='0'
> align='absmiddle' alt='$node->{'country_code'}'></a>";
> +						print "<img
> src='/images/flags/blank.png' border='0' align='absmiddle'/>";
>  					}
>  				}
>  
> diff --git a/lfs/tor b/lfs/tor
> index c21e4b4..91eab09 100644
> --- a/lfs/tor
> +++ b/lfs/tor
> @@ -32,7 +32,7 @@ DL_FROM    = $(URL_IPFIRE)
>  DIR_APP    = $(DIR_SRC)/$(THISAPP)
>  TARGET     = $(DIR_INFO)/$(THISAPP)
>  PROG       = tor
> -PAK_VER    = 14
> +PAK_VER    = 15
>  
>  DEPS       = ""
>