X-Git-Url: http://git.ipfire.org/?p=ipfire-2.x.git;a=blobdiff_plain;f=html%2Fcgi-bin%2Ftor.cgi;h=71da66666448f27c65e284ff5be243b3b7e332c6;hp=befd5083442993a57168fa6315ccdeba3b20b568;hb=56947acb12176f397cbd5078c5544cdc4f19b27b;hpb=4245fe34792cb67b1fe4b073e3b4d71014c3b277 diff --git a/html/cgi-bin/tor.cgi b/html/cgi-bin/tor.cgi old mode 100755 new mode 100644 index befd508344..71da666664 --- a/html/cgi-bin/tor.cgi +++ b/html/cgi-bin/tor.cgi @@ -2,7 +2,7 @@ ############################################################################### # # # IPFire.org - A linux based firewall # -# Copyright (C) 2013 IPFire Team # +# Copyright (C) 2013-2019 IPFire Team # # # # This program is free software: you can redistribute it and/or modify # # it under the terms of the GNU General Public License as published by # @@ -20,13 +20,14 @@ ############################################################################### use strict; -use Locale::Country; +use Locale::Codes::Country; # enable only the following on debugging purpose 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"; @@ -35,10 +36,10 @@ my @dummy = ( ${Header::colouryellow} ); undef (@dummy); my @bandwidth_limits = ( - 1000 * 1024, # 1G + 1000 * 1024, # 1 GBit/s 500 * 1024, 200 * 1024, - 100 * 1024, # 100M + 100 * 1024, # 100 MBit/s 64 * 1024, 50 * 1024, 25 * 1024, @@ -48,10 +49,7 @@ my @bandwidth_limits = ( 8 * 1024, 4 * 1024, 2 * 1024, - 1024, # 1M - 512, - 256, - 160 + 1024 # 1 MBit/s ); my @accounting_periods = ('daily', 'weekly', 'monthly'); @@ -105,7 +103,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; @@ -235,8 +233,8 @@ sub showMainBox() { if ( ($memory != 0) && (@pid[0] ne "///") ){ - print ""; - print ""; + print "
$Lang::tr{'tor service'}
"; + print ""; print ""; print ""; print ""; @@ -247,8 +245,8 @@ if ( ($memory != 0) && (@pid[0] ne "///") ){ print ""; print "
$Lang::tr{'tor service'}
$Lang::tr{'tor daemon'}$Lang::tr{'running'}
$memory KB
"; } else { - print ""; - print ""; + print "
$Lang::tr{'tor service'}
"; + print ""; print ""; print ""; print "
$Lang::tr{'tor service'}
$Lang::tr{'tor daemon'}$Lang::tr{'stopped'}
"; @@ -266,7 +264,7 @@ if ( ($memory != 0) && (@pid[0] ne "///") ){ $Lang::tr{'tor enabled'}: - $Lang::tr{'tor socks port'}: + $Lang::tr{'tor socks port'}: * @@ -323,9 +321,9 @@ END END - my @country_names = Locale::Country::all_country_names(); + my @country_names = Locale::Codes::Country::all_country_names(); foreach my $country_name (sort @country_names) { - my $country_code = Locale::Country::country2code($country_name); + my $country_code = Locale::Codes::Country::country2code($country_name); $country_code = uc($country_code); print " - $Lang::tr{'tor relay nickname'}: * + $Lang::tr{'tor relay nickname'}: - $Lang::tr{'tor relay address'}: * + $Lang::tr{'tor relay address'}: - $Lang::tr{'tor relay port'}: + $Lang::tr{'tor relay port'}: * @@ -404,13 +402,13 @@ END     - $Lang::tr{'tor directory port'}: + $Lang::tr{'tor directory port'}: *  $Lang::tr{'tor 0 = disabled'} - $Lang::tr{'tor contact info'}: * + $Lang::tr{'tor contact info'}: @@ -431,9 +429,9 @@ END foreach (@bandwidth_limits) { if ($_ >= 1024) { - print "\n"; + print "\n"; } else { - print "\n"; + print "\n"; } } @@ -441,7 +439,7 @@ END - $Lang::tr{'tor accounting limit'}: + $Lang::tr{'tor accounting limit'}: * @@ -454,9 +452,9 @@ END foreach (@bandwidth_limits) { if ($_ >= 1024) { - print "\n"; + print "\n"; } else { - print "\n"; + print "\n"; } } print < - - * $Lang::tr{'this field may be blank'} - + * $Lang::tr{'required field'}   @@ -520,7 +516,7 @@ END $Lang::tr{'tor relay fingerprint'}: - $fingerprint + $fingerprint END @@ -613,7 +609,7 @@ END print < - + $node->{'name'} @@ -621,10 +617,14 @@ END END if (exists($node->{'country_code'})) { - if (!$node->{'country_code'} or $node->{'country_code'} eq '??') { - print ""; + # 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 "$node->{"; } else { - print "$node->{"; + print ""; } } @@ -975,7 +975,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)) {