X-Git-Url: https://git.p6c8.net/jirafeau.git/blobdiff_plain/48fd211cd255ea9ff05d0556eed4b6033683794a..b8d29136e66d51b7ed00d8f34deace7a58c82aaf:/lib/functions.php diff --git a/lib/functions.php b/lib/functions.php index 536bfe1..1e084fb 100644 --- a/lib/functions.php +++ b/lib/functions.php @@ -190,6 +190,9 @@ function jirafeau_ini_to_bytes($value) $modifier = substr($value, -1); $bytes = substr($value, 0, -1); switch (strtoupper($modifier)) { + default: + return intval($value); + break; case 'P': $bytes *= 1024; // no break @@ -235,13 +238,22 @@ function jirafeau_get_max_upload_size() */ function jirafeau_get_max_upload_chunk_size_bytes($max_upload_chunk_size_bytes = 0) { - if ($max_upload_chunk_size_bytes > 0) { - return min( - jirafeau_get_max_upload_size_bytes(), - $max_upload_chunk_size_bytes - ); + if ($max_upload_chunk_size_bytes == 0) { + $size = jirafeau_get_max_upload_size_bytes(); + // Jirafeau must choose an arbitrary number as PHP config does not give any limit nor $max_upload_chunk_size_bytes + if ($size == 0) { + return 10000000; // 10MB + } + return $size; + } + $size = min( + jirafeau_get_max_upload_size_bytes(), + $max_upload_chunk_size_bytes + ); + if ($size == 0) { + return $max_upload_chunk_size_bytes; } - return jirafeau_get_max_upload_size_bytes(); + return $size; } /**