]>
Commit | Line | Data |
---|---|---|
1 | #!/usr/bin/perl | |
2 | ############################################################################### | |
3 | # # | |
4 | # IPFire.org - A linux based firewall # | |
5 | # Copyright (C) 2007 Michael Tremer & Christian Schmidt # | |
6 | # # | |
7 | # This program is free software: you can redistribute it and/or modify # | |
8 | # it under the terms of the GNU General Public License as published by # | |
9 | # the Free Software Foundation, either version 3 of the License, or # | |
10 | # (at your option) any later version. # | |
11 | # # | |
12 | # This program is distributed in the hope that it will be useful, # | |
13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of # | |
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # | |
15 | # GNU General Public License for more details. # | |
16 | # # | |
17 | # You should have received a copy of the GNU General Public License # | |
18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. # | |
19 | # # | |
20 | ############################################################################### | |
21 | ||
22 | use strict; | |
23 | ||
24 | use Locale::Codes::Country; | |
25 | ||
26 | my $col; | |
27 | my $lines = '1'; | |
28 | my $lines2 = ''; | |
29 | ||
30 | require '/var/ipfire/general-functions.pl'; | |
31 | require "${General::swroot}/geoip-functions.pl"; | |
32 | require "${General::swroot}/lang.pl"; | |
33 | require "${General::swroot}/header.pl"; | |
34 | ||
35 | &Header::showhttpheaders(); | |
36 | ||
37 | &Header::openpage($Lang::tr{'countries'}, 1, ''); | |
38 | &Header::openbigbox('100%', 'left'); | |
39 | ||
40 | &Header::openbox('100%', 'left', $Lang::tr{'country codes and flags'}); | |
41 | ||
42 | print<<END; | |
43 | <table class='tbl'> | |
44 | <tr> | |
45 | <th style='width=5%'><b>$Lang::tr{'flag'}</b></th> | |
46 | <th style='width=5%'><b>$Lang::tr{'countrycode'}</b></th> | |
47 | <th style='width=40% text-align:left'><b>$Lang::tr{'country'}</b></th> | |
48 | <th> </th> | |
49 | <th style='width=5%'><b>$Lang::tr{'flag'}</b></th> | |
50 | <th style='width=5%;'><b>$Lang::tr{'countrycode'}</b></th> | |
51 | <th style='width=40% text-align:left;'><b>$Lang::tr{'country'}</b></th> | |
52 | </tr> | |
53 | END | |
54 | ||
55 | # Get a list of all supported country codes. | |
56 | my @countries = Locale::Codes::Country::all_country_codes(); | |
57 | ||
58 | # Loop through whole country list. | |
59 | foreach my $country (@countries) { | |
60 | $lines++; | |
61 | ||
62 | # Convert country code into upper case. | |
63 | my $country_uc = uc($country); | |
64 | ||
65 | # Get flag icon for of the country. | |
66 | my $flag_icon = &GeoIP::get_flag_icon($country); | |
67 | ||
68 | # Get country name. | |
69 | my $name = &GeoIP::get_full_country_name($country); | |
70 | ||
71 | if ($lines % 2) { | |
72 | print "<td $col><a id='$country'><img src='$flag_icon' alt='$country_uc' title='$country_uc'/></a></td>"; | |
73 | print "<td $col>$country_uc</td>"; | |
74 | print "<td $col>$name</td></tr>\n"; | |
75 | } else { | |
76 | $lines2++; | |
77 | if($lines2 % 2) { | |
78 | $col="style='background-color:${Header::table2colour};'"; | |
79 | } else { | |
80 | $col="style='background-color:${Header::table1colour};'"; | |
81 | } | |
82 | print "<tr>"; | |
83 | print "<td $col><a id='$country'><img src='$flag_icon' alt='$country_uc' title='$country_uc'/></a></td>"; | |
84 | print "<td $col>$country_uc</td>"; | |
85 | print "<td $col>$name</td>"; | |
86 | print "<td $col> </td>"; | |
87 | ||
88 | # Finish column when the last element in the array has passed and we have an uneven amount of items. | |
89 | if ( $country eq $countries[-1] ) { | |
90 | print "<td $col> </td>\n"; | |
91 | print "<td $col> </td>\n"; | |
92 | print "<td $col> </td></tr>\n"; | |
93 | } | |
94 | } | |
95 | } | |
96 | print "</table>"; | |
97 | &Header::closebox(); | |
98 | ||
99 | &Header::closebigbox(); | |
100 | ||
101 | print "<div style='text-align:center'><a href='$ENV{'HTTP_REFERER'}'>$Lang::tr{'back'}</a></div>\n"; | |
102 | ||
103 | &Header::closepage(); | |
104 | ||
105 |