mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-28 11:43:25 +02:00
Merge remote-tracking branch 'stevee/core90-fixes'
This commit is contained in:
@@ -23,12 +23,9 @@ use strict;
|
|||||||
|
|
||||||
use Locale::Codes::Country;
|
use Locale::Codes::Country;
|
||||||
|
|
||||||
my $flagdir = '/srv/web/ipfire/html/images/flags';
|
my $col;
|
||||||
my $lines = '1';
|
my $lines = '1';
|
||||||
my $lines2 = '';
|
my $lines2 = '';
|
||||||
my @flaglist=();
|
|
||||||
my @flaglistfiles=();
|
|
||||||
my $flag = '';
|
|
||||||
|
|
||||||
require '/var/ipfire/general-functions.pl';
|
require '/var/ipfire/general-functions.pl';
|
||||||
require "${General::swroot}/geoip-functions.pl";
|
require "${General::swroot}/geoip-functions.pl";
|
||||||
@@ -41,44 +38,41 @@ require "${General::swroot}/header.pl";
|
|||||||
&Header::openbigbox('100%', 'left');
|
&Header::openbigbox('100%', 'left');
|
||||||
|
|
||||||
&Header::openbox('100%', 'left', $Lang::tr{'country codes and flags'});
|
&Header::openbox('100%', 'left', $Lang::tr{'country codes and flags'});
|
||||||
print "<table class='tbl'>";
|
|
||||||
print "<tr><th style='width=5%;'><b>$Lang::tr{'flag'}</b></th>";
|
|
||||||
print "<th style='width=5%;'><b>$Lang::tr{'countrycode'}</b></th>";
|
|
||||||
print "<th style='width=40%; text-align:left;'><b>$Lang::tr{'country'}</b></th>";
|
|
||||||
print "<th> </th>";
|
|
||||||
print "<th style='width=5%;'><b>$Lang::tr{'flag'}</b></th>";
|
|
||||||
print "<th style='width=5%;'><b>$Lang::tr{'countrycode'}</b></th>";
|
|
||||||
print "<th style='width=40%; text-align:left;'><b>$Lang::tr{'country'}</b></th></tr>";
|
|
||||||
|
|
||||||
@flaglist = <$flagdir/*>;
|
print<<END;
|
||||||
|
<table class='tbl'>
|
||||||
|
<tr>
|
||||||
|
<th style='width=5%'><b>$Lang::tr{'flag'}</b></th>
|
||||||
|
<th style='width=5%'><b>$Lang::tr{'countrycode'}</b></th>
|
||||||
|
<th style='width=40% text-align:left'><b>$Lang::tr{'country'}</b></th>
|
||||||
|
<th> </th>
|
||||||
|
<th style='width=5%'><b>$Lang::tr{'flag'}</b></th>
|
||||||
|
<th style='width=5%;'><b>$Lang::tr{'countrycode'}</b></th>
|
||||||
|
<th style='width=40% text-align:left;'><b>$Lang::tr{'country'}</b></th>
|
||||||
|
</tr>
|
||||||
|
END
|
||||||
|
|
||||||
undef @flaglistfiles;
|
# Get a list of all supported country codes.
|
||||||
|
my @countries = Locale::Codes::Country::all_country_codes();
|
||||||
|
|
||||||
foreach (@flaglist)
|
# Loop through whole country list.
|
||||||
{
|
foreach my $country (@countries) {
|
||||||
if (!-d) { push(@flaglistfiles,substr($_,rindex($_,"/")+1)); }
|
|
||||||
}
|
|
||||||
my $col="";
|
|
||||||
foreach $flag (@flaglistfiles)
|
|
||||||
{
|
|
||||||
$lines++;
|
$lines++;
|
||||||
|
|
||||||
my $flagcode = uc(substr($flag, 0, 2));
|
# Convert country code into upper case.
|
||||||
my $fcode = lc($flagcode);
|
my $country_uc = uc($country);
|
||||||
|
|
||||||
# Get flag icon for of the country.
|
# Get flag icon for of the country.
|
||||||
my $flag_icon = &GeoIP::get_flag_icon($fcode);
|
my $flag_icon = &GeoIP::get_flag_icon($country);
|
||||||
|
|
||||||
|
# Get country name.
|
||||||
|
my $name = &GeoIP::get_full_country_name($country);
|
||||||
|
|
||||||
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) {
|
if ($lines % 2) {
|
||||||
print "<td $col><a id='$fcode'><img src='$flag_icon' alt='$flagcode' title='$flagcode'/></a></td>";
|
print "<td $col><a id='$country'><img src='$flag_icon' alt='$country_uc' title='$country_uc'/></a></td>";
|
||||||
print "<td $col>$flagcode</td>";
|
print "<td $col>$country_uc</td>";
|
||||||
print "<td $col>$country</td></tr>\n";
|
print "<td $col>$name</td></tr>\n";
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$lines2++;
|
$lines2++;
|
||||||
if($lines2 % 2) {
|
if($lines2 % 2) {
|
||||||
$col="style='background-color:${Header::table2colour};'";
|
$col="style='background-color:${Header::table2colour};'";
|
||||||
@@ -86,25 +80,25 @@ foreach $flag (@flaglistfiles)
|
|||||||
$col="style='background-color:${Header::table1colour};'";
|
$col="style='background-color:${Header::table1colour};'";
|
||||||
}
|
}
|
||||||
print "<tr>";
|
print "<tr>";
|
||||||
print "<td $col><a id='$fcode'><img src='$flag_icon' alt='$flagcode' title='$flagcode'/></a></td>";
|
print "<td $col><a id='$country'><img src='$flag_icon' alt='$country_uc' title='$country_uc'/></a></td>";
|
||||||
print "<td $col>$flagcode</td>";
|
print "<td $col>$country_uc</td>";
|
||||||
print "<td $col>$country</td>";
|
print "<td $col>$name</td>";
|
||||||
print "<td $col> </td>";
|
print "<td $col> </td>";
|
||||||
|
|
||||||
|
# Finish column when the last element in the array has passed and we have an uneven amount of items.
|
||||||
|
if ( $country eq $countries[-1] ) {
|
||||||
|
print "<td $col> </td>\n";
|
||||||
|
print "<td $col> </td>\n";
|
||||||
|
print "<td $col> </td></tr>\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
print "</table>";
|
print "</table>";
|
||||||
&Header::closebox();
|
&Header::closebox();
|
||||||
|
|
||||||
&Header::closebigbox();
|
&Header::closebigbox();
|
||||||
|
|
||||||
print <<END
|
print "<div style='text-align:center'><a href='$ENV{'HTTP_REFERER'}'>$Lang::tr{'back'}</a></div>\n";
|
||||||
<div style='text-align:center'>
|
|
||||||
<a href='$ENV{'HTTP_REFERER'}'>$Lang::tr{'back'}</a>
|
|
||||||
</div>
|
|
||||||
END
|
|
||||||
;
|
|
||||||
|
|
||||||
&Header::closepage();
|
&Header::closepage();
|
||||||
|
|
||||||
|
|||||||
@@ -225,7 +225,16 @@ foreach my $location (@locations) {
|
|||||||
print "<td align='center' $col>$flag</td>\n";
|
print "<td align='center' $col>$flag</td>\n";
|
||||||
print "<td align='center' $col>$ccode_uc</td>\n";
|
print "<td align='center' $col>$ccode_uc</td>\n";
|
||||||
print "<td align='left' $col>$cname</td>$line_end\n";
|
print "<td align='left' $col>$cname</td>$line_end\n";
|
||||||
|
|
||||||
|
# Finish column when the last element in the array has passed and we have an uneven amount of items.
|
||||||
|
if(! ($lines2 % 2) && ($location eq $locations[-1] )) {
|
||||||
|
print "<td $col> </td>\n";
|
||||||
|
print "<td $col> </td>\n";
|
||||||
|
print "<td $col> </td>\n";
|
||||||
|
print "<td $col> </td>\n";
|
||||||
|
print "<td $col> </td></tr>\n";
|
||||||
|
}
|
||||||
|
|
||||||
$lines2++;
|
$lines2++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user