diff options
Diffstat (limited to 'en/downloads')
-rw-r--r-- | en/downloads/get/definitions_doc.ini | 29 | ||||
-rw-r--r-- | en/downloads/get/index.php | 22 | ||||
-rw-r--r-- | en/downloads/get/lib.php | 5 |
3 files changed, 52 insertions, 4 deletions
diff --git a/en/downloads/get/definitions_doc.ini b/en/downloads/get/definitions_doc.ini new file mode 100644 index 000000000..4acfa8b17 --- /dev/null +++ b/en/downloads/get/definitions_doc.ini @@ -0,0 +1,29 @@ +; Downloads definitions file. +; This is a whitelist for what can be downloaded from mageia.org +; through the download redirector (to official Mageia mirrors). +; + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;;;; Mageia documentation +;;;;;;;;;;;;;;;;;;;;; + +[Mageia4_DrakX_en_epub] +size = around 2 MB +path = people/marcom/doc/mga4/epub/installer +langs = "ca|cs|de|el|en|eo|es|et|eu|fr|id|nl|pl|pt_br|ro|ru|sq|sv|tr|uk" ; it epub is currently missing + +[Mageia4_DrakX_en_pdf] +size = around 2 MB +path = people/marcom/doc/mga4/pdf/installer +langs = "ca|cs|de|el|en|eo|es|et|eu|fr|id|it|nl|pl|pt_br|ro|ru|sq|sv|tr|uk" + +[Mageia4_MCC_en_epub] +size = around 10 MB +path = people/marcom/doc/mga4/epub/mcc +langs = "de|en|et|fr|ro|ru|tr|uk" + +[Mageia4_MCC_en_pdf] +size = around 10 MB +path = people/marcom/doc/mga4/pdf/mcc +langs = "de|en|et|fr|ro|ru|tr|uk" 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); diff --git a/en/downloads/get/lib.php b/en/downloads/get/lib.php index 35bbe985c..b730b767d 100644 --- a/en/downloads/get/lib.php +++ b/en/downloads/get/lib.php @@ -22,6 +22,7 @@ $countries = array( 'CN' => '中国', // China 'CZ' => 'Česko', // Czechia 'DE' => 'Deutschland', + 'EC' => 'Ecuador', 'ES' => 'España', 'FR' => 'France', 'GB' => 'Great Britain', @@ -125,11 +126,11 @@ function get_info_for_product($product, $def_file = null) * speed * link */ -function get_mirrors_for($file, $locale = null, $country = null) +function get_mirrors_for($file, $locale = null, $country = null, $prod = true, $documentation = false) { //include '../../../lib/Downloads.php'; - $mirrors = Downloads::get_all_mirrors(); + $mirrors = Downloads::get_all_mirrors($prod, $documentation); $wsd = new Downloads(); $one = $wsd->prepare_download(true, $country); |