]> git.ipfire.org Git - ipfire-2.x.git/blame - html/cgi-bin/country.cgi
HinzugefĆ¼gt:
[ipfire-2.x.git] / html / cgi-bin / country.cgi
CommitLineData
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
10use strict;
11
12use Locale::Country;
13
14my $flagdir = '/home/httpd/html/images/flags';
15my $lines = '1';
16my $lines2 = '';
17my @flaglist=();
18my @flaglistfiles=();
19my $flag = '';
20
df8c7810 21require '/var/ipfire/general-functions.pl';
dace10b5
MT
22require "${General::swroot}/lang.pl";
23require "${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:');
31print "<TABLE WIDTH='100%'>";
32print "<tr><td width='5%'><b>Flag</b></td>";
33print "<td width='5%'><b>Code</b></td>";
34print "<td width='40%'><b>Country</b></td>";
35print "<td><b>&nbsp;</b></td>";
36print "<td width='5%'><b>Flag</b></td>";
37print "<td width='5%'><b>Code</b></td>";
38print "<td width='40%'><b>Country</b></td></tr>";
39
40@flaglist = <$flagdir/*>;
41
42undef @flaglistfiles;
43
44foreach (@flaglist)
45{
46 if (!-d) { push(@flaglistfiles,substr($_,rindex($_,"/")+1)); }
47}
48
49foreach $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>&nbsp;</td>";
76 }
77}
78
79
80print "</TABLE>";
81&Header::closebox();
82
83&Header::closebigbox();
84
85print <<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>
93END
94;
95
96&Header::closepage();
97
98