From: Weblate Date: Thu, 7 May 2015 16:42:47 +0000 (+0200) Subject: Merge remote-tracking branch 'origin/master' X-Git-Tag: 1.1~77 X-Git-Url: https://git.p6c8.net/jirafeau_mojo42.git/commitdiff_plain/063c21d8341dbade23c21427e6c9de447b67cc16?hp=ef7711fcbea94ca12e41a4897f5cc4ab284b4b11 Merge remote-tracking branch 'origin/master' --- diff --git a/f.php b/f.php index 59717b9..99a67df 100644 --- a/f.php +++ b/f.php @@ -240,6 +240,7 @@ if (!jirafeau_is_viewable ($link['mime_type']) || !$cfg['preview'] || $do_downlo else header ('Content-Disposition: filename="' . $link['file_name'] . '"'); header ('Content-Type: ' . $link['mime_type']); +header ('Content-MD5: ' . hex_to_base64($link['md5'])); /* Read encrypted file. */ if ($link['crypted']) diff --git a/lib/functions.php b/lib/functions.php index 77acae1..1800231 100644 --- a/lib/functions.php +++ b/lib/functions.php @@ -1134,3 +1134,14 @@ function get_ip_address($cfg) { } return $_SERVER['REMOTE_ADDR']; } + +/** + * Convert hexadecimal string to base64 + */ +function hex_to_base64($hex) +{ + $b = ''; + foreach (str_split ($hex, 2) as $pair) + $b .= chr (hexdec ($pair)); + return base64_encode ($b); +}