]>
Commit | Line | Data |
---|---|---|
dace10b5 | 1 | #!/usr/bin/perl |
70df8302 MT |
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 | ############################################################################### | |
dace10b5 MT |
21 | |
22 | use strict; | |
23 | ||
b013822b | 24 | use Locale::Codes::Country; |
dace10b5 | 25 | |
95fb58a3 | 26 | my $flagdir = '/srv/web/ipfire/html/images/flags'; |
dace10b5 MT |
27 | my $lines = '1'; |
28 | my $lines2 = ''; | |
29 | my @flaglist=(); | |
30 | my @flaglistfiles=(); | |
31 | my $flag = ''; | |
32 | ||
df8c7810 | 33 | require '/var/ipfire/general-functions.pl'; |
3ea01fe0 | 34 | require "${General::swroot}/geoip-functions.pl"; |
dace10b5 MT |
35 | require "${General::swroot}/lang.pl"; |
36 | require "${General::swroot}/header.pl"; | |
37 | ||
38 | &Header::showhttpheaders(); | |
39 | ||
326a764d AH |
40 | &Header::openpage($Lang::tr{'countries'}, 1, ''); |
41 | &Header::openbigbox('100%', 'left'); | |
42 | ||
43 | &Header::openbox('100%', 'left', $Lang::tr{'country codes and flags'}); | |
44 | print "<table class='tbl'>"; | |
45 | print "<tr><th style='width=5%;'><b>$Lang::tr{'flag'}</b></th>"; | |
46 | print "<th style='width=5%;'><b>$Lang::tr{'countrycode'}</b></th>"; | |
47 | print "<th style='width=40%; text-align:left;'><b>$Lang::tr{'country'}</b></th>"; | |
48 | print "<th> </th>"; | |
49 | print "<th style='width=5%;'><b>$Lang::tr{'flag'}</b></th>"; | |
50 | print "<th style='width=5%;'><b>$Lang::tr{'countrycode'}</b></th>"; | |
51 | print "<th style='width=40%; text-align:left;'><b>$Lang::tr{'country'}</b></th></tr>"; | |
dace10b5 MT |
52 | |
53 | @flaglist = <$flagdir/*>; | |
54 | ||
55 | undef @flaglistfiles; | |
56 | ||
57 | foreach (@flaglist) | |
58 | { | |
59 | if (!-d) { push(@flaglistfiles,substr($_,rindex($_,"/")+1)); } | |
60 | } | |
4250f386 | 61 | my $col=""; |
dace10b5 MT |
62 | foreach $flag (@flaglistfiles) |
63 | { | |
64 | $lines++; | |
4250f386 AM |
65 | |
66 | my $flagcode = uc(substr($flag, 0, 2)); | |
67 | my $fcode = lc($flagcode); | |
3ea01fe0 SS |
68 | |
69 | # Get flag icon for of the country. | |
70 | my $flag_icon = &GeoIP::get_flag_icon($fcode); | |
71 | ||
dace10b5 | 72 | my $country = Locale::Country::code2country($fcode); |
4250f386 AM |
73 | if($fcode eq 'eu') { $country = 'Europe'; } |
74 | if($fcode eq 'tp') { $country = 'East Timor'; } | |
75 | if($fcode eq 'yu') { $country = 'Yugoslavia'; } | |
76 | if ($lines % 2) { | |
3ea01fe0 | 77 | print "<td $col><a id='$fcode'><img src='$flag_icon' alt='$flagcode' title='$flagcode'/></a></td>"; |
4250f386 AM |
78 | print "<td $col>$flagcode</td>"; |
79 | print "<td $col>$country</td></tr>\n"; | |
4250f386 | 80 | } |
326a764d AH |
81 | else { |
82 | $lines2++; | |
83 | if($lines2 % 2) { | |
84 | $col="style='background-color:${Header::table2colour};'"; | |
85 | } else { | |
86 | $col="style='background-color:${Header::table1colour};'"; | |
87 | } | |
88 | print "<tr>"; | |
3ea01fe0 | 89 | print "<td $col><a id='$fcode'><img src='$flag_icon' alt='$flagcode' title='$flagcode'/></a></td>"; |
326a764d AH |
90 | print "<td $col>$flagcode</td>"; |
91 | print "<td $col>$country</td>"; | |
92 | print "<td $col> </td>"; | |
dace10b5 | 93 | } |
dace10b5 MT |
94 | } |
95 | ||
96 | ||
326a764d | 97 | print "</table>"; |
dace10b5 MT |
98 | &Header::closebox(); |
99 | ||
100 | &Header::closebigbox(); | |
101 | ||
102 | print <<END | |
326a764d AH |
103 | <div style='text-align:center'> |
104 | <a href='$ENV{'HTTP_REFERER'}'>$Lang::tr{'back'}</a> | |
dace10b5 MT |
105 | </div> |
106 | END | |
107 | ; | |
108 | ||
109 | &Header::closepage(); | |
110 | ||
111 |