From e25e4fcb8927a2831e756baf119cfe5f467a00c8 Mon Sep 17 00:00:00 2001 From: filip Date: Thu, 19 May 2016 00:26:48 +0200 Subject: adding signature links + refresh i19n --- en/downloads/get/index.php | 37 +++++++++++++++++-------------------- en/downloads/get/lib.php | 30 +++++++++++++++++++++++++++++- 2 files changed, 46 insertions(+), 21 deletions(-) (limited to 'en/downloads') 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[] = '' . basename($download) . '.' . $checksum . ''; + if (isset($product[$checksum])) { + $sum_links[] = "" . basename($download) . ".$checksum"; $chksm_cmd .= '$ ' . $checksum . 'sum ' . basename($download) . "\n" . $product[$checksum] . "\n" . PHP_EOL; + if (isset($product["$checksum.gpg"])) { + $sig_links[] = "" . basename($download) . ".$checksum.gpg"; + } } } ?> 0 && !$torrent) { _g('As soon as your download is complete, you should check that the checksums match:', null, 'p'); echo PHP_EOL . '
' . PHP_EOL; @@ -250,25 +255,16 @@ if ($num_checksums > 0 && !$torrent) { echo $chksm_cmd; echo '' . PHP_EOL . '

'; _g('If checksums do not match, DO NOT use this ISO. 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.

"; -// } - ?> + 0) { // only output if there are any signatures files present ?>

MIT PGP Public Key Server:'), 'https://pgp.mit.edu/'); ?>

+_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 MIT PGP Public Key Server:'), 'https://pgp.mit.edu/'); ?>

 $ gpg --keyserver pgp.mit.edu --recv-keys EDCA7A90
 
@@ -292,8 +288,9 @@ gpg: There is no indication that the signature belongs to the owner. Primary key fingerprint: B210 76A0 CBE4 D93D 66A9 D08D 835E 41F4 EDCA 7A90

+
- + 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; +} -- cgit v1.2.1