]> git.ipfire.org Git - ipfire-2.x.git/blobdiff - html/cgi-bin/country.cgi
Multiple CGI's: Use &GeoIP::get_flag_icon for getting country flags.
[ipfire-2.x.git] / html / cgi-bin / country.cgi
index 65ce154337f9f5f635005aa7b1e21cb90acf36a3..60c2e5869e260b89d2f37f1c98a90892ff6d9822 100644 (file)
@@ -31,6 +31,7 @@ my @flaglistfiles=();
 my $flag = '';
 
 require '/var/ipfire/general-functions.pl';
+require "${General::swroot}/geoip-functions.pl";
 require "${General::swroot}/lang.pl";
 require "${General::swroot}/header.pl";
 
@@ -64,12 +65,16 @@ foreach $flag (@flaglistfiles)
 
        my $flagcode = uc(substr($flag, 0, 2));
        my $fcode = lc($flagcode);
+
+       # Get flag icon for of the country.
+       my $flag_icon = &GeoIP::get_flag_icon($fcode);
+
        my $country = Locale::Country::code2country($fcode);
        if($fcode eq 'eu') { $country = 'Europe'; }
        if($fcode eq 'tp') { $country = 'East Timor'; }
        if($fcode eq 'yu') { $country = 'Yugoslavia'; }
        if ($lines % 2) {
-               print "<td $col><a id='$fcode'><img src='/images/flags/$fcode.png' alt='$flagcode' title='$flagcode'/></a></td>";
+               print "<td $col><a id='$fcode'><img src='$flag_icon' alt='$flagcode' title='$flagcode'/></a></td>";
                print "<td $col>$flagcode</td>";
                print "<td $col>$country</td></tr>\n";
        }
@@ -81,7 +86,7 @@ foreach $flag (@flaglistfiles)
                        $col="style='background-color:${Header::table1colour};'";
                }
                print "<tr>";
-               print "<td $col><a id='$fcode'><img src='/images/flags/$fcode.png' alt='$flagcode' title='$flagcode'/></a></td>";
+               print "<td $col><a id='$fcode'><img src='$flag_icon' alt='$flagcode' title='$flagcode'/></a></td>";
                print "<td $col>$flagcode</td>";
                print "<td $col>$country</td>";
                print "<td $col>&nbsp;</td>";