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

This commit is contained in:
José González 2022-04-06 17:11:10 +02:00
parent 2471bbf1d4
commit 2ae66f7eb3
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];