From c95f70dde7752a82157ffccac0a3845b32e9f71a Mon Sep 17 00:00:00 2001 From: Alejandro Gallardo Escobar Date: Mon, 4 May 2015 18:27:23 +0200 Subject: [PATCH] Error fixes related with the improved oracle compatibility --- pandora_console/extensions/module_groups.php | 6 +-- .../pandoradb_migrate_5.1_to_6.0.mysql.sql | 4 +- .../pandoradb_migrate_5.1_to_6.0.oracle.sql | 4 +- ...andoradb_migrate_5.1_to_6.0.postgreSQL.sql | 4 +- .../godmode/alerts/alert_list.list.php | 2 +- .../godmode/massive/massive_delete_alerts.php | 4 +- .../godmode/massive/massive_delete_tags.php | 2 +- .../godmode/massive/massive_edit_modules.php | 2 +- .../reporting/graph_builder.graph_editor.php | 6 +-- .../reporting_builder.list_items.php | 12 ++--- .../godmode/reporting/reporting_builder.php | 12 ++--- pandora_console/include/functions_alerts.php | 6 +-- pandora_console/include/functions_api.php | 44 +++++++++---------- pandora_console/include/functions_events.php | 14 +++--- pandora_console/include/functions_gis.php | 14 +++--- .../include/functions_reporting.php | 4 +- pandora_console/include/functions_tags.php | 4 +- .../operation/agentes/estado_agente.php | 8 ++-- .../operation/agentes/status_monitor.php | 4 +- pandora_console/operation/gis_maps/ajax.php | 16 +++---- .../operation/search_agents.getdata.php | 8 ++-- .../operation/search_maps.getdata.php | 4 +- .../operation/search_modules.getdata.php | 24 +++++----- 23 files changed, 104 insertions(+), 104 deletions(-) diff --git a/pandora_console/extensions/module_groups.php b/pandora_console/extensions/module_groups.php index 01d7eb0609..ee5a92eb33 100644 --- a/pandora_console/extensions/module_groups.php +++ b/pandora_console/extensions/module_groups.php @@ -56,9 +56,9 @@ if (is_ajax ()) { $default_action = false; // Try to get actions for the current alert $sql = 'SELECT t2.name - FROM talert_template_module_actions AS t1 - INNER JOIN talert_actions AS t2 - INNER JOIN talert_template_modules AS t3 + FROM talert_template_module_actions t1 + INNER JOIN talert_actions t2 + INNER JOIN talert_template_modules t3 ON t3.id = t1.id_alert_template_module AND t1.id_alert_action = t2.id WHERE (t3.id_alert_template = ' . $template['id'] . ' AND diff --git a/pandora_console/extras/pandoradb_migrate_5.1_to_6.0.mysql.sql b/pandora_console/extras/pandoradb_migrate_5.1_to_6.0.mysql.sql index 56ccc56c20..3d758a0681 100755 --- a/pandora_console/extras/pandoradb_migrate_5.1_to_6.0.mysql.sql +++ b/pandora_console/extras/pandoradb_migrate_5.1_to_6.0.mysql.sql @@ -25,10 +25,10 @@ INSERT INTO `tconfig_os` (`name`, `description`, `icon_name`) VALUES ('Mainframe -- --------------------------------------------------------------------- ALTER TABLE ttag_module ADD COLUMN `id_policy_module` int(10) NOT NULL DEFAULT 0; -UPDATE ttag_module AS t1 +UPDATE ttag_module t1 SET t1.id_policy_module = ( SELECT t2.id_policy_module - FROM tagente_modulo AS t2 + FROM tagente_modulo t2 WHERE t1.id_agente_modulo = t2.id_agente_modulo); /* 2014/12/10 */ diff --git a/pandora_console/extras/pandoradb_migrate_5.1_to_6.0.oracle.sql b/pandora_console/extras/pandoradb_migrate_5.1_to_6.0.oracle.sql index 1edf86c129..13a42d2efb 100755 --- a/pandora_console/extras/pandoradb_migrate_5.1_to_6.0.oracle.sql +++ b/pandora_console/extras/pandoradb_migrate_5.1_to_6.0.oracle.sql @@ -26,10 +26,10 @@ INSERT INTO tconfig_os (name, description, icon_name) VALUES ('Mainframe', 'Main ALTER TABLE tlayout_data ADD COLUMN id_policy_module NUMBER(10, 0) DEFAULT 0 NOT NULL; -UPDATE ttag_module AS t1 +UPDATE ttag_module t1 SET t1.id_policy_module = ( SELECT t2.id_policy_module - FROM tagente_modulo AS t2 + FROM tagente_modulo t2 WHERE t1.id_agente_modulo = t2.id_agente_modulo); /* 2014/12/10 */ diff --git a/pandora_console/extras/pandoradb_migrate_5.1_to_6.0.postgreSQL.sql b/pandora_console/extras/pandoradb_migrate_5.1_to_6.0.postgreSQL.sql index 154d65b308..6d6fd8eec3 100755 --- a/pandora_console/extras/pandoradb_migrate_5.1_to_6.0.postgreSQL.sql +++ b/pandora_console/extras/pandoradb_migrate_5.1_to_6.0.postgreSQL.sql @@ -26,10 +26,10 @@ INSERT INTO "tconfig_os" ("name", "description", "icon_name") VALUES ('Mainframe ALTER TABLE tlayout_data ADD COLUMN "id_policy_module" INTEGER NOT NULL DEFAULT 0; -UPDATE ttag_module AS t1 +UPDATE ttag_module t1 SET t1.id_policy_module = ( SELECT t2.id_policy_module - FROM tagente_modulo AS t2 + FROM tagente_modulo t2 WHERE t1.id_agente_modulo = t2.id_agente_modulo); /* 2014/12/10 */ diff --git a/pandora_console/godmode/alerts/alert_list.list.php b/pandora_console/godmode/alerts/alert_list.list.php index 509279569b..71f3872fce 100644 --- a/pandora_console/godmode/alerts/alert_list.list.php +++ b/pandora_console/godmode/alerts/alert_list.list.php @@ -181,7 +181,7 @@ if ($searchFlag) { case "mysql": case "postgresql": $where .= " AND id_agent_module IN (SELECT t2.id_agente_modulo - FROM tagente AS t1 INNER JOIN tagente_modulo AS t2 ON t1.id_agente = t2.id_agente + FROM tagente t1 INNER JOIN tagente_modulo t2 ON t1.id_agente = t2.id_agente WHERE t1.nombre LIKE '" . trim($agentName) . "')"; break; case "oracle": diff --git a/pandora_console/godmode/massive/massive_delete_alerts.php b/pandora_console/godmode/massive/massive_delete_alerts.php index 3f3f2cf015..781930dd16 100755 --- a/pandora_console/godmode/massive/massive_delete_alerts.php +++ b/pandora_console/godmode/massive/massive_delete_alerts.php @@ -98,10 +98,10 @@ function process_manage_delete ($id_alert_template, $id_agents, $module_names) { if (count($module_names) == 1 && $module_names[0] == '0') { if ($module_selection_mode == 'common') { $sql = 'SELECT t1.id_agente_modulo - FROM tagente_modulo AS t1 + FROM tagente_modulo t1 WHERE t1.id_agente_modulo IN ( SELECT t2.id_agent_module - FROM talert_template_modules AS t2 + FROM talert_template_modules t2 WHERE t2.id_alert_template = ' . $id_alert_template . ') AND t1.id_agente IN (' . implode(',', $id_agents) . ');'; diff --git a/pandora_console/godmode/massive/massive_delete_tags.php b/pandora_console/godmode/massive/massive_delete_tags.php index 52d9ece86e..296a7ab8e1 100755 --- a/pandora_console/godmode/massive/massive_delete_tags.php +++ b/pandora_console/godmode/massive/massive_delete_tags.php @@ -64,7 +64,7 @@ if (is_ajax ()) { WHERE id_agente IN (" . implode(',', $id_agents) . ") AND id_agente_modulo IN ( SELECT t1.id_agente_modulo - FROM ttag_module AS t1 + FROM ttag_module t1 WHERE id_tag = " . $id_tag . " AND id_policy_module = 0) GROUP BY nombre;"); diff --git a/pandora_console/godmode/massive/massive_edit_modules.php b/pandora_console/godmode/massive/massive_edit_modules.php index a277981df9..336b479da3 100755 --- a/pandora_console/godmode/massive/massive_edit_modules.php +++ b/pandora_console/godmode/massive/massive_edit_modules.php @@ -81,7 +81,7 @@ if ($update) { $agents_ = db_get_all_rows_sql(' SELECT DISTINCT(t1.id_agente) - FROM tagente AS t1, tagente_modulo AS t2 + FROM tagente t1, tagente_modulo t2 WHERE t1.id_agente = t2.id_agente AND t2.delete_pending = 0 ' . $condition); foreach ($agents_ as $id_agent) { diff --git a/pandora_console/godmode/reporting/graph_builder.graph_editor.php b/pandora_console/godmode/reporting/graph_builder.graph_editor.php index d41a0c778c..ce57c92111 100644 --- a/pandora_console/godmode/reporting/graph_builder.graph_editor.php +++ b/pandora_console/godmode/reporting/graph_builder.graph_editor.php @@ -39,13 +39,13 @@ if (isset ($_GET["get_agent"])) { if ($editGraph) { $graphRows = db_get_all_rows_sql("SELECT t1.*, (SELECT t3.nombre - FROM tagente AS t3 + FROM tagente t3 WHERE t3.id_agente = (SELECT t2.id_agente - FROM tagente_modulo AS t2 + FROM tagente_modulo t2 WHERE t2.id_agente_modulo = t1.id_agent_module)) AS agent_name - FROM tgraph_source AS t1 + FROM tgraph_source t1 WHERE t1.id_graph = " . $id); $module_array = array(); $weight_array = array(); diff --git a/pandora_console/godmode/reporting/reporting_builder.list_items.php b/pandora_console/godmode/reporting/reporting_builder.list_items.php index 552dcf339a..bb9a9f72cb 100644 --- a/pandora_console/godmode/reporting/reporting_builder.list_items.php +++ b/pandora_console/godmode/reporting/reporting_builder.list_items.php @@ -44,11 +44,11 @@ else { FROM ( SELECT t1.*, id_agente - FROM treport_content AS t1 - LEFT JOIN tagente_modulo AS t2 + FROM treport_content t1 + LEFT JOIN tagente_modulo t2 ON t1.id_agent_module = id_agente_modulo - ) AS t4 - INNER JOIN tagente AS t5 + ) t4 + INNER JOIN tagente t5 ON (t4.id_agent = t5.id_agente OR t4.id_agente = t5.id_agente) WHERE t4.id_report = ' . $idReport); break; @@ -82,8 +82,8 @@ else { case "postgresql": $rows = db_get_all_rows_sql(' SELECT t1.id_agent_module, t2.nombre - FROM treport_content AS t1 - INNER JOIN tagente_modulo AS t2 + FROM treport_content t1 + INNER JOIN tagente_modulo t2 ON t1.id_agent_module = t2.id_agente_modulo WHERE t1.id_report = ' . $idReport); break; diff --git a/pandora_console/godmode/reporting/reporting_builder.php b/pandora_console/godmode/reporting/reporting_builder.php index 780a04d09c..98b0b57d3c 100644 --- a/pandora_console/godmode/reporting/reporting_builder.php +++ b/pandora_console/godmode/reporting/reporting_builder.php @@ -1347,8 +1347,8 @@ switch ($action) { case 'module': $sql = " SELECT t1.id_rc, t2.nombre - FROM treport_content AS t1 - LEFT JOIN tagente_modulo AS t2 + FROM treport_content t1 + LEFT JOIN tagente_modulo t2 ON t1.id_agent_module = t2.id_agente_modulo WHERE %s ORDER BY nombre %s @@ -1360,11 +1360,11 @@ switch ($action) { FROM ( SELECT t1.*, id_agente - FROM treport_content AS t1 - LEFT JOIN tagente_modulo AS t2 + FROM treport_content t1 + LEFT JOIN tagente_modulo t2 ON t1.id_agent_module = id_agente_modulo - ) AS t4 - LEFT JOIN tagente AS t5 + ) t4 + LEFT JOIN tagente t5 ON (t4.id_agent = t5.id_agente OR t4.id_agente = t5.id_agente) WHERE %s ORDER BY t5.nombre %s diff --git a/pandora_console/include/functions_alerts.php b/pandora_console/include/functions_alerts.php index 47ba471751..088f215741 100644 --- a/pandora_console/include/functions_alerts.php +++ b/pandora_console/include/functions_alerts.php @@ -96,11 +96,11 @@ function alerts_get_alerts($id_group = 0, $free_search = "", $status = "all", $s } $sql .= ' FROM talert_template_modules AS t0 - INNER JOIN talert_templates AS t1 + INNER JOIN talert_templates t1 ON t0.id_alert_template = t1.id - INNER JOIN tagente_modulo AS t2 + INNER JOIN tagente_modulo t2 ON t0.id_agent_module = t2.id_agente_modulo - INNER JOIN tagente AS t3 + INNER JOIN tagente t3 ON t2.id_agente = t3.id_agente WHERE 1=1 ' . $status_query . ' ' . $standby_query . ' ' . $group_query . ' diff --git a/pandora_console/include/functions_api.php b/pandora_console/include/functions_api.php index fc3f69f38e..f6eaa8a269 100755 --- a/pandora_console/include/functions_api.php +++ b/pandora_console/include/functions_api.php @@ -742,10 +742,10 @@ function api_get_tree_agents($trash1, $trahs2, $other, $returnType) { $modules = db_get_all_rows_sql('SELECT * FROM (SELECT id_agente_modulo as module_id_agent_modulo ' . $module_additional_columns . ' FROM tagente_modulo - WHERE id_agente = ' . $agent['agent_id'] . ') AS t1 + WHERE id_agente = ' . $agent['agent_id'] . ') t1 INNER JOIN (SELECT id_agente_modulo as module_id_agent_modulo ' . $estado_additional_columns . ' FROM tagente_estado - WHERE id_agente = ' . $agent['agent_id'] . ') AS t2 + WHERE id_agente = ' . $agent['agent_id'] . ') t2 ON t1.module_id_agent_modulo = t2.module_id_agent_modulo'); if ($modules === false) $modules = array(); @@ -766,14 +766,14 @@ function api_get_tree_agents($trash1, $trahs2, $other, $returnType) { $alerts = db_get_all_rows_sql('SELECT t1.id_agent_module as alert_id_agent_module ' . $alert_additional_columns . ' FROM (SELECT * FROM talert_template_modules - WHERE id_agent_module = ' . $module['module_id_agent_modulo'] . ') AS t1 - INNER JOIN talert_templates AS t2 + WHERE id_agent_module = ' . $module['module_id_agent_modulo'] . ') t1 + INNER JOIN talert_templates t2 ON t1.id_alert_template = t2.id - LEFT JOIN talert_template_module_actions AS t3 + LEFT JOIN talert_template_module_actions t3 ON t1.id = t3.id_alert_template_module - LEFT JOIN talert_actions AS t4 + LEFT JOIN talert_actions t4 ON t3.id_alert_action = t4.id - LEFT JOIN talert_commands AS t5 + LEFT JOIN talert_commands t5 ON t4.id_alert_command = t5.id'); if ($alerts === false) $alerts = array(); @@ -981,10 +981,10 @@ function get_module_properties($id_module, $fields, $separator, $returnType, $re $modules = db_get_all_rows_sql('SELECT * FROM (SELECT id_agente_modulo as module_id_agent_modulo ' . $module_additional_columns . ' FROM tagente_modulo - WHERE id_agente_modulo = ' . $id_module . ') AS t1 + WHERE id_agente_modulo = ' . $id_module . ') t1 INNER JOIN (SELECT id_agente_modulo as module_id_agent_modulo ' . $estado_additional_columns . ' FROM tagente_estado - WHERE id_agente_modulo = ' . $id_module . ') AS t2 + WHERE id_agente_modulo = ' . $id_module . ') t2 ON t1.module_id_agent_modulo = t2.module_id_agent_modulo'); if ($modules === false) $modules = array(); @@ -5889,8 +5889,8 @@ function api_set_new_event($trash1, $trash2, $other, $trash3) { } else { $idAlert = db_get_value_sql("SELECT t1.id - FROM talert_template_modules AS t1 - INNER JOIN talert_templates AS t2 + FROM talert_template_modules t1 + INNER JOIN talert_templates t2 ON t1.id_alert_template = t2.id WHERE t1.id_agent_module = 1 AND t2.name LIKE '" . $other['data'][7] . "'"); @@ -6425,10 +6425,10 @@ function get_events_with_user($trash1, $trash2, $other, $returnType, $user_in_db if (defined ('METACONSOLE')) { $sql = "SELECT *, (SELECT t2.nombre - FROM tgrupo AS t2 + FROM tgrupo t2 WHERE t2.id_grupo = " . $table_events . ".id_grupo) AS group_name, (SELECT t2.icon - FROM tgrupo AS t2 + FROM tgrupo t2 WHERE t2.id_grupo = " . $table_events . ".id_grupo) AS group_icon FROM " . $table_events . " WHERE 1=1 " . $sql_post . " @@ -6438,13 +6438,13 @@ function get_events_with_user($trash1, $trash2, $other, $returnType, $user_in_db else { $sql = "SELECT *, (SELECT t1.nombre - FROM tagente AS t1 + FROM tagente t1 WHERE t1.id_agente = tevento.id_agente) AS agent_name, (SELECT t2.nombre - FROM tgrupo AS t2 + FROM tgrupo t2 WHERE t2.id_grupo = tevento.id_grupo) AS group_name, (SELECT t2.icon - FROM tgrupo AS t2 + FROM tgrupo t2 WHERE t2.id_grupo = tevento.id_grupo) AS group_icon, (SELECT tmodule.name FROM tmodule @@ -6464,13 +6464,13 @@ function get_events_with_user($trash1, $trash2, $other, $returnType, $user_in_db //TODO TOTAL $sql = "SELECT *, (SELECT t1.nombre - FROM tagente AS t1 + FROM tagente t1 WHERE t1.id_agente = tevento.id_agente) AS agent_name, (SELECT t2.nombre - FROM tgrupo AS t2 + FROM tgrupo t2 WHERE t2.id_grupo = tevento.id_grupo) AS group_name, (SELECT t2.icon - FROM tgrupo AS t2 + FROM tgrupo t2 WHERE t2.id_grupo = tevento.id_grupo) AS group_icon, (SELECT tmodule.name FROM tmodule @@ -6491,13 +6491,13 @@ function get_events_with_user($trash1, $trash2, $other, $returnType, $user_in_db $sql = "SELECT *, (SELECT t1.nombre - FROM tagente AS t1 + FROM tagente t1 WHERE t1.id_agente = tevento.id_agente) AS agent_name, (SELECT t2.nombre - FROM tgrupo AS t2 + FROM tgrupo t2 WHERE t2.id_grupo = tevento.id_grupo) AS group_name, (SELECT t2.icon - FROM tgrupo AS t2 + FROM tgrupo t2 WHERE t2.id_grupo = tevento.id_grupo) AS group_icon, (SELECT tmodule.name FROM tmodule diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php index 1b7df5b6bd..e0b8fc22e2 100644 --- a/pandora_console/include/functions_events.php +++ b/pandora_console/include/functions_events.php @@ -1267,12 +1267,12 @@ function events_get_group_events_steps ($begin, &$result, $id_group, $period, $d $sql = sprintf ('SELECT *, (SELECT t2.nombre - FROM tagente AS t2 + FROM tagente t2 WHERE t2.id_agente = t3.id_agente) AS agent_name, (SELECT t2.fullname - FROM tusuario AS t2 + FROM tusuario t2 WHERE t2.id_user = t3.id_usuario) AS user_name - FROM tevento AS t3 + FROM tevento t3 WHERE utimestamp > %d AND utimestamp <= %d AND id_grupo IN (%s) ' . $sql_where . ' ORDER BY utimestamp ASC', @@ -2566,10 +2566,10 @@ function events_get_count_events_by_agent ($id_group, $period, $date, $sql = sprintf ('SELECT id_agente, (SELECT t2.nombre - FROM tagente AS t2 + FROM tagente t2 WHERE t2.id_agente = t3.id_agente) AS agent_name, COUNT(*) AS count - FROM tevento AS t3 + FROM tevento t3 WHERE utimestamp > %d AND utimestamp <= %d AND id_grupo IN (%s) ' . $sql_where . ' GROUP BY id_agente', @@ -2648,10 +2648,10 @@ function events_get_count_events_validated_by_user ($filter, $period, $date, $sql = sprintf ('SELECT id_usuario, (SELECT t2.fullname - FROM tusuario AS t2 + FROM tusuario t2 WHERE t2.id_user = t3.id_usuario) AS user_name, COUNT(*) AS count - FROM tevento AS t3 + FROM tevento t3 WHERE utimestamp > %d AND utimestamp <= %d %s ' . $sql_where . ' GROUP BY id_usuario', diff --git a/pandora_console/include/functions_gis.php b/pandora_console/include/functions_gis.php index 260b779891..40367a76fe 100644 --- a/pandora_console/include/functions_gis.php +++ b/pandora_console/include/functions_gis.php @@ -942,9 +942,9 @@ function gis_get_agent_map($agent_id, $heigth, $width, $show_history = false, $c $defaultMap = db_get_all_rows_sql(" SELECT t1.*, t3.conection_name, t3.connection_type, t3.conection_data, t3.num_zoom_levels - FROM tgis_map AS t1, - tgis_map_has_tgis_map_connection AS t2, - tgis_map_connection AS t3 + FROM tgis_map t1, + tgis_map_has_tgis_map_connection t2, + tgis_map_connection t3 WHERE t1.default_map = 1 AND t2.tgis_map_id_tgis_map = t1.id_tgis_map AND t2.default_map_connection = 1 @@ -1189,9 +1189,9 @@ function gis_get_map_data($idMap) { $connections = db_get_all_rows_sql('SELECT t1.tgis_map_connection_id_tmap_connection AS id_conection, t1.default_map_connection AS `default`, ( SELECT t2.num_zoom_levels - FROM tgis_map_connection AS t2 + FROM tgis_map_connection t2 WHERE t2.id_tmap_connection = t1.tgis_map_connection_id_tmap_connection) AS num_zoom_levels - FROM tgis_map_has_tgis_map_connection AS t1 + FROM tgis_map_has_tgis_map_connection t1 WHERE t1.tgis_map_id_tgis_map = '. $map['id_tgis_map']); break; case "postgresql": @@ -1199,9 +1199,9 @@ function gis_get_map_data($idMap) { $connections = db_get_all_rows_sql('SELECT t1.tgis_map_connection_id_tmap_connection AS id_conection, t1.default_map_connection AS "default", ( SELECT t2.num_zoom_levels - FROM tgis_map_connection AS t2 + FROM tgis_map_connection t2 WHERE t2.id_tmap_connection = t1.tgis_map_connection_id_tmap_connection) AS num_zoom_levels - FROM tgis_map_has_tgis_map_connection AS t1 + FROM tgis_map_has_tgis_map_connection t1 WHERE t1.tgis_map_id_tgis_map = '. $map['id_tgis_map']); break; } diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 9a1d52597f..e0f6794392 100644 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -2680,8 +2680,8 @@ function reporting_alert_reporting_module ($id_agent_module, $period = 0, $date $alerts = db_get_all_rows_sql('SELECT *, t1.id as id_alert_template_module - FROM talert_template_modules AS t1 - INNER JOIN talert_templates AS t2 ON t1.id_alert_template = t2.id + FROM talert_template_modules t1 + INNER JOIN talert_templates t2 ON t1.id_alert_template = t2.id WHERE id_agent_module = ' . $id_agent_module); if ($alerts === false) { diff --git a/pandora_console/include/functions_tags.php b/pandora_console/include/functions_tags.php index db61e8e8a3..e5d77416cb 100644 --- a/pandora_console/include/functions_tags.php +++ b/pandora_console/include/functions_tags.php @@ -524,10 +524,10 @@ function tags_get_agents($id_tag, $id_policy_module = 0) { FROM tagente WHERE id_agente IN ( SELECT t1.id_agente - FROM tagente_modulo AS t1 + FROM tagente_modulo t1 WHERE t1.id_agente_modulo IN ( SELECT t2.id_agente_modulo - FROM ttag_module AS t2 + FROM ttag_module t2 WHERE id_tag = " . $id_tag . " AND id_policy_module = " . $id_policy_module . "))"); diff --git a/pandora_console/operation/agentes/estado_agente.php b/pandora_console/operation/agentes/estado_agente.php index b4163d861b..2a7b7d60ca 100644 --- a/pandora_console/operation/agentes/estado_agente.php +++ b/pandora_console/operation/agentes/estado_agente.php @@ -53,10 +53,10 @@ if (is_ajax ()) { case "mysql": $sql = sprintf ("SELECT t1.id, t1.name, (SELECT COUNT(t2.id) - FROM talert_templates AS t2 + FROM talert_templates t2 WHERE t2.id = %d AND t2.id_alert_action = t1.id) as 'sort_order' - FROM talert_actions AS t1 + FROM talert_actions t1 WHERE id_group IN (%s) ORDER BY sort_order DESC", $id_template, $filter_groups); break; @@ -73,10 +73,10 @@ if (is_ajax ()) { case "postgresql": $sql = sprintf ("SELECT t1.id, t1.name, (SELECT COUNT(t2.id) - FROM talert_templates AS t2 + FROM talert_templates t2 WHERE t2.id = %d AND t2.id_alert_action = t1.id) as sort_order - FROM talert_actions AS t1 + FROM talert_actions t1 WHERE id_group IN (%s) ORDER BY sort_order DESC", $id_template, $filter_groups); break; diff --git a/pandora_console/operation/agentes/status_monitor.php b/pandora_console/operation/agentes/status_monitor.php index b549b82361..041cd09697 100644 --- a/pandora_console/operation/agentes/status_monitor.php +++ b/pandora_console/operation/agentes/status_monitor.php @@ -287,8 +287,8 @@ switch ($config["dbtype"]) { case "mysql": case "postgresql": $profiles = db_get_all_rows_sql('SELECT id_grupo - FROM tusuario_perfil AS t1 - INNER JOIN tperfil AS t2 ON t1.id_perfil = t2.id_perfil + FROM tusuario_perfil t1 + INNER JOIN tperfil t2 ON t1.id_perfil = t2.id_perfil WHERE t2.agent_view = 1 AND t1.id_usuario = \'' . $config['id_user'] . '\''); if ($profiles === false) $profiles = array(); diff --git a/pandora_console/operation/gis_maps/ajax.php b/pandora_console/operation/gis_maps/ajax.php index 09687ab8fa..33e5de8aa3 100644 --- a/pandora_console/operation/gis_maps/ajax.php +++ b/pandora_console/operation/gis_maps/ajax.php @@ -120,16 +120,16 @@ switch ($opt) { $agentsGISStatus = db_get_all_rows_sql('SELECT t1.nombre, id_parent, t1.id_agente AS tagente_id_agente, IFNULL(t2.stored_longitude, ' . $defaultCoords['default_longitude'] . ') AS stored_longitude, IFNULL(t2.stored_latitude, ' . $defaultCoords['default_latitude'] . ') AS stored_latitude - FROM tagente AS t1 - LEFT JOIN tgis_data_status AS t2 ON t1.id_agente = t2.tagente_id_agente + FROM tagente t1 + LEFT JOIN tgis_data_status t2 ON t1.id_agente = t2.tagente_id_agente WHERE 1 = 0'); } else { $agentsGISStatus = db_get_all_rows_sql('SELECT t1.nombre, id_parent, t1.id_agente AS tagente_id_agente, IFNULL(t2.stored_longitude, ' . $defaultCoords['default_longitude'] . ') AS stored_longitude, IFNULL(t2.stored_latitude, ' . $defaultCoords['default_latitude'] . ') AS stored_latitude - FROM tagente AS t1 - LEFT JOIN tgis_data_status AS t2 ON t1.id_agente = t2.tagente_id_agente + FROM tagente t1 + LEFT JOIN tgis_data_status t2 ON t1.id_agente = t2.tagente_id_agente WHERE id_agente IN (' . implode(',', $idAgentsWithGIS) . ')'); } break; @@ -138,16 +138,16 @@ switch ($opt) { $agentsGISStatus = db_get_all_rows_sql('SELECT t1.nombre, id_parent, t1.id_agente AS tagente_id_agente, COALESCE(t2.stored_longitude, ' . $defaultCoords['default_longitude'] . ') AS stored_longitude, COALESCE(t2.stored_latitude, ' . $defaultCoords['default_latitude'] . ') AS stored_latitude - FROM tagente AS t1 - LEFT JOIN tgis_data_status AS t2 ON t1.id_agente = t2.tagente_id_agente + FROM tagente t1 + LEFT JOIN tgis_data_status t2 ON t1.id_agente = t2.tagente_id_agente WHERE 1 = 0'); } else { $agentsGISStatus = db_get_all_rows_sql('SELECT t1.nombre, id_parent, t1.id_agente AS tagente_id_agente, COALESCE(t2.stored_longitude, ' . $defaultCoords['default_longitude'] . ') AS stored_longitude, COALESCE(t2.stored_latitude, ' . $defaultCoords['default_latitude'] . ') AS stored_latitude - FROM tagente AS t1 - LEFT JOIN tgis_data_status AS t2 ON t1.id_agente = t2.tagente_id_agente + FROM tagente t1 + LEFT JOIN tgis_data_status t2 ON t1.id_agente = t2.tagente_id_agente WHERE id_agente IN (' . implode(',', $idAgentsWithGIS) . ')'); } break; diff --git a/pandora_console/operation/search_agents.getdata.php b/pandora_console/operation/search_agents.getdata.php index c1740c9d34..7e63fbc9fe 100644 --- a/pandora_console/operation/search_agents.getdata.php +++ b/pandora_console/operation/search_agents.getdata.php @@ -118,8 +118,8 @@ if ($searchAgents) { switch ($config["dbtype"]) { case "mysql": $sql = " - FROM tagente AS t1 - INNER JOIN tgrupo AS t2 + FROM tagente t1 + INNER JOIN tgrupo t2 ON t2.id_grupo = t1.id_grupo WHERE ( 1 = ( @@ -149,8 +149,8 @@ if ($searchAgents) { case "postgresql": case "oracle": $sql = " - FROM tagente AS t1 - INNER JOIN tgrupo AS t2 + FROM tagente t1 + INNER JOIN tgrupo t2 ON t2.id_grupo = t1.id_grupo WHERE ( 1 = ( diff --git a/pandora_console/operation/search_maps.getdata.php b/pandora_console/operation/search_maps.getdata.php index 4e9b5e8137..fb110bf6bb 100644 --- a/pandora_console/operation/search_maps.getdata.php +++ b/pandora_console/operation/search_maps.getdata.php @@ -21,8 +21,8 @@ $searchMaps = check_acl($config["id_user"], 0, "IR"); $maps = false; if ($searchMaps) { $sql = "SELECT t1.id, t1.name, t1.id_group, - (SELECT COUNT(*) FROM tlayout_data AS t2 WHERE t2.id_layout = t1.id) AS count - FROM tlayout AS t1 WHERE t1.name LIKE '%" . $stringSearchSQL . "%' + (SELECT COUNT(*) FROM tlayout_data t2 WHERE t2.id_layout = t1.id) AS count + FROM tlayout t1 WHERE t1.name LIKE '%" . $stringSearchSQL . "%' LIMIT " . $config['block_size'] . " OFFSET " . get_parameter ('offset',0); $maps = db_process_sql($sql); diff --git a/pandora_console/operation/search_modules.getdata.php b/pandora_console/operation/search_modules.getdata.php index be2fff2145..753befbf7e 100644 --- a/pandora_console/operation/search_modules.getdata.php +++ b/pandora_console/operation/search_modules.getdata.php @@ -95,12 +95,12 @@ if ($searchModules) { switch ($config["dbtype"]) { case "mysql": $chunk_sql = ' - FROM tagente_modulo AS t1 - INNER JOIN tagente AS t2 + FROM tagente_modulo t1 + INNER JOIN tagente t2 ON t2.id_agente = t1.id_agente - INNER JOIN tgrupo AS t3 + INNER JOIN tgrupo t3 ON t3.id_grupo = t2.id_grupo - INNER JOIN tagente_estado AS t4 + INNER JOIN tagente_estado t4 ON t4.id_agente_modulo = t1.id_agente_modulo WHERE ' . $sql_tags . ' @@ -124,12 +124,12 @@ if ($searchModules) { break; case "postgresql": $chunk_sql = ' - FROM tagente_modulo AS t1 - INNER JOIN tagente AS t2 + FROM tagente_modulo t1 + INNER JOIN tagente t2 ON t2.id_agente = t1.id_agente - INNER JOIN tgrupo AS t3 + INNER JOIN tgrupo t3 ON t3.id_grupo = t2.id_grupo - INNER JOIN tagente_estado AS t4 + INNER JOIN tagente_estado t4 ON t4.id_agente_modulo = t1.id_agente_modulo WHERE ' . $sql_tags . ' @@ -152,12 +152,12 @@ if ($searchModules) { break; case "oracle": $chunk_sql = ' - FROM tagente_modulo AS t1 - INNER JOIN tagente AS t2 + FROM tagente_modulo t1 + INNER JOIN tagente t2 ON t2.id_agente = t1.id_agente - INNER JOIN tgrupo AS t3 + INNER JOIN tgrupo t3 ON t3.id_grupo = t2.id_grupo - INNER JOIN tagente_estado AS t4 + INNER JOIN tagente_estado t4 ON t4.id_agente_modulo = t1.id_agente_modulo WHERE ' . $sql_tags . '