Clean code

This commit is contained in:
Laurent Destailleur
2023-05-12 19:21:47 +02:00
parent 3322a5eeb8
commit 4c1c6319b3

View File

@@ -952,7 +952,7 @@ function sanitizeVal($out = '', $check = 'alphanohtml', $filter = null, $options
}
}
break;
case 'aZ09arobase': // great to sanitize objecttype parameter
case 'aZ09arobase': // great to sanitize $objecttype parameter
if (!is_array($out)) {
$out = trim($out);
if (preg_match('/[^a-z0-9_\-\.@]+/i', $out)) {
@@ -960,7 +960,7 @@ function sanitizeVal($out = '', $check = 'alphanohtml', $filter = null, $options
}
}
break;
case 'aZ09comma': // great to sanitize sortfield or sortorder params that can be t.abc,t.def_gh
case 'aZ09comma': // great to sanitize $sortfield or $sortorder params that can be 't.abc,t.def_gh'
if (!is_array($out)) {
$out = trim($out);
if (preg_match('/[^a-z0-9_\-\.,]+/i', $out)) {
@@ -968,9 +968,6 @@ function sanitizeVal($out = '', $check = 'alphanohtml', $filter = null, $options
}
}
break;
case 'nohtml': // No html
$out = dol_string_nohtmltag($out, 0);
break;
case 'alpha': // No html and no ../ and "
case 'alphanohtml': // Recommended for most scalar parameters and search parameters
if (!is_array($out)) {
@@ -1002,6 +999,9 @@ function sanitizeVal($out = '', $check = 'alphanohtml', $filter = null, $options
} while ($oldstringtoclean != $out);
}
break;
case 'nohtml': // No html
$out = dol_string_nohtmltag($out, 0);
break;
case 'restricthtml': // Recommended for most html textarea
case 'restricthtmlnolink':
case 'restricthtmlallowunvalid':
@@ -7391,6 +7391,7 @@ function dol_htmlwithnojs($stringtoencode, $nouseofiframesandbox = 0, $check = '
* @param string $pagecodefrom Pagecode stringtoencode is encoded
* @param int $removelasteolbr 1=Remove last br or lasts \n (default), 0=Do nothing
* @return string String encoded
* @see dolGetFirstLineOfText()
*/
function dol_htmlentitiesbr($stringtoencode, $nl2brmode = 0, $pagecodefrom = 'UTF-8', $removelasteolbr = 1)
{