diff --git a/htdocs/admin/system/dolibarr.php b/htdocs/admin/system/dolibarr.php index ce38d2cd1e9..238b0ac324b 100644 --- a/htdocs/admin/system/dolibarr.php +++ b/htdocs/admin/system/dolibarr.php @@ -444,11 +444,13 @@ $configfileparameters = array( '?dolibarr_font_DOL_DEFAULT_TTF_BOLD' => 'dolibarr_font_DOL_DEFAULT_TTF_BOLD', 'separator4' => '', 'dolibarr_main_restrict_os_commands' => 'Restrict CLI commands for backups', + 'dolibarr_main_restrict_eval_methods' => 'Restrict php commands for dol_eval', 'dolibarr_main_restrict_ip' => 'Restrict access to some IPs only', + '?dolibarr_website_allow_custom_php' => 'Allow custom php code in website pages', '?dolibarr_mailing_limit_sendbyweb' => 'Limit nb of email sent by page', '?dolibarr_mailing_limit_sendbycli' => 'Limit nb of email sent by cli', '?dolibarr_mailing_limit_sendbyday' => 'Limit nb of email sent per day', - '?dolibarr_strict_mode' => 'Strict mode is on/off', + '?dolibarr_strict_mode' => 'Strict mode for php syntax is on/off', '?dolibarr_nocsrfcheck' => 'Disable CSRF security checks' ); diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 269761ac776..875ed501220 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -11606,6 +11606,19 @@ function dol_htmloutput_errors($mesgstring = '', $mesgarray = array(), $keepembe dol_htmloutput_mesg($mesgstring, $mesgarray, 'error', $keepembedded); } + +/** + * Sort an array using a user defined function. This function is a wrapper to usort without the callable parameter so we can use it into dol_eval(). + * This function is not used in Dolibarr code. + * + * @param array $arraytosort Array to sort + * @return array Return the sorted array (the source array is not modified) + */ +function dolSort($arraytosort) +{ + return usort($arraytosort); +} + /** * Advanced sort array by the value of a given key, which produces ascending (default) or descending * output and uses optionally natural case insensitive sorting (which can be optionally case sensitive as well). diff --git a/htdocs/install/step1.php b/htdocs/install/step1.php index 214d43d29f7..c6d8cd38c01 100644 --- a/htdocs/install/step1.php +++ b/htdocs/install/step1.php @@ -984,7 +984,7 @@ function write_conf_file($conffile) fwrite($fp, '$dolibarr_main_restrict_os_commands=\'mariadb-dump, mariadb, mysqldump, mysql, pg_dump, pg_restore, clamdscan, clamdscan.exe\';'); fwrite($fp, "\n"); - fwrite($fp, '$dolibarr_main_restrict_eval_methods=\'getDolGlobalString, getDolGlobalInt, getDolCurrency, getDolEntity, getDolDBType, fetchNoCompute, hasRight, isAdmin, isModEnabled, isStringVarMatching, abs, min, max, round, dol_now, preg_match\';'); + fwrite($fp, '$dolibarr_main_restrict_eval_methods=\'getDolGlobalString, getDolGlobalInt, getDolCurrency, getDolEntity, getDolDBType, fetchNoCompute, hasRight, isAdmin, isModEnabled, isStringVarMatching, dolSort, abs, min, max, round, dol_now, preg_match\';'); fwrite($fp, "\n"); fwrite($fp, '$dolibarr_nocsrfcheck=\'0\';');