diff --git a/pandora_console/godmode/agentes/modificar_agente.php b/pandora_console/godmode/agentes/modificar_agente.php index 487fe54e07..5ea31914c6 100644 --- a/pandora_console/godmode/agentes/modificar_agente.php +++ b/pandora_console/godmode/agentes/modificar_agente.php @@ -566,10 +566,10 @@ if ($search != '') { if ($id != '') { $aux = $id[0]['id_agent']; $search_sql = sprintf( - ' AND ( nombre LIKE "%%%s%%" - OR alias LIKE "%%%s%%" - OR comentarios LIKE "%%%s%%" - OR EXISTS (SELECT * FROM tagent_custom_data WHERE id_agent = id_agente AND description LIKE "%%%s%%") + ' AND ( REPLACE(nombre, " ", " ") LIKE "%%%s%%" + OR REPLACE(alias, " ", " ") LIKE "%%%s%%" + OR REPLACE(comentarios, " ", " ") LIKE "%%%s%%" + OR EXISTS (SELECT * FROM tagent_custom_data WHERE id_agent = id_agente AND REPLACE(description, " ", " ") LIKE "%%%s%%") OR tagente.id_agente = %d', $search, $search, @@ -591,10 +591,10 @@ if ($search != '') { $search_sql .= ')'; } else { $search_sql = sprintf( - ' AND ( nombre - LIKE "%%%s%%" OR alias - LIKE "%%%s%%" OR comentarios LIKE "%%%s%%" - OR EXISTS (SELECT * FROM tagent_custom_data WHERE id_agent = id_agente AND description LIKE "%%%s%%"))', + ' AND ( REPLACE(nombre, " ", " ") + LIKE "%%%s%%" OR REPLACE(alias, " ", " ") + LIKE "%%%s%%" OR REPLACE(comentarios, " ", " ") LIKE "%%%s%%" + OR EXISTS (SELECT * FROM tagent_custom_data WHERE id_agent = id_agente AND REPLACE(description, " ", " ") LIKE "%%%s%%"))', $search, $search, $search, diff --git a/pandora_console/godmode/agentes/module_manager.php b/pandora_console/godmode/agentes/module_manager.php index c3772c00d3..b4cd0e2351 100644 --- a/pandora_console/godmode/agentes/module_manager.php +++ b/pandora_console/godmode/agentes/module_manager.php @@ -575,7 +575,7 @@ $where = sprintf('delete_pending = 0 AND id_agente = %s', $id_agente); $search_string_entities = io_safe_input($search_string); $basic_where = sprintf( - "(nombre LIKE '%%%s%%' OR nombre LIKE '%%%s%%' OR descripcion LIKE '%%%s%%' OR descripcion LIKE '%%%s%%') AND", + "(REPLACE(nombre, ' ', ' ') LIKE '%%%s%%' OR REPLACE(nombre, ' ', ' ') LIKE '%%%s%%' OR REPLACE(descripcion, ' ', ' ') LIKE '%%%s%%' OR REPLACE(descripcion, ' ', ' ') LIKE '%%%s%%') AND", $search_string, $search_string_entities, $search_string, diff --git a/pandora_console/godmode/modules/manage_network_components.php b/pandora_console/godmode/modules/manage_network_components.php index 53318517d7..d1d5f5687f 100644 --- a/pandora_console/godmode/modules/manage_network_components.php +++ b/pandora_console/godmode/modules/manage_network_components.php @@ -729,7 +729,7 @@ if ($search_id_group) { } if ($search_string != '') { - $filter[] = '(name LIKE '."'%".$search_string."%'".'OR description LIKE '."'%".$search_string."%'".'OR tcp_send LIKE '."'%".$search_string."%'".'OR tcp_rcv LIKE '."'%".$search_string."%'".')'; + $filter[] = '(REPLACE(name, " ", " ") LIKE '."'%".$search_string."%'".' OR REPLACE(REPLACE(description, " ", " "), " ", " ")LIKE '."'%".$search_string."%'".' OR REPLACE(tcp_send, " ", " ") LIKE '."'%".$search_string."%'".'OR REPLACE(tcp_rcv, " ", " ") LIKE '."'%".$search_string."%'".')'; } $total_components = network_components_get_network_components( diff --git a/pandora_console/include/class/ConfigPEN.class.php b/pandora_console/include/class/ConfigPEN.class.php index cea6123f08..6e2f7ec1f6 100644 --- a/pandora_console/include/class/ConfigPEN.class.php +++ b/pandora_console/include/class/ConfigPEN.class.php @@ -118,7 +118,7 @@ class ConfigPEN extends HTML if (is_array($filter)) { if (!empty($filter['free_search'])) { $sql_filters[] = vsprintf( - ' AND (lower(`manufacturer`) like lower("%%%s%%") + ' AND (lower(REPLACE(manufacturer, " ", " ")) like lower("%%%s%%") OR pen = "%s") ', array_fill(0, 2, $filter['free_search']) ); diff --git a/pandora_console/include/functions_custom_graphs.php b/pandora_console/include/functions_custom_graphs.php index 500b668a24..f76dc7c0f7 100644 --- a/pandora_console/include/functions_custom_graphs.php +++ b/pandora_console/include/functions_custom_graphs.php @@ -194,11 +194,11 @@ function custom_graphs_get_user($id_user=0, $only_names=false, $returnAllGroup=t function custom_graphs_search($id_group, $search) { if ($id_group != '' && $search != '') { - $all_graphs = db_get_all_rows_sql('select * from tgraph where id_group = '.$id_group.' AND (name LIKE "%'.$search.'%" OR description LIKE "'.$search.'")'); + $all_graphs = db_get_all_rows_sql('select * from tgraph where id_group = '.$id_group.' AND (REPLACE(name, " ", " ") LIKE "%'.$search.'%" OR REPLACE(description, " ", " ") LIKE "'.$search.'")'); } else if ($id_group != '') { $all_graphs = db_get_all_rows_sql('select * from tgraph where id_group = '.$id_group.''); } else { - $all_graphs = db_get_all_rows_sql('select * from tgraph where name LIKE "%'.$search.'%" OR description LIKE "'.$search.'"'); + $all_graphs = db_get_all_rows_sql('select * from tgraph where REPLACE(name, " ", " ") LIKE "%'.$search.'%" OR REPLACE(description, " ", " ") LIKE "'.$search.'"'); } if ($all_graphs === false) { diff --git a/pandora_console/include/functions_inventory.php b/pandora_console/include/functions_inventory.php index 8e69da7445..afa61c3811 100644 --- a/pandora_console/include/functions_inventory.php +++ b/pandora_console/include/functions_inventory.php @@ -77,7 +77,7 @@ function inventory_get_data( } if ($inventory_search_string != '') { - array_push($where, "tagent_module_inventory.data LIKE '%".$inventory_search_string."%'"); + array_push($where, "REPLACE(tagent_module_inventory.data, ' ', ' ') LIKE '%".$inventory_search_string."%'"); } $offset = (int) get_parameter('offset'); @@ -746,7 +746,7 @@ function inventory_get_datatable( } if ($inventory_search_string != '') { - array_push($where, "tagent_module_inventory.data LIKE '%".$inventory_search_string."%'"); + array_push($where, "REPLACE(tagente_datos_inventory.data, ' ', ' ') LIKE '%".$inventory_search_string."%'"); } if ($utimestamp > 0) { @@ -786,7 +786,6 @@ function inventory_get_datatable( } $rows = db_get_all_rows_sql($sql); - if ($order_by_agent === false) { $modules = []; foreach ($rows as $row) { @@ -796,7 +795,13 @@ function inventory_get_datatable( $data_rows = explode(PHP_EOL, $row['data_inventory']); foreach ($data_rows as $data_key => $data_value) { - if (empty($data_value) === false) { + if (empty($inventory_search_string) !== true) { + $search_check = strpos(str_replace(' ', ' ', $data_value), $inventory_search_string); + } else { + $search_check = true; + } + + if (empty($data_value) === false && $search_check !== false) { $row['data'] = $data_value; $modules[$row['name']][$row['name_agent'].'-'.$data_key.'-'.$data_value] = $row; } @@ -889,7 +894,7 @@ function get_data_basic_info_sql($params, $count=false) if ($params['search'] > 0) { $where .= sprintf( - ' AND ( alias LIKE "%%%s%%" )', + ' AND ( REPLACE(alias, " ", " ") LIKE "%%%s%%" )', $params['search'] ); } diff --git a/pandora_console/operation/inventory/inventory.php b/pandora_console/operation/inventory/inventory.php index 7355662366..0a7754e46d 100755 --- a/pandora_console/operation/inventory/inventory.php +++ b/pandora_console/operation/inventory/inventory.php @@ -1289,6 +1289,10 @@ if ($inventory_module !== 'basic') { $style = 'width: 100%'; $ordering = true; $searching = false; + $search = []; + if (strlen($inventory_search_string) > 0) { + $search['value'] = $inventory_search_string; + } $columns = [ 'alias', @@ -1338,6 +1342,7 @@ if ($inventory_module !== 'basic') { 'get_data_basic_info' => 1, 'id_agent' => $id_agente, 'id_group' => $inventory_id_group, + 'search' => $search, ], 'zeroRecords' => __('Agent info not found'), 'emptyTable' => __('Agent info not found'), diff --git a/pandora_console/operation/search_agents.getdata.php b/pandora_console/operation/search_agents.getdata.php index d8182385b2..0284f8e738 100644 --- a/pandora_console/operation/search_agents.getdata.php +++ b/pandora_console/operation/search_agents.getdata.php @@ -76,15 +76,15 @@ if ($searchAgents) { $sql = "SELECT DISTINCT taddress_agent.id_agent FROM taddress INNER JOIN taddress_agent ON taddress.id_a = taddress_agent.id_a - WHERE taddress.ip LIKE '$stringSearchSQL'"; + WHERE LOWER(REPLACE(taddress.ip, ' ', ' ')) LIKE LOWER('$stringSearchSQL')"; $id = db_get_all_rows_sql($sql); if ($id != '') { $aux = $id[0]['id_agent']; - $search_sql = " t1.nombre LIKE '".$stringSearchSQL."' OR - t2.nombre LIKE '".$stringSearchSQL."' OR - t1.alias LIKE '".$stringSearchSQL."' OR - t1.comentarios LIKE '".$stringSearchSQL."' OR + $search_sql = " LOWER(REPLACE(t1.nombre, ' ', ' ')) LIKE LOWER('".$stringSearchSQL."') OR + LOWER(REPLACE(t2.nombre, ' ', ' ')) LIKE LOWER('".$stringSearchSQL."') OR + LOWER(REPLACE(t1.alias, ' ', ' ')) LIKE LOWER('".$stringSearchSQL."') OR + LOWER(REPLACE(t1.comentarios, ' ', ' ')) LIKE LOWER('".$stringSearchSQL."') OR t1.id_agente =".$aux; $idCount = count($id); @@ -96,16 +96,16 @@ if ($searchAgents) { } } } else { - $search_sql = " t1.nombre LIKE '".$stringSearchSQL."' OR - t2.nombre LIKE '".$stringSearchSQL."' OR - t1.direccion LIKE '".$stringSearchSQL."' OR - t1.comentarios LIKE '".$stringSearchSQL."' OR - t1.alias LIKE '".$stringSearchSQL."'"; + $search_sql = " LOWER(REPLACE(t1.nombre, ' ', ' ')) LIKE LOWER('".$stringSearchSQL."') OR + LOWER(REPLACE(t2.nombre, ' ', ' ')) LIKE LOWER('".$stringSearchSQL."') OR + LOWER(REPLACE(t1.direccion, ' ', ' ')) LIKE LOWER('".$stringSearchSQL."') OR + LOWER(REPLACE(t1.comentarios, ' ', ' ')) LIKE LOWER('".$stringSearchSQL."') OR + LOWER(REPLACE(t1.alias, ' ', ' ')) LIKE LOWER('".$stringSearchSQL."')"; } if ($has_secondary === true) { $search_sql .= " OR (tasg.id_group IS NOT NULL AND - tasg.id_group IN (SELECT id_grupo FROM tgrupo WHERE nombre LIKE '".$stringSearchSQL."'))"; + tasg.id_group IN (SELECT id_grupo FROM tgrupo WHERE LOWER(REPLACE(nombre, ' ', ' ')) LIKE LOWER('".$stringSearchSQL."')))"; } $sql = " diff --git a/pandora_console/operation/search_alerts.getdata.php b/pandora_console/operation/search_alerts.getdata.php index cebb13919c..eea9f70324 100644 --- a/pandora_console/operation/search_alerts.getdata.php +++ b/pandora_console/operation/search_alerts.getdata.php @@ -139,64 +139,64 @@ if ($searchAlerts) { switch ($config['dbtype']) { case 'mysql': $whereAlerts = 'AND ( - id_alert_template IN (SELECT id FROM talert_templates WHERE name LIKE "%'.$stringSearchSQL.'%") OR + id_alert_template IN (SELECT id FROM talert_templates WHERE REPLACE(name, " ", " ") LIKE "%'.$stringSearchSQL.'%") OR id_alert_template IN ( SELECT id FROM talert_templates WHERE id_alert_action IN ( SELECT id FROM talert_actions - WHERE name LIKE "%'.$stringSearchSQL.'%")) OR + WHERE REPLACE(name, " ", " ") LIKE "%'.$stringSearchSQL.'%")) OR talert_template_modules.id IN ( SELECT id_alert_template_module FROM talert_template_module_actions WHERE id_alert_action IN ( SELECT id FROM talert_actions - WHERE name LIKE "%'.$stringSearchSQL.'%")) OR + WHERE REPLACE(name, " ", " ") LIKE "%'.$stringSearchSQL.'%")) OR id_agent_module IN ( SELECT id_agente_modulo FROM tagente_modulo - WHERE nombre LIKE "%'.$stringSearchSQL.'%") OR + WHERE REPLACE(nombre, " ", " ") LIKE "%'.$stringSearchSQL.'%") OR id_agent_module IN ( SELECT id_agente_modulo FROM tagente_modulo WHERE id_agente IN ( SELECT id_agente FROM tagente - WHERE nombre LIKE "%'.$stringSearchSQL.'%" '.$extra_sql.')) + WHERE REPLACE(nombre, " ", " ") LIKE "%'.$stringSearchSQL.'%" '.$extra_sql.')) )'; break; case 'postgresql': case 'oracle': $whereAlerts = 'AND ( - id_alert_template IN (SELECT id FROM talert_templates WHERE upper(name) LIKE \'%'.strtolower($stringSearchSQL).'%\') OR + id_alert_template IN (SELECT id FROM talert_templates WHERE upper(REPLACE(name, " ", " ")) LIKE \'%'.strtolower($stringSearchSQL).'%\') OR id_alert_template IN ( SELECT id FROM talert_templates WHERE id_alert_action IN ( SELECT id FROM talert_actions - WHERE upper(name) LIKE \'%'.strtolower($stringSearchSQL).'%\')) OR + WHERE upper(REPLACE(name, " ", " ")) LIKE \'%'.strtolower($stringSearchSQL).'%\')) OR talert_template_modules.id IN ( SELECT id_alert_template_module FROM talert_template_module_actions WHERE id_alert_action IN ( SELECT id FROM talert_actions - WHERE upper(name) LIKE \'%'.strtolower($stringSearchSQL).'%\')) OR + WHERE upper(REPLACE(name, " ", " ")) LIKE \'%'.strtolower($stringSearchSQL).'%\')) OR id_agent_module IN ( SELECT id_agente_modulo FROM tagente_modulo - WHERE upper(nombre) LIKE \'%'.strtolower($stringSearchSQL).'%\') OR + WHERE upper(REPLACE(nombre, " ", " ")) LIKE \'%'.strtolower($stringSearchSQL).'%\') OR id_agent_module IN ( SELECT id_agente_modulo FROM tagente_modulo WHERE id_agente IN ( SELECT id_agente FROM tagente - WHERE upper(nombre) LIKE \'%'.strtolower($stringSearchSQL).'%\' '.$extra_sql.')) + WHERE upper(REPLACE(nombre, " ", " ")) LIKE \'%'.strtolower($stringSearchSQL).'%\' '.$extra_sql.')) )'; $agents = false; break; diff --git a/pandora_console/operation/search_graphs.getdata.php b/pandora_console/operation/search_graphs.getdata.php index f4b5fdf171..7037274b08 100644 --- a/pandora_console/operation/search_graphs.getdata.php +++ b/pandora_console/operation/search_graphs.getdata.php @@ -31,7 +31,7 @@ if ($searchGraphs) { } $filter = []; - $filter[] = "(upper(name) LIKE '%".strtolower($stringSearchSQL)."%' OR upper(description) LIKE '%$".strtolower($stringSearchSQL)."%')"; + $filter[] = "(upper(REPLACE(name, ' ', ' ')) LIKE '%".strtolower($stringSearchSQL)."%' OR upper(REPLACE(description, ' ', ' ')) LIKE '%$".strtolower($stringSearchSQL)."%')"; $filter['id_graph'] = $usergraphs_id; $columns = [ diff --git a/pandora_console/operation/search_main.php b/pandora_console/operation/search_main.php index e5f136f457..ac841fa703 100644 --- a/pandora_console/operation/search_main.php +++ b/pandora_console/operation/search_main.php @@ -62,10 +62,10 @@ $sql = "SELECT DISTINCT taddress_agent.id_agent FROM taddress $id = db_get_all_rows_sql($sql); if ($id != '') { $aux = $id[0]['id_agent']; - $search_sql = " t1.nombre LIKE '".$stringSearchSQL."' OR - t2.nombre LIKE '".$stringSearchSQL."' OR - t1.alias LIKE '".$stringSearchSQL."' OR - t1.comentarios LIKE '".$stringSearchSQL."' OR + $search_sql = " REPLACE(t1.nombre, ' ', ' ') LIKE '".$stringSearchSQL."' OR + REPLACE(t2.nombre, ' ', ' ') LIKE '".$stringSearchSQL."' OR + REPLACE(t1.alias, ' ', ' ') LIKE '".$stringSearchSQL."' OR + REPLACE(t1.comentarios, ' ', ' ') LIKE '".$stringSearchSQL."' OR t1.id_agente =".$aux; $idCount = count($id); @@ -77,16 +77,16 @@ if ($id != '') { } } } else { - $search_sql = " t1.nombre LIKE '".$stringSearchSQL."' OR - t2.nombre LIKE '".$stringSearchSQL."' OR - t1.direccion LIKE '".$stringSearchSQL."' OR - t1.comentarios LIKE '".$stringSearchSQL."' OR - t1.alias LIKE '".$stringSearchSQL."'"; + $search_sql = " REPLACE(t1.nombre, ' ', ' ') LIKE '".$stringSearchSQL."' OR + REPLACE(t2.nombre, ' ', ' ') LIKE '".$stringSearchSQL."' OR + REPLACE(t1.direccion, ' ', ' ') LIKE '".$stringSearchSQL."' OR + REPLACE(t1.comentarios, ' ', ' ') LIKE '".$stringSearchSQL."' OR + REPLACE(t1.alias, ' ', ' ') LIKE '".$stringSearchSQL."'"; } if ($has_secondary === true) { $search_sql .= " OR (tasg.id_group IS NOT NULL AND - tasg.id_group IN (SELECT id_grupo FROM tgrupo WHERE nombre LIKE '".$stringSearchSQL."'))"; + tasg.id_group IN (SELECT id_grupo FROM tgrupo WHERE REPLACE(nombre, ' ', ' ') LIKE '".$stringSearchSQL."'))"; } $sql = " diff --git a/pandora_console/operation/search_maps.getdata.php b/pandora_console/operation/search_maps.getdata.php index 6f3456ef5b..60cd83f556 100644 --- a/pandora_console/operation/search_maps.getdata.php +++ b/pandora_console/operation/search_maps.getdata.php @@ -32,7 +32,7 @@ if ((bool) $searchMaps === true) { FROM tlayout tl LEFT JOIN tlayout_data tld ON tl.id = tld.id_layout - WHERE tl.name LIKE "%%%s%%" + WHERE REPLACE(tl.name, " ", " ") LIKE "%%%s%%" AND tl.id_group IN (%s) GROUP BY tl.id, tl.name, tl.id_group', $stringSearchSQL, diff --git a/pandora_console/operation/search_modules.getdata.php b/pandora_console/operation/search_modules.getdata.php index a278ca8cd0..405212fb19 100644 --- a/pandora_console/operation/search_modules.getdata.php +++ b/pandora_console/operation/search_modules.getdata.php @@ -142,8 +142,8 @@ if ($searchModules) { ) ) AND - (t1.nombre LIKE "%'.$stringSearchSQL.'%" OR - t3.nombre LIKE "%'.$stringSearchSQL.'%") + (REPLACE(t1.nombre, " ", " ") LIKE "%'.$stringSearchSQL.'%" OR + REPLACE(t3.nombre, " ", " ") LIKE "%'.$stringSearchSQL.'%") AND t1.disabled = 0'; break; @@ -172,8 +172,8 @@ if ($searchModules) { ) ) ) AND - (t1.nombre LIKE \'%'.$stringSearchSQL.'%\' OR - t3.nombre LIKE \'%'.$stringSearchSQL.'%\')'; + (REPLACE(t1.nombre, " ", " ") LIKE \'%'.$stringSearchSQL.'%\' OR + REPLACE(t3.nombre, " ", " ") LIKE \'%'.$stringSearchSQL.'%\')'; break; case 'oracle': @@ -201,8 +201,8 @@ if ($searchModules) { ) ) ) AND - (LOWER(t1.nombre) LIKE \'%'.strtolower($stringSearchSQL).'%\' OR - LOWER(t3.nombre) LIKE \'%'.strtolower($stringSearchSQL).'%\')'; + (LOWER(REPLACE(t1.nombre, " ", " ")) LIKE \'%'.strtolower($stringSearchSQL).'%\' OR + LOWER(REPLACE(t3.nombre, " ", " ")) LIKE \'%'.strtolower($stringSearchSQL).'%\')'; break; } diff --git a/pandora_console/operation/search_policies.getdata.php b/pandora_console/operation/search_policies.getdata.php index cc6f0dca45..cc4c844ea0 100644 --- a/pandora_console/operation/search_policies.getdata.php +++ b/pandora_console/operation/search_policies.getdata.php @@ -207,7 +207,7 @@ if ($searchpolicies === true) { $sql = "SELECT id, name, description, id_group, status FROM tpolicies - WHERE name LIKE '$stringSearchSQL' + WHERE REPLACE(name, ' ', ' ') LIKE '$stringSearchSQL' AND id_group IN ($id_user_groups_str) "; } diff --git a/pandora_console/operation/search_reports.getdata.php b/pandora_console/operation/search_reports.getdata.php index 082d9914cc..3cf83bacbc 100644 --- a/pandora_console/operation/search_reports.getdata.php +++ b/pandora_console/operation/search_reports.getdata.php @@ -46,13 +46,13 @@ if ($searchReports) { case 'postgresql': $sql = "SELECT id_report, name, description FROM treport - WHERE (name LIKE '%".$stringSearchSQL."%' OR description LIKE '%".$stringSearchSQL."%')".$reports_condition; + WHERE (REPLACE(name, ' ', ' ') LIKE '%".$stringSearchSQL."%' OR REPLACE(description, ' ', ' ') LIKE '%".$stringSearchSQL."%')".$reports_condition; break; case 'oracle': $sql = "SELECT id_report, name, description FROM treport - WHERE (upper(name) LIKE '%".strtolower($stringSearchSQL)."%' OR description LIKE '%".strtolower($stringSearchSQL)."%')".$reports_condition; + WHERE (upper(REPLACE(name, ' ', ' ') ) LIKE '%".strtolower($stringSearchSQL)."%' OR REPLACE(description, ' ', ' ') LIKE '%".strtolower($stringSearchSQL)."%')".$reports_condition; break; } @@ -77,13 +77,13 @@ if ($searchReports) { case 'postgresql': $sql_count = "SELECT COUNT(id_report) AS count FROM treport - WHERE (name LIKE '%".$stringSearchSQL."%' OR description LIKE '%".$stringSearchSQL."%')".$reports_condition; + WHERE (REPLACE(name, ' ', ' ') LIKE '%".$stringSearchSQL."%' OR REPLACE(description, ' ', ' ') LIKE '%".$stringSearchSQL."%')".$reports_condition; break; case 'oracle': $sql_count = "SELECT COUNT(id_report) AS count FROM treport - WHERE (upper(name) LIKE '%".strtolower($stringSearchSQL)."%' OR upper(description) LIKE '%".strtolower($stringSearchSQL)."%')".$reports_condition; + WHERE (upper(REPLACE(name, ' ', ' ') ) LIKE '%".strtolower($stringSearchSQL)."%' OR upper(REPLACE(description, ' ', ' ') ) LIKE '%".strtolower($stringSearchSQL)."%')".$reports_condition; break; } diff --git a/pandora_console/operation/search_users.getdata.php b/pandora_console/operation/search_users.getdata.php index 212eb8a493..1e8932c4bc 100644 --- a/pandora_console/operation/search_users.getdata.php +++ b/pandora_console/operation/search_users.getdata.php @@ -179,23 +179,23 @@ if ($searchUsers) { case 'mysql': case 'postgresql': $sql = "SELECT id_user, fullname, firstname, lastname, middlename, email, last_connect, is_admin, comments FROM tusuario - WHERE fullname LIKE '%".$stringSearchSQL."%' OR - id_user LIKE '%".$stringSearchSQL."%' OR - firstname LIKE '%".$stringSearchSQL."%' OR - lastname LIKE '%".$stringSearchSQL."%' OR - middlename LIKE '%".$stringSearchSQL."%' OR - email LIKE '%".$stringSearchSQL."%' + WHERE REPLACE(fullname, ' ', ' ') LIKE '%".$stringSearchSQL."%' OR + REPLACE(id_user, ' ', ' ') LIKE '%".$stringSearchSQL."%' OR + REPLACE(firstname, ' ', ' ') LIKE '%".$stringSearchSQL."%' OR + REPLACE(lastname, ' ', ' ') LIKE '%".$stringSearchSQL."%' OR + REPLACE(middlename, ' ', ' ') LIKE '%".$stringSearchSQL."%' OR + REPLACE(email, ' ', ' ') LIKE '%".$stringSearchSQL."%' ORDER BY ".$order['field'].' '.$order['order']; break; case 'oracle': $sql = "SELECT id_user, fullname, firstname, lastname, middlename, email, last_connect, is_admin, comments FROM tusuario - WHERE upper(fullname) LIKE '%".strtolower($stringSearchSQL)."%' OR - upper(id_user) LIKE '%".strtolower($stringSearchSQL)."%' OR - upper(firstname) LIKE '%".strtolower($stringSearchSQL)."%' OR - upper(lastname) LIKE '%".strtolower($stringSearchSQL)."%' OR - upper(middlename) LIKE '%".strtolower($stringSearchSQL)."%' OR - upper(email) LIKE '%".strtolower($stringSearchSQL)."%' + WHERE upper(REPLACE(fullname, ' ', ' ') ) LIKE '%".strtolower($stringSearchSQL)."%' OR + upper(REPLACE(id_user, ' ', ' ') ) LIKE '%".strtolower($stringSearchSQL)."%' OR + upper(REPLACE(firstname, ' ', ' ') ) LIKE '%".strtolower($stringSearchSQL)."%' OR + upper(REPLACE(lastname, ' ', ' ') ) LIKE '%".strtolower($stringSearchSQL)."%' OR + upper(REPLACE(middlename, ' ', ' ') ) LIKE '%".strtolower($stringSearchSQL)."%' OR + upper(REPLACE(email, ' ', ' ') ) LIKE '%".strtolower($stringSearchSQL)."%' ORDER BY ".$order['field'].' '.$order['order']; break; }