Merge branch '16.0' of git@github.com:Dolibarr/dolibarr.git into 16.0

This commit is contained in:
Laurent Destailleur 2022-08-25 14:32:09 +02:00
commit 5328ca0041

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2005-2016 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2005-2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr> * Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2022 Charlene Benke <charlene@patas-monkey.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -625,7 +626,7 @@ if ($step == 3 && $datatoimport) {
$maxfilesizearray = getMaxFileSizeArray(); $maxfilesizearray = getMaxFileSizeArray();
$maxmin = $maxfilesizearray['maxmin']; $maxmin = $maxfilesizearray['maxmin'];
if ($maxmin > 0) { if ($maxmin > 0) {
$texte .= '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">'; // MAX_FILE_SIZE must precede the field type=file print '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">'; // MAX_FILE_SIZE must precede the field type=file
} }
print '<input type="file" name="userfile" size="20" maxlength="80"> &nbsp; &nbsp; '; print '<input type="file" name="userfile" size="20" maxlength="80"> &nbsp; &nbsp; ';
$out = (empty($conf->global->MAIN_UPLOAD_DOC) ? ' disabled' : ''); $out = (empty($conf->global->MAIN_UPLOAD_DOC) ? ' disabled' : '');
@ -635,29 +636,29 @@ if ($step == 3 && $datatoimport) {
$max = $conf->global->MAIN_UPLOAD_DOC; // In Kb $max = $conf->global->MAIN_UPLOAD_DOC; // In Kb
$maxphp = @ini_get('upload_max_filesize'); // In unknown $maxphp = @ini_get('upload_max_filesize'); // In unknown
if (preg_match('/k$/i', $maxphp)) { if (preg_match('/k$/i', $maxphp)) {
$maxphp = $maxphp * 1; $maxphp = (int) substr($maxphp, 0, -1) * 1;
} }
if (preg_match('/m$/i', $maxphp)) { if (preg_match('/m$/i', $maxphp)) {
$maxphp = $maxphp * 1024; $maxphp = (int) substr($maxphp, 0, -1) * 1024;
} }
if (preg_match('/g$/i', $maxphp)) { if (preg_match('/g$/i', $maxphp)) {
$maxphp = $maxphp * 1024 * 1024; $maxphp = (int) substr($maxphp, 0, -1) * 1024 * 1024;
} }
if (preg_match('/t$/i', $maxphp)) { if (preg_match('/t$/i', $maxphp)) {
$maxphp = $maxphp * 1024 * 1024 * 1024; $maxphp = (int) substr($maxphp, 0, -1) * 1024 * 1024 * 1024;
} }
$maxphp2 = @ini_get('post_max_size'); // In unknown $maxphp2 = @ini_get('post_max_size'); // In unknown
if (preg_match('/k$/i', $maxphp2)) { if (preg_match('/k$/i', $maxphp2)) {
$maxphp2 = $maxphp2 * 1; $maxphp2 = (int) substr($maxphp2, 0, -1) * 1;
} }
if (preg_match('/m$/i', $maxphp2)) { if (preg_match('/m$/i', $maxphp2)) {
$maxphp2 = $maxphp2 * 1024; $maxphp2 = (int) substr($maxphp2, 0, -1) * 1024;
} }
if (preg_match('/g$/i', $maxphp2)) { if (preg_match('/g$/i', $maxphp2)) {
$maxphp2 = $maxphp2 * 1024 * 1024; $maxphp2 = (int) substr($maxphp2, 0, -1) * 1024 * 1024;
} }
if (preg_match('/t$/i', $maxphp2)) { if (preg_match('/t$/i', $maxphp2)) {
$maxphp2 = $maxphp2 * 1024 * 1024 * 1024; $maxphp2 = (int) substr($maxphp2, 0, -1) * 1024 * 1024 * 1024;
} }
// Now $max and $maxphp and $maxphp2 are in Kb // Now $max and $maxphp and $maxphp2 are in Kb
$maxmin = $max; $maxmin = $max;