diff options
author | filip <filip.komar@gmail.com> | 2016-05-19 00:26:48 +0200 |
---|---|---|
committer | filip <filip.komar@gmail.com> | 2016-05-19 00:26:48 +0200 |
commit | e25e4fcb8927a2831e756baf119cfe5f467a00c8 (patch) | |
tree | 5d4ad13412057a0a8230b8372832bd7b57d2a548 /en/downloads | |
parent | a07cdad7531caf3c046b30dae24b09a7b9be4b35 (diff) | |
download | www-e25e4fcb8927a2831e756baf119cfe5f467a00c8.tar www-e25e4fcb8927a2831e756baf119cfe5f467a00c8.tar.gz www-e25e4fcb8927a2831e756baf119cfe5f467a00c8.tar.bz2 www-e25e4fcb8927a2831e756baf119cfe5f467a00c8.tar.xz www-e25e4fcb8927a2831e756baf119cfe5f467a00c8.zip |
adding signature links + refresh i19n
Diffstat (limited to 'en/downloads')
-rw-r--r-- | en/downloads/get/index.php | 37 | ||||
-rw-r--r-- | en/downloads/get/lib.php | 30 |
2 files changed, 46 insertions, 21 deletions
diff --git a/en/downloads/get/index.php b/en/downloads/get/index.php index 2b7cfed17..43c415c21 100644 --- a/en/downloads/get/index.php +++ b/en/downloads/get/index.php @@ -234,15 +234,20 @@ if (!isset($_SERVER['APP_MODE']) || $_SERVER['APP_MODE'] == 'prod') { $checksums = array('md5', 'sha1', 'sha512'); $sum_links = array(); $chksm_cmd = ''; +$sig_links = array(); foreach ($checksums as $checksum) { - if (array_key_exists($checksum, $product)) { - $sum_links[] = '<a href="' . $download . '.' . $checksum . '">' . basename($download) . '.' . $checksum . '</a>'; + if (isset($product[$checksum])) { + $sum_links[] = "<a href=\"$download.$checksum\">" . basename($download) . ".$checksum</a>"; $chksm_cmd .= '$ ' . $checksum . 'sum ' . basename($download) . "\n<strong>" . $product[$checksum] . "</strong>\n" . PHP_EOL; + if (isset($product["$checksum.gpg"])) { + $sig_links[] = "<a href=\"$download.$checksum.gpg\">" . basename($download) . ".$checksum.gpg</a>"; + } } } ?> <?php -$num_checksums = count($sum_links); +$num_checksums = count($sum_links); +// only output for nontorrent DL and if there are any checksums files present if ($num_checksums > 0 && !$torrent) { _g('As soon as your download is complete, you should check that the checksums match:', null, 'p'); echo PHP_EOL . '<div id="check-signs">' . PHP_EOL; @@ -250,25 +255,16 @@ if ($num_checksums > 0 && !$torrent) { echo $chksm_cmd; echo '</pre>' . PHP_EOL . '<p>'; _g('If checksums do not match, <strong>DO NOT use this ISO</strong>. Double-check and try to download again.', null, ' '); - $checksum_links = ''; - $list_sign = _r(',', ' '); - foreach ($sum_links as $checksum_link) { - $checksum_links .= $checksum_link; - if ($num_checksums == 2) { - $list_sign = ' ' . _r('and', ' '); - } else if ($num_checksums == 1) { - $list_sign = ''; - } - $checksum_links .= $list_sign; - $num_checksums--; - } - _g('Checksums are available for download as files', null, ' '); + $checksum_links = array_to_list($sum_links, ' ' . _r('and', ' '), _r(',', ' ')); + $signature_links = array_to_list($sig_links, ' ' . _r('and', ' '), _r(',', ' ')); + _g('Checksums are available for download as files:', null, ' '); echo "$checksum_links.</p>"; -// } - ?> +<?php if (count($sig_links) > 0) { // only output if there are any signatures files present ?> <p><?php _g('You can also verify the signature of an ISO.', null, ' '); -echo sprintf(_r('First you need to import the key from a <a href="%s">MIT PGP Public Key Server</a>:'), 'https://pgp.mit.edu/'); ?></p> +_g('They are also available for download as files:', null, ' '); +echo "$signature_links. "; +echo sprintf(_r('First you need to import the "Mageia Release" key from a <a href="%s">MIT PGP Public Key Server</a>:'), 'https://pgp.mit.edu/'); ?></p> <pre class="term"> $ gpg --keyserver pgp.mit.edu --recv-keys EDCA7A90 </pre> @@ -292,8 +288,9 @@ gpg: There is no indication that the signature belongs to the owner. <strong>Primary key fingerprint: B210 76A0 CBE4 D93D 66A9 D08D 835E 41F4 EDCA 7A90</strong> </pre> <p><?php _g('The warning about uncertified signature is expected.'); ?></p> +<?php } // signatures check end ?> </div> -<?php } ?> +<?php } // checksums check end ?> </div> <!-- alternative mirrors table --> diff --git a/en/downloads/get/lib.php b/en/downloads/get/lib.php index 65baa10a3..cb15c423d 100644 --- a/en/downloads/get/lib.php +++ b/en/downloads/get/lib.php @@ -162,4 +162,32 @@ function get_download_link($product, $torrent_preferred = false) } return '$MIRROR/' . $path; -}
\ No newline at end of file +} + +/** + * Builds human readable list from array with l10n option + * + * @param array $array to build the string from + * @param string $last_separator flexible (l10n) last separator + * @param string $nonlast_separator flexible (l10n) other than last separators + * + * @return string +*/ +function array_to_list($array, $last_separator = ' and ', $nonlast_separator = ', ') +{ + $num_of_values = count($array); + $output_string = ''; + $separator = $nonlast_separator; + foreach ($array as $value) { + $output_string .= $value; + if ($num_of_values == 2) { + $separator = $last_separator; + } else if ($num_of_values == 1) { + $separator = ''; + } + $output_string .= $separator; + $num_of_values--; + } + + return $output_string; +} |