Add dolSort to offer a secured solution to use sort in dynamic fields
This commit is contained in:
parent
41dfccfc14
commit
a9254763f3
3 changed files with 17 additions and 2 deletions
|
|
@ -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'
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -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<string|int,mixed> $arraytosort Array to sort
|
||||
* @return array<string|int,mixed> 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).
|
||||
|
|
|
|||
|
|
@ -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\';');
|
||||
|
|
|
|||
Loading…
Reference in a new issue