From ae8410e36ef98d0cd26f2bb671b34dc43788aabb Mon Sep 17 00:00:00 2001 From: juanmanuelr Date: Tue, 19 Apr 2011 18:42:49 +0000 Subject: [PATCH] * include/functions_graph.php include/functions_html.php include/functions_messages.php include/db/postgresql.php include/db/mysql.php include/db/oracle.php include/functions_reporting.php include/functions_filemanager.php include/functions_gis.php include/auth/ldap.php include/auth/mysql.php include/functions_networkmap.php include/functions_network_components.php include/ajax/skins.ajax.php include/ajax/reporting.ajax.php include/ajax/visual_console_builder.ajax.php include/ajax/alert_list.ajax.php include/ajax/module.php include/functions_config.php include/functions_api.php include/help/en/help_timesource.php include/help/es/help_timesource.php include/help/ja/help_timesource.php include/config_process.php include/functions_ui.php include/functions_custom_graphs.php include/fgraph.php include/functions_incidents.php include/api.php include/functions_reports.php include/functions_ui_renders.php extensions/insert_data.php extensions/system_info.php extensions/extension_uploader.php extensions/pandora_logs.php extensions/agents_modules.php extensions/update_manager.php extensions/ssh_console.php extensions/dbmanager.php extensions/vnc_view.php extensions/resource_registration.php extensions/resource_exportation.php extensions/users_connected.php extensions/module_groups.php extensions/update_manager/load_updatemanager.php extensions/update_manager/lib/libupdate_manager_client.php extensions/update_manager/lib/libupdate_manager.php extensions/update_manager/lib/libupdate_manager_components.php extensions/update_manager/lib/libupdate_manager_updates.php extensions/update_manager/settings.php extensions/update_manager/main.php extensions/plugin_registration.php operation/incidents/incident.php operation/incidents/incident_detail.php operation/incidents/incident_statistics.php operation/search_modules.php operation/visual_console/render_view.php operation/visual_console/index.php operation/extensions.php operation/agentes/status_monitor.php operation/agentes/export_csv.php operation/agentes/estado_ultimopaquete.php operation/agentes/datos_agente.php operation/agentes/alerts_status.php operation/agentes/estado_generalagente.php operation/agentes/custom_fields.php operation/agentes/estado_agente.php operation/agentes/networkmap.topology.php operation/agentes/networkmap.groups.php operation/agentes/sla_view.php operation/agentes/exportdata.php operation/agentes/gis_view.php operation/agentes/estado_monitores.php operation/agentes/ver_agente.php operation/agentes/graphs.php operation/agentes/agent_fields.php operation/agentes/tactical.php operation/agentes/group_view.php operation/agentes/networkmap.php operation/agentes/stat_win.php operation/servers/view_server.php operation/servers/view_server_detail.php operation/menu.php operation/search_agents.php operation/search_graphs.php operation/snmpconsole/snmp_view.php operation/users/user_edit.php operation/gis_maps/render_view.php operation/gis_maps/ajax.php operation/integria_incidents/incident.php operation/integria_incidents/incident_detail.php operation/integria_incidents/incident_statistics.php operation/events/event_statistics.php operation/events/events_rss.php operation/events/export_csv.php operation/events/sound_events.php operation/events/events_validate.php operation/events/events_list.php operation/events/events_marquee.php operation/events/events.php operation/search_alerts.php operation/messages/message.php operation/reporting/reporting_xml.php operation/reporting/reporting_viewer.php operation/reporting/graph_viewer.php operation/search_reports.php operation/search_maps.php operation/search_users.php extras/pandora_diag.php mobile/operation/agents/monitor_status.php mobile/operation/agents/view_agents.php mobile/operation/agents/view_alerts.php mobile/operation/agents/group_view.php mobile/operation/events/events.php mobile/index.php general/error_authconfig.php general/links_menu.php general/logon_ok.php general/error_dbconfig.php general/ui/agents_list.php general/header.php godmode/groups/modu_group_list.php godmode/groups/configure_group.php godmode/groups/configure_modu_group.php godmode/groups/group_list.php godmode/admin_access_logs.php godmode/db/db_main.php godmode/db/db_audit.php godmode/db/db_sanity.php godmode/db/db_refine.php godmode/db/db_info.php godmode/db/db_event.php godmode/db/db_purge.php godmode/extensions.php godmode/agentes/agent_template.php godmode/agentes/module_manager_editor_common.php godmode/agentes/fields_manager.php godmode/agentes/agent_conf_gis.php godmode/agentes/module_manager_editor_prediction.php godmode/agentes/module_manager.php godmode/agentes/modificar_agente.php godmode/agentes/configurar_agente.php godmode/agentes/configure_field.php godmode/agentes/module_manager_editor.php godmode/agentes/planned_downtime.php godmode/agentes/manage_config_remote.php godmode/agentes/agent_manager.php godmode/servers/recon_script.php godmode/servers/plugin.php godmode/servers/manage_recontask.php godmode/servers/modificar_server.php godmode/servers/manage_recontask_form.php godmode/alerts/alert_list.list.php godmode/alerts/configure_alert_compound.php godmode/alerts/alert_compounds.php godmode/alerts/alert_list.php godmode/alerts/configure_alert_template.php godmode/alerts/alert_templates.php godmode/alerts/configure_alert_action.php godmode/alerts/configure_alert_command.php godmode/alerts/alert_actions.php godmode/alerts/alert_list.builder.php godmode/alerts/alert_commands.php godmode/setup/file_manager.php godmode/setup/os.list.php godmode/setup/news.php godmode/setup/gis_step_2.php godmode/setup/links.php godmode/setup/setup.php godmode/setup/os.php godmode/setup/performance.php godmode/setup/setup_auth.php godmode/setup/gis.php godmode/setup/os.builder.php godmode/setup/setup_visuals.php godmode/snmpconsole/snmp_alert.php godmode/snmpconsole/snmp_filters.php godmode/users/user_list.php godmode/users/configure_profile.php godmode/gis_maps/configure_gis_map.php godmode/gis_maps/index.php godmode/massive/massive_add_alerts.php godmode/massive/massive_copy_modules.php godmode/massive/massive_delete_agents.php godmode/massive/massive_enable_disable_alerts.php godmode/massive/massive_operations.php godmode/massive/massive_delete_profiles.php godmode/massive/massive_edit_agents.php godmode/massive/massive_delete_action_alerts.php godmode/massive/massive_delete_modules.php godmode/massive/massive_add_profiles.php godmode/massive/massive_delete_alerts.php godmode/massive/massive_edit_modules.php godmode/massive/massive_standby_alerts.php godmode/massive/massive_add_action_alerts.php godmode/modules/manage_network_components_form.php godmode/modules/manage_nc_groups_form.php godmode/modules/manage_network_templates.php godmode/modules/module_list.php godmode/modules/manage_network_components_form_common.php godmode/modules/manage_network_components_form_network.php godmode/modules/manage_network_templates_form.php godmode/modules/manage_network_components_form_wmi.php godmode/modules/manage_network_components.php godmode/modules/manage_nc_groups.php godmode/reporting/visual_console_builder.wizard.php godmode/reporting/graph_builder.main.php godmode/reporting/reporting_builder.list_items.php godmode/reporting/visual_console_builder.php godmode/reporting/reporting_builder.preview.php godmode/reporting/reporting_builder.main.php godmode/reporting/visual_console_builder.data.php godmode/reporting/visual_console_builder.elements.php godmode/reporting/graph_builder.php godmode/reporting/visual_console_builder.preview.php godmode/reporting/graph_builder.graph_editor.php godmode/reporting/reporting_builder.php godmode/reporting/visual_console_builder.editor.php godmode/reporting/reporting_builder.item_editor.php godmode/reporting/map_builder.php godmode/reporting/graphs.php godmode/reporting/graph_builder.preview.php include/functions_db.php: Added some includes and functions of this code have "db_" prefix. * include/functions.php: Moved function check_login(), check_acl(), dame_nombre_pluginid(), get_os_name() from functions_db.php to functions.php. * include/functions_groups.php: Moved functions get_childrens(), safe_acl_group() and get_parents(), give_disabled_group(), isAllGroups(), get_group_icon(), get_all_groups(), get_id_groups_recursive(), get_user_groups_tree_recursive(), get_group_status(), get_group_name(), get_group_users() from functions_db.php to this code. * include/functions_profile.php: New library with profile functions. Moved functions get_profile_name(), get_profiles(), create_user_profile(), delete_user_profile(), delete_profile() from functions_db.php to this code. Added new parameter in function get_profile() to retrieve profiles with filter conditions applied. * include/functions_users.php: New library with users functions. Moved functions get_users_info(), get_all_model_groups(), get_user_groups(), get_user_groups_tree(), get_user_first_group(), user_access_to_agent() from funtions_db.php to this code. * godmode/users/configure_user.php: Changed get_profile_filter() function to get_profile(). * include/functions_agents.php: Moved functions get_group_agents(), get_agent_modules(), get_agent_module_id(), get_agent_id(), get_agent_name(), get_agent_modules_data_count(), check_alert_fired(), get_agent_interval(), get_agent_os(), give_agentmodule_flag(), agent_add_address(), agent_delete_address(), get_agent_address(), get_agent_with_ip(), get_agent_addresses(), get_agent_status(), delete_agent(), get_agentmodule_group(), get_agent_group() from functions_db.php to this code. * include/functions_modules.php: Moved functions get_agentmodule(), get_agentmodule_id(), get_agentmodule_is_init(), get_agent_modules_count(), get_module_type_name(), get_module_type_icon(), get_agentmodule_agent(), get_agentmodule_agent_name(), get_agentmodule_name(), get_agentmodule_type(), get_monitor_downs_in_period(), get_monitor_last_down_timestamp_in_period(), get_monitors_in_group(), get_monitors_in_agent(), get_monitors_down(), get_moduletype_name(), get_moduletype_description(), get_moduletypes(), get_module_interval(), show_icon_type(), give_modulecategory_name(), give_agent_id_from_module_id(), get_module_status(), get_agent_module_last_value(), get_previous_data(), get_agentmodule_modulegroup(), get_modulegroups(), get_modulegroup_name() from functions_db.php to this code. * include/functions_alerts.php: Moved functions get_alert_type(), get_agent_alert_fired(), get_module_alert_fired(), get_alert_fires_in_period(), get_group_alerts(), get_alerts_fired(), get_alert_last_fire_timestamp_in_period(), get_agentmodule_status(), get_agentmodule_last_status() from functions_db.php to this code. * include/functions_exportserver.php: Moved function dame_nombre_servidorexportacion() from functions_db.php to this code. * include/functions_events.php: Moved functions get_group_events(), get_agent_events(), get_module_events() from functions_db.php to this code. * include/functions_servers.php: Moved functions get_server_name(), show_server_type(), check_server_status(), server_status() from functions_db.php to this code. * include/functions_network_profiles.php: Moved function get_networkprofile_name() from functions_db.php to this code. * include/functions_visual_map.php: Moved functions get_layoutdata_x(), get_layoutdata_y() from fucntions_db.php to this code. * include/functions_io.php: Moved function __() from functions_db.php to this code. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4258 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/extensions/agents_modules.php | 12 +- pandora_console/extensions/dbmanager.php | 10 +- .../extensions/extension_uploader.php | 2 +- pandora_console/extensions/insert_data.php | 12 +- pandora_console/extensions/module_groups.php | 14 +- pandora_console/extensions/pandora_logs.php | 2 +- .../extensions/plugin_registration.php | 10 +- .../extensions/resource_exportation.php | 46 +- .../extensions/resource_registration.php | 56 +- pandora_console/extensions/ssh_console.php | 2 +- pandora_console/extensions/system_info.php | 82 +- pandora_console/extensions/update_manager.php | 36 +- .../update_manager/lib/libupdate_manager.php | 130 +- .../lib/libupdate_manager_client.php | 14 +- .../lib/libupdate_manager_components.php | 30 +- .../lib/libupdate_manager_updates.php | 24 +- .../update_manager/load_updatemanager.php | 12 +- .../extensions/update_manager/main.php | 2 +- .../extensions/update_manager/settings.php | 2 +- .../extensions/users_connected.php | 2 +- pandora_console/extensions/vnc_view.php | 2 +- pandora_console/extras/pandora_diag.php | 10 +- pandora_console/general/error_authconfig.php | 2 +- pandora_console/general/error_dbconfig.php | 2 +- pandora_console/general/header.php | 4 +- pandora_console/general/links_menu.php | 2 +- pandora_console/general/logon_ok.php | 4 +- pandora_console/general/ui/agents_list.php | 1 + pandora_console/godmode/admin_access_logs.php | 14 +- .../godmode/agentes/agent_conf_gis.php | 3 +- .../godmode/agentes/agent_manager.php | 8 +- .../godmode/agentes/agent_template.php | 14 +- .../godmode/agentes/configurar_agente.php | 85 +- .../godmode/agentes/configure_field.php | 4 +- .../godmode/agentes/fields_manager.php | 10 +- .../godmode/agentes/manage_config_remote.php | 13 +- .../godmode/agentes/modificar_agente.php | 16 +- .../godmode/agentes/module_manager.php | 37 +- .../godmode/agentes/module_manager_editor.php | 14 +- .../agentes/module_manager_editor_common.php | 2 + .../module_manager_editor_prediction.php | 3 +- .../godmode/agentes/planned_downtime.php | 28 +- .../godmode/alerts/alert_actions.php | 32 +- .../godmode/alerts/alert_commands.php | 20 +- .../godmode/alerts/alert_compounds.php | 10 +- .../godmode/alerts/alert_list.builder.php | 5 +- .../godmode/alerts/alert_list.list.php | 16 +- pandora_console/godmode/alerts/alert_list.php | 51 +- .../godmode/alerts/alert_templates.php | 12 +- .../godmode/alerts/configure_alert_action.php | 7 +- .../alerts/configure_alert_command.php | 2 +- .../alerts/configure_alert_compound.php | 6 +- .../alerts/configure_alert_template.php | 19 +- pandora_console/godmode/db/db_audit.php | 6 +- pandora_console/godmode/db/db_event.php | 6 +- pandora_console/godmode/db/db_info.php | 4 +- pandora_console/godmode/db/db_main.php | 26 +- pandora_console/godmode/db/db_purge.php | 84 +- pandora_console/godmode/db/db_refine.php | 8 +- pandora_console/godmode/db/db_sanity.php | 20 +- pandora_console/godmode/extensions.php | 2 +- .../godmode/gis_maps/configure_gis_map.php | 4 +- pandora_console/godmode/gis_maps/index.php | 8 +- .../godmode/groups/configure_group.php | 7 +- .../godmode/groups/configure_modu_group.php | 4 +- pandora_console/godmode/groups/group_list.php | 24 +- .../godmode/groups/modu_group_list.php | 14 +- .../massive/massive_add_action_alerts.php | 5 +- .../godmode/massive/massive_add_alerts.php | 8 +- .../godmode/massive/massive_add_profiles.php | 12 +- .../godmode/massive/massive_copy_modules.php | 7 +- .../massive/massive_delete_action_alerts.php | 7 +- .../godmode/massive/massive_delete_agents.php | 13 +- .../godmode/massive/massive_delete_alerts.php | 8 +- .../massive/massive_delete_modules.php | 13 +- .../massive/massive_delete_profiles.php | 13 +- .../godmode/massive/massive_edit_agents.php | 25 +- .../godmode/massive/massive_edit_modules.php | 25 +- .../massive/massive_enable_disable_alerts.php | 11 +- .../godmode/massive/massive_operations.php | 2 +- .../massive/massive_standby_alerts.php | 11 +- .../godmode/modules/manage_nc_groups.php | 12 +- .../godmode/modules/manage_nc_groups_form.php | 2 +- .../modules/manage_network_components.php | 2 +- .../manage_network_components_form.php | 2 +- .../manage_network_components_form_common.php | 2 +- ...manage_network_components_form_network.php | 2 +- .../manage_network_components_form_wmi.php | 8 +- .../modules/manage_network_templates.php | 6 +- .../modules/manage_network_templates_form.php | 19 +- .../godmode/modules/module_list.php | 6 +- .../reporting/graph_builder.graph_editor.php | 10 +- .../godmode/reporting/graph_builder.main.php | 4 +- .../godmode/reporting/graph_builder.php | 16 +- .../reporting/graph_builder.preview.php | 8 +- pandora_console/godmode/reporting/graphs.php | 8 +- .../godmode/reporting/map_builder.php | 20 +- .../reporting_builder.item_editor.php | 45 +- .../reporting_builder.list_items.php | 20 +- .../reporting/reporting_builder.main.php | 4 +- .../godmode/reporting/reporting_builder.php | 62 +- .../reporting/reporting_builder.preview.php | 9 +- .../reporting/visual_console_builder.data.php | 3 +- .../visual_console_builder.editor.php | 8 +- .../visual_console_builder.elements.php | 5 +- .../reporting/visual_console_builder.php | 31 +- .../visual_console_builder.preview.php | 2 +- .../visual_console_builder.wizard.php | 3 +- .../godmode/servers/manage_recontask.php | 18 +- .../godmode/servers/manage_recontask_form.php | 6 +- .../godmode/servers/modificar_server.php | 8 +- pandora_console/godmode/servers/plugin.php | 16 +- .../godmode/servers/recon_script.php | 14 +- .../godmode/setup/file_manager.php | 2 +- pandora_console/godmode/setup/gis.php | 4 +- pandora_console/godmode/setup/gis_step_2.php | 4 +- pandora_console/godmode/setup/links.php | 12 +- pandora_console/godmode/setup/news.php | 12 +- pandora_console/godmode/setup/os.builder.php | 2 +- pandora_console/godmode/setup/os.list.php | 4 +- pandora_console/godmode/setup/os.php | 12 +- pandora_console/godmode/setup/performance.php | 2 +- pandora_console/godmode/setup/setup.php | 8 +- pandora_console/godmode/setup/setup_auth.php | 4 +- .../godmode/setup/setup_visuals.php | 2 +- .../godmode/snmpconsole/snmp_alert.php | 14 +- .../godmode/snmpconsole/snmp_filters.php | 12 +- .../godmode/users/configure_profile.php | 22 +- .../godmode/users/configure_user.php | 28 +- pandora_console/godmode/users/user_list.php | 12 +- .../include/ajax/alert_list.ajax.php | 6 +- pandora_console/include/ajax/module.php | 2 + .../include/ajax/reporting.ajax.php | 16 +- pandora_console/include/ajax/skins.ajax.php | 2 +- .../ajax/visual_console_builder.ajax.php | 25 +- pandora_console/include/api.php | 2 +- pandora_console/include/auth/ldap.php | 4 +- pandora_console/include/auth/mysql.php | 27 +- pandora_console/include/config_process.php | 8 +- pandora_console/include/db/mysql.php | 159 +- pandora_console/include/db/oracle.php | 172 +- pandora_console/include/db/postgresql.php | 158 +- pandora_console/include/fgraph.php | 102 +- pandora_console/include/functions.php | 182 + pandora_console/include/functions_agents.php | 887 ++++- pandora_console/include/functions_alerts.php | 364 +- pandora_console/include/functions_api.php | 88 +- pandora_console/include/functions_config.php | 22 +- .../include/functions_custom_graphs.php | 10 +- pandora_console/include/functions_db.php | 3101 +---------------- pandora_console/include/functions_events.php | 139 +- .../include/functions_exportserver.php | 16 +- .../include/functions_filemanager.php | 6 +- pandora_console/include/functions_gis.php | 81 +- pandora_console/include/functions_graph.php | 83 +- pandora_console/include/functions_groups.php | 422 ++- pandora_console/include/functions_html.php | 11 +- .../include/functions_incidents.php | 48 +- pandora_console/include/functions_io.php | 53 + .../include/functions_messages.php | 21 +- pandora_console/include/functions_modules.php | 720 +++- .../include/functions_network_components.php | 36 +- .../include/functions_network_profiles.php | 15 +- .../include/functions_networkmap.php | 20 +- pandora_console/include/functions_profile.php | 121 + .../include/functions_reporting.php | 125 +- pandora_console/include/functions_reports.php | 58 +- pandora_console/include/functions_servers.php | 147 +- pandora_console/include/functions_ui.php | 19 +- .../include/functions_ui_renders.php | 2 + pandora_console/include/functions_users.php | 188 + .../include/functions_visual_map.php | 66 +- .../include/help/en/help_timesource.php | 6 +- .../include/help/es/help_timesource.php | 6 +- .../include/help/ja/help_timesource.php | 6 +- pandora_console/mobile/index.php | 16 +- .../mobile/operation/agents/group_view.php | 5 + .../operation/agents/monitor_status.php | 10 +- .../mobile/operation/agents/view_agents.php | 17 +- .../mobile/operation/agents/view_alerts.php | 6 + .../mobile/operation/events/events.php | 7 +- .../operation/agentes/agent_fields.php | 6 +- .../operation/agentes/alerts_status.php | 9 +- .../operation/agentes/custom_fields.php | 6 +- .../operation/agentes/datos_agente.php | 6 +- .../operation/agentes/estado_agente.php | 12 +- .../agentes/estado_generalagente.php | 9 +- .../operation/agentes/estado_monitores.php | 11 +- .../agentes/estado_ultimopaquete.php | 10 +- .../operation/agentes/export_csv.php | 6 +- .../operation/agentes/exportdata.php | 2 + .../operation/agentes/gis_view.php | 13 +- pandora_console/operation/agentes/graphs.php | 2 +- .../operation/agentes/group_view.php | 10 +- .../operation/agentes/networkmap.groups.php | 2 +- .../operation/agentes/networkmap.php | 2 +- .../operation/agentes/networkmap.topology.php | 2 +- .../operation/agentes/sla_view.php | 6 +- .../operation/agentes/stat_win.php | 1 + .../operation/agentes/status_monitor.php | 16 +- .../operation/agentes/tactical.php | 6 +- .../operation/agentes/ver_agente.php | 42 +- .../operation/events/event_statistics.php | 2 +- pandora_console/operation/events/events.php | 4 +- .../operation/events/events_list.php | 15 +- .../operation/events/events_marquee.php | 7 +- .../operation/events/events_rss.php | 3 +- .../operation/events/events_validate.php | 2 +- .../operation/events/export_csv.php | 6 +- .../operation/events/sound_events.php | 2 +- pandora_console/operation/extensions.php | 2 +- pandora_console/operation/gis_maps/ajax.php | 24 +- .../operation/gis_maps/render_view.php | 13 +- .../operation/incidents/incident.php | 2 +- .../operation/incidents/incident_detail.php | 19 +- .../incidents/incident_statistics.php | 2 +- .../operation/integria_incidents/incident.php | 2 +- .../integria_incidents/incident_detail.php | 19 +- .../incident_statistics.php | 2 +- pandora_console/operation/menu.php | 6 +- .../operation/messages/message.php | 2 + .../operation/reporting/graph_viewer.php | 12 +- .../operation/reporting/reporting_viewer.php | 13 +- .../operation/reporting/reporting_xml.php | 36 +- pandora_console/operation/search_agents.php | 6 +- pandora_console/operation/search_alerts.php | 3 + pandora_console/operation/search_graphs.php | 4 +- pandora_console/operation/search_maps.php | 4 +- pandora_console/operation/search_modules.php | 7 +- pandora_console/operation/search_reports.php | 4 +- pandora_console/operation/search_users.php | 10 +- .../operation/servers/view_server.php | 2 +- .../operation/servers/view_server_detail.php | 10 +- .../operation/snmpconsole/snmp_view.php | 25 +- pandora_console/operation/users/user_edit.php | 8 +- .../operation/visual_console/index.php | 3 +- .../operation/visual_console/render_view.php | 8 +- 237 files changed, 5256 insertions(+), 4897 deletions(-) create mode 100644 pandora_console/include/functions_profile.php create mode 100644 pandora_console/include/functions_users.php diff --git a/pandora_console/extensions/agents_modules.php b/pandora_console/extensions/agents_modules.php index 5d54d91564..3874aeb19f 100644 --- a/pandora_console/extensions/agents_modules.php +++ b/pandora_console/extensions/agents_modules.php @@ -14,6 +14,10 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. +include_once($config['homedir'] . "/include/functions_agents.php"); +include_once($config['homedir'] . "/include/functions_modules.php"); +include_once($config['homedir'] . '/include/functions_users.php'); + function mainAgentsModules() { global $config; @@ -24,7 +28,7 @@ function mainAgentsModules() { check_login (); // ACL Check if (! check_acl ($config['id_user'], 0, "AR")) { - pandora_audit("ACL Violation", + db_pandora_audit("ACL Violation", "Trying to access Agent view (Grouped)"); require ("general/noaccess.php"); exit; @@ -38,10 +42,10 @@ function mainAgentsModules() { if (check_acl ($config['id_user'], $group, "AW")) { $where = array("id_agente" => "ANY(SELECT id_agente FROM tagente WHERE id_grupo = " . $group); - process_sql_update('tagente_modulo', array("flag" => 1), $where); + db_process_sql_update('tagente_modulo', array("flag" => 1), $where); } else { - pandora_audit("ACL Violation", "Trying to set flag for groups"); + db_pandora_audit("ACL Violation", "Trying to set flag for groups"); require ("general/noaccess.php"); exit; } @@ -49,7 +53,7 @@ function mainAgentsModules() { if ($config["realtimestats"] == 0) { - $updated_info = __('Last update'). " : ". ui_print_timestamp (get_db_sql ("SELECT min(utimestamp) FROM tgroup_stat"), true); + $updated_info = __('Last update'). " : ". ui_print_timestamp (db_get_sql ("SELECT min(utimestamp) FROM tgroup_stat"), true); } else { $updated_info = __("Updated at realtime"); diff --git a/pandora_console/extensions/dbmanager.php b/pandora_console/extensions/dbmanager.php index 611f2e2427..cd4fc34a56 100644 --- a/pandora_console/extensions/dbmanager.php +++ b/pandora_console/extensions/dbmanager.php @@ -57,12 +57,12 @@ function dbmanager_query ($sql, &$error) { $sql = html_entity_decode($sql, ENT_QUOTES); - $result = process_sql($sql, "affected_rows", '', false, $status); + $result = db_process_sql($sql, "affected_rows", '', false, $status); //$result = mysql_query ($sql); if ($result === false) { $backtrace = debug_backtrace(); - $error = get_db_last_error(); + $error = db_get_last_error(); return false; } @@ -84,7 +84,7 @@ function dbmgr_extension_main () { global $config; if (! check_acl ($config['id_user'], 0, "PM") && ! is_user_admin ($config['id_user'])) { - pandora_audit("ACL Violation", "Trying to access Setup Management"); + db_pandora_audit("ACL Violation", "Trying to access Setup Management"); require ("general/noaccess.php"); return; } @@ -124,7 +124,7 @@ function dbmgr_extension_main () { echo 'An error has occured when querying the database.
'; echo $error; - pandora_audit("Extension DB inface", "Error in SQL", false, false, $sql); + db_pandora_audit("Extension DB inface", "Error in SQL", false, false, $sql); return; } @@ -132,7 +132,7 @@ function dbmgr_extension_main () { if (! is_array ($result)) { echo "Output: ".$result; - pandora_audit("Extension DB inface", "SQL", false, false, $sql); + db_pandora_audit("Extension DB inface", "SQL", false, false, $sql); return; } diff --git a/pandora_console/extensions/extension_uploader.php b/pandora_console/extensions/extension_uploader.php index 870d3a665b..c4228dd0ba 100644 --- a/pandora_console/extensions/extension_uploader.php +++ b/pandora_console/extensions/extension_uploader.php @@ -43,7 +43,7 @@ function extension_uploader_extensions() { } if ($result) { - pandora_audit ("Extension manager", "Upload extension " . $_FILES['extension']['name']); + db_pandora_audit ("Extension manager", "Upload extension " . $_FILES['extension']['name']); } ui_print_result_message ($result, __('Success to upload extension'), diff --git a/pandora_console/extensions/insert_data.php b/pandora_console/extensions/insert_data.php index b599053f8d..259c1d9097 100644 --- a/pandora_console/extensions/insert_data.php +++ b/pandora_console/extensions/insert_data.php @@ -14,6 +14,12 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. +global $config; + +include_once($config['homedir'] . "/include/functions_agents.php"); +include_once($config['homedir'] . "/include/functions_modules.php"); +include_once($config['homedir'] . "/include/functions.php"); + function createXMLData($agent, $agentModule, $time, $data) { global $config; @@ -48,7 +54,7 @@ function mainInsertData() { ui_print_page_header (__("Insert data"), "images/extensions.png", false, "", true, ""); if (! check_acl ($config['id_user'], 0, "AW") && ! is_user_admin ($config['id_user'])) { - pandora_audit("ACL Violation", "Trying to access Setup Management"); + db_pandora_audit("ACL Violation", "Trying to access Setup Management"); require ("general/noaccess.php"); return; } @@ -77,8 +83,8 @@ function mainInsertData() { ui_print_error_message(__('You haven\'t privileges for insert data in the agent.')); } else { - $agent = get_db_row_filter('tagente', array('nombre' => $id_agent)); - $agentModule = get_db_row_filter('tagente_modulo', array('id_agente_modulo' => $id_agent_module)); + $agent = db_get_row_filter('tagente', array('nombre' => $id_agent)); + $agentModule = db_get_row_filter('tagente_modulo', array('id_agente_modulo' => $id_agent_module)); $date2 = str_replace('-', '/', $date); $time2 = DATE("H:i", strtotime($time)); diff --git a/pandora_console/extensions/module_groups.php b/pandora_console/extensions/module_groups.php index a9d827489d..5b8f4adc58 100644 --- a/pandora_console/extensions/module_groups.php +++ b/pandora_console/extensions/module_groups.php @@ -32,17 +32,17 @@ if (is_ajax ()) { $alerts = agents_get_alerts_simple($agents); foreach ($alerts as $alert) { - $module = get_db_row_filter('tagente_modulo', array('id_agente_modulo' => $alert['id_agent_module'])); + $module = db_get_row_filter('tagente_modulo', array('id_agente_modulo' => $alert['id_agent_module'])); if ($module_group == $module['id_module_group']) { if ($alert["times_fired"] > 0) { echo '' . __('Number fired of alerts').': ' . $alert["times_fired"] . '
'; - $agent = get_db_row('tagente', 'id_agente', $module['id_agente']); + $agent = db_get_row('tagente', 'id_agente', $module['id_agente']); echo '' . __('Agent').': '; echo safe_output($agent['nombre']) . '
'; echo '' . __('Module') . ': '; echo safe_output($module['nombre']) . '
'; - $template = get_db_row('talert_templates', 'id' , $alert['id_alert_template']); + $template = db_get_row('talert_templates', 'id' , $alert['id_alert_template']); echo '' . __('Alert template') . ': '; echo safe_output($template['name']) . '
'; @@ -52,7 +52,7 @@ if (is_ajax ()) { WHERE t1.id_alert_template_module = ' . $template['id'] . ' OR t2.id = ' . $template['id_alert_action'] . ';'; - $actions = get_db_all_rows_sql($sql); + $actions = db_get_all_rows_sql($sql); if ($actions === false) { $actions = array(); } @@ -88,6 +88,8 @@ function mainModuleGroups() { global $config; //the useful global var of Pandora Console, it has many data can you use require_once ('include/functions_reporting.php'); + require_once($config['homedir'] . "/include/functions_agents.php"); + require_once($config['homedir'] . "/include/functions_users.php"); //The big query switch ($config["dbtype"]) { @@ -154,7 +156,7 @@ function mainModuleGroups() { foreach ($modelGroups as $idModelGroup => $modelGroup) { $query = sprintf($sql,$idAgentGroup, $idModelGroup); - $rowsDB = get_db_all_rows_sql ($query); + $rowsDB = db_get_all_rows_sql ($query); $agents = get_group_agents($idAgentGroup); @@ -162,7 +164,7 @@ function mainModuleGroups() { $alerts = agents_get_alerts_simple($agents); foreach ($alerts as $alert) { - $module = get_db_row_filter('tagente_modulo', array('id_agente_modulo' => $alert['id_agent_module'])); + $module = db_get_row_filter('tagente_modulo', array('id_agente_modulo' => $alert['id_agent_module'])); if ($idModelGroup == $module['id_module_group']) { if ($alert["times_fired"] > 0) { diff --git a/pandora_console/extensions/pandora_logs.php b/pandora_console/extensions/pandora_logs.php index 647a5b7510..0dc4fb81c2 100644 --- a/pandora_console/extensions/pandora_logs.php +++ b/pandora_console/extensions/pandora_logs.php @@ -41,7 +41,7 @@ function pandoralogs_extension_main () { global $config; if (! check_acl ($config['id_user'], 0, "PM") && ! is_user_admin ($config['id_user'])) { - pandora_audit("ACL Violation", "Trying to access Setup Management"); + db_pandora_audit("ACL Violation", "Trying to access Setup Management"); require ("general/noaccess.php"); return; } diff --git a/pandora_console/extensions/plugin_registration.php b/pandora_console/extensions/plugin_registration.php index c879c27fa6..257fd8a3bc 100644 --- a/pandora_console/extensions/plugin_registration.php +++ b/pandora_console/extensions/plugin_registration.php @@ -18,7 +18,7 @@ function pluginreg_extension_main () { global $config; if (! check_acl ($config['id_user'], 0, "PM") && ! is_user_admin ($config['id_user'])) { - pandora_audit("ACL Violation", "Trying to access Setup Management"); + db_pandora_audit("ACL Violation", "Trying to access Setup Management"); require ("general/noaccess.php"); return; } @@ -93,7 +93,7 @@ function pluginreg_extension_main () { // Verify if a plugin with the same name is already registered $sql0 = "SELECT COUNT(*) FROM tplugin WHERE name = '" . safe_input ($ini_array["plugin_definition"]["name"]) . "'"; - $result = get_db_sql ($sql0); + $result = db_get_sql ($sql0); if ($result> 0) { @@ -113,7 +113,7 @@ function pluginreg_extension_main () { 'pass_opt' => $ini_array["plugin_definition"]["pass_opt"], 'plugin_type' => $ini_array["plugin_definition"]["plugin_type"]); - $create_id = process_sql_insert('tplugin', $values); + $create_id = db_process_sql_insert('tplugin', $values); $values = array( 'name' => safe_input ($ini_array["plugin_definition"]["name"]), @@ -125,7 +125,7 @@ function pluginreg_extension_main () { 'user_opt' => $ini_array["plugin_definition"]["user_opt"], 'pass_opt' => $ini_array["plugin_definition"]["pass_opt"], 'plugin_type' => $ini_array["plugin_definition"]["plugin_type"]); - $create_id = process_sql_insert('tplugin', $values); + $create_id = db_process_sql_insert('tplugin', $values); for ($ax=1; $ax <= $ini_array["plugin_definition"]["total_modules_provided"]; $ax++){ $label = "module".$ax; @@ -150,7 +150,7 @@ function pluginreg_extension_main () { 'min_ff_event' => $ini_array[$label]["min_ff_event"], 'tcp_port' => $ini_array[$label]["tcp_port"], 'id_plugin' => $create_id); - process_sql_insert('tnetwork_component', $values); + db_process_sql_insert('tnetwork_component', $values); echo "

".__("Module plugin registered"). " : ". $ini_array[$label]["name"] ."

"; } diff --git a/pandora_console/extensions/resource_exportation.php b/pandora_console/extensions/resource_exportation.php index b2c0618a3c..c4c6a1ef34 100644 --- a/pandora_console/extensions/resource_exportation.php +++ b/pandora_console/extensions/resource_exportation.php @@ -42,7 +42,7 @@ if (isset($_GET['get_ptr'])) { if (! check_acl ($config['id_user'], 0, "PM") && ! is_user_admin ($config['id_user'])) { - pandora_audit("ACL Violation", "Trying to access Setup Management"); + db_pandora_audit("ACL Violation", "Trying to access Setup Management"); require ("general/noaccess.php"); return; } @@ -83,16 +83,20 @@ function output_xml_resource($hook_enterprise) { } function output_xml_report($id) { - $report = get_db_row('treport', 'id_report', $id); + global $config; + + require_once ($config['homedir'].'/include/functions_agents.php'); + + $report = db_get_row('treport', 'id_report', $id); echo '' . "\n"; echo "\n"; echo "\n"; if (isset($report['description'])) echo "\n"; - $group = get_db_value('nombre', 'tgrupo', 'id_grupo', $report['id_group']); + $group = db_get_value('nombre', 'tgrupo', 'id_grupo', $report['id_group']); echo "\n"; - $items = get_db_all_rows_field_filter('treport_content', 'id_report', $report['id_report']); + $items = db_get_all_rows_field_filter('treport_content', 'id_report', $report['id_report']); foreach ($items as $item) { echo "\n"; echo "" . safe_output($item['type']) . "\n"; @@ -102,8 +106,8 @@ function output_xml_report($id) { $agent = get_agent_name($item['id_agent']); } if ($item['id_agent_module'] != 0) { - $module = get_db_value('nombre', 'tagente_modulo', 'id_agente_modulo', $item['id_agent_module']); - $id_agent = get_db_value('id_agente', 'tagente_modulo', 'id_agente_modulo', $item['id_agent_module']); + $module = db_get_value('nombre', 'tagente_modulo', 'id_agente_modulo', $item['id_agent_module']); + $id_agent = db_get_value('id_agente', 'tagente_modulo', 'id_agente_modulo', $item['id_agent_module']); $agent = get_agent_name($item['id_agent']); echo "\n"; @@ -119,7 +123,7 @@ function output_xml_report($id) { break; case 2: case 'custom_graph': - $graph = get_db_value('name', 'tgraph', 'id_graph', $item['id_gs']); + $graph = db_get_value('name', 'tgraph', 'id_graph', $item['id_gs']); echo "\n"; break; case 3: @@ -135,12 +139,12 @@ function output_xml_report($id) { echo "" . $item['time_from'] . "\n"; echo "" . $item['time_to'] . "\n"; - $slas = get_db_all_rows_field_filter('treport_content_sla_combined', 'id_report_content', $item['id_rc']); + $slas = db_get_all_rows_field_filter('treport_content_sla_combined', 'id_report_content', $item['id_rc']); if ($slas === false) $slas = array(); foreach ($slas as $sla) { - $module = get_db_value('nombre', 'tagente_modulo', 'id_agente_modulo', $sla['id_agent_module']); - $id_agent = get_db_value('id_agente', 'tagente_modulo', 'id_agente_modulo', $sla['id_agent_module']); + $module = db_get_value('nombre', 'tagente_modulo', 'id_agente_modulo', $sla['id_agent_module']); + $id_agent = db_get_value('id_agente', 'tagente_modulo', 'id_agente_modulo', $sla['id_agent_module']); $agent = get_agent_name($item['id_agent']); echo ""; echo "\n"; @@ -178,7 +182,7 @@ function output_xml_report($id) { echo "\n"; } else { - $sql = get_db_value('sql', 'treport_custom_sql', 'id', $item['treport_custom_sql_id']); + $sql = db_get_value('sql', 'treport_custom_sql', 'id', $item['treport_custom_sql_id']); echo "" . safe_output($sql) . "\n"; } break; @@ -190,12 +194,12 @@ function output_xml_report($id) { echo "" . safe_output($item['external_source']) . "\n"; } else { - $sql = get_db_value('sql', 'treport_custom_sql', 'id', $item['treport_custom_sql_id']); + $sql = db_get_value('sql', 'treport_custom_sql', 'id', $item['treport_custom_sql_id']); echo "" . safe_output($sql) . "\n"; } break; case 'event_report_group': - $group = get_db_value('nombre', 'tgrupo', 'id_grupo', $item['id_agent']); + $group = db_get_value('nombre', 'tgrupo', 'id_grupo', $item['id_agent']); echo "\n"; break; case 'event_report_module': @@ -227,19 +231,19 @@ function output_xml_report($id) { } function output_xml_visual_console($id) { - $visual_map = get_db_row('tlayout', 'id', $id); + $visual_map = db_get_row('tlayout', 'id', $id); echo '' . "\n"; echo "\n"; echo "\n"; if ($visual_map['id_group'] != 0) { - $group = get_db_value('nombre', 'tgrupo', 'id_grupo', $visual_map['id_group']); + $group = db_get_value('nombre', 'tgrupo', 'id_grupo', $visual_map['id_group']); echo "\n"; } echo "\n"; echo "" . safe_output($visual_map['height']) . "\n"; echo "" . safe_output($visual_map['width']) . "\n"; - $items = get_db_all_rows_field_filter('tlayout_data', 'id_layout', $visual_map['id']); + $items = db_get_all_rows_field_filter('tlayout_data', 'id_layout', $visual_map['id']); if ($items === false) $items = array(); foreach ($items as $item){ echo "\n"; @@ -268,8 +272,8 @@ function output_xml_visual_console($id) { } if (isset($item['id_agente_modulo'])) { if ($item['id_agente_modulo'] != 0) { - $module = get_db_value('nombre', 'tagente_modulo', 'id_agente_modulo', $item['id_agente_modulo']); - $id_agent = get_db_value('id_agente', 'tagente_modulo', 'id_agente_modulo', $item['id_agente_modulo']); + $module = db_get_value('nombre', 'tagente_modulo', 'id_agente_modulo', $item['id_agente_modulo']); + $id_agent = db_get_value('id_agente', 'tagente_modulo', 'id_agente_modulo', $item['id_agente_modulo']); $agent = get_agent_name($id_agent); echo "\n"; @@ -300,10 +304,10 @@ function get_name_xml_resource($hook_enterprise) { switch ($type) { case 'report': - $name = get_db_value('name', 'treport', 'id_report', $id); + $name = db_get_value('name', 'treport', 'id_report', $id); break; case 'visual_console': - $name = get_db_value('name', 'tlayout', 'id', $id); + $name = db_get_value('name', 'tlayout', 'id', $id); break; default: if ($hook_enterprise === true) @@ -326,7 +330,7 @@ function resource_exportation_extension_main() { global $config; if (! check_acl ($config['id_user'], 0, "PM") && ! is_user_admin ($config['id_user'])) { - pandora_audit("ACL Violation", "Trying to access Setup Management"); + db_pandora_audit("ACL Violation", "Trying to access Setup Management"); require ("general/noaccess.php"); return; } diff --git a/pandora_console/extensions/resource_registration.php b/pandora_console/extensions/resource_registration.php index cabb3dc5a6..4cccbd7092 100644 --- a/pandora_console/extensions/resource_registration.php +++ b/pandora_console/extensions/resource_registration.php @@ -34,7 +34,7 @@ enterprise_include_once('include/functions_local_components.php'); function insert_item_report($report_id, $values) { foreach ($report_id as $id => $name) { $values['id_report'] = $id; - $result = (bool)process_sql_insert('treport_content', $values); + $result = (bool)db_process_sql_insert('treport_content', $values); ui_print_result_message($result, sprintf(__("Success add '%s' item in report '%s'."), $values['type'], $name), @@ -54,7 +54,7 @@ function process_upload_xml_report($xml, $group_filter = 0) { $exist = true; $loops = 30; //Loops to exit or tries while ($exist && $loops > 0) { - $exist = (bool)get_db_row_filter('treport', array('name' => safe_input($posible_name))); + $exist = (bool)db_get_row_filter('treport', array('name' => safe_input($posible_name))); if ($exist) { $loops--; @@ -83,7 +83,7 @@ function process_upload_xml_report($xml, $group_filter = 0) { break; } - $id_group = get_db_value('id_grupo', 'tgrupo', 'nombre', $reportElement->group); + $id_group = db_get_value('id_grupo', 'tgrupo', 'nombre', $reportElement->group); if ($id_group === false) { ui_print_error_message(__("Error the report haven't group.")); break; @@ -92,17 +92,17 @@ function process_upload_xml_report($xml, $group_filter = 0) { if (isset($reportElement->description)) $values['description'] = $reportElement->description; - $id_report = process_sql_insert ('treport', $values); + $id_report = db_process_sql_insert ('treport', $values); ui_print_result_message($id_report, sprintf(__("Success create '%s' report."), $posible_name), sprintf(__("Error create '%s' report."), $posible_name)); if ($id_report) { - pandora_audit("Report management", "Create report " . $id_report, false, false); + db_pandora_audit("Report management", "Create report " . $id_report, false, false); } else { - pandora_audit("Report management", "Fail to create report", false, false); + db_pandora_audit("Report management", "Fail to create report", false, false); break; } @@ -143,7 +143,7 @@ function process_upload_xml_report($xml, $group_filter = 0) { $regular_expresion = ($module_clean != $item['module']); foreach ($agents_item as $id => $agent) { - $modules = get_db_all_rows_filter('tagente_modulo', + $modules = db_get_all_rows_filter('tagente_modulo', array('id_agente' => $id), array('id_agente_modulo', 'nombre')); $agents_item[$id]['modules'] = array(); @@ -173,7 +173,7 @@ function process_upload_xml_report($xml, $group_filter = 0) { break; case 2: case 'custom_graph': - $group = get_db_value('id_grupo', 'tgrupo', 'nombre', safe_input($item['graph'])); + $group = db_get_value('id_grupo', 'tgrupo', 'nombre', safe_input($item['graph'])); $values['id_gs'] = $group; break; case 3: @@ -228,7 +228,7 @@ function process_upload_xml_report($xml, $group_filter = 0) { $module_clean = str_replace(array('[', ']'), '', $sla_xml->module); $regular_expresion = ($module_clean != $sla_xml->module); - $modules = get_db_all_rows_filter('tagente_modulo', + $modules = db_get_all_rows_filter('tagente_modulo', array('id_agente' => $id_agent), array('id_agente_modulo', 'nombre')); foreach ($modules as $module) { @@ -291,7 +291,7 @@ function process_upload_xml_report($xml, $group_filter = 0) { $values['external_source'] = safe_input($item['sql']); break; case 'event_report_group': - $values['id_agent'] = get_db_value('id_grupo', 'tgrupo', 'nombre', safe_input($item->group)); + $values['id_agent'] = db_get_value('id_grupo', 'tgrupo', 'nombre', safe_input($item->group)); break; case 'event_report_module': break; @@ -318,7 +318,7 @@ function process_upload_xml_report($xml, $group_filter = 0) { } if (empty($agents_item)) { - $id_content = process_sql_insert ('treport_content', $values); + $id_content = db_process_sql_insert ('treport_content', $values); ui_print_result_message($id_content, sprintf(__("Success add '%s' content."), $values['type']), sprintf(__("Error add '%s' action."), $values['type'])); @@ -326,7 +326,7 @@ function process_upload_xml_report($xml, $group_filter = 0) { if ($item['type'] == 'SLA') { foreach ($slas as $sla) { $sla['id_report_content'] = $id_content; - $result = process_sql_insert ('treport_content_sla_combined', $sla); + $result = db_process_sql_insert ('treport_content_sla_combined', $sla); ui_print_result_message($result, sprintf(__("Success add '%s' SLA."), $sla['id_agent_module']), sprintf(__("Error add '%s' SLA."), $sla['id_agent_module'])); @@ -339,7 +339,7 @@ function process_upload_xml_report($xml, $group_filter = 0) { foreach ($agents_item as $id_agent => $agent) { if (empty($agent['modules'])) { $values['id_agent'] = $id_agent; - $id_content = process_sql_insert ('treport_content', $values); + $id_content = db_process_sql_insert ('treport_content', $values); ui_print_result_message($id_content, sprintf(__("Success add '%s' content."), $values['type']), sprintf(__("Error add '%s' action."), $values['type'])); @@ -349,7 +349,7 @@ function process_upload_xml_report($xml, $group_filter = 0) { $values['id_agent_module'] = $id_module; $values['id_agent'] = $id_agent; - $id_content = process_sql_insert ('treport_content', $values); + $id_content = db_process_sql_insert ('treport_content', $values); ui_print_result_message($id_content, sprintf(__("Success add '%s' content."), $values['type']), sprintf(__("Error add '%s' action."), $values['type'])); @@ -376,7 +376,7 @@ function process_upload_xml_visualmap($xml, $filter_group = 0) { $values['id_group'] = 0; if (isset($visual_map->group)) { - $id_group = get_db_value('id_grupo', 'tgrupo', 'nombre', safe_input($visual_map->group)); + $id_group = db_get_value('id_grupo', 'tgrupo', 'nombre', safe_input($visual_map->group)); if ($id_group !== false) $values['id_group'] = $id_group; } @@ -395,7 +395,7 @@ function process_upload_xml_visualmap($xml, $filter_group = 0) { $exist = true; $loops = 30; //Loops to exit or tries while ($exist && $loops > 0) { - $exist = (bool)get_db_row_filter('tlayout', array('name' => safe_input($posible_name))); + $exist = (bool)db_get_row_filter('tlayout', array('name' => safe_input($posible_name))); if ($exist) { $loops--; @@ -418,14 +418,14 @@ function process_upload_xml_visualmap($xml, $filter_group = 0) { } $values['name'] = safe_input($posible_name); - $id_visual_map = process_sql_insert('tlayout', $values); + $id_visual_map = db_process_sql_insert('tlayout', $values); ui_print_result_message((bool)$id_visual_map, sprintf(__("Success create '%s' visual map."), $posible_name), sprintf(__("Error create '%s' visual map."), $posible_name)); if ($id_visual_map !== false) { - pandora_audit('CREATE VISUAL CONSOLE', $id_visual_map, $config['id_user']); + db_pandora_audit('CREATE VISUAL CONSOLE', $id_visual_map, $config['id_user']); } else { break; @@ -472,7 +472,7 @@ function process_upload_xml_visualmap($xml, $filter_group = 0) { $regular_expresion = ($module_clean != $item->module); foreach ($agents_in_item as $id => $agent) { - $modules = get_db_all_rows_filter('tagente_modulo', + $modules = db_get_all_rows_filter('tagente_modulo', array('id_agente' => $id), array('id_agente_modulo', 'nombre')); $modules_in_item = array(); @@ -527,14 +527,14 @@ function process_upload_xml_visualmap($xml, $filter_group = 0) { $values['type'] = (string)$item->type; if ($no_agents) { - $id_item = process_sql_insert('tlayout_data', $values); + $id_item = db_process_sql_insert('tlayout_data', $values); ui_print_result_message((bool)$id_item, sprintf(__("Success create item type '%d' visual map."), $values['type']), sprintf(__("Error create item type '%d' visual map."), $values['type'])); if ($id_item !== false) { - pandora_audit('CREATE ITEM VISUAL CONSOLE', $values['id_layout'] . " - " . $id_item, $config['id_user']); + db_pandora_audit('CREATE ITEM VISUAL CONSOLE', $values['id_layout'] . " - " . $id_item, $config['id_user']); } } else { @@ -542,7 +542,7 @@ function process_upload_xml_visualmap($xml, $filter_group = 0) { if ($no_modules) { $values['id_agent'] = $id; - $id_item = process_sql_insert('tlayout_data', $values); + $id_item = db_process_sql_insert('tlayout_data', $values); if (isset($item->other_id)) { $relation_other_ids[(string)$item->other_id] = $id_item; @@ -553,7 +553,7 @@ function process_upload_xml_visualmap($xml, $filter_group = 0) { sprintf(__("Error create item for agent '%s' visual map."), $agent['name'])); if ($id_item !== false) { - pandora_audit('CREATE ITEM VISUAL CONSOLE', $values['id_layout'] . " - " . $id_item, $config['id_user']); + db_pandora_audit('CREATE ITEM VISUAL CONSOLE', $values['id_layout'] . " - " . $id_item, $config['id_user']); } } else { @@ -561,14 +561,14 @@ function process_upload_xml_visualmap($xml, $filter_group = 0) { $values['id_agent'] = $id; $values['id_agente_modulo'] = $id_module; - process_sql_insert('tlayout_data', $values); + db_process_sql_insert('tlayout_data', $values); ui_print_result_message((bool)$id_item, sprintf(__("Success create item for agent '%s' visual map."), $agent['name']), sprintf(__("Error create item for agent '%s' visual map."), $agent['name'])); if ($id_item !== false) { - pandora_audit('CREATE ITEM VISUAL CONSOLE', $values['id_layout'] . " - " . $id_item, $config['id_user']); + db_pandora_audit('CREATE ITEM VISUAL CONSOLE', $values['id_layout'] . " - " . $id_item, $config['id_user']); } } } @@ -771,12 +771,12 @@ function process_upload_xml_component($xml) { $templateName = (string)$templateElement->name; $templateDescription = (string)$templateElement->description; - $idTemplate = process_sql_insert('tnetwork_profile', array('name' => $templateName, 'description' => $templateDescription)); + $idTemplate = db_process_sql_insert('tnetwork_profile', array('name' => $templateName, 'description' => $templateDescription)); $result = false; if ((bool)$idTemplate) { foreach ($components as $idComponent) { - process_sql_insert("tnetwork_profile_component", array('id_nc' => $idComponent, 'id_np' => $idTemplate)); + db_process_sql_insert("tnetwork_profile_component", array('id_nc' => $idComponent, 'id_np' => $idTemplate)); } } } @@ -807,7 +807,7 @@ function resource_registration_extension_main() { global $config; if (! check_acl ($config['id_user'], 0, "PM") && ! is_user_admin ($config['id_user'])) { - pandora_audit("ACL Violation", "Trying to access Setup Management"); + db_pandora_audit("ACL Violation", "Trying to access Setup Management"); require ("general/noaccess.php"); return; } diff --git a/pandora_console/extensions/ssh_console.php b/pandora_console/extensions/ssh_console.php index b3622406c9..342e44c277 100644 --- a/pandora_console/extensions/ssh_console.php +++ b/pandora_console/extensions/ssh_console.php @@ -21,7 +21,7 @@ function main_ssh_console () { $id_agente = get_parameter ("id_agente"); - $ip = get_db_sql ("SELECT direccion FROM tagente WHERE id_agente = $id_agente"); + $ip = db_get_sql ("SELECT direccion FROM tagente WHERE id_agente = $id_agente"); ?>
diff --git a/pandora_console/extensions/system_info.php b/pandora_console/extensions/system_info.php index d747d8db83..8c8ab2c7e1 100644 --- a/pandora_console/extensions/system_info.php +++ b/pandora_console/extensions/system_info.php @@ -26,54 +26,54 @@ function getPandoraDiagnostic(&$systemInfo) { $systemInfo["PHP Version"] = phpversion(); - $systemInfo['tagente'] = get_db_sql("SELECT COUNT(*) FROM tagente"); - $systemInfo['tagent_access'] = get_db_sql("SELECT COUNT(*) FROM tagent_access"); - $systemInfo['tagente_datos'] = get_db_sql("SELECT COUNT(*) FROM tagente_datos"); - $systemInfo['tagente_datos_string'] = get_db_sql("SELECT COUNT(*) FROM tagente_datos_string"); - $systemInfo['tagente_estado'] = get_db_sql("SELECT COUNT(*) FROM tagente_estado"); - $systemInfo['tagente_modulo'] = get_db_sql("SELECT COUNT(*) FROM tagente_modulo"); - $systemInfo['talert_actions'] = get_db_sql("SELECT COUNT(*) FROM talert_actions"); - $systemInfo['talert_commands'] = get_db_sql("SELECT COUNT(*) FROM tagente"); - $systemInfo['talert_template_modules'] = get_db_sql("SELECT COUNT(*) FROM talert_template_modules"); - $systemInfo['tlayout'] = get_db_sql("SELECT COUNT(*) FROM tlayout"); + $systemInfo['tagente'] = db_get_sql("SELECT COUNT(*) FROM tagente"); + $systemInfo['tagent_access'] = db_get_sql("SELECT COUNT(*) FROM tagent_access"); + $systemInfo['tagente_datos'] = db_get_sql("SELECT COUNT(*) FROM tagente_datos"); + $systemInfo['tagente_datos_string'] = db_get_sql("SELECT COUNT(*) FROM tagente_datos_string"); + $systemInfo['tagente_estado'] = db_get_sql("SELECT COUNT(*) FROM tagente_estado"); + $systemInfo['tagente_modulo'] = db_get_sql("SELECT COUNT(*) FROM tagente_modulo"); + $systemInfo['talert_actions'] = db_get_sql("SELECT COUNT(*) FROM talert_actions"); + $systemInfo['talert_commands'] = db_get_sql("SELECT COUNT(*) FROM tagente"); + $systemInfo['talert_template_modules'] = db_get_sql("SELECT COUNT(*) FROM talert_template_modules"); + $systemInfo['tlayout'] = db_get_sql("SELECT COUNT(*) FROM tlayout"); if($config['enterprise_installed']) - $systemInfo['tlocal_component'] = get_db_sql("SELECT COUNT(*) FROM tlocal_component"); - $systemInfo['tserver'] = get_db_sql("SELECT COUNT(*) FROM tserver"); - $systemInfo['treport'] = get_db_sql("SELECT COUNT(*) FROM treport"); - $systemInfo['ttrap'] = get_db_sql("SELECT COUNT(*) FROM ttrap"); - $systemInfo['tusuario'] = get_db_sql("SELECT COUNT(*) FROM tusuario"); - $systemInfo['tsesion'] = get_db_sql("SELECT COUNT(*) FROM tsesion"); + $systemInfo['tlocal_component'] = db_get_sql("SELECT COUNT(*) FROM tlocal_component"); + $systemInfo['tserver'] = db_get_sql("SELECT COUNT(*) FROM tserver"); + $systemInfo['treport'] = db_get_sql("SELECT COUNT(*) FROM treport"); + $systemInfo['ttrap'] = db_get_sql("SELECT COUNT(*) FROM ttrap"); + $systemInfo['tusuario'] = db_get_sql("SELECT COUNT(*) FROM tusuario"); + $systemInfo['tsesion'] = db_get_sql("SELECT COUNT(*) FROM tsesion"); switch ($config["dbtype"]) { case "mysql": - $systemInfo['db_scheme_version'] = get_db_sql("SELECT `value` FROM tconfig WHERE `token` = 'db_scheme_version'"); - $systemInfo['db_scheme_build'] = get_db_sql("SELECT `value` FROM tconfig WHERE `token` = 'db_scheme_build'"); - $systemInfo['enterprise_installed'] = get_db_sql("SELECT `value` FROM tconfig WHERE `token` = 'enterprise_installed'"); - $systemInfo['db_maintance'] = date ("Y/m/d H:i:s", get_db_sql ("SELECT `value` FROM tconfig WHERE `token` = 'db_maintance'")); - $systemInfo['customer_key'] = get_db_sql("SELECT value FROM tupdate_settings WHERE `key` = 'customer_key';"); - $systemInfo['updating_code_path'] = get_db_sql("SELECT value FROM tupdate_settings WHERE `key` = 'updating_code_path'"); - $systemInfo['keygen_path'] = get_db_sql("SELECT value FROM tupdate_settings WHERE `key` = 'keygen_path'"); - $systemInfo['current_update'] = get_db_sql("SELECT value FROM tupdate_settings WHERE `key` = 'current_update'"); + $systemInfo['db_scheme_version'] = db_get_sql("SELECT `value` FROM tconfig WHERE `token` = 'db_scheme_version'"); + $systemInfo['db_scheme_build'] = db_get_sql("SELECT `value` FROM tconfig WHERE `token` = 'db_scheme_build'"); + $systemInfo['enterprise_installed'] = db_get_sql("SELECT `value` FROM tconfig WHERE `token` = 'enterprise_installed'"); + $systemInfo['db_maintance'] = date ("Y/m/d H:i:s", db_get_sql ("SELECT `value` FROM tconfig WHERE `token` = 'db_maintance'")); + $systemInfo['customer_key'] = db_get_sql("SELECT value FROM tupdate_settings WHERE `key` = 'customer_key';"); + $systemInfo['updating_code_path'] = db_get_sql("SELECT value FROM tupdate_settings WHERE `key` = 'updating_code_path'"); + $systemInfo['keygen_path'] = db_get_sql("SELECT value FROM tupdate_settings WHERE `key` = 'keygen_path'"); + $systemInfo['current_update'] = db_get_sql("SELECT value FROM tupdate_settings WHERE `key` = 'current_update'"); break; case "postgresql": - $systemInfo['db_scheme_version'] = get_db_sql("SELECT \"value\" FROM tconfig WHERE \"token\" = 'db_scheme_version'"); - $systemInfo['db_scheme_build'] = get_db_sql("SELECT \"value\" FROM tconfig WHERE \"token\" = 'db_scheme_build'"); - $systemInfo['enterprise_installed'] = get_db_sql("SELECT \"value\" FROM tconfig WHERE \"token\" = 'enterprise_installed'"); - $systemInfo['db_maintance'] = date ("Y/m/d H:i:s", get_db_sql ("SELECT \"value\" FROM tconfig WHERE \"token\" = 'db_maintance'")); - $systemInfo['customer_key'] = get_db_sql("SELECT value FROM tupdate_settings WHERE \"key\" = 'customer_key';"); - $systemInfo['updating_code_path'] = get_db_sql("SELECT value FROM tupdate_settings WHERE \"key\" = 'updating_code_path'"); - $systemInfo['keygen_path'] = get_db_sql("SELECT value FROM tupdate_settings WHERE \"key\" = 'keygen_path'"); - $systemInfo['current_update'] = get_db_sql("SELECT value FROM tupdate_settings WHERE \"key\" = 'current_update'"); + $systemInfo['db_scheme_version'] = db_get_sql("SELECT \"value\" FROM tconfig WHERE \"token\" = 'db_scheme_version'"); + $systemInfo['db_scheme_build'] = db_get_sql("SELECT \"value\" FROM tconfig WHERE \"token\" = 'db_scheme_build'"); + $systemInfo['enterprise_installed'] = db_get_sql("SELECT \"value\" FROM tconfig WHERE \"token\" = 'enterprise_installed'"); + $systemInfo['db_maintance'] = date ("Y/m/d H:i:s", db_get_sql ("SELECT \"value\" FROM tconfig WHERE \"token\" = 'db_maintance'")); + $systemInfo['customer_key'] = db_get_sql("SELECT value FROM tupdate_settings WHERE \"key\" = 'customer_key';"); + $systemInfo['updating_code_path'] = db_get_sql("SELECT value FROM tupdate_settings WHERE \"key\" = 'updating_code_path'"); + $systemInfo['keygen_path'] = db_get_sql("SELECT value FROM tupdate_settings WHERE \"key\" = 'keygen_path'"); + $systemInfo['current_update'] = db_get_sql("SELECT value FROM tupdate_settings WHERE \"key\" = 'current_update'"); break; case "oracle": - $systemInfo['db_scheme_version'] = get_db_sql("SELECT value FROM tconfig WHERE token = 'db_scheme_version'"); - $systemInfo['db_scheme_build'] = get_db_sql("SELECT value FROM tconfig WHERE token = 'db_scheme_build'"); - $systemInfo['enterprise_installed'] = get_db_sql("SELECT value FROM tconfig WHERE token = 'enterprise_installed'"); - $systemInfo['db_maintance'] = get_db_sql ("SELECT value FROM tconfig WHERE token = 'db_maintance'"); - $systemInfo['customer_key'] = get_db_sql("SELECT value FROM tupdate_settings WHERE key = 'customer_key';"); - $systemInfo['updating_code_path'] = get_db_sql("SELECT value FROM tupdate_settings WHERE key = 'updating_code_path'"); - $systemInfo['keygen_path'] = get_db_sql("SELECT value FROM tupdate_settings WHERE key = 'keygen_path'"); - $systemInfo['current_update'] = get_db_sql("SELECT value FROM tupdate_settings WHERE key = 'current_update'"); + $systemInfo['db_scheme_version'] = db_get_sql("SELECT value FROM tconfig WHERE token = 'db_scheme_version'"); + $systemInfo['db_scheme_build'] = db_get_sql("SELECT value FROM tconfig WHERE token = 'db_scheme_build'"); + $systemInfo['enterprise_installed'] = db_get_sql("SELECT value FROM tconfig WHERE token = 'enterprise_installed'"); + $systemInfo['db_maintance'] = db_get_sql ("SELECT value FROM tconfig WHERE token = 'db_maintance'"); + $systemInfo['customer_key'] = db_get_sql("SELECT value FROM tupdate_settings WHERE key = 'customer_key';"); + $systemInfo['updating_code_path'] = db_get_sql("SELECT value FROM tupdate_settings WHERE key = 'updating_code_path'"); + $systemInfo['keygen_path'] = db_get_sql("SELECT value FROM tupdate_settings WHERE key = 'keygen_path'"); + $systemInfo['current_update'] = db_get_sql("SELECT value FROM tupdate_settings WHERE key = 'current_update'"); break; } } @@ -240,7 +240,7 @@ function mainSystemInfo() { global $config; if (! check_acl ($config['id_user'], 0, "PM") && ! is_user_admin ($config['id_user'])) { - pandora_audit("ACL Violation", "Trying to access Setup Management"); + db_pandora_audit("ACL Violation", "Trying to access Setup Management"); require ("general/noaccess.php"); return; diff --git a/pandora_console/extensions/update_manager.php b/pandora_console/extensions/update_manager.php index 031e2153fd..6781ef1c8f 100644 --- a/pandora_console/extensions/update_manager.php +++ b/pandora_console/extensions/update_manager.php @@ -52,13 +52,13 @@ function pandora_update_manager_install () { break; } foreach ($sentences as $sentence) { - $success = process_sql ($sentence); + $success = db_process_sql ($sentence); if ($success === false) return; } $values = array("token" => "update_manager_installed", "value" => 1); - process_sql_insert('tconfig', $values); + db_process_sql_insert('tconfig', $values); um_db_connect ('mysql', $config['dbhost'], $config['dbuser'], $config['dbpass'], $config['dbname']); @@ -72,25 +72,25 @@ function pandora_update_manager_uninstall () { switch ($config["dbtype"]) { case "mysql": - process_sql ('DELETE FROM `tconfig` WHERE `token` = "update_manager_installed"'); - process_sql ('DROP TABLE `tupdate_settings`'); - process_sql ('DROP TABLE `tupdate_journal`'); - process_sql ('DROP TABLE `tupdate`'); - process_sql ('DROP TABLE `tupdate_package`'); + db_process_sql ('DELETE FROM `tconfig` WHERE `token` = "update_manager_installed"'); + db_process_sql ('DROP TABLE `tupdate_settings`'); + db_process_sql ('DROP TABLE `tupdate_journal`'); + db_process_sql ('DROP TABLE `tupdate`'); + db_process_sql ('DROP TABLE `tupdate_package`'); break; case "postgresql": - process_sql ('DELETE FROM "tconfig" WHERE "token" = \'update_manager_installed\''); - process_sql ('DROP TABLE "tupdate_settings"'); - process_sql ('DROP TABLE "tupdate_journal"'); - process_sql ('DROP TABLE "tupdate"'); - process_sql ('DROP TABLE "tupdate_package"'); + db_process_sql ('DELETE FROM "tconfig" WHERE "token" = \'update_manager_installed\''); + db_process_sql ('DROP TABLE "tupdate_settings"'); + db_process_sql ('DROP TABLE "tupdate_journal"'); + db_process_sql ('DROP TABLE "tupdate"'); + db_process_sql ('DROP TABLE "tupdate_package"'); break; case "oracle": - process_sql ('DELETE FROM tconfig WHERE token = \'update_manager_installed\''); - process_sql ('DROP TABLE tupdate_settings'); - process_sql ('DROP TABLE tupdate_journal'); - process_sql ('DROP TABLE tupdate'); - process_sql ('DROP TABLE tupdate_package'); + db_process_sql ('DELETE FROM tconfig WHERE token = \'update_manager_installed\''); + db_process_sql ('DROP TABLE tupdate_settings'); + db_process_sql ('DROP TABLE tupdate_journal'); + db_process_sql ('DROP TABLE tupdate'); + db_process_sql ('DROP TABLE tupdate_package'); break; } } @@ -116,7 +116,7 @@ function pandora_update_manager_login () { if (!isset($config["autoupdate"])){ $config["autoupdate"] = 1; - process_sql_insert('tconfig', array('token' => 'autoupdate', 'value' => 0)); + db_process_sql_insert('tconfig', array('token' => 'autoupdate', 'value' => 0)); } if ($config["autoupdate"] == 0) diff --git a/pandora_console/extensions/update_manager/lib/libupdate_manager.php b/pandora_console/extensions/update_manager/lib/libupdate_manager.php index a02c08a877..2e861d5275 100644 --- a/pandora_console/extensions/update_manager/lib/libupdate_manager.php +++ b/pandora_console/extensions/update_manager/lib/libupdate_manager.php @@ -20,7 +20,7 @@ require_once ('libupdate_manager_components.php'); require_once ('libupdate_manager_client.php'); function um_db_load_settings () { - $result = process_sql('SELECT * FROM '.DB_PREFIX.'tupdate_settings'); + $result = db_process_sql('SELECT * FROM '.DB_PREFIX.'tupdate_settings'); if($result === false) { echo 'Error reading settings
'; return NULL; @@ -43,13 +43,13 @@ function um_db_update_setting ($key, $value = '') { switch ($config["dbtype"]) { case "mysql": - $result = get_db_value('COUNT(*)', DB_PREFIX.'tupdate_settings', '`key`', $key); + $result = db_get_value('COUNT(*)', DB_PREFIX.'tupdate_settings', '`key`', $key); break; case "postgresql": - $result = get_db_value('COUNT(*)', DB_PREFIX.'tupdate_settings', '"key"', $key); + $result = db_get_value('COUNT(*)', DB_PREFIX.'tupdate_settings', '"key"', $key); break; case "oracle": - $result = get_db_value('COUNT(*)', DB_PREFIX.'tupdate_settings', 'key', $key); + $result = db_get_value('COUNT(*)', DB_PREFIX.'tupdate_settings', 'key', $key); break; } @@ -61,13 +61,13 @@ function um_db_update_setting ($key, $value = '') { if($result > 0) { switch ($config["dbtype"]) { case "mysql": - $result = process_sql_update(DB_PREFIX.'tupdate_settings', array('value' => $value), array('`key`' => $key)); + $result = db_process_sql_update(DB_PREFIX.'tupdate_settings', array('value' => $value), array('`key`' => $key)); break; case "postgresql": - $result = process_sql_update(DB_PREFIX.'tupdate_settings', array('value' => $value), array('"key"' => $key)); + $result = db_process_sql_update(DB_PREFIX.'tupdate_settings', array('value' => $value), array('"key"' => $key)); break; case "oracle": - $result = process_sql_update(DB_PREFIX.'tupdate_settings', array('value' => $value), array('key' => $key)); + $result = db_process_sql_update(DB_PREFIX.'tupdate_settings', array('value' => $value), array('key' => $key)); break; } @@ -79,13 +79,13 @@ function um_db_update_setting ($key, $value = '') { else { switch ($config["dbtype"]) { case "mysql": - $result = process_sql_insert(DB_PREFIX.'tupdate_settings', array('`key`' => $key, '`value`' => $value)); + $result = db_process_sql_insert(DB_PREFIX.'tupdate_settings', array('`key`' => $key, '`value`' => $value)); break; case "postgresql": - $result = process_sql_insert(DB_PREFIX.'tupdate_settings', array('"key"' => $key, '"value"' => $value)); + $result = db_process_sql_insert(DB_PREFIX.'tupdate_settings', array('"key"' => $key, '"value"' => $value)); break; case "oracle": - $result = process_sql_insert(DB_PREFIX.'tupdate_settings', array('key' => $key, 'value' => $value)); + $result = db_process_sql_insert(DB_PREFIX.'tupdate_settings', array('key' => $key, 'value' => $value)); break; } @@ -99,14 +99,14 @@ function um_db_update_setting ($key, $value = '') { } function um_db_get_latest_package_by_status ($id_package = '0', $status = 'public') { - $result = process_sql('SELECT COUNT(*) FROM '.DB_PREFIX.'tupdate_package WHERE status = "'.$status.'" AND id > ' . $id_package . ' ORDER BY id DESC LIMIT 1'); + $result = db_process_sql('SELECT COUNT(*) FROM '.DB_PREFIX.'tupdate_package WHERE status = "'.$status.'" AND id > ' . $id_package . ' ORDER BY id DESC LIMIT 1'); if($result === false) { echo 'Error reading latest package with status ' . $status . '
'; return false; } - $result = process_sql('SELECT * FROM '.DB_PREFIX.'tupdate_package WHERE status = "'.$status.'" AND id > ' . $id_package . ' ORDER BY id DESC LIMIT 1'); + $result = db_process_sql('SELECT * FROM '.DB_PREFIX.'tupdate_package WHERE status = "'.$status.'" AND id > ' . $id_package . ' ORDER BY id DESC LIMIT 1'); $package = um_std_from_result($result); @@ -124,7 +124,7 @@ function um_db_get_next_package ($id_package = '0', $development = false) { } function um_db_create_package ($description = '') { - $result = process_sql_insert(DB_PREFIX.'tupdate_package', array('description' => $description)); + $result = db_process_sql_insert(DB_PREFIX.'tupdate_package', array('description' => $description)); if($result === false) { echo 'Error creating package
'; @@ -138,7 +138,7 @@ function um_db_update_package ($id_package, $description = '', $status = 'disabl $values = array ('description' => $description, 'status' => $status); $where = array ('id' => $id_package); - $result = process_sql_update(DB_PREFIX.'tupdate_package', $values, $where); + $result = db_process_sql_update(DB_PREFIX.'tupdate_package', $values, $where); if($result === false) { echo 'Error updating package
'; @@ -156,7 +156,7 @@ function um_db_delete_package ($id_package) { return false; } - $result = process_sql_delete(DB_PREFIX.'tupdate_package', array('id' => $id_package)); + $result = db_process_sql_delete(DB_PREFIX.'tupdate_package', array('id' => $id_package)); if($result === false) { echo 'Error deleting package
'; @@ -167,7 +167,7 @@ function um_db_delete_package ($id_package) { } function um_db_get_package ($id_package) { - $result = process_sql ('SELECT * FROM '.DB_PREFIX.'tupdate_package WHERE id = ' . $id_package . ' LIMIT 1'); + $result = db_process_sql ('SELECT * FROM '.DB_PREFIX.'tupdate_package WHERE id = ' . $id_package . ' LIMIT 1'); if ($result === false) { echo 'Error getting package info
'; return NULL; @@ -194,7 +194,7 @@ function um_std_from_result($array, $i = 0) { } function um_db_get_all_packages () { - $result = process_sql ('SELECT * FROM '.DB_PREFIX.'tupdate_package'); + $result = db_process_sql ('SELECT * FROM '.DB_PREFIX.'tupdate_package'); if ($result === false) { echo 'Error getting all packages
'; return NULL; @@ -215,13 +215,13 @@ function um_db_get_all_packages () { } function um_db_get_package_updates ($id_package) { - $result = process_sql ('SELECT COUNT(*) FROM '.DB_PREFIX.'tupdate WHERE id_update_package = ' . $id_package); + $result = db_process_sql ('SELECT COUNT(*) FROM '.DB_PREFIX.'tupdate WHERE id_update_package = ' . $id_package); if ($result === false) { echo 'Error getting all packages '.$id_package.'
'.'SELECT * FROM '.DB_PREFIX.'tupdate WHERE id_update_package = ' . $id_package; return NULL; } - $result = process_sql ('SELECT * FROM '.DB_PREFIX.'tupdate WHERE id_update_package = ' . $id_package); + $result = db_process_sql ('SELECT * FROM '.DB_PREFIX.'tupdate WHERE id_update_package = ' . $id_package); $cont = 0; $updates = array(); @@ -252,7 +252,7 @@ function um_db_create_package_log ($id_package, $client_key, $user_package, $res 'result' => $result, 'description' => $description); - $result = process_sql_insert (DB_PREFIX.'tupdate_package_log', $values); + $result = db_process_sql_insert (DB_PREFIX.'tupdate_package_log', $values); if ($result === false) { return false; @@ -262,7 +262,7 @@ function um_db_create_package_log ($id_package, $client_key, $user_package, $res } function um_db_get_total_package_logs ($ip = '') { - $result = process_sql('SELECT COUNT(*) total FROM '.DB_PREFIX.'tupdate_package_log WHERE ip_address LIKE "%'.$ip.'%"'); + $result = db_process_sql('SELECT COUNT(*) total FROM '.DB_PREFIX.'tupdate_package_log WHERE ip_address LIKE "%'.$ip.'%"'); if ($result === false) { echo 'Error reading package log
'; @@ -279,10 +279,10 @@ function um_db_get_all_package_logs ($ip = '', $order_by = 'timestamp', $limit = switch ($config["dbtype"]) { case "mysql": - $result = process_sql('SELECT COUNT(*) FROM '.DB_PREFIX.'tupdate_package_log WHERE ip_address LIKE "%'.$ip.'%" ORDER BY '.$order_by.' DESC LIMIT '.$limit.' OFFSET '.$offset); + $result = db_process_sql('SELECT COUNT(*) FROM '.DB_PREFIX.'tupdate_package_log WHERE ip_address LIKE "%'.$ip.'%" ORDER BY '.$order_by.' DESC LIMIT '.$limit.' OFFSET '.$offset); break; case "postgresql": - $result = process_sql('SELECT COUNT(*) + $result = db_process_sql('SELECT COUNT(*) FROM '.DB_PREFIX.'tupdate_package_log WHERE ip_address LIKE \'%'.$ip.'%\' ORDER BY '.$order_by.' DESC LIMIT '.$limit.' OFFSET '.$offset); break; @@ -292,7 +292,7 @@ function um_db_get_all_package_logs ($ip = '', $order_by = 'timestamp', $limit = $set['order'] = $order_by . ' DESC'; $set['limit'] = $limit; $set['offset'] = $offset; - $result = get_db_num_rows(oracle_recode_query ('SELECT * FROM '.DB_PREFIX.'tupdate_package_log WHERE', $set, 'AND', true)); + $result = db_get_num_rows(oracle_recode_query ('SELECT * FROM '.DB_PREFIX.'tupdate_package_log WHERE', $set, 'AND', true)); break; } @@ -304,10 +304,10 @@ function um_db_get_all_package_logs ($ip = '', $order_by = 'timestamp', $limit = switch ($config["dbtype"]) { case "mysql": - $result = process_sql('SELECT * FROM '.DB_PREFIX.'tupdate_package_log WHERE ip_address LIKE "%'.$ip.'%" ORDER BY '.$order_by.' DESC LIMIT '.$limit.' OFFSET '.$offset); + $result = db_process_sql('SELECT * FROM '.DB_PREFIX.'tupdate_package_log WHERE ip_address LIKE "%'.$ip.'%" ORDER BY '.$order_by.' DESC LIMIT '.$limit.' OFFSET '.$offset); break; case "postgresql": - $result = process_sql('SELECT * + $result = db_process_sql('SELECT * FROM '.DB_PREFIX.'tupdate_package_log WHERE ip_address LIKE \'%'.$ip.'%\' ORDER BY '.$order_by.' DESC LIMIT '.$limit.' OFFSET '.$offset); break; @@ -335,7 +335,7 @@ function um_db_get_all_package_logs ($ip = '', $order_by = 'timestamp', $limit = } function um_db_delete_package_logs ($ip) { - $result = process_sql_delete(DB_PREFIX.'tupdate_package_log', array('ip_address' => $ip)); + $result = db_process_sql_delete(DB_PREFIX.'tupdate_package_log', array('ip_address' => $ip)); if($result === false) { echo 'Error deleting logs
'; @@ -352,7 +352,7 @@ function um_db_create_component ($type, $name, $path = '', $binary = false, $rel '`binary`' => $binary, 'relative_path' => $relative_path); - $result = process_sql_insert(DB_PREFIX.'tupdate_component', $values); + $result = db_process_sql_insert(DB_PREFIX.'tupdate_component', $values); if($result === false) { echo 'Error creating component
'; @@ -366,7 +366,7 @@ function um_db_update_component ($name, $path = '', $binary = false, $relative_p $values = array ('path' => $path, 'binary' => $binary, 'relative_path' => $relative_path); $where = array ('name' => $name); - $result = process_sql_update(DB_PREFIX.'tupdate_component', $values, $where); + $result = db_process_sql_update(DB_PREFIX.'tupdate_component', $values, $where); if($result === false) { echo 'Error updating component
'; @@ -377,7 +377,7 @@ function um_db_update_component ($name, $path = '', $binary = false, $relative_p } function um_db_delete_component ($name) { - $result = process_sql_delete(DB_PREFIX.'tupdate_component', array('name' => $name)); + $result = db_process_sql_delete(DB_PREFIX.'tupdate_component', array('name' => $name)); if($result === false) { echo 'Error deleting component
'; @@ -392,13 +392,13 @@ function um_db_get_component ($name) { switch ($config["dbtype"]) { case "mysql": - $result = process_sql('SELECT COUNT(*) FROM '.DB_PREFIX.'tupdate_component WHERE name = "'.$name.'" LIMIT 1'); + $result = db_process_sql('SELECT COUNT(*) FROM '.DB_PREFIX.'tupdate_component WHERE name = "'.$name.'" LIMIT 1'); break; case "postgresql": - $result = process_sql('SELECT COUNT(*) FROM '.DB_PREFIX.'tupdate_component WHERE name = \''.$name.'\' LIMIT 1'); + $result = db_process_sql('SELECT COUNT(*) FROM '.DB_PREFIX.'tupdate_component WHERE name = \''.$name.'\' LIMIT 1'); break; case "oracle": - $result = process_sql('SELECT COUNT(*) FROM '.DB_PREFIX.'tupdate_component WHERE name = \''.$name.'\' AND rownum < 2'); + $result = db_process_sql('SELECT COUNT(*) FROM '.DB_PREFIX.'tupdate_component WHERE name = \''.$name.'\' AND rownum < 2'); break; } @@ -409,13 +409,13 @@ function um_db_get_component ($name) { switch ($config["dbtype"]) { case "mysql": - $result = process_sql('SELECT * FROM '.DB_PREFIX.'tupdate_component WHERE name = "'.$name.'" LIMIT 1'); + $result = db_process_sql('SELECT * FROM '.DB_PREFIX.'tupdate_component WHERE name = "'.$name.'" LIMIT 1'); break; case "postgresql": - $result = process_sql('SELECT * FROM '.DB_PREFIX.'tupdate_component WHERE name = \''.$name.'\' LIMIT 1'); + $result = db_process_sql('SELECT * FROM '.DB_PREFIX.'tupdate_component WHERE name = \''.$name.'\' LIMIT 1'); break; case "oracle": - $result = process_sql('SELECT * FROM '.DB_PREFIX.'tupdate_component WHERE name = \''.$name.'\' AND rownum < 2'); + $result = db_process_sql('SELECT * FROM '.DB_PREFIX.'tupdate_component WHERE name = \''.$name.'\' AND rownum < 2'); break; } @@ -432,10 +432,10 @@ function um_db_get_component ($name) { function um_db_get_all_components ($type = '') { if ($type != '') { - $result = process_sql('SELECT * FROM '.DB_PREFIX.'tupdate_component WHERE type = '.$type); + $result = db_process_sql('SELECT * FROM '.DB_PREFIX.'tupdate_component WHERE type = '.$type); } else { - $result = process_sql('SELECT * FROM '.DB_PREFIX.'tupdate_component'); + $result = db_process_sql('SELECT * FROM '.DB_PREFIX.'tupdate_component'); } if ($result === false) { @@ -459,7 +459,7 @@ function um_db_get_all_components ($type = '') { function um_db_create_component_db ($table_name, $field_name, $order, $component_name) { $values = array('table_name' => $table_name, 'field_name' => $field_name, '`order`' => $order, 'component' => $component_name); - $result = process_sql_insert(DB_PREFIX.'tupdate_component_db', $values); + $result = db_process_sql_insert(DB_PREFIX.'tupdate_component_db', $values); if ($result === false) { echo 'Error creating database component
'; @@ -474,7 +474,7 @@ function um_db_update_component_db ($id, $table_name = '', $field_name = '', $or $values = array ('table_name' => $table_name, 'field_name' => $field_name, '`order`' => $order); $where = array ('id' => $id); - $result = process_sql_update(DB_PREFIX.'tupdate_component_db', $values, $where); + $result = db_process_sql_update(DB_PREFIX.'tupdate_component_db', $values, $where); if($result === false) { echo 'Error updating database component
'; @@ -506,7 +506,7 @@ function um_delete_directory($dirname) { } function um_db_delete_component_db ($id) { - $result = process_sql_delete(DB_PREFIX.'tupdate_component_db', array('id' => $id)); + $result = db_process_sql_delete(DB_PREFIX.'tupdate_component_db', array('id' => $id)); if($result === false) { echo 'Error deleting database component
'; @@ -521,13 +521,13 @@ function um_db_get_component_db ($id_component_db) { switch ($config["dbtype"]) { case "mysql": - $result = process_sql('SELECT COUNT(*) FROM '.DB_PREFIX.'tupdate_component_db WHERE id = "'.$id_component_db.'" LIMIT 1'); + $result = db_process_sql('SELECT COUNT(*) FROM '.DB_PREFIX.'tupdate_component_db WHERE id = "'.$id_component_db.'" LIMIT 1'); break; case "postgresql": - $result = process_sql('SELECT COUNT(*) FROM '.DB_PREFIX.'tupdate_component_db WHERE id = \''.$id_component_db.'\' LIMIT 1'); + $result = db_process_sql('SELECT COUNT(*) FROM '.DB_PREFIX.'tupdate_component_db WHERE id = \''.$id_component_db.'\' LIMIT 1'); break; case "oracle": - $result = process_sql('SELECT COUNT(*) FROM '.DB_PREFIX.'tupdate_component_db WHERE id = \''.$id_component_db.'\' AND rownum < 2'); + $result = db_process_sql('SELECT COUNT(*) FROM '.DB_PREFIX.'tupdate_component_db WHERE id = \''.$id_component_db.'\' AND rownum < 2'); break; } @@ -538,13 +538,13 @@ function um_db_get_component_db ($id_component_db) { switch ($config["dbtype"]) { case "mysql": - $result = process_sql('SELECT * FROM '.DB_PREFIX.'tupdate_component_db WHERE id = "'.$id_component_db.'" LIMIT 1'); + $result = db_process_sql('SELECT * FROM '.DB_PREFIX.'tupdate_component_db WHERE id = "'.$id_component_db.'" LIMIT 1'); break; case "postgresql": - $result = process_sql('SELECT * FROM '.DB_PREFIX.'tupdate_component_db WHERE id = \''.$id_component_db.'\' LIMIT 1'); + $result = db_process_sql('SELECT * FROM '.DB_PREFIX.'tupdate_component_db WHERE id = \''.$id_component_db.'\' LIMIT 1'); break; case "oracle": - $result = process_sql('SELECT * FROM '.DB_PREFIX.'tupdate_component_db WHERE id = \''.$id_component_db.'\' AND rownum < 2'); + $result = db_process_sql('SELECT * FROM '.DB_PREFIX.'tupdate_component_db WHERE id = \''.$id_component_db.'\' AND rownum < 2'); break; } @@ -558,11 +558,11 @@ function um_db_get_database_components ($component_name) { switch ($config["dbtype"]) { case "mysql": - $result = process_sql('SELECT COUNT(*) FROM '.DB_PREFIX.'tupdate_component_db WHERE component = "'. $component_name.'" ORDER BY `order` ASC'); + $result = db_process_sql('SELECT COUNT(*) FROM '.DB_PREFIX.'tupdate_component_db WHERE component = "'. $component_name.'" ORDER BY `order` ASC'); break; case "postgresql": case "oracle": - $result = process_sql('SELECT COUNT(*) FROM '.DB_PREFIX.'tupdate_component_db WHERE component = \''. $component_name.'\' ORDER BY "order" ASC'); + $result = db_process_sql('SELECT COUNT(*) FROM '.DB_PREFIX.'tupdate_component_db WHERE component = \''. $component_name.'\' ORDER BY "order" ASC'); break; } @@ -573,11 +573,11 @@ function um_db_get_database_components ($component_name) { switch ($config["dbtype"]) { case "mysql": - $result = process_sql('SELECT * FROM '.DB_PREFIX.'tupdate_component_db WHERE component = "'. $component_name.'" ORDER BY `order` ASC'); + $result = db_process_sql('SELECT * FROM '.DB_PREFIX.'tupdate_component_db WHERE component = "'. $component_name.'" ORDER BY `order` ASC'); break; case "postgresql": case "oracle": - $result = process_sql('SELECT * FROM '.DB_PREFIX.'tupdate_component_db WHERE component = \''. $component_name.'\' ORDER BY "order" ASC'); + $result = db_process_sql('SELECT * FROM '.DB_PREFIX.'tupdate_component_db WHERE component = \''. $component_name.'\' ORDER BY "order" ASC'); break; } @@ -604,7 +604,7 @@ function um_db_create_auth ($client_key, $subscription_limit, $description = '', } $values = array ('client_key' => $client_key, 'subscription_limit' => $subscription_limit, 'description' => $description, 'developer' => $developer); - $result = process_sql_insert(DB_PREFIX.'tupdate_auth', $values); + $result = db_process_sql_insert(DB_PREFIX.'tupdate_auth', $values); if ($result === false) { echo 'Error creating authorization
'; @@ -626,7 +626,7 @@ function um_db_update_auth ($id_auth, $client_key, $subscription_limit, $descrip 'developer' => $developer); $where = array ('id' => $id_auth); - $result = process_sql_update(DB_PREFIX.'tupdate_auth', $values, $where); + $result = db_process_sql_update(DB_PREFIX.'tupdate_auth', $values, $where); if($result === false) { echo 'Error updating authorization
'; @@ -637,7 +637,7 @@ function um_db_update_auth ($id_auth, $client_key, $subscription_limit, $descrip } function um_db_delete_auth ($id_auth) { - $result = process_sql_delete(DB_PREFIX.'tupdate_auth', array('id' => $id_auth)); + $result = db_process_sql_delete(DB_PREFIX.'tupdate_auth', array('id' => $id_auth)); if($result === false) { echo 'Error deleting authorization
'; @@ -652,13 +652,13 @@ function um_db_get_auth ($id_auth) { switch ($config["dbtype"]) { case "mysql": - $result = process_sql('SELECT * FROM '.DB_PREFIX.'tupdate_auth WHERE id = "'.$id_auth.'" LIMIT 1'); + $result = db_process_sql('SELECT * FROM '.DB_PREFIX.'tupdate_auth WHERE id = "'.$id_auth.'" LIMIT 1'); break; case "postgresql": - $result = process_sql('SELECT * FROM '.DB_PREFIX.'tupdate_auth WHERE id = \''.$id_auth.'\' LIMIT 1'); + $result = db_process_sql('SELECT * FROM '.DB_PREFIX.'tupdate_auth WHERE id = \''.$id_auth.'\' LIMIT 1'); break; case "oracle": - $result = process_sql('SELECT * FROM '.DB_PREFIX.'tupdate_auth WHERE id = \''.$id_auth.'\' AND rownum < 2'); + $result = db_process_sql('SELECT * FROM '.DB_PREFIX.'tupdate_auth WHERE id = \''.$id_auth.'\' AND rownum < 2'); break; } @@ -673,14 +673,14 @@ function um_db_get_auth ($id_auth) { } function um_db_get_all_auths () { - $result = process_sql('SELECT COUNT(*) FROM '.DB_PREFIX.'tupdate_auth'); + $result = db_process_sql('SELECT COUNT(*) FROM '.DB_PREFIX.'tupdate_auth'); if ($result === false) { echo 'Error getting authorizations
'; return array(); } - $result = process_sql('SELECT * FROM '.DB_PREFIX.'tupdate_auth'); + $result = db_process_sql('SELECT * FROM '.DB_PREFIX.'tupdate_auth'); $cont = 0; $auths = array(); @@ -701,13 +701,13 @@ function um_db_check_auth ($client_key, $subscription_limit) { switch ($config["dbtype"]) { case "mysql": - $result = process_sql('SELECT * FROM '.DB_PREFIX.'tupdate_auth WHERE client_key = "'.$client_key.'" LIMIT 1'); + $result = db_process_sql('SELECT * FROM '.DB_PREFIX.'tupdate_auth WHERE client_key = "'.$client_key.'" LIMIT 1'); break; case "postgresql": - $result = process_sql('SELECT * FROM '.DB_PREFIX.'tupdate_auth WHERE client_key = \''.$client_key.'\' LIMIT 1'); + $result = db_process_sql('SELECT * FROM '.DB_PREFIX.'tupdate_auth WHERE client_key = \''.$client_key.'\' LIMIT 1'); break; case "oracle": - $result = process_sql('SELECT * FROM '.DB_PREFIX.'tupdate_auth WHERE client_key = \''.$client_key.'\' AND rownum < 2'); + $result = db_process_sql('SELECT * FROM '.DB_PREFIX.'tupdate_auth WHERE client_key = \''.$client_key.'\' AND rownum < 2'); break; } @@ -730,7 +730,7 @@ function um_db_check_auth ($client_key, $subscription_limit) { } function um_db_is_auth_developer ($id_auth) { - $developer = get_db_value('developer', DB_PREFIX.'tupdate_auth', '`id`', $id_auth); + $developer = db_get_value('developer', DB_PREFIX.'tupdate_auth', '`id`', $id_auth); if ($developer === false) { echo 'Error reading authorization developers bit
'; @@ -741,13 +741,13 @@ function um_db_is_auth_developer ($id_auth) { } function um_db_connect ($backend = 'mysql', $host = '', $user = '', $password = '', $db_name = '') { - return connect_db ($host, $db_name, $user, $password); + return db_connect ($host, $db_name, $user, $password); } function um_component_db_connect () { $settings = um_db_load_settings (); - return connect_db ($settings->dbhost, $settings->dbname, $settings->dbuser, $settings->dbpass); + return db_connect ($settings->dbhost, $settings->dbname, $settings->dbuser, $settings->dbpass); } function um_get_package_status () { diff --git a/pandora_console/extensions/update_manager/lib/libupdate_manager_client.php b/pandora_console/extensions/update_manager/lib/libupdate_manager_client.php index 1d8055dd6a..986a76eb88 100644 --- a/pandora_console/extensions/update_manager/lib/libupdate_manager_client.php +++ b/pandora_console/extensions/update_manager/lib/libupdate_manager_client.php @@ -162,7 +162,7 @@ function um_client_db_save_package ($package, $settings) { um_client_db_connect($settings); - $result = process_sql_insert(DB_PREFIX.'tupdate_package', $fields); + $result = db_process_sql_insert(DB_PREFIX.'tupdate_package', $fields); if($result === false) { return false; @@ -188,7 +188,7 @@ function um_client_db_save_update ($update) { unset($fields['order']); } - $result = process_sql_insert(DB_PREFIX.'tupdate', $fields); + $result = db_process_sql_insert(DB_PREFIX.'tupdate', $fields); if($result === false) { return false; @@ -231,7 +231,7 @@ function um_client_create_update_file ($data, $md5path_name) { function um_client_apply_update_database (&$update) { if ($update->type == 'db_data') { - $exists = get_db_value('COUNT(*)', $update->db_table, $update->db_field, $update->db_field_value); + $exists = db_get_value('COUNT(*)', $update->db_table, $update->db_field, $update->db_field_value); /* If it exists, it failed. */ if ($exists != 0) { @@ -240,7 +240,7 @@ function um_client_apply_update_database (&$update) { } $query_array = explode(';',um_data_decode($update->data)); - $result = process_sql($query_array[0]); + $result = db_process_sql($query_array[0]); if ($result === false) { //echo $result->getMessage (); @@ -292,7 +292,7 @@ function um_client_rollback_update (&$update, $settings) { $filename = $settings->updating_binary_path.'/'.$update->filename; $success = um_client_rollback_update_file ($update, $filename); } else if ($update->type == 'db_data' || $update->type == 'db_schema') { - process_sql_rollback(); + db_process_sql_rollback(); $success = true; } else { return false; @@ -515,7 +515,7 @@ function um_client_upgrade_to_package ($package, $settings, $force = true, $upda um_db_update_setting ('current_update', $package->id); - process_sql_commit(); + db_process_sql_commit(); } else { $data_queries = ''; @@ -620,7 +620,7 @@ function um_client_upgrade_to_package ($package, $settings, $force = true, $upda function um_client_upgrade_to_latest ($user_key, $force = true) { $settings = um_db_load_settings (); - process_sql_begin(); + db_process_sql_begin(); do { $package = um_client_get_package ($settings, $user_key); diff --git a/pandora_console/extensions/update_manager/lib/libupdate_manager_components.php b/pandora_console/extensions/update_manager/lib/libupdate_manager_components.php index fbe9b60bec..9bdcf372dc 100644 --- a/pandora_console/extensions/update_manager/lib/libupdate_manager_components.php +++ b/pandora_console/extensions/update_manager/lib/libupdate_manager_components.php @@ -22,13 +22,13 @@ function um_component_database_get_data ($component_db) { $fields = um_component_database_get_table_fields ($component_db->table_name); - $result = process_sql('SELECT COUNT(*) FROM '.$component_db->table_name); + $result = db_process_sql('SELECT COUNT(*) FROM '.$component_db->table_name); if ($result === false) { echo 'Error getting table fields
'; return NULL; } - $result = process_sql('SELECT '.implode (',', $fields).' FROM '.$component_db->table_name); + $result = db_process_sql('SELECT '.implode (',', $fields).' FROM '.$component_db->table_name); $cont = 0; $resultdata = array(); @@ -62,13 +62,13 @@ function um_component_database_get_all_tables () { switch ($config["dbtype"]) { case "mysql": - $result = process_sql('SHOW TABLES'); + $result = db_process_sql('SHOW TABLES'); break; case "postgresql": - $result = process_sql('SELECT table_name FROM information_schema.tables WHERE table_schema = \'public\';'); + $result = db_process_sql('SELECT table_name FROM information_schema.tables WHERE table_schema = \'public\';'); break; case "oracle": - $result = process_sql('SELECT table_name FROM user_tables'); + $result = db_process_sql('SELECT table_name FROM user_tables'); break; } @@ -113,14 +113,14 @@ function um_component_database_get_table_fields ($table_name) { switch ($config["dbtype"]) { case "mysql": - $result = process_sql('SHOW COLUMNS FROM '.$table_name.' WHERE `Key` != "PRI"'); + $result = db_process_sql('SHOW COLUMNS FROM '.$table_name.' WHERE `Key` != "PRI"'); break; case "postgresql": //TODO: verificar que se extraen todos los campos menos clave primaria - $result = process_sql("SELECT * FROM pg_indexes WHERE tablename = '" . $table_name . "'"); + $result = db_process_sql("SELECT * FROM pg_indexes WHERE tablename = '" . $table_name . "'"); break; case "oracle": - $result = process_sql("SELECT cols1.column_name as Fields, cols1.data_type as Type, + $result = db_process_sql("SELECT cols1.column_name as Fields, cols1.data_type as Type, CASE WHEN (cols1.nullable = 'Y') THEN 'YES' ELSE 'NO' END as \"Null\", cols1.data_default as \"Default\", '' as Extra FROM user_tab_columns cols1 @@ -197,11 +197,11 @@ function um_component_get_all_blacklisted ($component) { switch ($config["dbtype"]) { case "mysql": - $result = process_sql('SELECT COUNT(name) FROM '.DB_PREFIX.'tupdate_component_blacklist WHERE component = "'.$component->name.'"'); + $result = db_process_sql('SELECT COUNT(name) FROM '.DB_PREFIX.'tupdate_component_blacklist WHERE component = "'.$component->name.'"'); break; case "postgresql": case "oracle": - $result = process_sql('SELECT COUNT(name) + $result = db_process_sql('SELECT COUNT(name) FROM '.DB_PREFIX.'tupdate_component_blacklist WHERE component = \''.$component->name.'\''); break; @@ -214,11 +214,11 @@ function um_component_get_all_blacklisted ($component) { switch ($config["dbtype"]) { case "mysql": - $result = process_sql('SELECT name FROM '.DB_PREFIX.'tupdate_component_blacklist WHERE component = "'.$component->name.'"'); + $result = db_process_sql('SELECT name FROM '.DB_PREFIX.'tupdate_component_blacklist WHERE component = "'.$component->name.'"'); break; case "postgresql": case "oracle": - $result = process_sql('SELECT name + $result = db_process_sql('SELECT name FROM '.DB_PREFIX.'tupdate_component_blacklist WHERE component = \''.$component->name.'\''); break; @@ -243,11 +243,11 @@ function um_component_is_blacklisted ($component, $name) { switch ($config["dbtype"]) { case "mysql": - $result = process_sql('SELECT COUNT(*) AS blacklisted FROM '.DB_PREFIX.'tupdate_component_blacklist WHERE component = "'.$component->name.'" AND name = "'.$name.'"'); + $result = db_process_sql('SELECT COUNT(*) AS blacklisted FROM '.DB_PREFIX.'tupdate_component_blacklist WHERE component = "'.$component->name.'" AND name = "'.$name.'"'); break; case "postgresql": case "oracle": - $result = process_sql('SELECT COUNT(*) AS blacklisted + $result = db_process_sql('SELECT COUNT(*) AS blacklisted FROM '.DB_PREFIX.'tupdate_component_blacklist WHERE component = \''.$component->name.'\' AND name = \''.$name.'\''); break; @@ -265,7 +265,7 @@ function um_component_is_blacklisted ($component, $name) { function um_component_add_blacklist ($component, $name) { $values = array('component' => $component->name, 'name' => $name); - $result = process_sql_insert(DB_PREFIX.'tupdate_component_blacklist', $values); + $result = db_process_sql_insert(DB_PREFIX.'tupdate_component_blacklist', $values); if ($result === false) { echo 'Error creating blacklist component
'; diff --git a/pandora_console/extensions/update_manager/lib/libupdate_manager_updates.php b/pandora_console/extensions/update_manager/lib/libupdate_manager_updates.php index abccc6f4b9..a479925c75 100644 --- a/pandora_console/extensions/update_manager/lib/libupdate_manager_updates.php +++ b/pandora_console/extensions/update_manager/lib/libupdate_manager_updates.php @@ -24,13 +24,13 @@ function um_update_get_last_from_filename ($component_name, $filename) { switch ($config["dbtype"]) { case "mysql": - $result = process_sql('SELECT COUNT(*) FROM '.DB_PREFIX.'tupdate WHERE component = "'.$component_name.'" AND filename = "'.$component->relative_path.$filename.'" ORDER BY id DESC LIMIT 1'); + $result = db_process_sql('SELECT COUNT(*) FROM '.DB_PREFIX.'tupdate WHERE component = "'.$component_name.'" AND filename = "'.$component->relative_path.$filename.'" ORDER BY id DESC LIMIT 1'); break; case "postgresql": - $result = process_sql('SELECT COUNT(*) FROM '.DB_PREFIX.'tupdate WHERE component = \''.$component_name.'\' AND filename = \''.$component->relative_path.$filename.'\' ORDER BY id DESC LIMIT 1'); + $result = db_process_sql('SELECT COUNT(*) FROM '.DB_PREFIX.'tupdate WHERE component = \''.$component_name.'\' AND filename = \''.$component->relative_path.$filename.'\' ORDER BY id DESC LIMIT 1'); break; case "oracle": - $result = process_sql('SELECT COUNT(*) FROM '.DB_PREFIX.'tupdate WHERE (component = \''.$component_name.'\' AND filename = \''.$component->relative_path.$filename.'\') AND rownum < 2 ORDER BY id DESC'); + $result = db_process_sql('SELECT COUNT(*) FROM '.DB_PREFIX.'tupdate WHERE (component = \''.$component_name.'\' AND filename = \''.$component->relative_path.$filename.'\') AND rownum < 2 ORDER BY id DESC'); break; } @@ -41,16 +41,16 @@ function um_update_get_last_from_filename ($component_name, $filename) { switch ($config["dbtype"]) { case "mysql": - $result = process_sql('SELECT * FROM '.DB_PREFIX.'tupdate WHERE component = "'.$component_name.'" AND filename = "'.$component->relative_path.$filename.'" ORDER BY id DESC LIMIT 1'); + $result = db_process_sql('SELECT * FROM '.DB_PREFIX.'tupdate WHERE component = "'.$component_name.'" AND filename = "'.$component->relative_path.$filename.'" ORDER BY id DESC LIMIT 1'); break; case "postgresql": - $result = process_sql('SELECT * + $result = db_process_sql('SELECT * FROM '.DB_PREFIX.'tupdate WHERE component = \''.$component_name.'\' AND filename = \''.$component->relative_path.$filename.'\' ORDER BY id DESC LIMIT 1'); break; case "oracle": - $result = process_sql('SELECT * + $result = db_process_sql('SELECT * FROM '.DB_PREFIX.'tupdate WHERE (component = \''.$component_name.'\' AND filename = \''.$component->relative_path.$filename.'\') AND rownum < 2 ORDER BY id DESC'); @@ -63,14 +63,14 @@ function um_update_get_last_from_filename ($component_name, $filename) { } function um_update_get_last_from_table_field_value ($component_name, $id_component_db, $field_value) { - $result = process_sql('SELECT COUNT(*) FROM '.DB_PREFIX.'tupdate WHERE component = "'.$component_name.'" AND id_component_db = "'.$id_component_db.'" AND db_field_value = "'.$field_value.'" ORDER BY id DESC LIMIT 1'); + $result = db_process_sql('SELECT COUNT(*) FROM '.DB_PREFIX.'tupdate WHERE component = "'.$component_name.'" AND id_component_db = "'.$id_component_db.'" AND db_field_value = "'.$field_value.'" ORDER BY id DESC LIMIT 1'); if ($result === false) { echo 'Error getting last value
'; return NULL; } - $result = process_sql('SELECT * FROM '.DB_PREFIX.'tupdate WHERE component = "'.$component_name.'" AND id_component_db = "'.$id_component_db.'" AND db_field_value = "'.$field_value.'" ORDER BY id DESC LIMIT 1'); + $result = db_process_sql('SELECT * FROM '.DB_PREFIX.'tupdate WHERE component = "'.$component_name.'" AND id_component_db = "'.$id_component_db.'" AND db_field_value = "'.$field_value.'" ORDER BY id DESC LIMIT 1'); $update = um_std_from_result($result); @@ -78,7 +78,7 @@ function um_update_get_last_from_table_field_value ($component_name, $id_compone } function um_db_get_orphan_updates () { - $result = process_sql('SELECT * FROM '.DB_PREFIX.'tupdate WHERE id_update_package IS NULL'); + $result = db_process_sql('SELECT * FROM '.DB_PREFIX.'tupdate WHERE id_update_package IS NULL'); if ($result === false) { echo 'Error getting orphan updates
'; @@ -100,7 +100,7 @@ function um_db_get_orphan_updates () { } function um_db_get_update ($id_update) { - $result = process_sql('SELECT * FROM '.DB_PREFIX.'tupdate WHERE id = "'.$id_update.'" LIMIT 1'); + $result = db_process_sql('SELECT * FROM '.DB_PREFIX.'tupdate WHERE id = "'.$id_update.'" LIMIT 1'); if ($result === false) { echo 'Error getting update
'; @@ -121,7 +121,7 @@ function um_db_delete_update ($id_update) { echo 'Error: '.'Only packages in development state can be deleted'; return false; } - $result = process_sql_delete(DB_PREFIX.'tupdate', array('id' => $id_update)); + $result = db_process_sql_delete(DB_PREFIX.'tupdate', array('id' => $id_update)); if ($result === false) { echo 'Error deleting update
'; @@ -193,7 +193,7 @@ function um_db_create_update ($type, $component_name, $id_package, $update, $db_ return false; } - $result = process_sql_insert(DB_PREFIX.'tupdate', $values); + $result = db_process_sql_insert(DB_PREFIX.'tupdate', $values); if ($result === false) { echo 'Error creating update
'; diff --git a/pandora_console/extensions/update_manager/load_updatemanager.php b/pandora_console/extensions/update_manager/load_updatemanager.php index 325df499c5..4bf9ec7de9 100644 --- a/pandora_console/extensions/update_manager/load_updatemanager.php +++ b/pandora_console/extensions/update_manager/load_updatemanager.php @@ -63,18 +63,18 @@ function get_user_key ($settings) { switch ($config['dbtype']) { case 'mysql': - $n = (int) get_db_value ('COUNT(`id_agente`)', 'tagente', 'disabled', 0); - $m = (int) get_db_value ('COUNT(`id_agente_modulo`)', 'tagente_modulo', + $n = (int) db_get_value ('COUNT(`id_agente`)', 'tagente', 'disabled', 0); + $m = (int) db_get_value ('COUNT(`id_agente_modulo`)', 'tagente_modulo', 'disabled', 0); break; case 'postgresql': - $n = (int) get_db_value ('COUNT("id_agente")', 'tagente', 'disabled', 0); - $m = (int) get_db_value ('COUNT("id_agente_modulo")', 'tagente_modulo', + $n = (int) db_get_value ('COUNT("id_agente")', 'tagente', 'disabled', 0); + $m = (int) db_get_value ('COUNT("id_agente_modulo")', 'tagente_modulo', 'disabled', 0); break; case 'oracle': - $n = (int) get_db_value ('COUNT(id_agente)', 'tagente', 'disabled', 0); - $m = (int) get_db_value ('COUNT(id_agente_modulo)', 'tagente_modulo', + $n = (int) db_get_value ('COUNT(id_agente)', 'tagente', 'disabled', 0); + $m = (int) db_get_value ('COUNT(id_agente_modulo)', 'tagente_modulo', 'disabled', 0); break; } diff --git a/pandora_console/extensions/update_manager/main.php b/pandora_console/extensions/update_manager/main.php index 148860e6ce..a8518ea6b3 100644 --- a/pandora_console/extensions/update_manager/main.php +++ b/pandora_console/extensions/update_manager/main.php @@ -141,7 +141,7 @@ else { $error = '
'.__('File cannot be uploaded').'
'; } -clean_cache(); +db_clean_cache(); $settings = um_db_load_settings (); $user_key = get_user_key ($settings); diff --git a/pandora_console/extensions/update_manager/settings.php b/pandora_console/extensions/update_manager/settings.php index c30675404f..91ee84bf84 100644 --- a/pandora_console/extensions/update_manager/settings.php +++ b/pandora_console/extensions/update_manager/settings.php @@ -17,7 +17,7 @@ global $config; check_login (); if (! check_acl ($config['id_user'], 0, 'PM')) { - pandora_audit("ACL Violation", "Trying to use Open Update Manager extension"); + db_pandora_audit("ACL Violation", "Trying to use Open Update Manager extension"); include ("general/noaccess.php"); return; } diff --git a/pandora_console/extensions/users_connected.php b/pandora_console/extensions/users_connected.php index 46501a78ab..ad43440b6c 100644 --- a/pandora_console/extensions/users_connected.php +++ b/pandora_console/extensions/users_connected.php @@ -48,7 +48,7 @@ function users_extension_main_god ($god = true) { break; } - $rows = get_db_all_rows_sql ($sql); + $rows = db_get_all_rows_sql ($sql); if (empty ($rows)) { $rows = array (); echo "
".__('No other users connected')."
"; diff --git a/pandora_console/extensions/vnc_view.php b/pandora_console/extensions/vnc_view.php index 4f9e5116f0..7d49d72d07 100644 --- a/pandora_console/extensions/vnc_view.php +++ b/pandora_console/extensions/vnc_view.php @@ -16,7 +16,7 @@ function vnc_view() { $idAgent = (int)get_parameter('id_agente', 0); - $ipAgent = get_db_value('direccion', 'tagente', 'id_agente', $idAgent); + $ipAgent = db_get_value('direccion', 'tagente', 'id_agente', $idAgent); echo ''; echo ''; diff --git a/pandora_console/extras/pandora_diag.php b/pandora_console/extras/pandora_diag.php index 808cf176b4..c126160bf8 100644 --- a/pandora_console/extras/pandora_diag.php +++ b/pandora_console/extras/pandora_diag.php @@ -16,14 +16,14 @@ function render_info ($table) { global $console_mode; - $info = get_db_sql ("SELECT COUNT(*) FROM $table"); + $info = db_get_sql ("SELECT COUNT(*) FROM $table"); render_row ($info,"DB Table $table"); } function render_info_data ($query, $label) { global $console_mode; - $info = get_db_sql ($query); + $info = db_get_sql ($query); render_row ($info, $label); } @@ -124,7 +124,7 @@ switch ($config["dbtype"]) { render_info_data ("SELECT `value` FROM tconfig WHERE `token` = 'db_scheme_version'", "DB Schema Version"); render_info_data ("SELECT `value` FROM tconfig WHERE `token` = 'db_scheme_build'", "DB Schema Build"); render_info_data ("SELECT `value` FROM tconfig WHERE `token` = 'enterprise_installed'", "Enterprise installed"); - render_row ( date ("Y/m/d H:i:s",get_db_sql ("SELECT `value` FROM tconfig WHERE `token` = 'db_maintance'")), "PandoraDB Last run"); + render_row ( date ("Y/m/d H:i:s",db_get_sql ("SELECT `value` FROM tconfig WHERE `token` = 'db_maintance'")), "PandoraDB Last run"); render_info_data ("SELECT value FROM tupdate_settings WHERE `key` = 'customer_key';", "Update Key"); render_info_data ("SELECT value FROM tupdate_settings WHERE `key` = 'updating_code_path'", "Updating code path"); @@ -135,7 +135,7 @@ switch ($config["dbtype"]) { render_info_data ("SELECT \"value\" FROM tconfig WHERE \"token\" = 'db_scheme_version'", "DB Schema Version"); render_info_data ("SELECT \"value\" FROM tconfig WHERE \"token\" = 'db_scheme_build'", "DB Schema Build"); render_info_data ("SELECT \"value\" FROM tconfig WHERE \"token\" = 'enterprise_installed'", "Enterprise installed"); - render_row ( date ("Y/m/d H:i:s",get_db_sql ("SELECT \"value\" FROM tconfig WHERE \"token\" = 'db_maintance'")), "PandoraDB Last run"); + render_row ( date ("Y/m/d H:i:s",db_get_sql ("SELECT \"value\" FROM tconfig WHERE \"token\" = 'db_maintance'")), "PandoraDB Last run"); render_info_data ("SELECT value FROM tupdate_settings WHERE \"key\" = 'customer_key';", "Update Key"); render_info_data ("SELECT value FROM tupdate_settings WHERE \"key\" = 'updating_code_path'", "Updating code path"); @@ -146,7 +146,7 @@ switch ($config["dbtype"]) { render_info_data ("SELECT value FROM tconfig WHERE token = 'db_scheme_version'", "DB Schema Version"); render_info_data ("SELECT value FROM tconfig WHERE token = 'db_scheme_build'", "DB Schema Build"); render_info_data ("SELECT value FROM tconfig WHERE token = 'enterprise_installed'", "Enterprise installed"); - render_row (get_db_sql ("SELECT value FROM tconfig WHERE token = 'db_maintance'"), "PandoraDB Last run"); + render_row (db_get_sql ("SELECT value FROM tconfig WHERE token = 'db_maintance'"), "PandoraDB Last run"); render_info_data ("SELECT value FROM tupdate_settings WHERE key = 'customer_key'", "Update Key"); render_info_data ("SELECT value FROM tupdate_settings WHERE key = 'updating_code_path'", "Updating code path"); diff --git a/pandora_console/general/error_authconfig.php b/pandora_console/general/error_authconfig.php index dcee46d809..0335bf0852 100644 --- a/pandora_console/general/error_authconfig.php +++ b/pandora_console/general/error_authconfig.php @@ -45,7 +45,7 @@ the database server is not running.

DB ERROR:
diff --git a/pandora_console/general/error_dbconfig.php b/pandora_console/general/error_dbconfig.php index 744ca0619d..0ce3da4c48 100644 --- a/pandora_console/general/error_dbconfig.php +++ b/pandora_console/general/error_dbconfig.php @@ -43,7 +43,7 @@ Cannot connect to the database, please check your database setup in the include/config.php file or read the documentation on how to setup Pandora FMS.

Probably one or more of your user, database or hostname values are incorrect or the database server is not running.


- DB ERROR: + DB ERROR:
 
diff --git a/pandora_console/general/header.php b/pandora_console/general/header.php index 93eb8b17b0..b328083d54 100644 --- a/pandora_console/general/header.php +++ b/pandora_console/general/header.php @@ -15,6 +15,8 @@ // GNU General Public License for more details. require_once ("include/functions_messages.php"); +require_once ('include/functions_servers.php'); + $msg_cnt = 0; @@ -68,7 +70,7 @@ $msg_cnt = 0; if ($config["metaconsole"] == 0){ echo ''; - $servers["all"] = (int) get_db_value ('COUNT(id_server)','tserver'); + $servers["all"] = (int) db_get_value ('COUNT(id_server)','tserver'); $servers["up"] = (int) check_server_status (); $servers["down"] = $servers["all"] - $servers["up"]; if ($servers["up"] == 0) { diff --git a/pandora_console/general/links_menu.php b/pandora_console/general/links_menu.php index aff6dc299c..e85a29a380 100644 --- a/pandora_console/general/links_menu.php +++ b/pandora_console/general/links_menu.php @@ -15,7 +15,7 @@ // GNU General Public License for more details. $sql = 'SELECT link, name FROM tlink ORDER BY name'; -$result = get_db_all_rows_sql ($sql); +$result = db_get_all_rows_sql ($sql); if ($result !== false) { echo '
:: '.__('Links').' ::
'; echo '