예제 #1
0
</p>

<p>
 Please note that in case the site finds your preferred mirror site disabled
 for some reason, it will fall back to the automatic selection procedure, but
 will not alter your preferences, so next time when your selected server works,
 the redirections will lead you there. 
</p>

<div class="indent">
 <select name="mirror">
<?php 
$mirror = myphpnet_mirror();
foreach ($mirror_sites as $murl => $mdata) {
    // Skip inactive mirrors
    if (mirror_status($murl) != MIRROR_OK || $murl == "http://www.php.net/") {
        continue;
    }
    // Compute user friendly mirror name
    if ($murl == "NONE") {
        $mname = "Automatic selection (default)";
    } else {
        $tmpurl = " (" . substr($murl, strpos($murl, '//') + 2, -1) . ")";
        if (isset($COUNTRIES[$mdata[0]])) {
            $mname = $COUNTRIES[$mdata[0]] . $tmpurl;
        } else {
            $mname = "Unknown" . $tmpurl;
        }
    }
    // Print out mirror option with selection if needed
    printf("  <option value=\"{$murl}\"%s>{$mname}</option>\n", $mirror == $murl ? ' selected="selected"' : '');
예제 #2
0
global $MIRRORS, $COUNTRIES;
// Lets group the mirrors by country code, for easy output on the page.
$grouped_mirrors = array();
foreach ($MIRRORS as $key => $mirror) {
    if (!isset($grouped_mirrors[$mirror[0]])) {
        $grouped_mirrors[$mirror[0]] = array();
    }
    $grouped_mirrors[$mirror[0]][] = array('url' => $key, 'country_code' => $mirror[0], 'title' => $COUNTRIES[$mirror[0]], 'provider_title' => $mirror[1], 'provider_url' => $mirror[3]);
}
foreach ($grouped_mirrors as $country) {
    $first = true;
    foreach ($country as $mirror) {
        $murl = $mirror['url'];
        $country = $mirror['country_code'];
        // If the mirror is not all right or it is virtual (not an official mirror), skip it
        if (mirror_status($mirror['url']) != MIRROR_OK || mirror_type($mirror['url']) == MIRROR_VIRTUAL) {
            continue;
        }
        // Get the country code and check if it is matching the country provided (or does not
        // match the country, which it should not be)
        $country = mirror_country($mirror['url']);
        if ($first) {
            ?>

        <div class="mirror">
            <div class="title"><?php 
            echo $mirror['title'];
            ?>
</div>
            <div class="flag">
                <img alt="<?php