aboutsummaryrefslogtreecommitdiffstats
path: root/en/downloads/get/index.php
diff options
context:
space:
mode:
authorfilip <filip.komar@gmail.com>2015-05-02 16:13:53 +0200
committerfilip <filip.komar@gmail.com>2015-05-02 16:13:53 +0200
commite31ec4507c495254239f11841d81c865e80e41a9 (patch)
treee0c62b5c7cc2e0564e7ae13d6ce8e82a6058da78 /en/downloads/get/index.php
parentc2158bebcc570b4f1a573122a546310268434e9e (diff)
downloadwww-e31ec4507c495254239f11841d81c865e80e41a9.tar
www-e31ec4507c495254239f11841d81c865e80e41a9.tar.gz
www-e31ec4507c495254239f11841d81c865e80e41a9.tar.bz2
www-e31ec4507c495254239f11841d81c865e80e41a9.tar.xz
www-e31ec4507c495254239f11841d81c865e80e41a9.zip
adding download of pdf and epub file infrastructure
Diffstat (limited to 'en/downloads/get/index.php')
-rw-r--r--en/downloads/get/index.php22
1 files changed, 20 insertions, 2 deletions
diff --git a/en/downloads/get/index.php b/en/downloads/get/index.php
index 0678b9f0a..fc4497f98 100644
--- a/en/downloads/get/index.php
+++ b/en/downloads/get/index.php
@@ -37,6 +37,7 @@ require 'lib.php';
// request
$product = get('q');
+$doc = get('doc');
$debug = get('d');
if (isset($_GET['torrent'])) {
$torrent = strip_tags(trim($_GET['torrent']));
@@ -58,14 +59,31 @@ session_start();
$download = null;
$js_redirect = null;
$reason = null;
+if ($doc == 'yes') {
+ $def_file = 'definitions_doc.ini';
+ list($release, $type, $lang, $extension) = explode('_', $product); // 'Mageia4_DrakX_en_epub'
+ $product = implode('_', array($release, $type, 'en', $extension));
+ $documentation = true;
+} else {
+ $def_file = 'definitions.ini';
+ $documentation = false;
+}
try {
// TODO simplify and wrap all this in a single interface:
// list(dl_template, mirrors) = get_download_options_for(product)
// Step 1.
include '../../../lib/Downloads.php';
- $product = get_info_for_product($product);
- $all_mirrors = get_mirrors_for($product['file'], 'en', get('country'));
+ $product = get_info_for_product($product, $def_file);
+ if ($doc == 'yes') {
+ $langs = explode('|', $product['langs']);
+ if (!in_array($lang, $langs)) {
+ $lang = 'en'; // fallback language
+ }
+ $product['file'] = $release . '-' . $type . '-' . $lang . '.' . $extension;
+ $product['name'] = $product['file'];
+ }
+ $all_mirrors = get_mirrors_for($product['file'], 'en', get('country'), true, $documentation);
$one_mirror = $all_mirrors[0];
$alt_mirrors = $all_mirrors[1];
$download_tmpl = get_download_link($product, $torrent);