]> git.ipfire.org Git - ipfire-2.x.git/blobdiff - html/cgi-bin/tor.cgi
ids.cgi: Rework "Enable IPS" section
[ipfire-2.x.git] / html / cgi-bin / tor.cgi
index 91f4b45feb9c6fd1541c13d3d29c223d20e43502..0d235c9490903beb9355ea319b0b2c88d6cd07fd 100644 (file)
@@ -27,6 +27,7 @@ use warnings;
 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";
 
@@ -105,7 +106,7 @@ if (&Header::blue_used()) {
 }
 
 $settings{'TOR_RELAY_ENABLED'} = 'off';
-$settings{'TOR_RELAY_MODE'} = 'exit';
+$settings{'TOR_RELAY_MODE'} = 'relay';
 $settings{'TOR_RELAY_ADDRESS'} = '';
 $settings{'TOR_RELAY_PORT'} = 9001;
 $settings{'TOR_RELAY_DIRPORT'} = 0;
@@ -431,9 +432,9 @@ END
 
        foreach (@bandwidth_limits) {
                if ($_ >= 1024) {
-                       print "<option value='$_' $selected{'TOR_RELAY_BANDWIDTH_RATE'}{$_}>". $_ / 1024 ." MBit/s</option>\n";
+                       print "<option value='$_' $selected{'TOR_RELAY_BANDWIDTH_RATE'}{$_}>". $_ / 1024 ." Mbit/s</option>\n";
                } else {
-                       print "<option value='$_' $selected{'TOR_RELAY_BANDWIDTH_RATE'}{$_}>$_ kBit/s</option>\n";
+                       print "<option value='$_' $selected{'TOR_RELAY_BANDWIDTH_RATE'}{$_}>$_ kbit/s</option>\n";
                }
        }
 
@@ -454,9 +455,9 @@ END
 
        foreach (@bandwidth_limits) {
                if ($_ >= 1024) {
-                       print "<option value='$_' $selected{'TOR_RELAY_BANDWIDTH_BURST'}{$_}>". $_ / 1024 ." MBit/s</option>\n";
+                       print "<option value='$_' $selected{'TOR_RELAY_BANDWIDTH_BURST'}{$_}>". $_ / 1024 ." Mbit/s</option>\n";
                } else {
-                       print "<option value='$_' $selected{'TOR_RELAY_BANDWIDTH_BURST'}{$_}>$_ kBit/s</option>\n";
+                       print "<option value='$_' $selected{'TOR_RELAY_BANDWIDTH_BURST'}{$_}>$_ kbit/s</option>\n";
                }
        }
        print <<END;
@@ -619,10 +620,14 @@ END
 END
 
                                if (exists($node->{'country_code'})) {
-                                       if (!$node->{'country_code'} or $node->{'country_code'} eq '??') {
-                                               print "<img src='/images/flags/blank.png' border='0' align='absmiddle'/>";
+                                       # Get the flag icon of the country.
+                                       my $flag_icon = &GeoIP::get_flag_icon($node->{'country_code'});
+
+                                       # Check if a flag for the given country is available.
+                                       if ($flag_icon) {
+                                               print "<a href='country.cgi#$node->{'country_code'}'><img src='$flag_icon' border='0' align='absmiddle' alt='$node->{'country_code'}'></a>";
                                        } else {
-                                               print "<a href='country.cgi#$node->{'country_code'}'><img src='/images/flags/$node->{'country_code'}.png' border='0' align='absmiddle' alt='$node->{'country_code'}'></a>";
+                                               print "<img src='/images/flags/blank.png' border='0' align='absmiddle'/>";
                                        }
                                }
 
@@ -973,7 +978,7 @@ sub FormatBytes() {
 sub FormatBitsPerSecond() {
        my $bits = shift;
 
-       my @units = ("Bit/s", "KBit/s", "MBit/s", "GBit/s", "TBit/s");
+       my @units = ("bit/s", "kbit/s", "Mbit/s", "Gbit/s", "Tbit/s");
        my $units_index = 0;
 
        while (($units_index <= $#units) && ($bits >= 1024)) {