Merge branch '3199-Parsear-espacios-al-final-y-caracteres-especiales-al-introducir-nombre-agente-en-consola' into 'develop'

remove special characters from agent alias string on creation and trim blank…

See merge request artica/pandorafms!2100

Former-commit-id: 2e2268eef1c2a45f8c6bc046e9e21d0101d456c0
This commit is contained in:
Daniel Rodriguez 2019-02-20 11:02:24 +01:00
commit 1c7c0ebe8f
2 changed files with 5 additions and 3 deletions

View File

@ -229,7 +229,7 @@ if (!$new_agent) {
$table->data[0][1] .= "&nbsp;&nbsp;<span align='right'><a onClick=\"if (!confirm('".__('Are you sure?')."')) return false;\" href='index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&borrar_agente=$id_agente&search=&offset=0&sort_field=&sort=none'>".html_print_image('images/cross.png', true, ['title' => __('Delete agent')]).'</a>';
}
$table->data[1][0] = __('Alias');
$table->data[1][0] = __('Alias').ui_print_help_tip(__('Characters /,\,|,%,#,&,$ are not allowed'), true).'</span>';
$table->data[1][1] = html_print_input_text('alias', $alias, '', 50, 100, true);
if ($new_agent) {
$table->data[1][1] .= html_print_checkbox('alias_as_name', 1, $config['alias_as_name'], true).__('Use alias as name');

View File

@ -159,7 +159,8 @@ $module_macros = [];
// Create agent
if ($create_agent) {
$mssg_warning = 0;
$alias = (string) get_parameter_post('alias', '');
$alias = trim (preg_replace('/[\/\\\|%#&$-]/', '',
html_entity_decode( str_replace('`','&lsquo;',(string) get_parameter_post ("alias", "")))));
$alias_as_name = (int) get_parameter_post('alias_as_name', 0);
$direccion_agente = (string) get_parameter_post('direccion', '');
$unique_ip = (int) get_parameter_post('unique_ip', 0);
@ -764,7 +765,8 @@ if ($update_agent) {
$mssg_warning = 0;
$id_agente = (int) get_parameter_post('id_agente');
$nombre_agente = str_replace('`', '&lsquo;', (string) get_parameter_post('agente', ''));
$alias = str_replace('`', '&lsquo;', (string) get_parameter_post('alias', ''));
$alias = trim (preg_replace('/[\/\\\|%#&$-]/', '',
html_entity_decode( str_replace('`','&lsquo;',(string) get_parameter_post ("alias", "")))));
$alias_as_name = (int) get_parameter_post('alias_as_name', 0);
$direccion_agente = (string) get_parameter_post('direccion', '');
$unique_ip = (int) get_parameter_post('unique_ip', 0);