Fixes #12515.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
my @dummy = ( ${Header::table1colour} );
undef (@dummy);
-# Init libloc database connection.
-my $libloc_db_handle = &Location::Functions::init();
-
# check sorting arguments
if ( $cgiin{'sort_field'} ~~ [ '1','2','3','4','5','6','7','8','9' ] ) {
$SORT_FIELD = $cgiin{'sort_field'};
my $bytes_out = format_bytes($bytes[1]);
# enumerate location information
- my $srcccode = &Location::Functions::lookup_country_code($libloc_db_handle, $sip_ret);
+ my $srcccode = &Location::Functions::lookup_country_code($sip_ret);
my $src_flag_icon = &Location::Functions::get_flag_icon($srcccode);
- my $dstccode = &Location::Functions::lookup_country_code($libloc_db_handle, $dip_ret);
+ my $dstccode = &Location::Functions::lookup_country_code($dip_ret);
my $dst_flag_icon = &Location::Functions::get_flag_icon($dstccode);
# Format TTL
</tr>
END
-# Init libloc database connection.
-my $db_handle = &Location::Functions::init();
-
# Get a list of all supported country codes.
-my @countries = &Location::database_countries($db_handle);
+my @countries = &Location::database_countries();
# Loop through whole country list.
foreach my $country (@countries) {
# Read-in config file.
&General::readhasharray("$servers_file", \%dns_servers);
-# Libloc database handle
-my $libloc_db_handle = &Location::Functions::init();
-
&Header::openpage($Lang::tr{'dns title'}, 1, '');
&Header::openbigbox('100%', 'left', '', $errormessage);
}
# collect more information about name server (rDNS, country code)
- my $ccode = &Location::Functions::lookup_country_code($libloc_db_handle, $nameserver);
+ my $ccode = &Location::Functions::lookup_country_code($nameserver);
my $flag_icon = &Location::Functions::get_flag_icon($ccode);
my $rdns;
if (!$hostname) { $hostname = $Lang::tr{'lookup failed'}; }
# enumerate location information for IP address...
- my $db_handle = &Location::Functions::init();
- my $ccode = &Location::Functions::lookup_country_code($db_handle, $addr);
+ my $ccode = &Location::Functions::lookup_country_code($addr);
my @network_flags = &Location::Functions::address_has_flags($addr);
# Try to get the continent of the country code.
- my $continent = &Location::get_continent_code($db_handle, $ccode);
+ my $continent = &Location::Functions::get_continent_code($ccode);
# Check if a whois server for the continent is known.
if($whois_servers_by_continent{$continent}) {
require "${General::swroot}/lang.pl";
require "${General::swroot}/header.pl";
-# Libloc database handle.
-my $libloc_db_handle = &Location::Functions::init();
-
my %color = ();
my %mainsettings = ();
&General::readhash("${General::swroot}/main/settings", \%mainsettings);
$srcport=$1 if $packet =~ /SPT=(\d+)/;
$dstport=$1 if $packet =~ /DPT=(\d+)/;
- my $ccode = &Location::Functions::lookup_country_code($libloc_db_handle, $srcaddr);
+ # Get the country code.
+ my $ccode = &Location::Functions::lookup_country_code($srcaddr);
my $servi = uc(getservbyport($srcport, lc($proto)));
if ($servi ne '' && $srcport < 1024) {
require "${General::swroot}/lang.pl";
require "${General::swroot}/header.pl";
-# Libloc database handle.
-my $libloc_db_handle = &Location::Functions::init();
-
use POSIX();
my %cgiparams=();
# Traffic from red
if($srcaddr ne '') {
# srcaddr is set
- my $ccode = &Location::Functions::lookup_country_code($libloc_db_handle, $srcaddr);
+ my $ccode = &Location::Functions::lookup_country_code($srcaddr);
if ($ccode eq '') {
$ccode = 'unknown';
}
require "${General::swroot}/lang.pl";
require "${General::swroot}/header.pl";
-# Libloc database handle.
-my $libloc_db_handle = &Location::Functions::init();
-
use POSIX();
my %cgiparams=();
$col="bgcolor='$color{\"color$colorIndex\"}'";
print "<tr>";
- my $ccode = &Location::Functions::lookup_country_code($libloc_db_handle, $key[$s]);
+ # Get country code.
+ my $ccode = &Location::Functions::lookup_country_code($key[$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>";
require "${General::swroot}/lang.pl";
require "${General::swroot}/header.pl";
-# Libloc database handle.
-my $libloc_db_handle = &Location::Functions::init();
-
use POSIX();
#workaround to suppress a warning when a variable is used only once
}
elsif($srcaddr ne '') {
# or srcaddr matches country code
- my $ccode = &Location::Functions::lookup_country_code($libloc_db_handle, $srcaddr);
+ my $ccode = &Location::Functions::lookup_country_code($srcaddr);
if($ccode eq uc($country)){
$log[$lines] = $_;
$lines++;
if($iface eq $country || $srcaddr ne '') {
my $ccode='';
if($iface ne $country) {
- $ccode = &Location::Functions::lookup_country_code($libloc_db_handle, $srcaddr);
+ $ccode = &Location::Functions::lookup_country_code($srcaddr);
}
if($iface eq $country || $ccode eq uc($country)) {
my $chain = '';
&Header::openbigbox('100%', 'LEFT', '', '');
&Header::openbox('100%', 'LEFT', $Lang::tr{'ovpn con stat'});
- # Libloc database handle.
- my $libloc_db_handle = &Location::Functions::init();
-
#
# <td><b>$Lang::tr{'protocol'}</b></td>
# protocol temp removed
$users[$uid]{'Proto'} = $proto;
# get country code for "RealAddress"...
- my $ccode = &Location::Functions::lookup_country_code($libloc_db_handle, (split ':', $users[$uid]{'RealAddress'})[0]);
+ my $ccode = &Location::Functions::lookup_country_code((split ':', $users[$uid]{'RealAddress'})[0]);
my $flag_icon = &Location::Functions::get_flag_icon($ccode);
$users[$uid]{'Country'} = "<a href='country.cgi#$ccode'><img src='$flag_icon' border='0' align='absmiddle' alt='$ccode' title='$ccode' /></a>";
$uid++;
print "<tr bgcolor='$table_colour'><td colspan='5'>$Lang::tr{'ssh no active logins'}</td></tr>\n";
} else {
# list active logins...
-
- # Libloc database handle.
- my $libloc_db_handle = &Location::Functions::init();
-
foreach my $line (@output)
{
my @arry = split(/\ +/, $line);
$remoteip =~ s/[()]//g;
# display more information about that IP adress...
- my $ccode = &Location::Functions::lookup_country_code($libloc_db_handle, $remoteip);
+ my $ccode = &Location::Functions::lookup_country_code($remoteip);
my $flag_icon = &Location::Functions::get_flag_icon($ccode);
# get rDNS...
require "${General::swroot}/lang.pl";
require "${General::swroot}/header.pl";
-# Init libloc database connection.
-my $db_handle = &Location::Functions::init();
-
#workaround to suppress a warning when a variable is used only once
my @dummy = ( ${Header::colouryellow} );
undef (@dummy);
<select name='TOR_EXIT_COUNTRY'>
<option value=''>- $Lang::tr{'tor exit country any'} -</option>
END
- my @country_codes = &Location::database_countries($db_handle);
+ my @country_codes = &Location::Functions::get_locations("no_special_locations");
foreach my $country_code (@country_codes) {
# Convert country code into upper case format.
$country_code = uc($country_code);
$node->{'address'} = $3;
$node->{'port'} = $4;
- my $country_code = &Location::Functions::lookup_country_code($db_handle, $node->{'address'});
+ my $country_code = &Location::Functions::lookup_country_code($node->{'address'});
$node->{'country_code'} = $country_code;
# Flags