mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-09 18:45:54 +02:00
Merge remote-tracking branch 'stevee/next-cgi-geoip' into next
This commit is contained in:
@@ -41,8 +41,8 @@ sub get_flag_icon($) {
|
||||
# Remove whitespaces.
|
||||
chomp($input);
|
||||
|
||||
# Convert given country code to lower case.
|
||||
my $ccode = lc($input);
|
||||
# Convert given country code to upper case.
|
||||
my $ccode = uc($input);
|
||||
|
||||
# Generate filename, based on the contry code in lower case
|
||||
# and the defined file extension.
|
||||
@@ -58,6 +58,21 @@ sub get_flag_icon($) {
|
||||
if (-e "$absolute_path") {
|
||||
# Return content of flag_icon.
|
||||
return $flag_icon;
|
||||
} else {
|
||||
# If no icon for the specified country exists, try to use
|
||||
# the icon for "unknown".
|
||||
my $ccode = "unknown";
|
||||
|
||||
# Redoing all the stuff from abouve for the "unknown" icon.
|
||||
my $file = join('.', $ccode,$ext);
|
||||
my $flag_icon = join('/', $flagdir,$file);
|
||||
my $absolute_path = join('', $webroot,$flag_icon);
|
||||
|
||||
# Check if the icon is present.
|
||||
if (-e "$absolute_path") {
|
||||
# Return "unknown" icon.
|
||||
return $flag_icon;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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> </td>";
|
||||
|
||||
@@ -21,6 +21,7 @@ use Getopt::Std;
|
||||
#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";
|
||||
|
||||
@@ -372,10 +373,15 @@ foreach $_ (@log)
|
||||
<td align='center' $col>$srcport<br/>$dstport</td>
|
||||
END
|
||||
;
|
||||
if ( $fcode ne "" ){
|
||||
print "<td align='center' $col><a href='../country.cgi#$fcode'><img src='/images/flags/$fcode.png' border='0' align='absmiddle' alt='$ccode'></a></td>";}
|
||||
else {
|
||||
print "<td align='center' $col></td>";}
|
||||
# Get flag icon for of the country.
|
||||
my $flag_icon = &GeoIP::get_flag_icon($fcode);
|
||||
|
||||
if ( $flag_icon) {
|
||||
print "<td align='center' $col><a href='../country.cgi#$fcode'><img src='$flag_icon' border='0' align='absmiddle' alt='$ccode'></a></td>";
|
||||
} else {
|
||||
print "<td align='center' $col></td>";
|
||||
}
|
||||
|
||||
print <<END
|
||||
<td align='center' $col>$macaddr</td>
|
||||
</tr>
|
||||
|
||||
@@ -19,6 +19,7 @@ use Getopt::Std;
|
||||
#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";
|
||||
|
||||
@@ -460,11 +461,15 @@ for($s=0;$s<$lines;$s++)
|
||||
print "<td align='center' $col>$key[$s]</td>";
|
||||
}
|
||||
else {
|
||||
if($key[$s] ne 'unknown' ) {
|
||||
my $fcode = lc($key[$s]);
|
||||
print "<td align='center' $col><a href='/cgi-bin/country.cgi#$fcode'><img src='/images/flags/$fcode.png' border='0' align='absmiddle' alt='$key[$s]' title='$key[$s]'></a></td>";}
|
||||
else {
|
||||
print "<td align='center' $col>$key[$s]</td>";
|
||||
my $fcode = lc($key[$s]);
|
||||
|
||||
# Get flag icon for of the country.
|
||||
my $flag_icon = &GeoIP::get_flag_icon($fcode);
|
||||
|
||||
if($flag_icon) {
|
||||
print "<td align='center' $col><a href='/cgi-bin/country.cgi#$fcode'><img src='$flag_icon' border='0' align='absmiddle' alt='$key[$s]' title='$key[$s]'></a></td>";
|
||||
} else {
|
||||
print "<td align='center' $col>$key[$s]</td>";
|
||||
}
|
||||
}
|
||||
print "<td align='center' $col>$value[$s]</td>";
|
||||
|
||||
@@ -19,6 +19,7 @@ use Getopt::Std;
|
||||
#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";
|
||||
|
||||
@@ -441,13 +442,19 @@ for($s=0;$s<$lines;$s++)
|
||||
$color++;
|
||||
print "<td align='center' $col><form method='post' action='showrequestfromip.dat'><input type='hidden' name='MONTH' value='$cgiparams{'MONTH'}'> <input type='hidden' name='DAY' value='$cgiparams{'DAY'}'> <input type='hidden' name='ip' value='$key[$s]'> <input type='submit' value='$Lang::tr{'details'}'></form></td>";
|
||||
print "<td align='center' $col><a href='/cgi-bin/ipinfo.cgi?ip=$key[$s]'>$key[$s]</a></td>";
|
||||
if ( $fcode ne "" ){
|
||||
print "<td align='center' $col><a href='/cgi-bin/country.cgi#$fcode'><img src='/images/flags/$fcode.png' border='0' align='absmiddle' alt='$ccode' title='$ccode'></a></td>";}
|
||||
else {
|
||||
print "<td align='center' $col></td>";}
|
||||
print "<td align='center' $col>$value[$s]</td>";
|
||||
print "<td align='center' $col>$percent</td>";
|
||||
print "</tr>";
|
||||
|
||||
# Get flag icon for of the country.
|
||||
my $flag_icon = &GeoIP::get_flag_icon($ccode);
|
||||
|
||||
if ( $flag_icon ) {
|
||||
print "<td align='center' $col><a href='/cgi-bin/country.cgi#$fcode'><img src='$flag_icon' border='0' align='absmiddle' alt='$ccode' title='$ccode'></a></td>";
|
||||
} else {
|
||||
print "<td align='center' $col></td>";
|
||||
}
|
||||
|
||||
print "<td align='center' $col>$value[$s]</td>";
|
||||
print "<td align='center' $col>$percent</td>";
|
||||
print "</tr>";
|
||||
}
|
||||
|
||||
if($cgiparams{'otherspie'} == 2 ){}
|
||||
|
||||
Reference in New Issue
Block a user