public inbox for development@lists.ipfire.org
 help / color / mirror / Atom feed
From: Stefan Schantl <stefan.schantl@ipfire.org>
To: development@lists.ipfire.org
Subject: [PATCH 08/11] ipinfo.cgi: Display network flags of the given addresses.
Date: Tue, 22 Sep 2020 20:25:06 +0200	[thread overview]
Message-ID: <20200922182509.18643-8-stefan.schantl@ipfire.org> (raw)
In-Reply-To: <20200922182509.18643-1-stefan.schantl@ipfire.org>

[-- Attachment #1: Type: text/plain, Size: 1993 bytes --]

Use the libloc data for gathering and displaying the stored network
flags, like "Anonymous Proxy" for the addresses.

The notice of a flag only will be displayed, if a flag is set for the
network which contains the given address.

Currently this notice text is "hardcoded" in englisch language, because
the entire other content of the page is in Englisch (responses from RIR's)
and also the flag names like "Anonymous Proxy" are only availabe in
English.

IMHO there is no need to to translate the string "This address is marked
as" into different languages, because of the reasons abouve.

Signed-off-by: Stefan Schantl <stefan.schantl(a)ipfire.org>
---
 html/cgi-bin/ipinfo.cgi | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/html/cgi-bin/ipinfo.cgi b/html/cgi-bin/ipinfo.cgi
index 978488cb1..cce6097ff 100644
--- a/html/cgi-bin/ipinfo.cgi
+++ b/html/cgi-bin/ipinfo.cgi
@@ -64,6 +64,7 @@ if (&General::validip($addr)) {
 	# enumerate location information for IP address...
 	my $db_handle = &Location::Functions::init();
 	my $ccode = &Location::Functions::lookup_country_code($db_handle, $addr);
+	my $network_flag = &Location::Functions::address_has_flag($addr);
 
 	# Try to get the continent of the country code.
 	my $continent = &Location::get_continent_code($db_handle, $ccode);
@@ -108,6 +109,17 @@ if (&General::validip($addr)) {
 	}
 
 	&Header::openbox('100%', 'left', $addr . " <a href='country.cgi#$ccode'><img src='$flag_icon' border='0' align='absmiddle' alt='$ccode' title='$ccode' /></a> (" . $hostname . ') : '.$whois_server);
+
+	# Check if the address has a flag.
+	if ($network_flag) {
+		# Get
+		my $network_flag_name = &Location::Functions::get_full_country_name($network_flag);
+
+		# Display notice.
+		print "<h3>This address is marked as $network_flag_name.</h3>\n";
+		print "<br>\n";
+	}
+
 	print "<pre>\n";
 	foreach my $line (@lines) {
 		print &Header::cleanhtml($line,"y");
-- 
2.20.1


  parent reply	other threads:[~2020-09-22 18:25 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-22 18:24 [PATCH 01/11] location-functions.pl: Refactor get_locations() function to use the Location module Stefan Schantl
2020-09-22 18:25 ` [PATCH 02/11] location-functions.pl: Refactor get_full_country_name() " Stefan Schantl
2020-09-22 18:25 ` [PATCH 03/11] location-functions.pl: Add address_has_flag() function Stefan Schantl
2020-09-22 18:25 ` [PATCH 04/11] country.cgi: Use own location-functions Stefan Schantl
2020-09-22 18:25 ` [PATCH 05/11] tor.cgi: Use own location functions Stefan Schantl
2020-09-22 18:25 ` [PATCH 06/11] guardian.cgi: Drop unused use of Locale::Codes::Country Stefan Schantl
2020-09-22 18:25 ` [PATCH 07/11] general-functions.pl: " Stefan Schantl
2020-09-22 18:25 ` Stefan Schantl [this message]
2020-09-22 18:25 ` [PATCH 09/11] Locale-Country: Drop package Stefan Schantl
2020-09-22 18:25 ` [PATCH 10/11] ipinfo.cgi: Allow to display multiple flags Stefan Schantl
2020-09-22 18:25 ` [PATCH 11/11] libloc: Update to 0.9.4 Stefan Schantl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200922182509.18643-8-stefan.schantl@ipfire.org \
    --to=stefan.schantl@ipfire.org \
    --cc=development@lists.ipfire.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox