php V8 warning, import max size not used

This commit is contained in:
This Charlène 2022-08-23 12:26:21 +02:00 committed by GitHub
parent 9f3ed07e87
commit 7f1a37da3e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2005-2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* 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
* it under the terms of the GNU General Public License as published by
@ -624,9 +625,9 @@ if ($step == 3 && $datatoimport) {
print '<div class="marginbottomonly">';
$maxfilesizearray = getMaxFileSizeArray();
$maxmin = $maxfilesizearray['maxmin'];
if ($maxmin > 0) {
$texte .= '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">'; // MAX_FILE_SIZE must precede the field type=file
}
//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="file" name="userfile" size="20" maxlength="80"> &nbsp; &nbsp; ';
$out = (empty($conf->global->MAIN_UPLOAD_DOC) ? ' disabled' : '');
print '<input type="submit" class="button small" value="'.$langs->trans("AddFile").'"'.$out.' name="sendit">';
@ -635,29 +636,29 @@ if ($step == 3 && $datatoimport) {
$max = $conf->global->MAIN_UPLOAD_DOC; // In Kb
$maxphp = @ini_get('upload_max_filesize'); // In unknown
if (preg_match('/k$/i', $maxphp)) {
$maxphp = $maxphp * 1;
$maxphp = (int)substr($maxphp, 0, -1) * 1;
}
if (preg_match('/m$/i', $maxphp)) {
$maxphp = $maxphp * 1024;
$maxphp = (int)substr($maxphp, 0, -1) * 1024;
}
if (preg_match('/g$/i', $maxphp)) {
$maxphp = $maxphp * 1024 * 1024;
$maxphp = (int)substr($maxphp, 0, -1) * 1024 * 1024;
}
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
if (preg_match('/k$/i', $maxphp2)) {
$maxphp2 = $maxphp2 * 1;
$maxphp2 = (int)substr($maxphp2, 0, -1) * 1;
}
if (preg_match('/m$/i', $maxphp2)) {
$maxphp2 = $maxphp2 * 1024;
$maxphp2 = (int)substr($maxphp2, 0, -1) * 1024;
}
if (preg_match('/g$/i', $maxphp2)) {
$maxphp2 = $maxphp2 * 1024 * 1024;
$maxphp2 = (int)substr($maxphp2, 0, -1) * 1024 * 1024;
}
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
$maxmin = $max;