diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php
index a0b8f2e50de..5fd40fb032a 100644
--- a/htdocs/admin/modules.php
+++ b/htdocs/admin/modules.php
@@ -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
diff --git a/htdocs/admin/system/phpinfo.php b/htdocs/admin/system/phpinfo.php
index 2dc9406eb13..d1c737ef5a8 100644
--- a/htdocs/admin/system/phpinfo.php
+++ b/htdocs/admin/system/phpinfo.php
@@ -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 '
';
+}
+
print '
| '.$langs->trans("Parameter").' | '.$langs->trans("Value").' | ||||
| '.$langs->trans("Version")." | ".$phpversion." | '; - $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 diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index c930dbf172a..9aa6177adf4 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -2935,22 +2935,23 @@ function dol_trunc($string, $size = 40, $trunc = 'right', $stringencoding = 'UTF /** * Show picto whatever it's its name (generic function) * - * @param string $titlealt Text on title tag for tooltip. Not used if param notitle is set to 1. - * @param string $picto Name of image file to show ('filenew', ...) - * If no extension provided, we use '.png'. Image must be stored into theme/xxx/img directory. - * Example: picto.png if picto.png is stored into htdocs/theme/mytheme/img - * Example: picto.png@mymodule if picto.png is stored into htdocs/mymodule/img - * Example: /mydir/mysubdir/picto.png if picto.png is stored into htdocs/mydir/mysubdir (pictoisfullpath must be set to 1) - * @param string $moreatt Add more attribute on img tag (For example 'style="float: right"') - * @param boolean|int $pictoisfullpath If true or 1, image path is a full path - * @param int $srconly Return only content of the src attribute of img. - * @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. - * @return string Return img tag + * @param string $titlealt Text on title tag for tooltip. Not used if param notitle is set to 1. + * @param string $picto Name of image file to show ('filenew', ...) + * If no extension provided, we use '.png'. Image must be stored into theme/xxx/img directory. + * Example: picto.png if picto.png is stored into htdocs/theme/mytheme/img + * Example: picto.png@mymodule if picto.png is stored into htdocs/mymodule/img + * Example: /mydir/mysubdir/picto.png if picto.png is stored into htdocs/mydir/mysubdir (pictoisfullpath must be set to 1) + * @param string $moreatt Add more attribute on img tag (For example 'style="float: right"') + * @param boolean|int $pictoisfullpath If true or 1, image path is a full path + * @param int $srconly Return only content of the src attribute of img. + * @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'; diff --git a/htdocs/imports/import.php b/htdocs/imports/import.php index 7bcd69e3d0b..2d3882e523e 100644 --- a/htdocs/imports/import.php +++ b/htdocs/imports/import.php @@ -567,25 +567,46 @@ if ($step == 3 && $datatoimport) //print ' | |||
| '.$langs->trans("FileWithDataToImport").' | |||||
| '; - print ' '; + print ' | |||||
| ';
+ print ' ';
$out = (empty($conf->global->MAIN_UPLOAD_DOC)?' disabled':'');
print '';
$out='';
if (! empty($conf->global->MAIN_UPLOAD_DOC))
{
- $max=$conf->global->MAIN_UPLOAD_DOC; // En Kb
- $maxphp=@ini_get('upload_max_filesize'); // En inconnu
- 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);
+ $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;
+ $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 '';
print ' ';
- 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 '';
print ' ';
diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang
index bb92e41a537..8e4d42559a8 100644
--- a/htdocs/langs/en_US/errors.lang
+++ b/htdocs/langs/en_US/errors.lang
@@ -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
diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php
index 4e1a6ecf01d..7b695dd8a12 100644
--- a/htdocs/main.inc.php
+++ b/htdocs/main.inc.php
@@ -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))
| |||||