Commit b11ccbc7 authored by Ludovic Fauvet's avatar Ludovic Fauvet

New page containing the full list of mirrors

parent 03b6c92f
#countrylist {
text-align: center;
margin-bottom: 40px;
}
table.mirrortable tr.heading {
background-color: #ddd;
font-weight: bold;
}
table.mirrortable tr.heading th {
padding-left: 5px;
}
table.mirrortable tr {
border-bottom: 1px solid #ddd;
}
table.mirrortable td {
padding: 10px 25px;
line-height: 54px;
}
table.mirrortable td img {
vertical-align: middle;
}
#generated {
text-align: center;
font-style: italic;
font-size: 0.8em;
color: #888;
}
<?php
$title = "VideoLAN - Free Software and Open Source video streaming solution for every OS!";
$lang = "en";
$body_color = "red";
$additional_css = array("/style/panels.css", "/style/mirrors.css");
require($_SERVER["DOCUMENT_ROOT"]."/include/header.php");
/* Build mirror list */
// Sort the list by country
function sortList($a, $b)
{
return strcmp($a['country'], $b['country']);
}
// Fetch the mirrors list
$content = file_get_contents("http://get.videolan.org/mirror-list.php");
if ($http_response_header[0] == "HTTP/1.1 200 OK")
{
$f = fopen("mirrors.txt", 'w');
if ($f)
{
fwrite($f, date('r')."\n");
fwrite($f, $content);
fclose($f);
}
}
$mirrors = array();
// Parse the mirrors list
$f = fopen("mirrors.txt", 'r');
if ($f)
{
if (!feof($f))
$update = fgets($f);
$i = 0;
while (!feof($f))
{
$line = fgets($f);
if (empty($line))
continue;
list($name, $url, $logo, $region, $country) = explode('|', $line);
$mirrors[$i]['name'] = $name;
$mirrors[$i]['url'] = $url;
$mirrors[$i]['logo'] = $logo;
$mirrors[$i]['region'] = $region;
$mirrors[$i]['country'] = $country;
$i++;
}
fclose($f);
usort($mirrors, 'sortList');
}
// Generate the shorcuts
$country = $shortcuts = "";
foreach($mirrors as $mirror)
{
if ($mirror['country'] != $country)
{
$country = $mirror['country'];
$shortcuts .= "<a href=\"#$country\">$country</a> - ";
}
}
$shortcuts = trim($shortcuts, "- ");
?>
<div>
<h1 class="bigtitle">Mirrors</h1>
<div class="projectDescription" style="clear: left;">
The VideoLAN projects rely on several mirrors distributed<br />
around the globe in order to provide faster downloads and<br />
are kindly operated by sponsors.<br/>
To be part of our mirror infrastructure please <a href="mailto:roots[@]videolan[.]org">contact us</a>.
</div>
<div style='clear: both; margin-top: 40px;'>
<div id="countrylist">
<?php echo $shortcuts; ?>
</div>
<table class="mirrortable">
<?php
$country = "";
foreach ($mirrors as $mirror)
{
if ($mirror['country'] != $country)
{
$country = $mirror['country'];
echo "<tr class=\"heading\"><th colspan=\"2\"><a name=\"$country\"></a>$country</th></tr>";
}
echo "<tr><td width=\"100%\"><a href=\"{$mirror['url']}\">{$mirror['name']}</a></td>"
."<td><a href=\"{$mirror['url']}\"><img src=\"{$mirror['logo']}\" /></a></td></tr>";
}
?>
</table>
<div id="generated">Generated on <?php echo $update ?></div>
</div>
</div>
<?php footer('$Id: mirror.php 1 2013-03-25 14:45:00Z etix $'); ?>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment