]>
Commit | Line | Data |
---|---|---|
dace10b5 MT |
1 | #!/usr/bin/perl |
2 | # | |
3 | # | |
4 | # This code is distributed under the terms of the GPL | |
5 | # | |
6 | # Country Codes | |
7 | # | |
8 | # 01.01.2006 Stephen Crooks | |
9 | ||
10 | use strict; | |
11 | ||
12 | use Locale::Country; | |
13 | ||
14 | my $flagdir = '/home/httpd/html/images/flags'; | |
15 | my $lines = '1'; | |
16 | my $lines2 = ''; | |
17 | my @flaglist=(); | |
18 | my @flaglistfiles=(); | |
19 | my $flag = ''; | |
20 | ||
df8c7810 | 21 | require '/var/ipfire/general-functions.pl'; |
dace10b5 MT |
22 | require "${General::swroot}/lang.pl"; |
23 | require "${General::swroot}/header.pl"; | |
24 | ||
25 | &Header::showhttpheaders(); | |
26 | ||
27 | &Header::openpage('Country Codes', 1, ''); | |
28 | &Header::openbigbox('100%', 'LEFT'); | |
29 | ||
30 | &Header::openbox('100%', 'LEFT', 'Flags & Country Codes:'); | |
31 | print "<TABLE WIDTH='100%'>"; | |
32 | print "<tr><td width='5%'><b>Flag</b></td>"; | |
33 | print "<td width='5%'><b>Code</b></td>"; | |
34 | print "<td width='40%'><b>Country</b></td>"; | |
35 | print "<td><b> </b></td>"; | |
36 | print "<td width='5%'><b>Flag</b></td>"; | |
37 | print "<td width='5%'><b>Code</b></td>"; | |
38 | print "<td width='40%'><b>Country</b></td></tr>"; | |
39 | ||
40 | @flaglist = <$flagdir/*>; | |
41 | ||
42 | undef @flaglistfiles; | |
43 | ||
44 | foreach (@flaglist) | |
45 | { | |
46 | if (!-d) { push(@flaglistfiles,substr($_,rindex($_,"/")+1)); } | |
47 | } | |
48 | ||
49 | foreach $flag (@flaglistfiles) | |
50 | { | |
51 | $lines++; | |
52 | ||
53 | my $flagcode = uc(substr($flag, 0, 2)); | |
54 | my $fcode = lc($flagcode); | |
55 | my $country = Locale::Country::code2country($fcode); | |
56 | if($fcode eq 'eu') { $country = 'Europe'; } | |
57 | if($fcode eq 'tp') { $country = 'East Timor'; } | |
58 | if($fcode eq 'yu') { $country = 'Yugoslavia'; } | |
59 | if ($lines % 2) { | |
60 | print "<td><a name='$fcode'/><img src='/images/flags/$fcode.png' border='0' align='absmiddle' alt='$flagcode'</td>"; | |
61 | print "<td>$flagcode</td>"; | |
62 | print "<td>$country</td></tr>\n"; | |
63 | } | |
64 | else { | |
65 | $lines2++; | |
66 | if($lines2 % 2) { | |
67 | print "<tr bgcolor='${Header::table1colour}'>"; | |
68 | } else { | |
69 | print "<tr bgcolor='${Header::table2colour}'>"; | |
70 | } | |
71 | print "<td><a name='$fcode'/><img src='/images/flags/$fcode.png' border='0' align='absmiddle' alt='$flagcode'</td>"; | |
72 | print "<td>$flagcode</td>"; | |
73 | print "<td>$country</td>"; | |
74 | #print "<td><img src='/blob.gif' alt='*' /></td>"; | |
75 | print "<td> </td>"; | |
76 | } | |
77 | } | |
78 | ||
79 | ||
80 | print "</TABLE>"; | |
81 | &Header::closebox(); | |
82 | ||
83 | &Header::closebigbox(); | |
84 | ||
85 | print <<END | |
86 | <div align='center'> | |
87 | <table width='80%'> | |
88 | <tr> | |
89 | <td align='center'><a href='$ENV{'HTTP_REFERER'}'>$Lang::tr{'back'}</a></td> | |
90 | </tr> | |
91 | </table> | |
92 | </div> | |
93 | END | |
94 | ; | |
95 | ||
96 | &Header::closepage(); | |
97 | ||
98 |