Merge branch 'ent-8751_espacios_no_mostrados_creando_agentes_en_API' into 'develop'

Fix x20; chars in alias when create agents with alias with spaces in API

See merge request artica/pandorafms!4804
This commit is contained in:
Daniel Rodriguez 2022-06-02 13:55:45 +00:00
commit a7791c06fc
1 changed files with 13 additions and 1 deletions

View File

@ -1855,7 +1855,19 @@ function api_set_new_agent($thrash1, $thrash2, $other, $thrash3)
return;
}
$alias = io_safe_input(trim(preg_replace('/[\/\\\|%#&$]/', '', $other['data'][0])));
$alias = io_safe_input(
trim(
preg_replace(
'/[\/\\\|%#&$]/',
'',
preg_replace(
'/x20;/',
' ',
$other['data'][0]
)
)
)
);
$direccion_agente = io_safe_input($other['data'][1]);
$nombre_agente = hash('sha256', $direccion_agente.'|'.$direccion_agente.'|'.time().'|'.sprintf('%04d', rand(0, 10000)));
$id_parent = (int) $other['data'][2];