CVS commit by binner: show "[stable only]" where known, hide those when requesting unstable/ M +23 -9 download.php 1.20 --- www/areas/download/download.php #1.19:1.20 @@ -11,4 +11,5 @@ $uri = htmlspecialchars(($HTTP_GET_VARS["url"])); + $requested_unstable = strpos($uri, 'nstable'); $redirectme = (strpos($HTTP_SERVER_VARS['HTTP_USER_AGENT'], "Wget") !== false); @@ -16,4 +17,5 @@ $local_sites = Array(); $nonpreferred_sites = Array(); + $content_type = Array(); $preferred_count = 20; @@ -66,5 +68,5 @@ list($url, $stamp, $state) = explode(" ", $buffer); - + # check if this mirror recently updated if(strlen($url) > 0 and $state == "ok" and @@ -77,12 +79,24 @@ while (!feof($handle)) { $buffer = fgets($handle, 512); - + + if (!strpos($buffer, "# stable only")==false) { + $site_has_unstable = false; + $content = " [stable only]"; + } + else { + $site_has_unstable = true; + $content = ""; + } + list($type, $mc, $url) = preg_split("/\s/", $buffer, -1, PREG_SPLIT_NO_EMPTY); if(array_key_exists(strtolower($url), $candidates)) { - if (strcasecmp($mc, $countrycode) == 0) - $local_sites[strtolower($url)] = $url; - else - $nonpreferred_sites[strtolower($url)] = $url; + if (!$requested_unstable or $site_has_unstable) { + $content_type[strtolower($url)] = $content; + if (strcasecmp($mc, $countrycode) == 0) + $local_sites[strtolower($url)] = $url; + else + $nonpreferred_sites[strtolower($url)] = $url; + } } } @@ -110,5 +124,5 @@ foreach ($ra as $i => $u) { $v = preg_replace("/^(.*:..[^\\/]+).*$/", "$1", $local_sites[$u]); - echo "