[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: www/areas/download
From: Stephan Binner <binner () kde ! org>
Date: 2005-04-25 21:41:56
Message-ID: 20050425214156.8788E3EF () office ! kde ! org
[Download RAW message or body]
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 "<li><a href=\"" . $local_sites[$u] . \
"$uri\">$v</a>   (" . floor((time() - $candidates[$u]) / 3600) . \
" hours)</li>\n"; + echo "<li><a href=\"" . $local_sites[$u] . \
"$uri\">$v</a>   (" . floor((time() - $candidates[$u]) / 3600) . \
" hours)" . $content_type[$u] . "</li>\n"; }
echo "</ul>\n";
@@ -135,5 +149,5 @@
$nonpref_offset = $preferred_count;
foreach ($nonpreferred_sites as $i => $v) {
- echo "<li><a href=\"$v$uri\">" . preg_replace("/^(.*:..[^\\/]+).*$/", "$1", \
$v) . "</a> </li>\n"; + echo "<li><a href=\"$v$uri\">" . \
preg_replace("/^(.*:..[^\\/]+).*$/", "$1", $v) . "</a> " . \
$content_type[$v] . "</li>\n"; if(++$cnt > $preferred_count) break;
}
@@ -152,5 +166,5 @@
foreach($nonpreferred_sites as $i => $v) {
if(++$cnt > $nonpref_offset)
- echo "<li><a href=\"$v$uri\">$v</a></li>\n";
+ echo "<li><a href=\"$v$uri\">$v</a>" . $content_type[$v] . "</li>\n";
}
?>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic