]> git.ipfire.org Git - ipfire-2.x.git/commitdiff
Adjust CGI files to work with latest location-function.pl changes.
authorStefan Schantl <stefan.schantl@ipfire.org>
Sat, 7 Nov 2020 18:47:24 +0000 (19:47 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 9 Nov 2020 14:07:21 +0000 (14:07 +0000)
Fixes #12515.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
html/cgi-bin/connections.cgi
html/cgi-bin/country.cgi
html/cgi-bin/dns.cgi
html/cgi-bin/ipinfo.cgi
html/cgi-bin/logs.cgi/firewalllog.dat
html/cgi-bin/logs.cgi/firewalllogcountry.dat
html/cgi-bin/logs.cgi/firewalllogip.dat
html/cgi-bin/logs.cgi/showrequestfromcountry.dat
html/cgi-bin/ovpnmain.cgi
html/cgi-bin/remote.cgi
html/cgi-bin/tor.cgi

index 6c55bd7a061b14d701defda8060f54c795affdf1..8613b9d9b0c3126e81606baf4a5e18179432ae0b 100644 (file)
@@ -86,9 +86,6 @@ if ( $debug ){
 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'};
@@ -554,9 +551,9 @@ foreach my $line (@conntrack) {
        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
index b519d89b3c98e381339c91e093a19a7f3a43f545..b1c72bb2232ea09465c23617610231f98e1590c4 100644 (file)
@@ -52,11 +52,8 @@ print<<END;
        </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) {
index 13dd9d6a09c415544ee1bc8d017109d0ad1b6584..762e77ff1da5d89aaa75361cc58e8410915b0446 100755 (executable)
@@ -269,9 +269,6 @@ my %dns_servers = ();
 # 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);
@@ -598,7 +595,7 @@ END
                                }
 
                                # 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;
index d8cb6c6b76a30150f37ba7d88af508fbf1d240a8..ecc7c436cf67169e0bf11287aa4205c213432a28 100644 (file)
@@ -62,12 +62,11 @@ if (&General::validip($addr)) {
        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}) {
index 2b690e35b723283d47fa2ed5497acff1209af33e..361bf0432740e7b74b1395f1470fdca0e6efbcbd 100644 (file)
@@ -24,9 +24,6 @@ require "${General::swroot}/location-functions.pl";
 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);
@@ -354,7 +351,8 @@ foreach $_ (@log)
        $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) {
index 701abab2c84987d65a7f872483c2bdbb5dd49f1f..e3901b945d8b37b72f40557ea8b846435da46571 100644 (file)
@@ -22,9 +22,6 @@ require "${General::swroot}/location-functions.pl";
 require "${General::swroot}/lang.pl";
 require "${General::swroot}/header.pl";
 
-# Libloc database handle.
-my $libloc_db_handle = &Location::Functions::init();
-
 use POSIX();
 
 my %cgiparams=();
@@ -311,7 +308,7 @@ foreach $_ (@log)
                # 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';
                        }
index 670d72a526fc848946fd32e990a4b83dc117be86..6de4081afbc64a5ed6b32e756620ff2c022424ef 100644 (file)
@@ -22,9 +22,6 @@ require "${General::swroot}/location-functions.pl";
 require "${General::swroot}/lang.pl";
 require "${General::swroot}/header.pl";
 
-# Libloc database handle.
-my $libloc_db_handle = &Location::Functions::init();
-
 use POSIX();
 
 my %cgiparams=();
@@ -438,7 +435,8 @@ for($s=0;$s<$lines;$s++)
        $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>";
index 4d80e77a4d68fa2bacba9f275c1df842bd2d9c4c..2a246ec60e9fbe5a7c5af804057796ed7bc99c9b 100644 (file)
@@ -19,9 +19,6 @@ require "${General::swroot}/location-functions.pl";
 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
@@ -181,7 +178,7 @@ if (!$skip)
                        }
                        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++;
@@ -352,7 +349,7 @@ foreach $_ (@slice)
        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 = '';
index e7bc505e744aaae5e6a07727c3d2f40d3fc0976f..8626a94cad7a4e0a544fe4f84b2d3a4f1f0864c2 100644 (file)
@@ -3002,9 +3002,6 @@ END
        &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 
@@ -3055,7 +3052,7 @@ END
                    $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++;
index 9c742669bc7266cccc1f58aeb4d5538960f94b15..a27e10de95678af7054b25621e35480e4ba4f1a4 100644 (file)
@@ -277,10 +277,6 @@ sub printactivelogins()
                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);
@@ -291,7 +287,7 @@ sub printactivelogins()
                        $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...
index 14bfcfe90079548b136f305c5a8cf481bc2d4124..983bb30c9ad0ffc66eabb1b40136b5bbdf29c936 100644 (file)
@@ -30,9 +30,6 @@ require "${General::swroot}/location-functions.pl";
 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);
@@ -322,7 +319,7 @@ END
                                        <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);
@@ -912,7 +909,7 @@ sub TorNodeDescription() {
                        $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