X-Git-Url: https://git.p6c8.net/jirafeau_mojo42.git/blobdiff_plain/03d1001bce1a6d3ba0cce77199a6e1ad686e8273..d60db9780188b973b727366f4867b8f17425c3bd:/lib/functions.php diff --git a/lib/functions.php b/lib/functions.php index 459587d..3a304a4 100644 --- a/lib/functions.php +++ b/lib/functions.php @@ -2,7 +2,7 @@ /* * Jirafeau, your web file repository * Copyright (C) 2008 Julien "axolotl" BERNARD - * Copyright (C) 2012 Jerome Jutteau + * Copyright (C) 2015 Jerome Jutteau * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as @@ -345,7 +345,9 @@ jirafeau_upload ($file, $one_time_download, $key, $time, $ip, $crypt, $link_name /* Crypt file if option is enabled. */ $crypted = false; $crypt_key = ''; - if ($crypt == true && extension_loaded('mcrypt')) + if ($crypt == true && !(extension_loaded('mcrypt') == true)) + error_log ("PHP extension mcrypt not loaded, won't encrypt in Jirafeau"); + if ($crypt == true && extension_loaded('mcrypt') == true) { $crypt_key = jirafeau_encrypt_file ($file['tmp_name'], $file['tmp_name']); if (strlen($crypt_key) > 0) @@ -451,7 +453,7 @@ jirafeau_is_viewable ($mime) if (!empty ($mime)) { /* Actually, verify if mime-type is an image or a text. */ - $viewable = array ('image', 'text'); + $viewable = array ('image', 'text', 'video', 'audio'); $decomposed = explode ('/', $mime); return in_array ($decomposed[0], $viewable); } @@ -908,7 +910,7 @@ jirafeau_async_end ($ref, $code, $crypt, $link_name_length) $crypted = false; $crypt_key = ''; - if ($crypt == true && extension_loaded('mcrypt')) + if ($crypt == true && extension_loaded('mcrypt') == true) { $crypt_key = jirafeau_encrypt_file ($p, $p); if (strlen($crypt_key) > 0) @@ -977,7 +979,7 @@ function jirafeau_encrypt_file ($fp_src, $fp_dst) { $fs = filesize ($fp_src); - if ($fs === false || $fs == 0 || !extension_loaded('mcrypt')) + if ($fs === false || $fs == 0 || !(extension_loaded('mcrypt') == true)) return ''; /* Prepare module. */ @@ -1016,7 +1018,7 @@ function jirafeau_decrypt_file ($fp_src, $fp_dst, $k) { $fs = filesize ($fp_src); - if ($fs === false || $fs == 0 || !extension_loaded('mcrypt')) + if ($fs === false || $fs == 0 || !(extension_loaded('mcrypt') == true)) return false; /* Init module */ @@ -1063,7 +1065,6 @@ function jirafeau_challenge_upload_password ($cfg, $password) forEach ($cfg['upload_password'] as $p) if ($password == $p) return true; - error_log("password not found $password"); return false; }