aboutsummaryrefslogtreecommitdiffstats
path: root/mirrors.php
blob: 392e3b0d6492ea17609c6407445c8245848164b4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
<?php
/**
*/

// update this list from mirrors.mageia.org
/* @fixme note to self: brains! */
$mirrors = array(
    'China' => array(
        'Beijing' => array(
            'http://fundawang.lcuc.org.cn/mageia/'
        )
    ),
    'Czech Republic' => array(
        'Praha' =>  array(
            'http://mageia.supp.name/'
        ),
        '?' => array(
            'ftp://ftp.sh.cvut.cz/MIRRORS/mageia/',
            'http://ftp.sh.cvut.cz/MIRRORS/mageia/'
        )
    ),
    'Deutschland' => array(
        'Erfurt' => array(
            'http://ftp.mandrivauser.de/mirrors/Mageia/',
            'ftp://ftp.mandrivauser.de/mirrors/Mageia/'
        ),
        'Erlangen' => array(
            'http://ftp.uni-erlangen.de/mirrors/Mageia/',
            'ftp://ftp.uni-erlangen.de/mirrors/Mageia/'
        ),
        'Esslingen' => array(
            'http://ftp-stud.hs-esslingen.de/pub/Mirrors/Mageia/',
            'ftp://ftp-stud.hs-esslingen.de/pub/Mirrors/Mageia/'
        )
    ),
    'France' => array(
        'Paris' => array(
            'http://distrib-coffee.ipsl.jussieu.fr/pub/linux/Mageia/',
            'ftp://distrib-coffee.ipsl.jussieu.fr/pub/linux/Mageia/'
        )
    ),
    'Ελλάδα' => array(
        'Ηράκλειον' => array(
            'http://ftp.cc.uoc.gr/mirrors/linux/mageia',
            'ftp://ftp.cc.uoc.gr/mirrors/linux/mageia'
        )
    ),
    'Schweitz' => array(
        'Geneva' => array(
            'http://mageia.unige.ch/mirror/'
        ),
        'Lucern' => array(
            'ftp://ftp.LinuxCabal.org/pub/mirrors/Mageia/'
        )
    ),
    'Nouvelle Calédonie' => array(
        'Nouméa' => array(
            'http://mageia.nautile.nc/mageia/'
        )
    ),
    'USA' => array(
        'Durham' => array(
            'ftp://distro.ibiblio.org/pub/linux/distributions/mageia/',
            'http://distro.ibiblio.org/pub/linux/distributions/mageia/'
        )
    )
);

// update this list 
$headers = array(
    'en' => array('Location', 'Protocol', 'Server'),
    'de' => array('Ort', 'Protokoll', 'Server'),
    'el' => array('Τοποθεσία', 'Πρωτόκολλο', 'Εξυπηρετητής'),
    'et' => array('Asukoht', 'Protokoll', 'Serveur'),
    'fr' => array('Emplacement', 'Protocole', 'Serveur'),
    'it' => array('Posizione', 'Protocollo', 'Server'),
    'pl' => array('Położenie', 'Protokół', 'Serwer'),
    'pt' => array('Localização', 'Protocolo', 'Servidor'),
    'ro' => array('Locație', 'Protocol', 'Server'),
    'ru' => array('Расположение', 'Протокол', 'Сервер'),
    'tr' => array('Yer', 'Protokol', 'Sunucu'),
    'zh-tw' => array('位置', '協定', '伺服器'),
    
);
$hl = array_key_exists($locale, $headers) ? $locale : 'en';

$s = '';
foreach ($mirrors as $country => $cities):
    $s_cities = '';
    $rowspan = 0;
    foreach ($cities as $city => $servers):
        $s_mirrors = '';
        foreach ($servers as $url):
            $pu = parse_url($url);
            $s_mirrors .= sprintf('<td>%s</td><td><a href="%s%s">%s</a></td></tr>',
                strtoupper($pu['scheme']),
                $url, 'iso/cauldron/', $pu['host']);
        endforeach;
        $s_cities .= sprintf('<td class="city" rowspan="%d">%s</td>',
            count($servers), $city) . $s_mirrors;
        
        $rowspan += count($servers);
    endforeach;
    
    $s .= sprintf('<tr><td class="country" rowspan="%d">%s</td>',
        $rowspan, $country) . $s_cities;
endforeach;

$th = array('<thead>', '<tr>',
    sprintf('<th colspan="2">%s</th><th>%s</th><th>%s</th>',
        $headers[$hl][0],
        $headers[$hl][1],
        $headers[$hl][2]),
    '</tr>', '</thead>');

echo '<br /><table id="dl-table">', implode($th), '<tbody>';
echo $s;
echo '</tbody></table>';