aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRomain d'Alverny <rda@mageia.org>2011-04-05 20:37:55 +0000
committerRomain d'Alverny <rda@mageia.org>2011-04-05 20:37:55 +0000
commit5cf210c9459bd601c5d4291786f595e711daa009 (patch)
tree266920431e88855ba3de2c0d2866fbe88e74b195
parent0a7b2c6184d7b8cf82f6b374734c29b49c85a4f6 (diff)
downloadwww-5cf210c9459bd601c5d4291786f595e711daa009.tar
www-5cf210c9459bd601c5d4291786f595e711daa009.tar.gz
www-5cf210c9459bd601c5d4291786f595e711daa009.tar.bz2
www-5cf210c9459bd601c5d4291786f595e711daa009.tar.xz
www-5cf210c9459bd601c5d4291786f595e711daa009.zip
add torrent links (tmb)
-rw-r--r--downloads.ini3
-rw-r--r--downloads.php11
-rw-r--r--en/downloads/dl.php19
3 files changed, 25 insertions, 8 deletions
diff --git a/downloads.ini b/downloads.ini
index ddbf16734..ca8eb6cd3 100644
--- a/downloads.ini
+++ b/downloads.ini
@@ -12,6 +12,7 @@ lang = All supported
md5 = a1e32b5617184c59b462a5d9a67e53ad
sha1 = f3cac56973a54871c0a21b89f0ec18e447670e2a
path = iso/cauldron/mageia-dvd-1-Beta1-i586.iso
+torrent = iso/cauldron/torrents/Mageia-1-Beta-1-i586-dvd.torrent
[dvd-x86_64]
name = 64bit DVD
@@ -20,6 +21,7 @@ lang = All supported
md5 = 6365a5eb6b9d599f0b1e58ee6d09948f
sha1 = 579b60f570ae30f8ddbc46b00a2b9177cd80031a
path = iso/cauldron/mageia-dvd-1-Beta1-x86_64.iso
+torrent = iso/cauldron/torrents/Mageia-1-Beta-1-x_86_64-dvd.torrent
[cd-dualarch]
name = Dual arch CD
@@ -28,6 +30,7 @@ lang = All supported
md5 = 687ffabed3cc2deff71c8156cea84438
sha1 = d7b4d4337bfdae311081267601c6b053b46858c8
path = iso/cauldron/mageia-dual-1-Beta1.iso
+torrent = iso/cauldron/torrents/Mageia-1-Beta-1-dual-arch-cd.torrent
;[live-kde-europa-cd-i586]
;name = Live KDE CD
diff --git a/downloads.php b/downloads.php
index 7076aa8d1..0286ce2e1 100644
--- a/downloads.php
+++ b/downloads.php
@@ -32,11 +32,10 @@ $tmpl = <<<T
<td class="lang">%s</td>
<td class="size">%s</td>
<td class="link"><a href="%s" rel="nofollow">%s</a></td>
-
+<td class="link"><a href="%s" rel="nofollow">%s</a></td>
</tr>
T;
//<td class="pop"><span class="pop_%s">%s</span></td>
-//<td class="link"><a href="%s" rel="nofollow">%s</a></td>
$s = '';
$glob = array_shift($prods);
@@ -46,14 +45,17 @@ foreach ($prods as $k => $p) {
$iso = sprintf('%s-%s', $glob['prefix'], $k);
$dl_link = sprintf('/%s/downloads/dl.php?product=%s', $locale, $iso);
- $bt_link = sprintf('/%s/downloads/dl.php?product=%s&torrent=1', $locale, $iso);
+ $bt_link = isset($p['torrent']) ?
+ sprintf('/%s/downloads/dl.php?product=%s&torrent=1', $locale, $iso) :
+ null;
+
$pop = rand(0,5);
$s .= sprintf($tmpl,
'', //($i == 0) ? ' class="reco"' : '',
$p['name'], $p['lang'], $p['size'],
//$pop, $pop,
$dl_link, $_t['download'],
- $bt_link, $_t['download']);
+ $bt_link, !is_null($bt_link) ? $_t['download'] : '');
$i++;
}
@@ -66,6 +68,7 @@ $dl_table = <<<T
<th>{$_t['language']}</th>
<th class="size">{$_t['size']}</th>
<th>{$_t['link']}</th>
+ <th>BitTorrent</th>
</tr>
</thead>
<tbody>
diff --git a/en/downloads/dl.php b/en/downloads/dl.php
index 635f73eea..1ca6ccef5 100644
--- a/en/downloads/dl.php
+++ b/en/downloads/dl.php
@@ -32,10 +32,21 @@ $product_iso = $product . '.iso';
$wsd = new Downloads('en', null);
$a = $wsd->prepare_download(null, true);
-if (isset($p['path']))
- $dl_link = sprintf('%s/%s', $a['mirror_url'], $p['path']);
-else
- $dl_link = sprintf('%s/%s/%s', $a['mirror_url'], 'iso/cauldron', $product_iso);
+if ($torrent) {
+ if (isset($p['torrent'])) {
+ $dl_link = sprintf('%s/%s', $a['mirror_url'], $p['torrent']);
+ }
+ else {
+ header('Location: /downloads/');
+ die;
+ }
+}
+else {
+ if (isset($p['path']))
+ $dl_link = sprintf('%s/%s', $a['mirror_url'], $p['path']);
+ else
+ $dl_link = sprintf('%s/%s/%s', $a['mirror_url'], 'iso/cauldron', $product_iso);
+}
// @fixme (rda) actually, http-equiv="refresh" is deprecated behaviour now.
// @fixme (rda) see http://www.w3.org/TR/WCAG10-HTML-TECHS/#meta-element