forked from Wavyzz/dolibarr
FIX Limit of uploaded files (max_post_size was not used)
This commit is contained in:
@@ -1027,15 +1027,35 @@ if ($mode == 'deploy')
|
||||
|
||||
print $langs->trans("YouCanSubmitFile");
|
||||
|
||||
$max=$conf->global->MAIN_UPLOAD_DOC; // En Kb
|
||||
$maxphp=@ini_get('upload_max_filesize'); // En inconnu
|
||||
$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;
|
||||
if (preg_match('/m$/i', $maxphp)) $maxphp=$maxphp*1024;
|
||||
if (preg_match('/g$/i', $maxphp)) $maxphp=$maxphp*1024*1024;
|
||||
if (preg_match('/t$/i', $maxphp)) $maxphp=$maxphp*1024*1024*1024;
|
||||
// Now $max and $maxphp are in Kb
|
||||
$maxphp2=@ini_get('post_max_size'); // In unknown
|
||||
if (preg_match('/k$/i', $maxphp2)) $maxphp2=$maxphp2*1;
|
||||
if (preg_match('/m$/i', $maxphp2)) $maxphp2=$maxphp2*1024;
|
||||
if (preg_match('/g$/i', $maxphp2)) $maxphp2=$maxphp2*1024*1024;
|
||||
if (preg_match('/t$/i', $maxphp2)) $maxphp2=$maxphp2*1024*1024*1024;
|
||||
// Now $max and $maxphp and $maxphp2 are in Kb
|
||||
$maxmin = $max;
|
||||
if ($maxphp > 0) $maxmin=min($max, $maxphp);
|
||||
$maxphptoshow = $maxphptoshowparam = '';
|
||||
if ($maxphp > 0)
|
||||
{
|
||||
$maxmin=min($max, $maxphp);
|
||||
$maxphptoshow = $maxphp;
|
||||
$maxphptoshowparam = 'upload_max_filesize';
|
||||
}
|
||||
if ($maxphp2 > 0)
|
||||
{
|
||||
$maxmin=min($max, $maxphp2);
|
||||
if ($maxphp2 < $maxphp)
|
||||
{
|
||||
$maxphptoshow = $maxphp2;
|
||||
$maxphptoshowparam = 'post_max_size';
|
||||
}
|
||||
}
|
||||
|
||||
if ($maxmin > 0)
|
||||
{
|
||||
@@ -1063,7 +1083,7 @@ if ($mode == 'deploy')
|
||||
{
|
||||
$langs->load('other');
|
||||
print ' ';
|
||||
print info_admin($langs->trans("ThisLimitIsDefinedInSetup", $max, $maxphp), 1);
|
||||
print info_admin($langs->trans("ThisLimitIsDefinedInSetup", $max, $maxphptoshow, $maxphptoshowparam), 1);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -48,14 +48,31 @@ if (isset($title))
|
||||
}
|
||||
|
||||
|
||||
// Check PHP setup is OK
|
||||
$maxphp=@ini_get('upload_max_filesize'); // In unknown
|
||||
if (preg_match('/k$/i', $maxphp)) $maxphp=$maxphp*1;
|
||||
if (preg_match('/m$/i', $maxphp)) $maxphp=$maxphp*1024;
|
||||
if (preg_match('/g$/i', $maxphp)) $maxphp=$maxphp*1024*1024;
|
||||
if (preg_match('/t$/i', $maxphp)) $maxphp=$maxphp*1024*1024*1024;
|
||||
$maxphp2=@ini_get('post_max_size'); // In unknown
|
||||
if (preg_match('/k$/i', $maxphp2)) $maxphp2=$maxphp2*1;
|
||||
if (preg_match('/m$/i', $maxphp2)) $maxphp2=$maxphp2*1024;
|
||||
if (preg_match('/g$/i', $maxphp2)) $maxphp2=$maxphp2*1024*1024;
|
||||
if (preg_match('/t$/i', $maxphp2)) $maxphp2=$maxphp2*1024*1024*1024;
|
||||
if ($maxphp > 0 && $maxphp2 > 0 && $maxphp > $maxphp2)
|
||||
{
|
||||
$langs->load("errors");
|
||||
print info_admin($langs->trans("WarningParamUploadMaxFileSizeHigherThanPostMaxSize", @ini_get('upload_max_filesize'), @ini_get('post_max_size')), 0, 0, 0, 'warning');
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
|
||||
print "\n";
|
||||
|
||||
$var=false;
|
||||
|
||||
// Recupere la version de PHP
|
||||
// Get PHP version
|
||||
$phpversion=version_php();
|
||||
print '<tr class="oddeven"><td width="220px">'.$langs->trans("Version")."</td><td>".$phpversion."</td></tr>\n";
|
||||
|
||||
|
||||
@@ -130,15 +130,35 @@ class FormFile
|
||||
|
||||
$out .= '<td class="valignmiddle nowrap">';
|
||||
|
||||
$max=$conf->global->MAIN_UPLOAD_DOC; // En Kb
|
||||
$maxphp=@ini_get('upload_max_filesize'); // En inconnu
|
||||
$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;
|
||||
if (preg_match('/m$/i', $maxphp)) $maxphp=$maxphp*1024;
|
||||
if (preg_match('/g$/i', $maxphp)) $maxphp=$maxphp*1024*1024;
|
||||
if (preg_match('/t$/i', $maxphp)) $maxphp=$maxphp*1024*1024*1024;
|
||||
// Now $max and $maxphp are in Kb
|
||||
$maxphp2=@ini_get('post_max_size'); // In unknown
|
||||
if (preg_match('/k$/i', $maxphp2)) $maxphp2=$maxphp2*1;
|
||||
if (preg_match('/m$/i', $maxphp2)) $maxphp2=$maxphp2*1024;
|
||||
if (preg_match('/g$/i', $maxphp2)) $maxphp2=$maxphp2*1024*1024;
|
||||
if (preg_match('/t$/i', $maxphp2)) $maxphp2=$maxphp2*1024*1024*1024;
|
||||
// Now $max and $maxphp and $maxphp2 are in Kb
|
||||
$maxmin = $max;
|
||||
if ($maxphp > 0) $maxmin=min($max, $maxphp);
|
||||
$maxphptoshow = $maxphptoshowparam = '';
|
||||
if ($maxphp > 0)
|
||||
{
|
||||
$maxmin=min($max, $maxphp);
|
||||
$maxphptoshow = $maxphp;
|
||||
$maxphptoshowparam = 'upload_max_filesize';
|
||||
}
|
||||
if ($maxphp2 > 0)
|
||||
{
|
||||
$maxmin=min($max, $maxphp2);
|
||||
if ($maxphp2 < $maxphp)
|
||||
{
|
||||
$maxphptoshow = $maxphp2;
|
||||
$maxphptoshowparam = 'post_max_size';
|
||||
}
|
||||
}
|
||||
|
||||
if ($maxmin > 0)
|
||||
{
|
||||
@@ -168,7 +188,7 @@ class FormFile
|
||||
{
|
||||
$langs->load('other');
|
||||
$out .= ' ';
|
||||
$out .= info_admin($langs->trans("ThisLimitIsDefinedInSetup", $max, $maxphp), 1);
|
||||
$out .= info_admin($langs->trans("ThisLimitIsDefinedInSetup", $max, $maxphptoshow), 1);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -2947,10 +2947,11 @@ function dol_trunc($string, $size = 40, $trunc = 'right', $stringencoding = 'UTF
|
||||
* @param int $notitle 1=Disable tag title. Use it if you add js tooltip, to avoid duplicate tooltip.
|
||||
* @param string $alt Force alt for bind people
|
||||
* @param string $morecss Add more class css on img tag (For example 'myclascss'). Work only if $moreatt is empty.
|
||||
* @param string $marginleftonlyshort 1 = Add a short left margin on picto, 2 = Add a larger left maring on picto, 0 = No margin left. Works for fontawesome picto only.
|
||||
* @return string Return img tag
|
||||
* @see img_object(), img_picto_common()
|
||||
*/
|
||||
function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $srconly = 0, $notitle = 0, $alt = '', $morecss = '')
|
||||
function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $srconly = 0, $notitle = 0, $alt = '', $morecss = '', $marginleftonlyshort = 2)
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
@@ -2986,7 +2987,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
|
||||
if (empty($conf->global->MAIN_DISABLE_FONT_AWESOME_5)) $fa='fas';
|
||||
$fakey = $pictowithoutext;
|
||||
$facolor = ''; $fasize = '';
|
||||
$marginleftonlyshort = 2;
|
||||
|
||||
if ($pictowithoutext == 'setup') {
|
||||
$fakey = 'fa-cog';
|
||||
$fasize = '1.4em';
|
||||
|
||||
@@ -567,25 +567,46 @@ if ($step == 3 && $datatoimport)
|
||||
//print '<tr class="liste_titre"><td colspan="6">'.$langs->trans("FileWithDataToImport").'</td></tr>';
|
||||
|
||||
// Input file name box
|
||||
print '<tr class="oddeven"><td colspan="6">';
|
||||
print '<tr class="oddeven nohover"><td colspan="6">';
|
||||
print '<input type="file" name="userfile" size="20" maxlength="80"> ';
|
||||
$out = (empty($conf->global->MAIN_UPLOAD_DOC)?' disabled':'');
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("AddFile").'"'.$out.' name="sendit">';
|
||||
$out='';
|
||||
if (! empty($conf->global->MAIN_UPLOAD_DOC))
|
||||
{
|
||||
$max=$conf->global->MAIN_UPLOAD_DOC; // En Kb
|
||||
$maxphp=@ini_get('upload_max_filesize'); // En inconnu
|
||||
$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;
|
||||
if (preg_match('/m$/i', $maxphp)) $maxphp=$maxphp*1024;
|
||||
if (preg_match('/g$/i', $maxphp)) $maxphp=$maxphp*1024*1024;
|
||||
if (preg_match('/t$/i', $maxphp)) $maxphp=$maxphp*1024*1024*1024;
|
||||
// Now $max and $maxphp are in Kb
|
||||
if ($maxphp > 0) $max=min($max, $maxphp);
|
||||
$maxphp2=@ini_get('post_max_size'); // In unknown
|
||||
if (preg_match('/k$/i', $maxphp2)) $maxphp2=$maxphp2*1;
|
||||
if (preg_match('/m$/i', $maxphp2)) $maxphp2=$maxphp2*1024;
|
||||
if (preg_match('/g$/i', $maxphp2)) $maxphp2=$maxphp2*1024*1024;
|
||||
if (preg_match('/t$/i', $maxphp2)) $maxphp2=$maxphp2*1024*1024*1024;
|
||||
// Now $max and $maxphp and $maxphp2 are in Kb
|
||||
$maxmin = $max;
|
||||
$maxphptoshow = $maxphptoshowparam = '';
|
||||
if ($maxphp > 0)
|
||||
{
|
||||
$maxmin=min($max, $maxphp);
|
||||
$maxphptoshow = $maxphp;
|
||||
$maxphptoshowparam = 'upload_max_filesize';
|
||||
}
|
||||
if ($maxphp2 > 0)
|
||||
{
|
||||
$maxmin=min($max, $maxphp2);
|
||||
if ($maxphp2 < $maxphp)
|
||||
{
|
||||
$maxphptoshow = $maxphp2;
|
||||
$maxphptoshowparam = 'post_max_size';
|
||||
}
|
||||
}
|
||||
|
||||
$langs->load('other');
|
||||
$out .= ' ';
|
||||
$out.=info_admin($langs->trans("ThisLimitIsDefinedInSetup", $max, $maxphp), 1);
|
||||
$out .= info_admin($langs->trans("ThisLimitIsDefinedInSetup", $max, $maxphptoshow), 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -846,7 +867,7 @@ if ($step == 4 && $datatoimport)
|
||||
print '<input type="hidden" name="enclosure" value="'.dol_escape_htmltag($enclosure).'">';
|
||||
|
||||
print '<div class="marginbottomonly opacitymedium">';
|
||||
print $langs->trans("SelectImportFields", img_picto('', 'grip_title', '')).' ';
|
||||
print $langs->trans("SelectImportFields", img_picto('', 'grip_title', '', false, 0, 0, '', '', 0)).' ';
|
||||
$htmlother->select_import_model($importmodelid, 'importmodelid', $datatoimport, 1);
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Select").'">';
|
||||
print '</div>';
|
||||
|
||||
@@ -219,6 +219,7 @@ ErrorURLMustStartWithHttp=URL %s must start with http:// or https://
|
||||
ErrorNewRefIsAlreadyUsed=Error, the new reference is already used
|
||||
ErrorDeletePaymentLinkedToAClosedInvoiceNotPossible=Error, delete payment linked to a closed invoice is not possible.
|
||||
# Warnings
|
||||
WarningParamUploadMaxFileSizeHigherThanPostMaxSize=Your PHP parameter upload_max_filesize (%s) is higher than PHP parameter post_max_size (%s). This is not a consistent setup.
|
||||
WarningPasswordSetWithNoAccount=A password was set for this member. However, no user account was created. So this password is stored but can't be used to login to Dolibarr. It may be used by an external module/interface but if you don't need to define any login nor password for a member, you can disable option "Manage a login for each member" from Member module setup. If you need to manage a login but don't need any password, you can keep this field empty to avoid this warning. Note: Email can also be used as a login if the member is linked to a user.
|
||||
WarningMandatorySetupNotComplete=Click here to setup mandatory parameters
|
||||
WarningEnableYourModulesApplications=Click here to enable your modules and applications
|
||||
|
||||
@@ -372,7 +372,7 @@ if (! defined('NOTOKENRENEWAL'))
|
||||
}
|
||||
|
||||
//var_dump(GETPOST('token').' '.$_SESSION['token'].' - '.$_SESSION['newtoken'].' '.$_SERVER['SCRIPT_FILENAME']);
|
||||
|
||||
//$dolibarr_nocsrfcheck=1;
|
||||
// Check token
|
||||
//var_dump((! defined('NOCSRFCHECK')).' '.empty($dolibarr_nocsrfcheck).' '.(! empty($conf->global->MAIN_SECURITY_CSRF_WITH_TOKEN)).' '.$_SERVER['REQUEST_METHOD'].' '.(! GETPOSTISSET('token')));
|
||||
if ((! defined('NOCSRFCHECK') && empty($dolibarr_nocsrfcheck) && ! empty($conf->global->MAIN_SECURITY_CSRF_WITH_TOKEN))
|
||||
|
||||
Reference in New Issue
Block a user