* 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
This commit is contained in:
juanmanuelr 2011-04-19 18:42:49 +00:00
parent af8fd12d1e
commit 14c3c216ec
237 changed files with 5256 additions and 4897 deletions

View File

@ -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");

View File

@ -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 '<strong>An error has occured when querying the database.</strong><br />';
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 "<strong>Output: <strong>".$result;
pandora_audit("Extension DB inface", "SQL", false, false, $sql);
db_pandora_audit("Extension DB inface", "SQL", false, false, $sql);
return;
}

View File

@ -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'),

View File

@ -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));

View File

@ -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 '<strong>' . __('Number fired of alerts').': </strong> ' . $alert["times_fired"] . '<br />';
$agent = get_db_row('tagente', 'id_agente', $module['id_agente']);
$agent = db_get_row('tagente', 'id_agente', $module['id_agente']);
echo '<strong>' . __('Agent').': </strong>';
echo safe_output($agent['nombre']) . '<br />';
echo '<strong>' . __('Module') . ': </strong>';
echo safe_output($module['nombre']) . '<br />';
$template = get_db_row('talert_templates', 'id' , $alert['id_alert_template']);
$template = db_get_row('talert_templates', 'id' , $alert['id_alert_template']);
echo '<strong>' . __('Alert template') . ': </strong>';
echo safe_output($template['name']) . '<br />';
@ -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) {

View File

@ -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;
}

View File

@ -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 "<h3 class=suc>".__("Module plugin registered"). " : ". $ini_array[$label]["name"] ."</h2>";
}

View File

@ -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 '<?xml version="1.0" encoding="UTF-8" ?>' . "\n";
echo "<report>\n";
echo "<name><![CDATA[" . safe_output($report['name']) . "]]></name>\n";
if (isset($report['description']))
echo "<description><![CDATA[" . safe_output($report['description']) . "]]></description>\n";
$group = get_db_value('nombre', 'tgrupo', 'id_grupo', $report['id_group']);
$group = db_get_value('nombre', 'tgrupo', 'id_grupo', $report['id_group']);
echo "<group><![CDATA[" . safe_output($group) . "]]></group>\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 "<item>\n";
echo "<type>" . safe_output($item['type']) . "</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 "<module><![CDATA[" . safe_output($module) . "]]></module>\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 "<graph><![CDATA[" . safe_output($graph) . "]]></graph>\n";
break;
case 3:
@ -135,12 +139,12 @@ function output_xml_report($id) {
echo "<time_from>" . $item['time_from'] . "</time_from>\n";
echo "<time_to>" . $item['time_to'] . "</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 "<sla>";
echo "<agent><![CDATA[" . $agent . "]]></agent>\n";
@ -178,7 +182,7 @@ function output_xml_report($id) {
echo "<sql><![CDATA[" . safe_output($item['external_source']) . "]]></sql>\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 "<sql>" . safe_output($sql) . "</sql>\n";
}
break;
@ -190,12 +194,12 @@ function output_xml_report($id) {
echo "<sql>" . safe_output($item['external_source']) . "</sql>\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 "<sql>" . safe_output($sql) . "</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 "<group><![CDATA[" . safe_output($group) . "]]></group>\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 '<?xml version="1.0" encoding="UTF-8" ?>' . "\n";
echo "<visual_map>\n";
echo "<name><![CDATA[" . safe_output($visual_map['name']) . "]]></name>\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 "<group><![CDATA[" . safe_output($group) . "]]></group>\n";
}
echo "<background><![CDATA[" . safe_output($visual_map['background']) . "]]></background>\n";
echo "<height>" . safe_output($visual_map['height']) . "</height>\n";
echo "<width>" . safe_output($visual_map['width']) . "</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 "<item>\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 "<module><![CDATA[" . safe_output($module) . "]]></module>\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;
}

View File

@ -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;
}

View File

@ -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");
?>
<div>

View File

@ -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;

View File

@ -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)

View File

@ -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 '<strong>Error reading settings</strong><br />';
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 '<strong>Error reading latest package with status ' . $status . '</strong><br />';
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 '<strong>Error creating package</strong><br />';
@ -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 '<strong>Error updating package</strong><br />';
@ -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 '<strong>Error deleting package</strong><br />';
@ -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 '<strong>Error getting package info</strong><br />';
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 '<strong>Error getting all packages</strong><br />';
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 '<strong>Error getting all packages '.$id_package.'</strong><br />'.'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 '<strong>Error reading package log</strong> <br />';
@ -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 '<strong>Error deleting logs</strong><br />';
@ -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 '<strong>Error creating component</strong><br />';
@ -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 '<strong>Error updating component</strong><br />';
@ -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 '<strong>Error deleting component</strong><br />';
@ -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 '<strong>Error creating database component</strong> <br />';
@ -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 '<strong>Error updating database component</strong><br />';
@ -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 '<strong>Error deleting database component</strong><br />';
@ -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 '<strong>Error creating authorization</strong> <br />';
@ -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 '<strong>Error updating authorization</strong><br />';
@ -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 '<strong>Error deleting authorization</strong><br />';
@ -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 '<strong>Error getting authorizations</strong> <br />';
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 '<strong>Error reading authorization developers bit</strong> <br />';
@ -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 () {

View File

@ -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);

View File

@ -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 '<strong>Error getting table fields</strong> <br />';
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 '<strong>Error creating blacklist component</strong> <br />';

View File

@ -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 '<strong>Error getting last value</strong> <br />';
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 '<strong>Error getting orphan updates</strong> <br />';
@ -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 '<strong>Error getting update</strong> <br />';
@ -121,7 +121,7 @@ function um_db_delete_update ($id_update) {
echo '<strong>Error</strong>: '.'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 '<strong>Error deleting update</strong> <br />';
@ -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 '<strong>Error creating update</strong> <br />';

View File

@ -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;
}

View File

@ -141,7 +141,7 @@ else {
$error = '<h5 class="error">'.__('File cannot be uploaded').'</h5>';
}
clean_cache();
db_clean_cache();
$settings = um_db_load_settings ();
$user_key = get_user_key ($settings);

View File

@ -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;
}

View File

@ -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 "<div class='nf'>".__('No other users connected')."</div>";

View File

@ -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 '<applet code="VncViewer.class" archive="extensions/vnc/VncViewer.jar" width="750" height="800">';
echo '<param name="Host" value="'.$ipAgent.'">';

View File

@ -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");

View File

@ -45,7 +45,7 @@
the database server is not running.</i><br /><br /><span class="error">
<b>DB ERROR:</b>
<?php
echo get_db_last_error();
echo db_get_last_error();
?></span>
</div>
<div class="msg">

View File

@ -43,7 +43,7 @@
Cannot connect to the database, please check your database setup in the <b>include/config.php</b> file or read the documentation on how to setup Pandora FMS.<i><br><br>
Probably one or more of your user, database or hostname values are incorrect or
the database server is not running.</i><br /><br /><span class="error">
<b>DB ERROR:</b><?php echo get_db_last_error(); ?></span>
<b>DB ERROR:</b><?php echo db_get_last_error(); ?></span>
<br>&nbsp;
</div>
</div>

View File

@ -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 '<a class="white_bold" href="index.php?sec=estado_server&amp;sec2=operation/servers/view_server&amp;refr=60">';
$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) {

View File

@ -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 '<div class="tit bg4">:: '.__('Links').' ::</div>';
echo '<div class="menu"><ul>';

View File

@ -46,7 +46,7 @@ switch ($config["dbtype"]) {
break;
}
$news = get_db_all_rows_sql ($sql);
$news = db_get_all_rows_sql ($sql);
if ($news !== false) {
echo '<table cellpadding="4" cellspacing="4" class="databox">';
foreach ($news as $article) {
@ -184,7 +184,7 @@ switch ($config["dbtype"]) {
break;
}
$sessions = get_db_all_rows_sql ($sql);
$sessions = db_get_all_rows_sql ($sql);
if ($sessions === false)
$sessions = array ();

View File

@ -15,6 +15,7 @@
require_once ('include/config.php');
require_once ('include/functions_agents.php');
require_once ('include/functions_users.php');
if (is_ajax ()) {
$search_agents = (bool) get_parameter ('search_agents');

View File

@ -17,6 +17,10 @@
global $config;
if ($config['flash_charts']) {
require_once ("include/fgraph.php");
}
require_once ($config["homedir"] . '/include/functions_graph.php');
check_login ();
@ -24,7 +28,7 @@ check_login ();
$enterprise_include = enterprise_include_once('godmode/admin_access_logs.php');
if (! check_acl ($config['id_user'], 0, "PM")) {
pandora_audit( "ACL Violation",
db_pandora_audit( "ACL Violation",
"Trying to access event viewer");
require ("general/noaccess.php");
exit;
@ -44,7 +48,7 @@ echo '<tr><td class="datost">';
echo '<div style="float: left; width: 400px;">';
echo '<b>'.__('Filter').'</b><br><br>';
$rows = get_db_all_rows_sql ("SELECT DISTINCT(accion) FROM tsesion");
$rows = db_get_all_rows_sql ("SELECT DISTINCT(accion) FROM tsesion");
if (empty ($rows)) {
$rows = array ();
}
@ -128,8 +132,8 @@ if ($filter_hours_old != 0) {
}
$sql = "SELECT COUNT(*) FROM tsesion " . $filter;
$count = get_db_sql ($sql);
$url = "index.php?sec=godmode&sec2=godmode/admin_access_logs&tipo_log=".$tipo_log."&user_filter=".$user_filter."&filter_text=".$filter_text."&filter_hours_old=".$filter_hours_old."&filter_ip=".$filter_ip;
$count = db_get_sql ($sql);
$url = "index.php?sec=godmode&sec2=godmode/admin_access_logs&tipo_log=".$tipo_log;
ui_pagination ($count, $url);
@ -149,7 +153,7 @@ switch ($config["dbtype"]) {
break;
}
$result = get_db_all_rows_sql ($sql);
$result = db_get_all_rows_sql ($sql);
// Delete rnum row generated by oracle_recode_query() function
if (($config["dbtype"] == 'oracle') && ($result !== false)){

View File

@ -20,13 +20,14 @@ if (!isset ($id_agente)) {
require_once ('include/functions_gis.php');
require_once ('include/functions_html.php');
require_once ('include/functions_agents.php');
ui_require_javascript_file('openlayers.pandora');
echo "<div style='margin-bottom: 10px;'></div>";
$agentData = getDataLastPositionAgent($id_agente);
$updateGisData = get_db_value('update_gis_data','tagente', 'id_agente', $id_agente);
$updateGisData = db_get_value('update_gis_data','tagente', 'id_agente', $id_agente);
$agent_name = get_agent_name($id_agente);
/* Map with the current position */

View File

@ -44,13 +44,15 @@ enterprise_include ('godmode/agentes/agent_manager.php');
require_once ('include/functions_servers.php');
require_once ('include/functions_gis.php');
require_once($config['homedir'] . "/include/functions_agents.php");
require_once ($config['homedir'].'/include/functions_users.php');
ui_require_javascript_file('openlayers.pandora');
$new_agent = (bool) get_parameter ('new_agent');
if (! isset ($id_agente) && ! $new_agent) {
pandora_audit("ACL Violation", "Trying to access agent manager witout an agent");
db_pandora_audit("ACL Violation", "Trying to access agent manager witout an agent");
require ("general/noaccess.php");
return;
}
@ -248,7 +250,7 @@ $table->style = array ();
$table->style[0] = 'font-weight: bold; width: 150px;';
$table->data = array ();
$fields = get_db_all_fields_in_table('tagent_custom_fields');
$fields = db_get_all_fields_in_table('tagent_custom_fields');
if($fields === false) $fields = array();
@ -256,7 +258,7 @@ foreach ($fields as $field) {
$data[0] = '<b>'.$field['name'].'</b>';
$custom_value = get_db_value_filter('description', 'tagent_custom_data', array('id_field' => $field['id_field'], 'id_agent' => $id_agente));
$custom_value = db_get_value_filter('description', 'tagent_custom_data', array('id_field' => $field['id_field'], 'id_agent' => $id_agente));
if($custom_value === false) {
$custom_value = '';

View File

@ -20,12 +20,14 @@ if (!isset ($id_agente)) {
die ("Not Authorized");
}
require_once($config['homedir'] . "/include/functions_modules.php");
// ==========================
// TEMPLATE ASSIGMENT LOGIC
// ==========================
if (isset ($_POST["template_id"])) {
// Take agent data
$row = get_db_row ("tagente", "id_agente", $id_agente);
$row = db_get_row ("tagente", "id_agente", $id_agente);
if ($row !== false) {
$intervalo = $row["intervalo"];
$nombre_agente = $row["nombre"];
@ -43,12 +45,12 @@ if (isset ($_POST["template_id"])) {
}
$id_np = get_parameter_post ("template_id");
$npc = get_db_all_rows_field_filter ("tnetwork_profile_component", "id_np", $id_np);
$npc = db_get_all_rows_field_filter ("tnetwork_profile_component", "id_np", $id_np);
if ($npc === false) {
$npc = array ();
}
foreach ($npc as $row) {
$nc = get_db_all_rows_field_filter ("tnetwork_component", "id_nc", $row["id_nc"]);
$nc = db_get_all_rows_field_filter ("tnetwork_component", "id_nc", $row["id_nc"]);
if ($nc === false) {
$nc = array ();
}
@ -75,7 +77,7 @@ if (isset ($_POST["template_id"])) {
'plugin_parameter' => $row2["plugin_parameter"],
'max_timeout' => $row2["max_timeout"],
'id_plugin' => $row2['id_plugin']);
$id_agente_modulo = process_sql_insert('tagente_modulo', $values);
$id_agente_modulo = db_process_sql_insert('tagente_modulo', $values);
// Create with different estado if proc type or data type
if ($id_agente_modulo !== false) {
@ -107,7 +109,7 @@ echo "<h2>".__('Module templates')."</h2>";
echo "<h3>".__('Available templates')."</h3>";
echo '<form method="post" action="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=template&id_agente='.$id_agente.'">';
$nps = get_db_all_fields_in_table ("tnetwork_profile", "name");
$nps = db_get_all_fields_in_table ("tnetwork_profile", "name");
if ($nps === false) {
$nps = array ();
}
@ -136,7 +138,7 @@ echo "<h3>".__('Assigned modules')."</h3>";
$sql = sprintf ("SELECT * FROM tagente_modulo WHERE id_agente = %d AND (delete_pending <> 1 AND delete_pending IS NOT NULL) ORDER BY id_module_group, dbms_lob.substr(nombre,4000,1)", $id_agente);
break;
}
$result = get_db_all_rows_sql ($sql);
$result = db_get_all_rows_sql ($sql);
if ($result === false) {
$result = array ();
}

View File

@ -18,6 +18,7 @@
global $config;
enterprise_include ('godmode/agentes/configurar_agente.php');
include_once($config['homedir'] . "/include/functions_agents.php");
check_login ();
@ -28,7 +29,7 @@ if ($id_agente)
$group = get_agent_group ($id_agente);
if (! check_acl ($config["id_user"], $group, "AW")) {
pandora_audit("ACL Violation",
db_pandora_audit("ACL Violation",
"Trying to access agent manager");
require ("general/noaccess.php");
return;
@ -129,7 +130,7 @@ if ($create_agent) {
$icon_path = (string) get_parameter_post ("icon_path",'');
$update_gis_data = (int) get_parameter_post("update_gis_data", 0);
$fields = get_db_all_fields_in_table('tagent_custom_fields');
$fields = db_get_all_fields_in_table('tagent_custom_fields');
if($fields === false) $fields = array();
@ -149,7 +150,7 @@ if ($create_agent) {
$agent_created_ok = 0;
}
else {
$id_agente = process_sql_insert ('tagente',
$id_agente = db_process_sql_insert ('tagente',
array ('nombre' => $nombre_agente,
'direccion' => $direccion_agente,
'id_grupo' => $grupo, 'intervalo' => $intervalo,
@ -164,7 +165,7 @@ if ($create_agent) {
if ($id_agente !== false) {
// Create custom fields for this agent
foreach($field_values as $key => $value) {
process_sql_insert ('tagent_custom_data',
db_process_sql_insert ('tagent_custom_data',
array('id_field' => $key,'id_agent' => $id_agente, 'description' => $value));
}
// Create address for this agent in taddress
@ -180,7 +181,7 @@ if ($create_agent) {
' Custom ID: ' . $custom_id . ' Cascade protection: ' . $cascade_protection .
' Icon path: ' . $icon_path . ' Update GIS data: ' . $update_gis_data;
pandora_audit("Agent management",
db_pandora_audit("Agent management",
"Created agent $nombre_agente", false, false, $info);
}
else {
@ -362,7 +363,7 @@ if (isset( $_GET["fix_module"])) {
$where = array(
'datos' => '>' . $media,
'id_agente_modulo' => $id_module);
process_sql_delete('tagente_datos', $where);
db_process_sql_delete('tagente_datos', $where);
}
else {
$result = false;
@ -404,7 +405,7 @@ if ($update_agent) { // if modified some agent paramenter
$icon_path = (string) get_parameter_post ("icon_path",'');
$update_gis_data = (int) get_parameter_post("update_gis_data", 0);
$fields = get_db_all_fields_in_table('tagent_custom_fields');
$fields = db_get_all_fields_in_table('tagent_custom_fields');
if($fields === false) $fields = array();
@ -416,15 +417,15 @@ if ($update_agent) { // if modified some agent paramenter
foreach($field_values as $key => $value) {
$old_value = get_db_all_rows_filter('tagent_custom_data', array('id_agent' => $id_agente, 'id_field' => $key));
$old_value = db_get_all_rows_filter('tagent_custom_data', array('id_agent' => $id_agente, 'id_field' => $key));
if($old_value === false) {
// Create custom field if not exist
process_sql_insert ('tagent_custom_data',
db_process_sql_insert ('tagent_custom_data',
array('id_field' => $key,'id_agent' => $id_agente, 'description' => $value));
}
else {
process_sql_update ('tagent_custom_data',
db_process_sql_update ('tagent_custom_data',
array('description' => $value),
array('id_field' => $key,'id_agent' => $id_agente));
}
@ -449,7 +450,7 @@ if ($update_agent) { // if modified some agent paramenter
agent_delete_address ($id_agente, $delete_ip);
}
$result = process_sql_update ('tagente',
$result = db_process_sql_update ('tagente',
array ('disabled' => $disabled,
'id_parent' => $id_parent,
'id_os' => $id_os,
@ -479,7 +480,7 @@ if ($update_agent) { // if modified some agent paramenter
enterprise_hook ('update_agent', array ($id_agente));
ui_print_success_message (__('Successfully updated'));
pandora_audit("Agent management",
db_pandora_audit("Agent management",
"Updated agent $nombre_agente", false, false, $info);
}
@ -492,12 +493,12 @@ if ($id_agente) {
//This has been done in the beginning of the page, but if an agent was created, this id might change
$id_grupo = get_agent_group ($id_agente);
if (check_acl ($config["id_user"], $id_grupo, "AW") != 1) {
pandora_audit("ACL Violation","Trying to admin an agent without access");
db_pandora_audit("ACL Violation","Trying to admin an agent without access");
require ("general/noaccess.php");
exit;
}
$agent = get_db_row ('tagente', 'id_agente', $id_agente);
$agent = db_get_row ('tagente', 'id_agente', $id_agente);
if (empty ($agent)) {
//Close out the page
ui_print_error_message (__('There was a problem loading the agent'));
@ -532,7 +533,7 @@ if ($update_module || $create_module) {
$id_grupo = get_agent_group ($id_agente);
if (! check_acl ($config["id_user"], $id_grupo, "AW")) {
pandora_audit("ACL Violation",
db_pandora_audit("ACL Violation",
"Trying to create a module without admin rights");
require ("general/noaccess.php");
exit;
@ -663,7 +664,7 @@ if ($update_module) {
echo '<h3 class="error">'.__('There was a problem updating module').'</h3>';
$edit_module = true;
pandora_audit("Agent management",
db_pandora_audit("Agent management",
"Fail to try update module '$name' for agent ".$agent["nombre"]);
}
else {
@ -671,9 +672,9 @@ if ($update_module) {
$id_agent_module = false;
$edit_module = false;
$agent = get_db_row ('tagente', 'id_agente', $id_agente);
$agent = db_get_row ('tagente', 'id_agente', $id_agente);
pandora_audit("Agent management",
db_pandora_audit("Agent management",
"Updated module '$name' for agent ".$agent["nombre"], false, false, json_encode($values));
}
}
@ -740,7 +741,7 @@ if ($create_module) {
echo '<h3 class="error">'.__('There was a problem adding module').'</h3>';
$edit_module = true;
$moduletype = $id_module;
pandora_audit("Agent management",
db_pandora_audit("Agent management",
"Fail to try added module '$name' for agent ".$agent["nombre"]);
}
else {
@ -750,8 +751,8 @@ if ($create_module) {
$info = '';
$agent = get_db_row ('tagente', 'id_agente', $id_agente);
pandora_audit("Agent management",
$agent = db_get_row ('tagente', 'id_agente', $id_agente);
db_pandora_audit("Agent management",
"Added module '$name' for agent ".$agent["nombre"], false, false, json_encode($values));
}
}
@ -760,18 +761,18 @@ if ($create_module) {
// =================
if ($delete_module) { // DELETE agent module !
$id_borrar_modulo = (int) get_parameter_get ("delete_module",0);
$module_data = get_db_row ('tagente_modulo', 'id_agente_modulo', $id_borrar_modulo);
$module_data = db_get_row ('tagente_modulo', 'id_agente_modulo', $id_borrar_modulo);
$id_grupo = (int) get_agent_group($id_agente);
if (! check_acl ($config["id_user"], $id_grupo, "AW")) {
pandora_audit("ACL Violation",
db_pandora_audit("ACL Violation",
"Trying to delete a module without admin rights");
require ("general/noaccess.php");
exit;
}
if ($id_borrar_modulo < 1) {
pandora_audit("HACK Attempt",
db_pandora_audit("HACK Attempt",
"Expected variable from form is not correct");
require ("general/noaccess.php");
exit;
@ -782,7 +783,7 @@ if ($delete_module) { // DELETE agent module !
//Init transaction
$error = 0;
process_sql_begin ();
db_process_sql_begin ();
// First delete from tagente_modulo -> if not successful, increment
// error. NOTICE that we don't delete all data here, just marking for deletion
@ -792,15 +793,15 @@ if ($delete_module) { // DELETE agent module !
'nombre' => 'pendingdelete',
'disabled' => 1,
'delete_pending' => 1);
$result = process_sql_update('tagente_modulo', $values, array('id_agente_modulo' => $id_borrar_modulo));
$result = db_process_sql_update('tagente_modulo', $values, array('id_agente_modulo' => $id_borrar_modulo));
if ($result === false)
$error++;
$result = process_sql_delete('tagente_estado', array('id_agente_modulo' => $id_borrar_modulo));
$result = db_process_sql_delete('tagente_estado', array('id_agente_modulo' => $id_borrar_modulo));
if ($result === false)
$error++;
$result = process_sql_delete('tagente_datos_inc', array('id_agente_modulo' => $id_borrar_modulo));
$result = db_process_sql_delete('tagente_datos_inc', array('id_agente_modulo' => $id_borrar_modulo));
if ($result === false)
$error++;
@ -810,15 +811,15 @@ if ($delete_module) { // DELETE agent module !
//Check for errors
if ($error != 0) {
process_sql_rollback ();
db_process_sql_rollback ();
ui_print_error_message (__('There was a problem deleting the module'));
}
else {
process_sql_commit ();
db_process_sql_commit ();
ui_print_success_message (__('Module deleted succesfully'));
$agent = get_db_row ('tagente', 'id_agente', $id_agente);
pandora_audit("Agent management",
$agent = db_get_row ('tagente', 'id_agente', $id_agente);
db_pandora_audit("Agent management",
"Deleted module '".$module_data["nombre"]."' for agent ".$agent["nombre"]);
}
}
@ -831,14 +832,14 @@ if ($duplicate_module) { // DUPLICATE agent module !
get_agentmodule_agent($id_duplicate_module),
__('copy of').' '.get_agentmodule_name($id_duplicate_module));
$agent = get_db_row ('tagente', 'id_agente', $id_agente);
$agent = db_get_row ('tagente', 'id_agente', $id_agente);
if ($result) {
pandora_audit("Agent management",
db_pandora_audit("Agent management",
"Duplicate module '".$id_duplicate_module."' for agent " . $agent["nombre"] . " with the new id for clon " . $result);
}
else {
pandora_audit("Agent management",
db_pandora_audit("Agent management",
"Fail to try duplicate module '".$id_duplicate_module."' for agent " . $agent["nombre"]);
}
}
@ -853,16 +854,16 @@ if ($updateGIS) {
$lastAltitude = get_parameter("altitude");
$idAgente = get_parameter("id_agente");
$previusAgentGISData = get_db_row_sql("SELECT *
$previusAgentGISData = db_get_row_sql("SELECT *
FROM tgis_data_status WHERE tagente_id_agente = " . $idAgente);
process_sql_begin();
db_process_sql_begin();
process_sql_update('tagente', array('update_gis_data' => $updateGisData),
db_process_sql_update('tagente', array('update_gis_data' => $updateGisData),
array('id_agente' => $idAgente));
if ($previusAgentGISData !== false) {
process_sql_insert('tgis_data_history', array(
db_process_sql_insert('tgis_data_history', array(
"longitude" => $previusAgentGISData['stored_longitude'],
"latitude" => $previusAgentGISData['stored_latitude'],
"altitude" => $previusAgentGISData['stored_altitude'],
@ -873,7 +874,7 @@ if ($updateGIS) {
"number_of_packages" => $previusAgentGISData['number_of_packages'],
"tagente_id_agente" => $previusAgentGISData['tagente_id_agente']
));
process_sql_update('tgis_data_status', array(
db_process_sql_update('tgis_data_status', array(
"tagente_id_agente" => $idAgente,
"current_longitude" => $lastLongitude,
"current_latitude" => $lastLatitude,
@ -887,7 +888,7 @@ if ($updateGIS) {
array("tagente_id_agente" => $idAgente));
}
else {
process_sql_insert('tgis_data_status', array(
db_process_sql_insert('tgis_data_status', array(
"tagente_id_agente" => $idAgente,
"current_longitude" => $lastLongitude,
"current_latitude" => $lastLatitude,
@ -899,7 +900,7 @@ if ($updateGIS) {
"description" => "Insert by Pandora Console"
));
}
process_sql_commit();
db_process_sql_commit();
}
// -----------------------------------

View File

@ -19,7 +19,7 @@ global $config;
check_login ();
if (! check_acl ($config['id_user'], 0, "PM")) {
pandora_audit("ACL Violation", "Trying to access Group Management2");
db_pandora_audit("ACL Violation", "Trying to access Group Management2");
require ("general/noaccess.php");
return;
}
@ -30,7 +30,7 @@ $display_on_front = (bool) get_parameter ('display_on_front', 0);
// Header
if ($id_field) {
$field = get_db_row_filter('tagent_custom_fields',array('id_field' => $id_field));
$field = db_get_row_filter('tagent_custom_fields',array('id_field' => $id_field));
$name = $field['name'];
$display_on_front = $field['display_on_front'];
ui_print_page_header (__("Update agent custom field"), "images/note.png", false, "", true, "");

View File

@ -20,7 +20,7 @@ global $config;
check_login();
if (!check_acl($config['id_user'], 0, "PM")) {
pandora_audit("ACL Violation",
db_pandora_audit("ACL Violation",
"Trying to access Group Management");
require ("general/noaccess.php");
@ -41,7 +41,7 @@ $display_on_front = (int) get_parameter ('display_on_front', 0);
if ($create_field) {
/*Check if name field is empty*/
if ($name != "") {
$result = process_sql_insert('tagent_custom_fields', array('name' => $name, 'display_on_front' => $display_on_front));
$result = db_process_sql_insert('tagent_custom_fields', array('name' => $name, 'display_on_front' => $display_on_front));
}
else {
$result = false;
@ -61,7 +61,7 @@ if ($update_field) {
if( $name != "") {
$values = array('name' => $name, 'display_on_front' => $display_on_front);
$result = process_sql_update('tagent_custom_fields', $values, array('id_field' => $id_field));
$result = db_process_sql_update('tagent_custom_fields', $values, array('id_field' => $id_field));
}
else {
$result = false;
@ -77,7 +77,7 @@ if ($update_field) {
/* Delete field */
if ($delete_field) {
$result = process_sql_delete('tagent_custom_fields', array('id_field' => $id_field));
$result = db_process_sql_delete('tagent_custom_fields', array('id_field' => $id_field));
if (!$result)
echo "<h3 class='error'>".__('There was a problem deleting field')."</h3>";
@ -85,7 +85,7 @@ if ($delete_field) {
echo "<h3 class='suc'>".__('Field successfully deleted')."</h3>";
}
$fields = get_db_all_fields_in_table('tagent_custom_fields');
$fields = db_get_all_fields_in_table('tagent_custom_fields');
$table->width = '65%';
if ($fields) {

View File

@ -24,12 +24,15 @@ $update_agent = get_parameter ("update_agent", -1);
$update_group = get_parameter ("update_group", -1);
if (! check_acl ($config['id_user'], 0, "AW")) {
pandora_audit("ACL Violation",
db_pandora_audit("ACL Violation",
"Trying to access remote config copy tool");
require ("general/noaccess.php");
exit;
}
require_once ($config['homedir'].'/include/functions_agents.php');
require_once ($config['homedir'].'/include/functions_users.php');
// Operations
if ((isset($_GET["operacion"])) AND ($update_group == -1) ) {
@ -55,7 +58,7 @@ if ((isset($_GET["operacion"])) AND ($update_group == -1) ) {
// Security check here
if (!user_access_to_agent ($id_origen)) {
pandora_audit("ACL Violation", "Trying to forge a source agent in remote config tool");
db_pandora_audit("ACL Violation", "Trying to forge a source agent in remote config tool");
require ("general/noaccess.php");
exit;
}
@ -69,7 +72,7 @@ if ((isset($_GET["operacion"])) AND ($update_group == -1) ) {
// Security check here
if (!user_access_to_agent ($id_agente)){
pandora_audit("ACL Violation", "Trying to forge a source agent in remote config tool");
db_pandora_audit("ACL Violation", "Trying to forge a source agent in remote config tool");
require ("general/noaccess.php");
exit;
}
@ -121,7 +124,7 @@ if ((isset($_GET["operacion"])) AND ($update_group == -1) ) {
$sql1 = "SELECT * FROM tagente WHERE id_grupo IN ($grouplist) ORDER BY nombre";
echo '<select name="origen" style="width:200px">';
$rows = get_db_all_rows_sql($sql1);
$rows = db_get_all_rows_sql($sql1);
if ($rows === false) {
$rows = array();
@ -147,7 +150,7 @@ if ((isset($_GET["operacion"])) AND ($update_group == -1) ) {
else
$sql1 = "SELECT * FROM tagente WHERE id_grupo IN ($grouplist) ORDER BY nombre";
$rows = get_db_all_rows_sql($sql1);
$rows = db_get_all_rows_sql($sql1);
if ($rows === false) {
$rows = array();

View File

@ -30,13 +30,15 @@ if (($ag_group == -1) && ($group_id != 0))
$ag_group = $group_id;
if (! check_acl ($config["id_user"], 0, "AW")) {
pandora_audit("ACL Violation",
db_pandora_audit("ACL Violation",
"Trying to access agent manager");
require ("general/noaccess.php");
exit;
}
enterprise_include_once('include/functions_policies.php');
require_once ('include/functions_agents.php');
require_once ('include/functions_users.php');
$search = get_parameter ("search", "");
@ -49,11 +51,11 @@ if (!empty($agent_to_delete)) {
if (check_acl ($config["id_user"], $id_grupo, "AW")==1) {
$id_agentes[0] = $id_agente;
delete_agent($id_agentes);
pandora_audit("Agent management", "Delete Agent " . $agent_name);
db_pandora_audit("Agent management", "Delete Agent " . $agent_name);
}
else {
// NO permissions.
pandora_audit("ACL Violation",
db_pandora_audit("ACL Violation",
"Trying to delete agent \'$agent_name\'");
require ("general/noaccess.php");
exit;
@ -180,7 +182,7 @@ if ($ag_group > 0) {
WHERE id_grupo = %d
%s',
$ag_group, $search_sql);
$total_agents = get_db_sql ($sql);
$total_agents = db_get_sql ($sql);
switch ($config["dbtype"]) {
case "mysql":
@ -218,7 +220,7 @@ else {
// Admin user get ANY group, even if they doesnt exist
if (check_acl ($config['id_user'], 0, "PM")){
$sql = sprintf ('SELECT COUNT(*) FROM tagente WHERE 1=1 %s', $search_sql);
$total_agents = get_db_sql ($sql);
$total_agents = db_get_sql ($sql);
switch ($config["dbtype"]) {
case "mysql":
$sql = sprintf ('SELECT *
@ -249,7 +251,7 @@ else {
%s',
implode (',', array_keys (get_user_groups ())),
$search_sql);
$total_agents = get_db_sql ($sql);
$total_agents = db_get_sql ($sql);
switch ($config["dbtype"]) {
case "mysql":
@ -287,7 +289,7 @@ else {
}
}
$agents = get_db_all_rows_sql ($sql);
$agents = db_get_all_rows_sql ($sql);
// Delete rnum row generated by oracle_recode_query() function
if (($config['dbtype'] == 'oracle') && ($agents !== false)) {

View File

@ -21,6 +21,9 @@ if (isset ($id_agente)) {
enterprise_include ('godmode/agentes/module_manager.php');
$isFunctionPolicies = enterprise_include_once ('include/functions_policies.php');
require_once ('include/functions_modules.php');
require_once ('include/functions_agents.php');
require_once ('include/functions_servers.php');
// Create module/type combo
echo '<table width="300" cellpadding="4" cellspacing="4" class="databox">';
@ -30,10 +33,10 @@ echo "<tr><td class='datos'>";
// Check if there is at least one server of each type available to assign that
// kind of modules. If not, do not show server type in combo
$network_available = get_db_sql ("SELECT count(*) from tserver where server_type = 1"); //POSTGRESQL AND ORACLE COMPATIBLE
$wmi_available = get_db_sql ("SELECT count(*) from tserver where server_type = 6"); //POSTGRESQL AND ORACLE COMPATIBLE
$plugin_available = get_db_sql ("SELECT count(*) from tserver where server_type = 4"); //POSTGRESQL AND ORACLE COMPATIBLE
$prediction_available = get_db_sql ("SELECT count(*) from tserver where server_type = 5"); //POSTGRESQL AND ORACLE COMPATIBLE
$network_available = db_get_sql ("SELECT count(*) from tserver where server_type = 1"); //POSTGRESQL AND ORACLE COMPATIBLE
$wmi_available = db_get_sql ("SELECT count(*) from tserver where server_type = 6"); //POSTGRESQL AND ORACLE COMPATIBLE
$plugin_available = db_get_sql ("SELECT count(*) from tserver where server_type = 4"); //POSTGRESQL AND ORACLE COMPATIBLE
$prediction_available = db_get_sql ("SELECT count(*) from tserver where server_type = 5"); //POSTGRESQL AND ORACLE COMPATIBLE
// Development mode to use all servers
if ($develop_bypass) {
@ -84,14 +87,14 @@ if ($multiple_delete) {
$id_grupo = (int) get_agent_group($id_agente);
if (! check_acl ($config["id_user"], $id_grupo, "AW")) {
pandora_audit("ACL Violation",
db_pandora_audit("ACL Violation",
"Trying to delete a module without admin rights");
require ("general/noaccess.php");
exit;
}
if ($id_agent_module_del < 1) {
pandora_audit("HACK Attempt",
db_pandora_audit("HACK Attempt",
"Expected variable from form is not correct");
die ("Nice try buddy");
exit;
@ -102,32 +105,32 @@ if ($multiple_delete) {
//Init transaction
$error = 0;
process_sql_begin ();
db_process_sql_begin ();
// First delete from tagente_modulo -> if not successful, increment
// error. NOTICE that we don't delete all data here, just marking for deletion
// and delete some simple data.
$status = '';
if (process_sql("UPDATE tagente_modulo
if (db_process_sql("UPDATE tagente_modulo
SET nombre = 'pendingdelete', disabled = 1, delete_pending = 1 WHERE id_agente_modulo = ".$id_agent_module_del, "affected_rows", '', true, $status, false) === false)
$error++;
switch ($config["dbtype"]) {
case "mysql":
case "postgresql":
$result = process_sql_delete('tagente_estado', array('id_agente_modulo' => $id_agent_module_del));
$result = db_process_sql_delete('tagente_estado', array('id_agente_modulo' => $id_agent_module_del));
if ($result === false)
$error++;
$result = process_sql_delete('tagente_datos_inc', array('id_agente_modulo' => $id_agent_module_del));
$result = db_process_sql_delete('tagente_datos_inc', array('id_agente_modulo' => $id_agent_module_del));
if ($result === false)
$error++;
break;
case "oracle":
$result = temp_sql_delete('tagente_estado', 'id_agente_modulo', $id_agent_module_del);
$result = db_process_delete_temp('tagente_estado', 'id_agente_modulo', $id_agent_module_del);
if ($result === false)
$error++;
$result = temp_sql_delete('tagente_datos_inc', 'id_agente_modulo', $id_agent_module_del);
$result = db_process_delete_temp('tagente_datos_inc', 'id_agente_modulo', $id_agent_module_del);
if ($result === false)
$error++;
break;
@ -135,11 +138,11 @@ if ($multiple_delete) {
}
//Check for errors
if ($error != 0) {
process_sql_rollback ();
db_process_sql_rollback ();
ui_print_error_message (__('There was a problem deleting the module'));
}
else {
process_sql_commit ();
db_process_sql_commit ();
ui_print_success_message (__('Module deleted succesfully'));
}
}
@ -253,7 +256,7 @@ switch ($sortField) {
break;
}
$modules = get_db_all_rows_filter ('tagente_modulo',
$modules = db_get_all_rows_filter ('tagente_modulo',
array ('delete_pending' => 0,
'id_agente' => $id_agente,
'order' => $order),
@ -300,7 +303,7 @@ $agent_interval = get_agent_interval ($id_agente);
$last_modulegroup = "0";
//Extract the ids only numeric modules for after show the normalize link.
$tempRows = get_db_all_rows_sql("SELECT *
$tempRows = db_get_all_rows_sql("SELECT *
FROM ttipo_modulo
WHERE nombre NOT LIKE '%string%' AND nombre NOT LIKE '%proc%'");
$numericModules = array();
@ -386,7 +389,7 @@ foreach ($modules as $module) {
}
// This module is initialized ? (has real data)
$module_init = get_db_value ('utimestamp', 'tagente_estado', 'id_agente_modulo', $module['id_agente_modulo']);
$module_init = db_get_value ('utimestamp', 'tagente_estado', 'id_agente_modulo', $module['id_agente_modulo']);
if ($module_init == 0)
$data[2] .= print_image ('images/error.png', true, array ('title' => __('Non initialized module')));

View File

@ -27,7 +27,7 @@ if (is_ajax ()) {
if ($get_module_component) {
$id_component = (int) get_parameter ('id_module_component');
$component = get_db_row ('tnetwork_component', 'id_nc', $id_component);
$component = db_get_row ('tnetwork_component', 'id_nc', $id_component);
echo json_encode ($component);
return;
@ -60,7 +60,7 @@ if (is_ajax ()) {
if ($get_module_local_component) {
$id_component = (int) get_parameter ('id_module_component');
$component = get_db_row ('tlocal_component', 'id', $id_component);
$component = db_get_row ('tlocal_component', 'id', $id_component);
foreach ($component as $index => $element) {
$component[$index] = html_entity_decode($element, ENT_QUOTES, "UTF-8");
}
@ -69,11 +69,11 @@ if (is_ajax ()) {
switch ($config["dbtype"]) {
case "mysql":
$component['type'] = get_db_value_sql('SELECT id_tipo FROM ttipo_modulo WHERE nombre LIKE "' . $typeName . '"');
$component['type'] = db_get_value_sql('SELECT id_tipo FROM ttipo_modulo WHERE nombre LIKE "' . $typeName . '"');
break;
case "postgresql":
case "oracle":
$component['type'] = get_db_value_sql('SELECT id_tipo FROM ttipo_modulo WHERE nombre LIKE \'' . $typeName . '\'');
$component['type'] = db_get_value_sql('SELECT id_tipo FROM ttipo_modulo WHERE nombre LIKE \'' . $typeName . '\'');
break;
}
@ -115,6 +115,8 @@ if (is_ajax ()) {
}
require_once ("include/functions_exportserver.php");
require_once($config['homedir'] . "/include/functions_modules.php");
require_once($config['homedir'] . "/include/functions_agents.php");
// Using network component to fill some fields
if ($id_agent_module) {
@ -230,14 +232,14 @@ if($relink_policy) {
$result = relink_module_policy($id_agent_module);
ui_print_result_message($result, 'Module relinked to the policy successful');
pandora_audit("Agent management", "Re-link module " . $id_agent_module);
db_pandora_audit("Agent management", "Re-link module " . $id_agent_module);
}
if($unlink_policy) {
$result = unlink_module_policy($id_agent_module);
ui_print_result_message($result, 'Module unlinked from the policy successful');
pandora_audit("Agent management", "Unlink module " . $id_agent_module);
db_pandora_audit("Agent management", "Unlink module " . $id_agent_module);
}
switch ($moduletype) {

View File

@ -14,6 +14,8 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
include_once("include/functions_modules.php");
function prepend_table_simple ($row, $id = false) {
global $table_simple;

View File

@ -14,6 +14,7 @@
// GNU General Public License for more details.
enterprise_include_once('include/functions_policies.php');
enterprise_include_once('godmode/agentes/module_manager_editor_prediction.php');
require_once ('include/functions_agents.php');
$disabledBecauseInPolicy = false;
$disabledTextBecauseInPolicy = '';
@ -22,7 +23,7 @@ $id_agente = get_parameter('id_agente', '');
$agent_name = get_parameter('agent_name', get_agent_name($id_agente));
$id_agente_modulo= get_parameter('id_agent_module',0);
$sql = 'SELECT * FROM tagente_modulo WHERE id_agente_modulo = '.$id_agente_modulo;
$row = get_db_row_sql($sql);
$row = db_get_row_sql($sql);
$is_service = false;
if ($row !== false && is_array($row)) {
$prediction_module = $row['prediction_module'];

View File

@ -19,12 +19,14 @@ global $config;
check_login();
if (! check_acl ($config['id_user'], 0, "AW")) {
pandora_audit("ACL Violation",
db_pandora_audit("ACL Violation",
"Trying to access downtime scheduler");
require ("general/noaccess.php");
return;
}
require_once ('include/functions_users.php');
//Initialize data
$id_agent = get_parameter ("id_agent");
$id_group = (int) get_parameter ("id_group", 0);
@ -61,7 +63,7 @@ if ($insert_downtime_agent == 1){
$values = array(
'id_downtime' => $id_downtime,
'id_agent' => $id_agente_dt);
$result = process_sql_insert('tplanned_downtime_agents', $values);
$result = db_process_sql_insert('tplanned_downtime_agents', $values);
}
}
@ -70,14 +72,14 @@ if ($delete_downtime_agent == 1){
$id_da = get_parameter ("id_downtime_agent");
$result = process_sql_delete('tplanned_downtime_agents', array('id' => $id_da));
$result = db_process_sql_delete('tplanned_downtime_agents', array('id' => $id_da));
}
// DELETE WHOLE DOWNTIME!
if ($delete_downtime) {
$result = process_sql_delete('tplanned_downtime', array('id' => $id_downtime));
$result = db_process_sql_delete('tplanned_downtime', array('id' => $id_downtime));
$result2 = process_sql_delete('tplanned_downtime_agents', array('id' => $id_downtime));
$result2 = db_process_sql_delete('tplanned_downtime_agents', array('id' => $id_downtime));
if (($result === false) OR ($result2 === false)){
echo '<h3 class="error">'.__('Not deleted. Error deleting data').'</h3>';
@ -107,7 +109,7 @@ if ($create_downtime || $update_downtime) {
'date_from' => $datetime_from,
'date_to' => $datetime_to,
'id_group' => $id_group);
$result = process_sql_insert('tplanned_downtime', $values);
$result = db_process_sql_insert('tplanned_downtime', $values);
}
else if ($update_downtime) {
$values = array(
@ -116,7 +118,7 @@ if ($create_downtime || $update_downtime) {
'date_from' => $datetime_from,
'date_to' => $datetime_to,
'id_group' => $id_group);
$result = process_sql_update('tplanned_downtime', $values, array('id' => $id_downtime));
$result = db_process_sql_update('tplanned_downtime', $values, array('id' => $id_downtime));
}
if ($result === false) {
@ -151,7 +153,7 @@ if ($create_downtime || $update_downtime) {
break;
}
$result = get_db_row_sql ($sql);
$result = db_get_row_sql ($sql);
$name = $result["name"];
$description = $result["description"];
$date_from = strftime ('%Y-%m-%d', $result["date_from"]);
@ -225,7 +227,7 @@ if ($create_downtime || $update_downtime) {
AND tplanned_downtime_agents.id_downtime = %d
) AND disabled = 0 $filter_cond
ORDER by tagente.nombre", $id_downtime);
$downtimes = get_db_all_rows_sql ($sql);
$downtimes = db_get_all_rows_sql ($sql);
$data = array ();
if ($downtimes)
foreach ($downtimes as $downtime) {
@ -259,7 +261,7 @@ if ($create_downtime || $update_downtime) {
WHERE tplanned_downtime_agents.id_agent = tagente.id_agente
AND tplanned_downtime_agents.id_downtime = %d ",$id_downtime);
$downtimes = get_db_all_rows_sql ($sql);
$downtimes = db_get_all_rows_sql ($sql);
if ($downtimes === false) {
echo '<div class="nf">'. __('There are no scheduled downtimes').'</div>';
}
@ -280,7 +282,7 @@ if ($create_downtime || $update_downtime) {
$data[0] = $downtime['nombre'];
$data[1] = get_db_sql ("SELECT nombre FROM tgrupo WHERE id_grupo = ". $downtime["id_grupo"]);
$data[1] = db_get_sql ("SELECT nombre FROM tgrupo WHERE id_grupo = ". $downtime["id_grupo"]);
$data[2] = ui_print_os_icon ($downtime["id_os"], true, true);
@ -319,7 +321,7 @@ else {
$table->align[7] = "center";
$sql = "SELECT * FROM tplanned_downtime WHERE id_group IN (" . implode (",", array_keys ($groups)) . ")";
$downtimes = get_db_all_rows_sql ($sql);
$downtimes = db_get_all_rows_sql ($sql);
if (!$downtimes) {
echo '<div class="nf">'.__('No planned downtime').'</div>';
}
@ -327,7 +329,7 @@ else {
echo '<h3>'.__('Planned Downtime present on system').':</h3>';
foreach ($downtimes as $downtime) {
$data = array();
$total = get_db_sql ("SELECT COUNT(id_agent) FROM tplanned_downtime_agents WHERE id_downtime = ".$downtime["id"]);
$total = db_get_sql ("SELECT COUNT(id_agent) FROM tplanned_downtime_agents WHERE id_downtime = ".$downtime["id"]);
$data[0] = $downtime['name']. " ($total)";
$data[1] = $downtime['description'];

View File

@ -17,11 +17,13 @@
global $config;
require_once ("include/functions_alerts.php");
require_once ('include/functions_users.php');
require_once ('include/functions_groups.php');
check_login ();
if (! check_acl ($config['id_user'], 0, "LM")) {
pandora_audit("ACL Violation",
db_pandora_audit("ACL Violation",
"Trying to access Alert actions");
require ("general/noaccess.php");
exit;
@ -58,7 +60,7 @@ if ($copy_action) {
if ($al_action['id_group'] == 0){
// then must have "PM" access privileges
if (! check_acl ($config['id_user'], 0, "PM")) {
pandora_audit("ACL Violation",
db_pandora_audit("ACL Violation",
"Trying to access Alert Management");
require ("general/noaccess.php");
exit;
@ -78,7 +80,7 @@ if ($copy_action) {
// Header
ui_print_page_header (__('Alerts').' &raquo; '.__('Alert actions'), "images/god2.png", false, "", true);
else{
pandora_audit("ACL Violation",
db_pandora_audit("ACL Violation",
"Trying to access Alert Management");
require ("general/noaccess.php");
exit;
@ -92,10 +94,10 @@ if ($copy_action) {
$result = alerts_clone_alert_action ($id);
if ($result) {
pandora_audit("Command management", "Duplicate alert action " . $id . " clone to " . $result);
db_pandora_audit("Command management", "Duplicate alert action " . $id . " clone to " . $result);
}
else {
pandora_audit("Command management", "Fail try to duplicate alert action " . $id);
db_pandora_audit("Command management", "Fail try to duplicate alert action " . $id);
}
ui_print_result_message ($result,
@ -124,10 +126,10 @@ if ($create_action) {
' Action threshold: ' . $action_threshold;
if ($result) {
pandora_audit("Command management", "Create alert action " . $result, false, false, $info);
db_pandora_audit("Command management", "Create alert action " . $result, false, false, $info);
}
else {
pandora_audit("Command management", "Fail try to create alert action", false, false, $info);
db_pandora_audit("Command management", "Fail try to create alert action", false, false, $info);
}
ui_print_result_message ($result,
@ -143,7 +145,7 @@ if ($update_action) {
if ($al_action !== false){
if ($al_action['id_group'] == 0){
if (! check_acl ($config['id_user'], 0, "PM")) {
pandora_audit("ACL Violation",
db_pandora_audit("ACL Violation",
"Trying to access Alert Management");
require ("general/noaccess.php");
exit;
@ -180,10 +182,10 @@ if ($update_action) {
' Action threshold: ' . $action_threshold;
if ($result) {
pandora_audit("Command management", "Update alert action " . $id, false, false, json_encode($values));
db_pandora_audit("Command management", "Update alert action " . $id, false, false, json_encode($values));
}
else {
pandora_audit("Command management", "Fail try to update alert action " . $id, false, false, json_encode($values));
db_pandora_audit("Command management", "Fail try to update alert action " . $id, false, false, json_encode($values));
}
ui_print_result_message ($result,
@ -201,7 +203,7 @@ if ($delete_action) {
if ($al_action['id_group'] == 0){
// then must have "PM" access privileges
if (! check_acl ($config['id_user'], 0, "PM")) {
pandora_audit("ACL Violation",
db_pandora_audit("ACL Violation",
"Trying to access Alert Management");
require ("general/noaccess.php");
exit;
@ -222,7 +224,7 @@ if ($delete_action) {
// Header
ui_print_page_header (__('Alerts').' &raquo; '.__('Alert actions'), "images/god2.png", false, "", true);
else{
pandora_audit("ACL Violation",
db_pandora_audit("ACL Violation",
"Trying to access Alert Management");
require ("general/noaccess.php");
exit;
@ -237,10 +239,10 @@ if ($delete_action) {
$result = alerts_delete_alert_action ($id);
if ($result) {
pandora_audit("Command management", "Delete alert action " . $id);
db_pandora_audit("Command management", "Delete alert action " . $id);
}
else {
pandora_audit("Command management", "Fail try to delete alert action " . $id);
db_pandora_audit("Command management", "Fail try to delete alert action " . $id);
}
ui_print_result_message ($result,
@ -264,7 +266,7 @@ $table->align = array ();
$table->align[2] = 'center';
$table->align[3] = 'center';
$actions = get_db_all_rows_in_table ('talert_actions');
$actions = db_get_all_rows_in_table ('talert_actions');
if ($actions === false)
$actions = array ();

View File

@ -22,7 +22,7 @@ require_once ("include/functions_alerts.php");
check_login ();
if (! check_acl ($config['id_user'], 0, "LM")) {
pandora_audit("ACL Violation",
db_pandora_audit("ACL Violation",
"Trying to access Alert Management");
require ("general/noaccess.php");
exit;
@ -56,10 +56,10 @@ if ($create_command) {
$info = 'Name: ' . $name . ' Command: ' . $command . ' Description: ' . $description;
if ($result) {
pandora_audit("Command management", "Create alert command " . $result, false, false, $info);
db_pandora_audit("Command management", "Create alert command " . $result, false, false, $info);
}
else {
pandora_audit("Command management", "Fail try to create alert command", false, false, $info);
db_pandora_audit("Command management", "Fail try to create alert command", false, false, $info);
}
ui_print_result_message ($result,
@ -71,7 +71,7 @@ if ($update_command) {
$id = (int) get_parameter ('id');
$alert = alerts_get_alert_command ($id);
if ($alert['internal']) {
pandora_audit("ACL Violation", "Trying to access Alert Management");
db_pandora_audit("ACL Violation", "Trying to access Alert Management");
require ("general/noaccess.php");
exit;
}
@ -87,10 +87,10 @@ if ($update_command) {
$info = 'Name: ' . $name . ' Command: ' . $command . ' Description: ' . $description;
if ($result) {
pandora_audit("Command management", "Create alert command " . $id, false, false, $info);
db_pandora_audit("Command management", "Create alert command " . $id, false, false, $info);
}
else {
pandora_audit("Command management", "Fail to create alert command " . $id, false, false, $info);
db_pandora_audit("Command management", "Fail to create alert command " . $id, false, false, $info);
}
ui_print_result_message ($result,
@ -103,7 +103,7 @@ if ($delete_command) {
// Internal commands cannot be deleted
if (alerts_get_alert_command_internal ($id)) {
pandora_audit("ACL Violation",
db_pandora_audit("ACL Violation",
"Trying to access Alert Management");
require ("general/noaccess.php");
return;
@ -112,10 +112,10 @@ if ($delete_command) {
$result = alerts_delete_alert_command ($id);
if ($result) {
pandora_audit("Command management", "Delete alert command " . $id);
db_pandora_audit("Command management", "Delete alert command " . $id);
}
else {
pandora_audit("Command management", "Fail to delete alert command " . $id);
db_pandora_audit("Command management", "Fail to delete alert command " . $id);
}
ui_print_result_message ($result,
@ -136,7 +136,7 @@ $table->size[2] = '40px';
$table->align = array ();
$table->align[2] = 'center';
$commands = get_db_all_rows_in_table ('talert_commands');
$commands = db_get_all_rows_in_table ('talert_commands');
if ($commands === false)
$commands = array ();

View File

@ -13,16 +13,20 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
global $config;
check_login ();
if (! check_acl ($config['id_user'], 0, "LM")) {
pandora_audit("ACL Violation",
db_pandora_audit("ACL Violation",
"Trying to access Alert Management");
require ("general/noaccess.php");
exit;
}
require_once ('include/functions_alerts.php');
require_once($config['homedir'] . "/include/functions_agents.php");
require_once($config['homedir'] . '/include/functions_users.php');
$id_group = (int) get_parameter ('id_group');
$id_agent = (int) get_parameter ('id_agent');
@ -155,7 +159,7 @@ if (count($agents) > 0) {
$sql = sprintf ('SELECT COUNT(*) FROM talert_compound
WHERE id_agent in (%s)%s',
implode (',', array_keys ($agents)), $where);
$total = (int) get_db_sql ($sql);
$total = (int) db_get_sql ($sql);
}
ui_pagination ($total, $url);
@ -196,7 +200,7 @@ if (count($agents)) {
$sql = oracle_recode_query($sql, $set);
break;
}
$id_alerts = get_db_all_rows_sql ($sql);
$id_alerts = db_get_all_rows_sql ($sql);
if (($config["dbtype"] == 'oracle') && ($id_alerts !== false)) {
for ($i=0; $i < count($id_alerts); $i++) {

View File

@ -19,12 +19,15 @@ global $config;
check_login ();
if (! check_acl ($config['id_user'], 0, "LW")) {
pandora_audit("ACL Violation",
db_pandora_audit("ACL Violation",
"Trying to access Alert Management");
require ("general/noaccess.php");
exit;
}
include_once($config['homedir'] . "/include/functions_agents.php");
include_once($config['homedir'] . '/include/functions_users.php');
$table->id = 'add_alert_table';
$table->class = 'databox';
$table->width = '95%';

View File

@ -19,7 +19,7 @@ global $config;
check_login ();
if (! check_acl ($config['id_user'], 0, "LW")) {
pandora_audit("ACL Violation",
db_pandora_audit("ACL Violation",
"Trying to access Alert Management");
require ("general/noaccess.php");
exit;
@ -28,12 +28,16 @@ if (! check_acl ($config['id_user'], 0, "LW")) {
/* Check if this page is included from a agent edition */
if (! check_acl ($config['id_user'], 0, "LW")) {
pandora_audit("ACL Violation",
db_pandora_audit("ACL Violation",
"Trying to access Alert Management");
require ("general/noaccess.php");
exit;
}
require_once ($config['homedir'].'/include/functions_agents.php');
require_once ($config['homedir'].'/include/functions_modules.php');
require_once ($config['homedir'].'/include/functions_users.php');
// Table for filter controls
$form_filter = '<form method="post" action="index.php?sec=galertas&amp;sec2=godmode/alerts/alert_list&amp;refr='.$config["refr"].'&amp;pure='.$config["pure"].'">';
$form_filter .= "<input type='hidden' name='search' value='1' />\n";
@ -68,10 +72,10 @@ $form_filter .= "<tr>\n";
switch ($config["dbtype"]) {
case "mysql":
case "postgresql":
$temp = get_db_all_rows_sql("SELECT id, name FROM talert_actions;");
$temp = db_get_all_rows_sql("SELECT id, name FROM talert_actions;");
break;
case "oracle":
$temp = get_db_all_rows_sql("SELECT id, name FROM talert_actions");
$temp = db_get_all_rows_sql("SELECT id, name FROM talert_actions");
break;
}
@ -444,9 +448,9 @@ foreach ($simple_alerts as $alert) {
$data[6] = '';
if (empty($actions)){
// Get and show default actions for this alert
$default_action = get_db_sql ("SELECT id_alert_action FROM talert_templates WHERE id = ".$alert["id_alert_template"]);
$default_action = db_get_sql ("SELECT id_alert_action FROM talert_templates WHERE id = ".$alert["id_alert_template"]);
if ($default_action != ""){
$data[6] = __("Default"). " : ".get_db_sql ("SELECT name FROM talert_actions WHERE id = $default_action");
$data[6] = __("Default"). " : ".db_get_sql ("SELECT name FROM talert_actions WHERE id = $default_action");
}
}

View File

@ -19,7 +19,7 @@ global $config;
check_login ();
if (! check_acl ($config['id_user'], 0, "LW")) {
pandora_audit("ACL Violation",
db_pandora_audit("ACL Violation",
"Trying to access Alert Management");
require ("general/noaccess.php");
exit;
@ -27,6 +27,7 @@ if (! check_acl ($config['id_user'], 0, "LW")) {
require_once ('include/functions_agents.php');
require_once ('include/functions_alerts.php');
require_once ('include/functions_users.php');
$isFunctionPolicies = enterprise_include ('include/functions_policies.php');
$id_group = 0;
@ -66,7 +67,7 @@ if ($create_alert) {
$id_alert_template = (int) get_parameter ('template');
$id_agent_module = (int) get_parameter ('id_agent_module');
if (get_db_value_sql("SELECT COUNT(id)
if (db_get_value_sql("SELECT COUNT(id)
FROM talert_template_modules
WHERE id_agent_module = " . $id_agent_module . "
AND id_alert_template = " . $id_alert_template) > 0) {
@ -75,17 +76,17 @@ if ($create_alert) {
else {
$id = alerts_create_alert_agent_module ($id_agent_module, $id_alert_template);
$alert_template_name = get_db_value ("name", "talert_templates","id", $id_alert_template);
$module_name = get_db_value ("nombre", "tagente_modulo","id_agente_modulo", $id_agent_module);
$agent_name = get_agent_name (get_db_value ("id_agente", "tagente_modulo","id_agente_modulo", $id_agent_module));
$alert_template_name = db_get_value ("name", "talert_templates","id", $id_alert_template);
$module_name = db_get_value ("nombre", "tagente_modulo","id_agente_modulo", $id_agent_module);
$agent_name = get_agent_name (db_get_value ("id_agente", "tagente_modulo","id_agente_modulo", $id_agent_module));
// Audit the creation only when the alert creation is correct
if($id) {
pandora_audit("Alert management",
db_pandora_audit("Alert management",
"Added alert '$alert_template_name' for module '$module_name' in agent '$agent_name'", false, false, 'ID: ' . $id);
}
else {
pandora_audit("Alert management",
db_pandora_audit("Alert management",
"Fail Added alert '$alert_template_name' for module '$module_name' in agent '$agent_name'");
}
@ -108,21 +109,21 @@ if ($create_alert) {
if ($delete_alert) {
$id_alert_agent_module = (int) get_parameter ('id_alert');
$temp = get_db_row ("talert_template_modules","id", $id_alert_agent_module);
$temp = db_get_row ("talert_template_modules","id", $id_alert_agent_module);
$id_alert_template = $temp["id_alert_template"];
$id_agent_module = $temp["id_agent_module"];
$alert_template_name = get_db_value ("name", "talert_templates","id", $id_alert_template);
$module_name = get_db_value ("nombre", "tagente_modulo","id_agente_modulo", $id_agent_module);
$agent_name = get_agent_name (get_db_value ("id_agente", "tagente_modulo","id_agente_modulo", $id_agent_module));
$alert_template_name = db_get_value ("name", "talert_templates","id", $id_alert_template);
$module_name = db_get_value ("nombre", "tagente_modulo","id_agente_modulo", $id_agent_module);
$agent_name = get_agent_name (db_get_value ("id_agente", "tagente_modulo","id_agente_modulo", $id_agent_module));
$result = alerts_delete_alert_agent_module ($id_alert_agent_module);
if ($result) {
pandora_audit("Alert management",
db_pandora_audit("Alert management",
"Deleted alert '$alert_template_name' for module '$module_name' in agent '$agent_name'");
}
else {
pandora_audit("Alert management",
db_pandora_audit("Alert management",
"Fail to deleted alert '$alert_template_name' for module '$module_name' in agent '$agent_name'");
}
@ -144,10 +145,10 @@ if ($add_action) {
$result = alerts_add_alert_agent_module_action ($id_alert_module, $id_action, $values);
if ($result) {
pandora_audit("Alert management", 'Add action ' . $id_action . ' in alert ' . $id_alert_module);
db_pandora_audit("Alert management", 'Add action ' . $id_action . ' in alert ' . $id_alert_module);
}
else {
pandora_audit("Alert management", 'Fail to add action ' . $id_action . ' in alert ' . $id_alert_module);
db_pandora_audit("Alert management", 'Fail to add action ' . $id_action . ' in alert ' . $id_alert_module);
}
$messageAction = ui_print_result_message ($result, __('Successfully added'), __('Could not be added'), '', true);
@ -160,10 +161,10 @@ if ($delete_action) {
$result = alerts_delete_alert_agent_module_action ($id_action);
if ($result) {
pandora_audit("Alert management", 'Delete action ' . $id_action . ' in alert ' . $id_alert);
db_pandora_audit("Alert management", 'Delete action ' . $id_action . ' in alert ' . $id_alert);
}
else {
pandora_audit("Alert management", 'Fail to delete action ' . $id_action . ' in alert ' . $id_alert);
db_pandora_audit("Alert management", 'Fail to delete action ' . $id_action . ' in alert ' . $id_alert);
}
$messageAction = ui_print_result_message ($result, __('Successfully deleted'), __('Could not be deleted'), '', true);
@ -175,10 +176,10 @@ if ($enable_alert) {
$result = alerts_agent_module_disable ($id_alert, false);
if ($result) {
pandora_audit("Alert management", 'Enable ' . $id_alert);
db_pandora_audit("Alert management", 'Enable ' . $id_alert);
}
else {
pandora_audit("Alert management", 'Fail to enable ' . $id_alert);
db_pandora_audit("Alert management", 'Fail to enable ' . $id_alert);
}
$messageAction = ui_print_result_message ($result, __('Successfully enabled'), __('Could not be enabled'), '', true);
@ -190,10 +191,10 @@ if ($disable_alert) {
$result = alerts_agent_module_disable ($id_alert, true);
if ($result) {
pandora_audit("Alert management", 'Disable ' . $id_alert);
db_pandora_audit("Alert management", 'Disable ' . $id_alert);
}
else {
pandora_audit("Alert management", 'Fail to disable ' . $id_alert);
db_pandora_audit("Alert management", 'Fail to disable ' . $id_alert);
}
$messageAction = ui_print_result_message ($result, __('Successfully disabled'), __('Could not be disabled'), '', true);
@ -205,10 +206,10 @@ if ($standbyon_alert) {
$result = alerts_agent_module_standby ($id_alert, true);
if ($result) {
pandora_audit("Alert management", 'Standby ' . $id_alert);
db_pandora_audit("Alert management", 'Standby ' . $id_alert);
}
else {
pandora_audit("Alert management", 'Fail to standby ' . $id_alert);
db_pandora_audit("Alert management", 'Fail to standby ' . $id_alert);
}
$messageAction = ui_print_result_message ($result, __('Successfully set standby'), __('Could not be set standby'), '', true);
@ -220,10 +221,10 @@ if ($standbyoff_alert) {
$result = alerts_agent_module_standby ($id_alert, false);
if ($result) {
pandora_audit("Alert management", 'Standbyoff ' . $id_alert);
db_pandora_audit("Alert management", 'Standbyoff ' . $id_alert);
}
else {
pandora_audit("Alert management", 'Fail to standbyoff ' . $id_alert);
db_pandora_audit("Alert management", 'Fail to standbyoff ' . $id_alert);
}
$messageAction = ui_print_result_message ($result, __('Successfully set off standby'), __('Could not be set off standby'), '', true);

View File

@ -17,6 +17,8 @@
global $config;
require_once ('include/functions_alerts.php');
require_once ('include/functions_users.php');
require_once ('include/functions_groups.php');
check_login ();
@ -100,7 +102,7 @@ if (is_ajax ()) {
}
if (! check_acl ($config['id_user'], 0, "LM")) {
pandora_audit("ACL Violation",
db_pandora_audit("ACL Violation",
"Trying to access Alert Management");
require ("general/noaccess.php");
exit;
@ -140,7 +142,7 @@ if ($delete_template) {
// If user tries to delete a template with group=ALL then must have "PM" access privileges
if ($al_template['id_group'] == 0){
if (! check_acl ($config['id_user'], 0, "PM")) {
pandora_audit("ACL Violation",
db_pandora_audit("ACL Violation",
"Trying to access Alert Management");
require ("general/noaccess.php");
exit;
@ -160,7 +162,7 @@ if ($delete_template) {
// Header
ui_print_page_header (__('Alerts')." &raquo; ". __('Alert templates'), "images/god2.png", false, "", true);
else{
pandora_audit("ACL Violation",
db_pandora_audit("ACL Violation",
"Trying to access Alert Management");
require ("general/noaccess.php");
exit;
@ -173,10 +175,10 @@ if ($delete_template) {
$result = alerts_delete_alert_template ($id);
if ($result) {
pandora_audit("Template alert management", "Delete alert template " . $id);
db_pandora_audit("Template alert management", "Delete alert template " . $id);
}
else {
pandora_audit("Template alert management", "Fail try to delete alert template " . $id);
db_pandora_audit("Template alert management", "Fail try to delete alert template " . $id);
}
ui_print_result_message ($result,

View File

@ -17,11 +17,12 @@
global $config;
require_once ('include/functions_alerts.php');
require_once ('include/functions_users.php');
check_login ();
if (! check_acl ($config['id_user'], 0, "LM")) {
pandora_audit("ACL Violation",
db_pandora_audit("ACL Violation",
"Trying to access Alert Management");
require ("general/noaccess.php");
exit;
@ -36,7 +37,7 @@ if ($al_action !== false){
if ($al_action['id_group'] == 0){
// then must have "PM" access privileges
if (! check_acl ($config['id_user'], 0, "PM")) {
pandora_audit("ACL Violation",
db_pandora_audit("ACL Violation",
"Trying to access Alert Management");
require ("general/noaccess.php");
exit;
@ -56,7 +57,7 @@ if ($al_action !== false){
// Header
ui_print_page_header (__('Alerts').' &raquo; '.__('Configure alert action'), "images/god2.png", false, "", true);
else{
pandora_audit("ACL Violation",
db_pandora_audit("ACL Violation",
"Trying to access Alert Management");
require ("general/noaccess.php");
exit;

View File

@ -20,7 +20,7 @@ require_once ("include/functions_alerts.php");
check_login ();
if (! check_acl ($config['id_user'], 0, "LM")) {
pandora_audit("ACL Violation",
db_pandora_audit("ACL Violation",
"Trying to access Alert Management");
require ("general/noaccess.php");
exit;

View File

@ -18,7 +18,7 @@ global $config;
check_login ();
if (! check_acl ($config['id_user'], 0, "AW")) {
pandora_audit("ACL Violation",
db_pandora_audit("ACL Violation",
"Trying to access Alert Management");
require ("general/noaccess.php");
return;
@ -29,6 +29,8 @@ $id_agent = (int) get_parameter ('id_agent');
require_once ('include/functions_agents.php');
require_once ('include/functions_alerts.php');
require_once ('include/functions_modules.php');
require_once ('include/functions_users.php');
function print_alert_compound_steps ($step, $id) {
echo '<ol class="steps">';
@ -228,7 +230,7 @@ if ($id && ! $create_compound) {
$id_agent = $compound['id_agent'];
$id_group = get_agent_group ($id_agent);
if (! check_acl ($config['id_user'], $id_group, "AW")) {
pandora_audit("ACL Violation",
db_pandora_audit("ACL Violation",
"Trying to access Alert Management");
require ("general/noaccess.php");
return;

View File

@ -16,11 +16,12 @@
// Load global vars
global $config;
require_once ('include/functions_alerts.php');
require_once ('include/functions_users.php');
check_login ();
if (! check_acl ($config['id_user'], 0, "LM")) {
pandora_audit("ACL Violation",
db_pandora_audit("ACL Violation",
"Trying to access Alert Management");
require ("general/noaccess.php");
exit;
@ -43,7 +44,7 @@ if ($a_template !== false){
if ($a_template['id_group'] == 0){
// then must have "PM" access privileges
if (! check_acl ($config['id_user'], 0, "PM")) {
pandora_audit("ACL Violation",
db_pandora_audit("ACL Violation",
"Trying to access Alert Management");
require ("general/noaccess.php");
exit;
@ -63,7 +64,7 @@ if ($a_template !== false){
// Header
ui_print_page_header (__('Alerts').' &raquo; '.__('Configure alert template'), "", false, "", true);
else{
pandora_audit("ACL Violation",
db_pandora_audit("ACL Violation",
"Trying to access Alert Management");
require ("general/noaccess.php");
exit;
@ -81,10 +82,10 @@ if ($duplicate_template) {
$id = alerts_duplicate_alert_template ($source_id);
if ($id) {
pandora_audit("Template alert management", "Duplicate alert template " . $source_id . " clone to " . $id);
db_pandora_audit("Template alert management", "Duplicate alert template " . $source_id . " clone to " . $id);
}
else {
pandora_audit("Template alert management", "Fail try to duplicate alert template " . $source_id);
db_pandora_audit("Template alert management", "Fail try to duplicate alert template " . $source_id);
}
ui_print_result_message ($id,
@ -249,10 +250,10 @@ function update_template ($step) {
}
if ($result) {
pandora_audit("Template alert management", "Update alert template " . $id, false, false, json_encode($values));
db_pandora_audit("Template alert management", "Update alert template " . $id, false, false, json_encode($values));
}
else {
pandora_audit("Template alert management", "Fail try to update alert template " . $id, false, false, json_encode($values));
db_pandora_audit("Template alert management", "Fail try to update alert template " . $id, false, false, json_encode($values));
}
return $result;
@ -317,10 +318,10 @@ if ($create_template) {
$result = alerts_create_alert_template ($name, $type, $values);
if ($result) {
pandora_audit("Command management", "Create alert command " . $result, false, false, json_encode($values));
db_pandora_audit("Command management", "Create alert command " . $result, false, false, json_encode($values));
}
else {
pandora_audit("Command management", "Fail try to create alert command", false, false, json_encode($values));
db_pandora_audit("Command management", "Fail try to create alert command", false, false, json_encode($values));
}
ui_print_result_message ($result,

View File

@ -21,7 +21,7 @@ ui_print_page_header (__('Database maintenance').' &raquo; '.__('Database audit
check_login ();
if (! check_acl ($config['id_user'], 0, "DM")) {
pandora_audit("ACL Violation",
db_pandora_audit("ACL Violation",
"Trying to access Database Management Audit");
require ("general/noaccess.php");
return;
@ -64,13 +64,13 @@ $time["3month"] = $time["all"]-(86400*90);
if (isset($_POST["purgedb"])){ # Fixed 2005-1-13, nil
$from_date = get_parameter_post("date_purge");
$deleted = process_sql_delete('tsesion', array('utimestamp' => '< ' . $from_date));
$deleted = db_process_sql_delete('tsesion', array('utimestamp' => '< ' . $from_date));
}
# End of get parameters block
echo "<table cellpadding='4' cellspacing='4' class='databox'>";
echo "<tr><td class='datos'>";
$result = get_db_row_sql ("SELECT COUNT(*) AS total, MIN(fecha) AS first_date, MAX(fecha) AS latest_date FROM tsesion");
$result = db_get_row_sql ("SELECT COUNT(*) AS total, MIN(fecha) AS first_date, MAX(fecha) AS latest_date FROM tsesion");
echo "<b>".__('Total')."</b></td>";
echo "<td class='datos'>".$result["total"]." ".__('Records')."</td>";

View File

@ -21,7 +21,7 @@ check_login ();
ui_print_page_header (__('Database maintenance').' &raquo; '.__('Event database cleanup'), "images/god8.png", false, "", true);
if (! check_acl ($config['id_user'], 0, "DM")) {
pandora_audit("ACL Violation", "Trying to access Database Management Event");
db_pandora_audit("ACL Violation", "Trying to access Database Management Event");
require ("general/noaccess.php");
exit;
}
@ -32,7 +32,7 @@ if (! check_acl ($config['id_user'], 0, "DM")) {
if (isset ($_POST["date_purge"])){
$from_date = (int) get_parameter_post ("date_purge");
$deleted = process_sql_delete('tevento', array('utimestamp' => '< ' . $from_date));
$deleted = db_process_sql_delete('tevento', array('utimestamp' => '< ' . $from_date));
if ($deleted !== false) {
echo '<h3 class="suc">'.__('Successfully deleted old events').'</h3>';
@ -43,7 +43,7 @@ if (isset ($_POST["date_purge"])){
}
# End of get parameters block
$row = get_db_row_sql ("SELECT COUNT(*) AS total, MIN(timestamp) AS first_date, MAX(timestamp) AS latest_date FROM tevento");
$row = db_get_row_sql ("SELECT COUNT(*) AS total, MIN(timestamp) AS first_date, MAX(timestamp) AS latest_date FROM tevento");
$table->data = array ();
$table->cellpadding = 4;

View File

@ -19,13 +19,15 @@
global $config;
require_once ($config["homedir"] . '/include/functions_graph.php');
require_once($config['homedir'] . "/include/functions_agents.php");
require_once($config['homedir'] . "/include/functions_modules.php");
ui_print_page_header (__('Database maintenance').' &raquo; '.__('Database information'), "images/god8.png", false, "", true);
check_login ();
if (! check_acl ($config['id_user'], 0, "DM")) {
pandora_audit("ACL Violation",
db_pandora_audit("ACL Violation",
"Trying to access Database Management Info");
require ("general/noaccess.php");
return;

View File

@ -20,7 +20,7 @@ global $config;
check_login ();
if (! check_acl ($config['id_user'], 0, "DM")) {
pandora_audit("ACL Violation",
db_pandora_audit("ACL Violation",
"Trying to access Database Management");
require ("general/noaccess.php");
return;
@ -29,24 +29,24 @@ if (! check_acl ($config['id_user'], 0, "DM")) {
// Get some general DB stats (not very heavy)
// NOTE: this is not realtime monitoring stats, are more focused on DB sanity
$stat_access = get_db_sql ("SELECT COUNT(*) FROM tagent_access WHERE id_agent != 0");
$stat_data = get_db_sql ("SELECT COUNT(*) FROM tagente_datos WHERE id_agente_modulo != 0");
$stat_data_log4x = get_db_sql ("SELECT COUNT(*) FROM tagente_datos_log4x WHERE id_agente_modulo != 0");
$stat_data_string = get_db_sql ("SELECT COUNT(*) FROM tagente_datos_string WHERE id_agente_modulo != 0");
$stat_modules = get_db_sql ("SELECT COUNT(*) FROM tagente_estado WHERE id_agente_modulo != 0");
$stat_event = get_db_sql (" SELECT COUNT(*) FROM tevento");
$stat_agente = get_db_sql (" SELECT COUNT(*) FROM tagente");
$stat_access = db_get_sql ("SELECT COUNT(*) FROM tagent_access WHERE id_agent != 0");
$stat_data = db_get_sql ("SELECT COUNT(*) FROM tagente_datos WHERE id_agente_modulo != 0");
$stat_data_log4x = db_get_sql ("SELECT COUNT(*) FROM tagente_datos_log4x WHERE id_agente_modulo != 0");
$stat_data_string = db_get_sql ("SELECT COUNT(*) FROM tagente_datos_string WHERE id_agente_modulo != 0");
$stat_modules = db_get_sql ("SELECT COUNT(*) FROM tagente_estado WHERE id_agente_modulo != 0");
$stat_event = db_get_sql (" SELECT COUNT(*) FROM tevento");
$stat_agente = db_get_sql (" SELECT COUNT(*) FROM tagente");
switch ($config["dbtype"]) {
case "mysql":
$stat_uknown = get_db_sql ("SELECT COUNT(*) FROM tagente WHERE ultimo_contacto < NOW() - (intervalo * 2)");
$stat_uknown = db_get_sql ("SELECT COUNT(*) FROM tagente WHERE ultimo_contacto < NOW() - (intervalo * 2)");
break;
case "postgresql":
$stat_uknown = get_db_sql ("SELECT COUNT(*)
$stat_uknown = db_get_sql ("SELECT COUNT(*)
FROM tagente
WHERE ceil(date_part('epoch', ultimo_contacto)) < ceil(date_part('epoch', NOW())) - (intervalo * 2)");
break;
case "oracle":
$stat_uknown = get_db_sql ("SELECT COUNT(*)
$stat_uknown = db_get_sql ("SELECT COUNT(*)
FROM tagente
WHERE CAST(ultimo_contacto AS DATE) < SYSDATE - (intervalo * 2)");
break;
@ -54,10 +54,10 @@ switch ($config["dbtype"]) {
switch ($config["dbtype"]) {
case "mysql":
case "postgresql":
$stat_noninit = get_db_sql ("SELECT COUNT(*) FROM tagente_estado WHERE utimestamp = 0;");
$stat_noninit = db_get_sql ("SELECT COUNT(*) FROM tagente_estado WHERE utimestamp = 0;");
break;
case "oracle":
$stat_noninit = get_db_sql ("SELECT COUNT(*) FROM tagente_estado WHERE utimestamp = 0");
$stat_noninit = db_get_sql ("SELECT COUNT(*) FROM tagente_estado WHERE utimestamp = 0");
break;
}

View File

@ -19,11 +19,13 @@
global $config;
require_once ($config["homedir"] . '/include/functions_graph.php');
require_once($config['homedir'] . "/include/functions_agents.php");
require_once($config['homedir'] . "/include/functions_modules.php");
check_login ();
if (! check_acl ($config['id_user'], 0, "DM")) {
pandora_audit( "ACL Violation",
db_pandora_audit( "ACL Violation",
"Trying to access Database Purge Section");
include ("general/noaccess.php");
exit;
@ -78,13 +80,13 @@ if (isset($_POST["purgedb"])) {
echo "<h3>".__('Please be patient. This operation can take a long time depending on the amount of modules.')."</h3>";
$sql = sprintf ("SELECT id_agente_modulo FROM tagente_modulo WHERE id_agente = %d", $id_agent);
$result = get_db_all_rows_sql ($sql);
$result = db_get_all_rows_sql ($sql);
if (empty ($result)) {
$result = array ();
}
//Made it in a transaction so it gets done all at once.
process_sql_begin ();
db_process_sql_begin ();
$errors = 0;
$affected = 0;
@ -94,7 +96,7 @@ if (isset($_POST["purgedb"])) {
flush (); //Flush here in case there are errors and the script dies, at least we know where we ended
set_time_limit (); //Reset the time limit just in case
$result = process_sql_delete('tagente_datos', array('id_agente_modulo' => $row["id_agente_modulo"], 'utimestamp' => '< ' . $from_date));
$result = db_process_sql_delete('tagente_datos', array('id_agente_modulo' => $row["id_agente_modulo"], 'utimestamp' => '< ' . $from_date));
if ($result === false)
$errors++;
@ -102,7 +104,7 @@ if (isset($_POST["purgedb"])) {
$affected += $result;
if ($errors == 0) {
$result = process_sql_delete('tagente_datos_inc', array('id_agente_modulo' => $row["id_agente_modulo"], 'utimestamp' => '< ' . $from_date));
$result = db_process_sql_delete('tagente_datos_inc', array('id_agente_modulo' => $row["id_agente_modulo"], 'utimestamp' => '< ' . $from_date));
if ($result === false)
$errors++;
@ -110,7 +112,7 @@ if (isset($_POST["purgedb"])) {
$affected += $result;
}
if ($errors == 0) {
$result = process_sql_delete('tagente_datos_string', array('id_agente_modulo' => $row["id_agente_modulo"], 'utimestamp' => '< ' . $from_date));
$result = db_process_sql_delete('tagente_datos_string', array('id_agente_modulo' => $row["id_agente_modulo"], 'utimestamp' => '< ' . $from_date));
if ($result === false)
$errors++;
@ -118,7 +120,7 @@ if (isset($_POST["purgedb"])) {
$affected += $result;
}
if ($errors == 0) {
$result = process_sql_delete('tagente_datos_log4x', array('id_agente_modulo' => $row["id_agente_modulo"], 'utimestamp' => '< ' . $from_date));
$result = db_process_sql_delete('tagente_datos_log4x', array('id_agente_modulo' => $row["id_agente_modulo"], 'utimestamp' => '< ' . $from_date));
if ($result === false)
$errors++;
@ -128,10 +130,10 @@ if (isset($_POST["purgedb"])) {
}
if ($errors > 0) {
process_sql_rollback ();
db_process_sql_rollback ();
}
else {
process_sql_commit ();
db_process_sql_commit ();
echo __('Total records deleted: ') . $affected;
}
@ -140,10 +142,10 @@ if (isset($_POST["purgedb"])) {
echo __('Deleting records for all agents');
flush ();
process_sql_delete('tagente_datos', array('utimestamp' => '< ' . $from_date));
process_sql_delete('tagente_datos_inc', array('utimestamp' => '< ' . $from_date));
process_sql_delete('tagente_datos_string', array('utimestamp' => '< ' . $from_date));
process_sql_delete('tagente_datos_log4x', array('utimestamp' => '< ' . $from_date));
db_process_sql_delete('tagente_datos', array('utimestamp' => '< ' . $from_date));
db_process_sql_delete('tagente_datos_inc', array('utimestamp' => '< ' . $from_date));
db_process_sql_delete('tagente_datos_string', array('utimestamp' => '< ' . $from_date));
db_process_sql_delete('tagente_datos_log4x', array('utimestamp' => '< ' . $from_date));
}
echo "<br /><br />";
}
@ -180,37 +182,37 @@ else {
$query = "";
}
$data["1day"] = get_db_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos WHERE utimestamp > %d %s", $time["1day"], $query));
$data["3day"] = get_db_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos WHERE utimestamp > %d %s", $time["3day"], $query));
$data["1week"] = get_db_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos WHERE utimestamp > %d %s", $time["1week"], $query));
$data["2week"] = get_db_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos WHERE utimestamp > %d %s", $time["2week"], $query));
$data["1month"] = get_db_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos WHERE utimestamp > %d %s", $time["1month"], $query));
$data["3month"] = get_db_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos WHERE utimestamp > %d %s", $time["3month"], $query));
$data["total"] = get_db_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos WHERE 1=1 %s", $query));
$data["1day"] = db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos WHERE utimestamp > %d %s", $time["1day"], $query));
$data["3day"] = db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos WHERE utimestamp > %d %s", $time["3day"], $query));
$data["1week"] = db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos WHERE utimestamp > %d %s", $time["1week"], $query));
$data["2week"] = db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos WHERE utimestamp > %d %s", $time["2week"], $query));
$data["1month"] = db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos WHERE utimestamp > %d %s", $time["1month"], $query));
$data["3month"] = db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos WHERE utimestamp > %d %s", $time["3month"], $query));
$data["total"] = db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos WHERE 1=1 %s", $query));
$data["1day"] += get_db_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_inc WHERE utimestamp > %d %s", $time["1day"], $query));
$data["3day"] += get_db_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_inc WHERE utimestamp > %d %s", $time["3day"], $query));
$data["1week"] += get_db_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_inc WHERE utimestamp > %d %s", $time["1week"], $query));
$data["2week"] += get_db_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_inc WHERE utimestamp > %d %s", $time["2week"], $query));
$data["1month"] += get_db_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_inc WHERE utimestamp > %d %s", $time["1month"], $query));
$data["3month"] += get_db_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_inc WHERE utimestamp > %d %s", $time["3month"], $query));
$data["total"] += get_db_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_inc WHERE 1=1 %s", $query));
$data["1day"] += db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_inc WHERE utimestamp > %d %s", $time["1day"], $query));
$data["3day"] += db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_inc WHERE utimestamp > %d %s", $time["3day"], $query));
$data["1week"] += db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_inc WHERE utimestamp > %d %s", $time["1week"], $query));
$data["2week"] += db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_inc WHERE utimestamp > %d %s", $time["2week"], $query));
$data["1month"] += db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_inc WHERE utimestamp > %d %s", $time["1month"], $query));
$data["3month"] += db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_inc WHERE utimestamp > %d %s", $time["3month"], $query));
$data["total"] += db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_inc WHERE 1=1 %s", $query));
$data["1day"] += get_db_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_string WHERE utimestamp > %d %s", $time["1day"], $query));
$data["3day"] += get_db_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_string WHERE utimestamp > %d %s", $time["3day"], $query));
$data["1week"] += get_db_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_string WHERE utimestamp > %d %s", $time["1week"], $query));
$data["2week"] += get_db_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_string WHERE utimestamp > %d %s", $time["2week"], $query));
$data["1month"] += get_db_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_string WHERE utimestamp > %d %s", $time["1month"], $query));
$data["3month"] += get_db_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_string WHERE utimestamp > %d %s", $time["3month"], $query));
$data["total"] += get_db_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_string WHERE 1=1 %s", $query));
$data["1day"] += db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_string WHERE utimestamp > %d %s", $time["1day"], $query));
$data["3day"] += db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_string WHERE utimestamp > %d %s", $time["3day"], $query));
$data["1week"] += db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_string WHERE utimestamp > %d %s", $time["1week"], $query));
$data["2week"] += db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_string WHERE utimestamp > %d %s", $time["2week"], $query));
$data["1month"] += db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_string WHERE utimestamp > %d %s", $time["1month"], $query));
$data["3month"] += db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_string WHERE utimestamp > %d %s", $time["3month"], $query));
$data["total"] += db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_string WHERE 1=1 %s", $query));
$data["1day"] += get_db_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_log4x WHERE utimestamp > %d %s", $time["1day"], $query));
$data["3day"] += get_db_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_log4x WHERE utimestamp > %d %s", $time["3day"], $query));
$data["1week"] += get_db_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_log4x WHERE utimestamp > %d %s", $time["1week"], $query));
$data["2week"] += get_db_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_log4x WHERE utimestamp > %d %s", $time["2week"], $query));
$data["1month"] += get_db_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_log4x WHERE utimestamp > %d %s", $time["1month"], $query));
$data["3month"] += get_db_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_log4x WHERE utimestamp > %d %s", $time["3month"], $query));
$data["total"] += get_db_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_log4x WHERE 1=1 %s", $query));
$data["1day"] += db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_log4x WHERE utimestamp > %d %s", $time["1day"], $query));
$data["3day"] += db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_log4x WHERE utimestamp > %d %s", $time["3day"], $query));
$data["1week"] += db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_log4x WHERE utimestamp > %d %s", $time["1week"], $query));
$data["2week"] += db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_log4x WHERE utimestamp > %d %s", $time["2week"], $query));
$data["1month"] += db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_log4x WHERE utimestamp > %d %s", $time["1month"], $query));
$data["3month"] += db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_log4x WHERE utimestamp > %d %s", $time["3month"], $query));
$data["total"] += db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_log4x WHERE 1=1 %s", $query));
$table->width = '50%';
$table->border = 0;

View File

@ -21,11 +21,15 @@ global $config;
check_login ();
if (! check_acl ($config['id_user'], 0, "DM")) {
pandora_audit("ACL Violation","Trying to access Database Debug Admin section");
db_pandora_audit("ACL Violation","Trying to access Database Debug Admin section");
require ("general/noaccess.php");
exit;
}
require_once($config['homedir'] . "/include/functions_agents.php");
require_once($config['homedir'] . "/include/functions_modules.php");
require_once($config['homedir'] . '/include/functions_users.php');
ui_print_page_header (__('Database maintenance').' &raquo; '.__('Database debug'), "images/god8.png", false, "", true);
@ -51,7 +55,7 @@ if ((isset ($_GET["operacion"])) && (!isset ($_POST["update_agent"]))) {
foreach ($origen_modulo as $id_agentemodulo) {
echo "<br /><br />".__('Filtering data module')."<b> [".get_agentmodule_name ($id_agentemodulo)."]</b>";
$sql = sprintf ("DELETE FROM tagente_datos WHERE id_agente_modulo = %d AND (datos < '%s' OR datos > '%s')", $id_agentemodulo, $min, $max);
process_sql ($sql);
db_process_sql ($sql);
}
} //if copy modules or alerts
echo '<br /><br /><h3 class="suc">'.__('Filtering completed').'</h3>';

View File

@ -20,7 +20,7 @@ global $config;
check_login();
if (! check_acl ($config["id_user"], 0, "DM")) {
pandora_audit("ACL Violation",
db_pandora_audit("ACL Violation",
"Trying to access Database cure section");
require ("general/noaccess.php");
return;
@ -34,7 +34,7 @@ if ($sanity == 1) {
// Create tagente estado when missing
echo "<h2>".__('Checking tagente_estado table')."</h2>";
$rows = get_db_all_rows_in_table('tagente_modulo');
$rows = db_get_all_rows_in_table('tagente_modulo');
if ($rows === false) {
$rows = array();
}
@ -45,17 +45,17 @@ if ($sanity == 1) {
// check if exist in tagente_estado and create if not
$sql = "SELECT COUNT(*) FROM tagente_estado
WHERE id_agente_modulo = $id_agente_modulo";
$total = get_db_sql ($sql);
$total = db_get_sql ($sql);
if ($total == 0) {
$sql = "INSERT INTO tagente_estado (id_agente_modulo, datos, timestamp, estado, id_agente, last_try, utimestamp, current_interval, running_by, last_execution_try) VALUE ($id_agente_modulo, 0, '0000-00-00 00:00:00', 0, 100, $id_agente, '0000-00-00 00:00:00', 0, 0, 0)";
echo "Inserting module $id_agente_modulo in state table <br>";
process_sql ($sql);
db_process_sql ($sql);
}
}
echo "<h3>".__('Checking database consistency')."</h2>";
$rows = get_db_all_rows_in_table('tagente_estado');
$rows = db_get_all_rows_in_table('tagente_estado');
if ($rows === false) {
$rows = array();
}
@ -64,7 +64,7 @@ if ($sanity == 1) {
$id_agente_modulo = $row['id_agente_modulo'];
# check if exist in tagente_estado and create if not
$rows = get_db_all_rows_sql("SELECT COUNT(*) AS count FROM tagente_modulo WHERE id_agente_modulo = $id_agente_modulo");
$rows = db_get_all_rows_sql("SELECT COUNT(*) AS count FROM tagente_modulo WHERE id_agente_modulo = $id_agente_modulo");
if ($rows !== false) {
$row = reset($rows);
@ -73,7 +73,7 @@ if ($sanity == 1) {
if ($count == 0) {
echo "Deleting non-existing module $id_agente_modulo in state table <br>";
process_sql_delete('tagente_estado', array('id_agente_modulo' => $id_agente_modulo));
db_process_sql_delete('tagente_estado', array('id_agente_modulo' => $id_agente_modulo));
}
}
}
@ -81,7 +81,7 @@ if ($sanity == 1) {
elseif ($sanity == 2) {
echo "<h3>".__('Deleting non-init data')."</h2>";
$rows = get_db_all_rows_filter("tagente_estado", array("utimestamp" => 0));
$rows = db_get_all_rows_filter("tagente_estado", array("utimestamp" => 0));
if ($rows === false) {
$rows = array();
}
@ -89,11 +89,11 @@ elseif ($sanity == 2) {
foreach ($rows as $row) {
echo "Deleting non init module $id_agente_modulo <br>";
process_sql_delete('tagente_estado', array('id_agente_modulo' => $row['id_agente_modulo']));
db_process_sql_delete('tagente_estado', array('id_agente_modulo' => $row['id_agente_modulo']));
}
echo "Deleting bad module (id 0)<br>";
process_sql_delete('tagente_modulo', array('id_modulo' => 0));
db_process_sql_delete('tagente_modulo', array('id_modulo' => 0));
}
echo "<br>";

View File

@ -17,7 +17,7 @@
check_login ();
if (! check_acl ($config['id_user'], 0, "PM")) {
pandora_audit("ACL Violation",
db_pandora_audit("ACL Violation",
"Trying to access extensions list");
include ("general/noaccess.php");
exit;

View File

@ -79,7 +79,7 @@ function updateArrowLayers() {
<?php
if (! check_acl ($config['id_user'], 0, "IW")) {
pandora_audit("ACL Violation", "Trying to access map builder");
db_pandora_audit("ACL Violation", "Trying to access map builder");
require ("general/noaccess.php");
return;
}
@ -312,7 +312,7 @@ if (isset($invalidFields['map_connection_list'])) {
}
}
$listConnectionTemp = get_db_all_rows_sql("SELECT id_tmap_connection, conection_name, group_id FROM tgis_map_connection");
$listConnectionTemp = db_get_all_rows_sql("SELECT id_tmap_connection, conection_name, group_id FROM tgis_map_connection");
$listConnection = array();
foreach ($listConnectionTemp as $connectionTemp) {
if (check_acl ($config["id_user"], $connectionTemp['group_id'], "IW")) {

View File

@ -22,7 +22,7 @@ require_once ('include/functions_gis.php');
ui_require_javascript_file('openlayers.pandora');
if (! check_acl ($config['id_user'], 0, "IW")) {
pandora_audit("ACL Violation", "Trying to access map builder");
db_pandora_audit("ACL Violation", "Trying to access map builder");
require ("general/noaccess.php");
return;
}
@ -32,10 +32,10 @@ if (is_ajax ()) {
$id_map = get_parameter('id_map');
// Set to not default the actual default map
$returnOperationDB = process_sql_update('tgis_map', array('default_map' => 0), array('default_map' => 1));
$returnOperationDB = db_process_sql_update('tgis_map', array('default_map' => 0), array('default_map' => 1));
// Set default the new default map
$returnOperationDB = process_sql_update('tgis_map', array('default_map' => 1), array('id_tgis_map' => $id_map));
$returnOperationDB = db_process_sql_update('tgis_map', array('default_map' => 1), array('id_tgis_map' => $id_map));
if ($returnOperationDB === false)
$data['correct'] = false;
@ -77,7 +77,7 @@ $table->align[2] = 'center';
$table->align[3] = 'center';
$table->align[4] = 'center';
$maps = get_db_all_rows_in_table ('tgis_map','map_name');
$maps = db_get_all_rows_in_table ('tgis_map','map_name');
$table->data = array();

View File

@ -19,11 +19,14 @@ global $config;
check_login ();
if (! check_acl ($config['id_user'], 0, "PM")) {
pandora_audit("ACL Violation", "Trying to access Group Management2");
db_pandora_audit("ACL Violation", "Trying to access Group Management2");
require ("general/noaccess.php");
return;
}
include_once($config['homedir'] . "/include/functions_groups.php");
include_once($config['homedir'] . '/include/functions_users.php');
// Init vars
$icon = "";
$name = "";
@ -37,7 +40,7 @@ $create_group = (bool) get_parameter ('create_group');
$id_group = (int) get_parameter ('id_group');
if ($id_group) {
$group = get_db_row ('tgrupo', 'id_grupo', $id_group);
$group = db_get_row ('tgrupo', 'id_grupo', $id_group);
if ($group) {
$name = $group["nombre"];
$icon = $group["icon"].'.png';

View File

@ -20,7 +20,7 @@ global $config;
check_login ();
if (! check_acl ($config['id_user'], 0, "PM")) {
pandora_audit("ACL Violation", "Trying to access Group Management2");
db_pandora_audit("ACL Violation", "Trying to access Group Management2");
require ("general/noaccess.php");
return;
}
@ -39,7 +39,7 @@ $create_group = (bool) get_parameter ('create_group');
$id_group = (int) get_parameter ('id_group');
if ($id_group) {
$group = get_db_row ('tmodule_group', 'id_mg', $id_group);
$group = db_get_row ('tmodule_group', 'id_mg', $id_group);
if ($group) {
$name = $group["name"];
} else {

View File

@ -20,10 +20,12 @@ global $config;
check_login();
require_once("include/functions_groups.php");
require_once($config['homedir'] . "/include/functions_agents.php");
require_once($config['homedir'] . '/include/functions_users.php');
if (is_ajax ()) {
if (! check_acl($config['id_user'], 0, "AR")) {
pandora_audit("ACL Violation", "Trying to access Group Management");
db_pandora_audit("ACL Violation", "Trying to access Group Management");
require ("general/noaccess.php");
return;
}
@ -47,13 +49,13 @@ if (is_ajax ()) {
}
if (! check_acl ($config['id_user'], $id_group, "AR")) {
pandora_audit("ACL Violation",
db_pandora_audit("ACL Violation",
"Trying to access Alert Management");
echo json_encode (false);
return;
}
$group = get_db_row ('tgrupo', 'id_grupo', $id_group);
$group = db_get_row ('tgrupo', 'id_grupo', $id_group);
echo json_encode ($group);
return;
@ -64,7 +66,7 @@ if (is_ajax ()) {
$disabled = (int) get_parameter ('disabled', 0);
if (! check_acl ($config['id_user'], $id_group, "AR")) {
pandora_audit("ACL Violation",
db_pandora_audit("ACL Violation",
"Trying to access Alert Management");
echo json_encode (false);
return;
@ -78,7 +80,7 @@ if (is_ajax ()) {
}
if (! check_acl($config['id_user'], 0, "PM")) {
pandora_audit("ACL Violation",
db_pandora_audit("ACL Violation",
"Trying to access Group Management");
require ("general/noaccess.php");
return;
@ -111,7 +113,7 @@ if ($create_group) {
'id_skin' => $skin
);
$result = process_sql_insert('tgrupo', $values);
$result = db_process_sql_insert('tgrupo', $values);
}
else {
$result = false;
@ -151,7 +153,7 @@ if ($update_group) {
$name, substr ($icon, 0, -4), !$alerts_enabled, $id_parent, $custom_id, $propagate, $skin, $id_group);
break;
}
$result = process_sql ($sql);
$result = db_process_sql ($sql);
} else {
$result = false;
}
@ -171,13 +173,13 @@ if ($delete_group) {
if (!$usedGroup['return']) {
$group = get_db_row_filter('tgrupo', array('id_grupo' => $id_group));
$group = db_get_row_filter('tgrupo', array('id_grupo' => $id_group));
process_sql_update('tgrupo', array('parent' => $group['parent']), array('parent' => $id_group));
db_process_sql_update('tgrupo', array('parent' => $group['parent']), array('parent' => $id_group));
$result = process_sql_delete('tgroup_stat', array('id_group' => $id_group));
$result = db_process_sql_delete('tgroup_stat', array('id_group' => $id_group));
$result = process_sql_delete('tgrupo', array('id_grupo' => $id_group));
$result = db_process_sql_delete('tgrupo', array('id_grupo' => $id_group));
}
else {
echo "<h3 class='error'>" .

View File

@ -21,7 +21,7 @@ global $config;
check_login();
if (! check_acl($config['id_user'], 0, "PM")) {
pandora_audit("ACL Violation",
db_pandora_audit("ACL Violation",
"Trying to access Group Management");
require ("general/noaccess.php");
return;
@ -35,13 +35,13 @@ if (is_ajax ()) {
$id_group = (int) get_parameter ('id_group');
if (! check_acl ($config['id_user'], $id_group, "AR")) {
pandora_audit("ACL Violation",
db_pandora_audit("ACL Violation",
"Trying to access Alert Management");
echo json_encode (false);
return;
}
$group = get_db_row ('tmodule_group', 'id_mg', $id_group);
$group = db_get_row ('tmodule_group', 'id_mg', $id_group);
echo json_encode ($group);
return;
@ -65,7 +65,7 @@ if ($create_group) {
$alerts_disabled = (bool) get_parameter ('alerts_disabled');
$custom_id = (string) get_parameter ('custom_id');
$result = process_sql_insert('tmodule_group', array('name' => $name));
$result = db_process_sql_insert('tmodule_group', array('name' => $name));
if ($result) {
echo "<h3 class='suc'>".__('Group successfully created')."</h3>";
@ -84,7 +84,7 @@ if ($update_group) {
$alerts_enabled = (bool) get_parameter ('alerts_enabled');
$custom_id = (string) get_parameter ('custom_id');
$result = process_sql_update('tmodule_group', array('name' => $name), array('id_mg' => $id_group));
$result = db_process_sql_update('tmodule_group', array('name' => $name), array('id_mg' => $id_group));
if ($result !== false) {
echo "<h3 class='suc'>".__('Group successfully updated')."</h3>";
}
@ -97,7 +97,7 @@ if ($update_group) {
if ($delete_group) {
$id_group = (int) get_parameter ('id_group');
$result = process_sql_delete('tmodule_group', array('id_mg' => $id_group));
$result = db_process_sql_delete('tmodule_group', array('id_mg' => $id_group));
if (! $result)
echo "<h3 class='error'>".__('There was a problem deleting group')."</h3>";
@ -115,7 +115,7 @@ $table->data = array ();
$sql = "SELECT *
FROM tmodule_group ";
$groups = get_db_all_rows_sql ($sql, true);
$groups = db_get_all_rows_sql ($sql, true);
foreach ($groups as $id_group ) {

View File

@ -17,7 +17,7 @@
check_login ();
if (! check_acl ($config['id_user'], 0, "AW")) {
pandora_audit("ACL Violation",
db_pandora_audit("ACL Violation",
"Trying to access massive agent deletion section");
require ("general/noaccess.php");
return;
@ -25,6 +25,7 @@ if (! check_acl ($config['id_user'], 0, "AW")) {
require_once ('include/functions_agents.php');
require_once ('include/functions_alerts.php');
require_once ('include/functions_users.php');
if (is_ajax ()) {
$get_alerts = (bool) get_parameter ('get_alerts');
@ -116,7 +117,7 @@ if ($add) {
$results = false;
}
pandora_audit("Masive management", "Add alert action " . $id_agent, false, false, 'Agents: ' .
db_pandora_audit("Masive management", "Add alert action " . $id_agent, false, false, 'Agents: ' .
json_encode($id_agents) . ' Alerts : ' . json_encode($agent_alerts) .
' Fires Min: ' . $fires_min . ' Fires Max: ' . $fires_max . ' Action: ' . $action);

View File

@ -18,7 +18,7 @@
check_login ();
if (! check_acl ($config['id_user'], 0, "AW")) {
pandora_audit("ACL Violation",
db_pandora_audit("ACL Violation",
"Trying to access massive alert deletion");
require ("general/noaccess.php");
return;
@ -26,6 +26,8 @@ if (! check_acl ($config['id_user'], 0, "AW")) {
require_once ('include/functions_agents.php');
require_once ('include/functions_alerts.php');
require_once($config['homedir'] . "/include/functions_modules.php");
require_once($config['homedir'] . '/include/functions_users.php');
if (is_ajax ()) {
$get_agents = (bool) get_parameter ('get_agents');
@ -75,10 +77,10 @@ function process_manage_add ($id_alert_template, $id_agents, $module_names) {
}
if ($countSuccess > 0) {
pandora_audit("Masive management", "Add alert", false, false, "Alert template: " . $id_alert_template . " Modules: " . json_encode($modules_id));
db_pandora_audit("Masive management", "Add alert", false, false, "Alert template: " . $id_alert_template . " Modules: " . json_encode($modules_id));
}
else {
pandora_audit("Masive management", "Fail try to add alert", false, false, "Alert template: " . $id_alert_template . " Modules: " . json_encode($modules_id));
db_pandora_audit("Masive management", "Fail try to add alert", false, false, "Alert template: " . $id_alert_template . " Modules: " . json_encode($modules_id));
}
ui_print_result_message ($contsuccess > 0,

View File

@ -18,7 +18,7 @@
check_login ();
if (! check_acl ($config['id_user'], 0, "AW")) {
pandora_audit("ACL Violation",
db_pandora_audit("ACL Violation",
"Trying to access massive alert deletion");
require ("general/noaccess.php");
return;
@ -26,6 +26,8 @@ if (! check_acl ($config['id_user'], 0, "AW")) {
require_once ('include/functions_agents.php');
require_once ('include/functions_alerts.php');
require_once($config['homedir'] . "/include/functions_profile.php");
require_once($config['homedir'] . "/include/functions_users.php");
$create_profiles = (int) get_parameter ('create_profiles');
@ -42,10 +44,10 @@ if ($create_profiles) {
foreach ($profiles_id as $profile) {
foreach ($groups_id as $group) {
foreach ($users_id as $user) {
$profile_data = get_db_row_filter ("tusuario_perfil", array("id_usuario" => $user, "id_perfil" => $profile, "id_grupo" => $group));
$profile_data = db_get_row_filter ("tusuario_perfil", array("id_usuario" => $user, "id_perfil" => $profile, "id_grupo" => $group));
// If the profile doesnt exist, we create it
if ($profile_data === false) {
pandora_audit("User management",
db_pandora_audit("User management",
"Added profile for user ".safe_input($user));
$return = create_user_profile ($user, $profile, $group);
if ($return !== false) {
@ -58,11 +60,11 @@ if ($create_profiles) {
}
if ($n_added > 0) {
pandora_audit("Masive management", "Add profiles", false, false,
db_pandora_audit("Masive management", "Add profiles", false, false,
'Profiles: ' . json_encode($profiles_id) . ' Groups: ' . json_encode($groups_id) . 'Users: ' . json_encode($users_id));
}
else {
pandora_audit("Masive management", "Fail to try add profiles", false, false,
db_pandora_audit("Masive management", "Fail to try add profiles", false, false,
'Profiles: ' . json_encode($profiles_id) . ' Groups: ' . json_encode($groups_id) . 'Users: ' . json_encode($users_id));
}

View File

@ -18,7 +18,7 @@
check_login ();
if (! check_acl ($config['id_user'], 0, "AW")) {
pandora_audit("ACL Violation",
db_pandora_audit("ACL Violation",
"Trying to access Agent Config Management Admin section");
require ("general/noaccess.php");
return;
@ -27,6 +27,7 @@ if (! check_acl ($config['id_user'], 0, "AW")) {
require_once ('include/functions_agents.php');
require_once ('include/functions_alerts.php');
require_once ('include/functions_modules.php');
require_once ('include/functions_users.php');
$source_id_group = (int) get_parameter ('source_id_group');
$source_id_agent = (int) get_parameter ('source_id_agent');
@ -39,11 +40,11 @@ if ($do_operation) {
$result = agents_process_manage_config ($source_id_agent, $destiny_id_agents);
if ($result) {
pandora_audit("Masive management", "Copy modules", false, false,
db_pandora_audit("Masive management", "Copy modules", false, false,
'Source agent: ' . json_encode($source_id_agent) . ' Destinity agent: ' . json_encode($destiny_id_agents));
}
else {
pandora_audit("Masive management", "Fail to try copy modules", false, false,
db_pandora_audit("Masive management", "Fail to try copy modules", false, false,
'Source agent: ' . json_encode($source_id_agent) . ' Destinity agent: ' . json_encode($destiny_id_agents));
}
}

View File

@ -17,7 +17,7 @@
check_login ();
if (! check_acl ($config['id_user'], 0, "AW")) {
pandora_audit("ACL Violation",
db_pandora_audit("ACL Violation",
"Trying to access massive agent deletion section");
require ("general/noaccess.php");
return;
@ -25,6 +25,7 @@ if (! check_acl ($config['id_user'], 0, "AW")) {
require_once ('include/functions_agents.php');
require_once ('include/functions_alerts.php');
require_once ('include/functions_users.php');
if (is_ajax ()) {
$get_alerts = (bool) get_parameter ('get_alerts');
@ -119,12 +120,12 @@ if ($delete) {
}
if ($results) {
pandora_audit("Masive management", "Delete alert action", false, false,
db_pandora_audit("Masive management", "Delete alert action", false, false,
'Agent: ' . json_encode($id_agents) . ' Alert templates: ' . json_encode($id_alert_templates) .
' Alert compound: ' . $id_alert_compounds . ' Action: ' . $action);
}
else {
pandora_audit("Masive management", "Fail try to delete alert action", false, false,
db_pandora_audit("Masive management", "Fail try to delete alert action", false, false,
'Agent: ' . json_encode($id_agents) . ' Alert templates: ' . json_encode($id_alert_templates) .
' Alert compound: ' . $id_alert_compounds . ' Action: ' . $action);
}

View File

@ -17,7 +17,7 @@
check_login ();
if (! check_acl ($config['id_user'], 0, "AW")) {
pandora_audit("ACL Violation",
db_pandora_audit("ACL Violation",
"Trying to access massive agent deletion section");
require ("general/noaccess.php");
return;
@ -26,6 +26,7 @@ if (! check_acl ($config['id_user'], 0, "AW")) {
require_once ('include/functions_agents.php');
require_once ('include/functions_alerts.php');
require_once ('include/functions_modules.php');
require_once ('include/functions_users.php');
function process_manage_delete ($id_agents) {
if (empty ($id_agents)) {
@ -38,7 +39,7 @@ function process_manage_delete ($id_agents) {
$copy_modules = (bool) get_parameter ('copy_modules');
$copy_alerts = (bool) get_parameter ('copy_alerts');
process_sql_begin ();
db_process_sql_begin ();
$error = false;
foreach ($id_agents as $id_agent) {
@ -50,13 +51,13 @@ function process_manage_delete ($id_agents) {
if (! $success) {
echo '<h3 class="error">'.__('There was an error deleting the agent, the operation has been cancelled').'</h3>';
echo '<h4>'.__('Could not delete agent').' '.get_agent_name ($id_agent).'</h4>';
process_sql_rollback ();
db_process_sql_rollback ();
return false;
}
else {
echo '<h3 class="suc">'.__('Successfully deleted').'</h3>';
process_sql_commit ();
db_process_sql_commit ();
return true;
}
@ -71,11 +72,11 @@ if ($delete) {
$result = process_manage_delete ($id_agents);
if ($result) {
pandora_audit("Masive management", "Delete agent ", false, false,
db_pandora_audit("Masive management", "Delete agent ", false, false,
'Agent: ' . json_encode($id_agents));
}
else {
pandora_audit("Masive management", "Fail try to delete agent", false, false,
db_pandora_audit("Masive management", "Fail try to delete agent", false, false,
'Agent: ' . json_encode($id_agents));
}
}

View File

@ -18,7 +18,7 @@
check_login ();
if (! check_acl ($config['id_user'], 0, "AW")) {
pandora_audit("ACL Violation",
db_pandora_audit("ACL Violation",
"Trying to access massive alert deletion");
require ("general/noaccess.php");
return;
@ -26,6 +26,8 @@ if (! check_acl ($config['id_user'], 0, "AW")) {
require_once ('include/functions_agents.php');
require_once ('include/functions_alerts.php');
require_once ($config['homedir'] . "/include/functions_modules.php");
require_once ($config['homedir'].'/include/functions_users.php');
if (is_ajax ()) {
$get_agents = (bool) get_parameter ('get_agents');
@ -96,11 +98,11 @@ if ($delete) {
$result = process_manage_delete ($id_alert_template, $id_agents, $module_names);
if ($result) {
pandora_audit("Masive management", "Delete alert ", false, false,
db_pandora_audit("Masive management", "Delete alert ", false, false,
'Agent: ' . json_encode($id_agents) . ' Template: ' . $id_alert_template . ' Module: ' . $module_names);
}
else {
pandora_audit("Masive management", "Fail try to delete alert", false, false,
db_pandora_audit("Masive management", "Fail try to delete alert", false, false,
'Agent: ' . json_encode($id_agents) . ' Template: ' . $id_alert_template . ' Module: ' . $module_names);
}
}

View File

@ -18,7 +18,7 @@
check_login ();
if (! check_acl ($config['id_user'], 0, "AW")) {
pandora_audit("ACL Violation",
db_pandora_audit("ACL Violation",
"Trying to access agent massive deletion");
require ("general/noaccess.php");
return;
@ -26,6 +26,7 @@ if (! check_acl ($config['id_user'], 0, "AW")) {
require_once ('include/functions_agents.php');
require_once ('include/functions_modules.php');
require_once ('include/functions_users.php');
if (is_ajax ()) {
$get_agents = (bool) get_parameter ('get_agents');
@ -56,20 +57,20 @@ function process_manage_delete ($module_name, $id_agents) {
return false;
}
process_sql_begin ();
db_process_sql_begin ();
$modules = get_agent_modules ($id_agents, 'id_agente_modulo',
array ('nombre' => $module_name), true);
$success = delete_agent_module ($modules);
if (! $success) {
echo '<h3 class="error">'.__('There was an error deleting the modules, the operation has been cancelled').'</h3>';
echo '<h4>'.__('Could not delete modules').'</h4>';
process_sql_rollback ();
db_process_sql_rollback ();
return false;
}
else {
echo '<h3 class="suc">'.__('Successfully deleted').'</h3>';
process_sql_commit ();
db_process_sql_commit ();
return true;
}
@ -84,11 +85,11 @@ $delete = (bool) get_parameter_post ('delete');
if ($delete) {
$result = process_manage_delete ($module_name, $id_agents);
if ($result) {
pandora_audit("Massive management", "Delete module ", false, false,
db_pandora_audit("Massive management", "Delete module ", false, false,
'Agent: ' . json_encode($id_agents) . ' Module: ' . $module_name);
}
else {
pandora_audit("Massive management", "Fail try to delete module", false, false,
db_pandora_audit("Massive management", "Fail try to delete module", false, false,
'Agent: ' . json_encode($id_agents) . ' Module: ' . $module_name);
}
}

View File

@ -18,7 +18,7 @@
check_login ();
if (! check_acl ($config['id_user'], 0, "AW")) {
pandora_audit("ACL Violation",
db_pandora_audit("ACL Violation",
"Trying to access massive alert deletion");
require ("general/noaccess.php");
return;
@ -26,6 +26,7 @@ if (! check_acl ($config['id_user'], 0, "AW")) {
require_once ('include/functions_agents.php');
require_once ('include/functions_alerts.php');
include_once($config['homedir'] . "/include/functions_profile.php");
if (is_ajax ()) {
$get_users = (bool) get_parameter ('get_users');
@ -34,7 +35,7 @@ if (is_ajax ()) {
$id_group = get_parameter ('id_group');
$id_profile = get_parameter ('id_profile');
$profile_data = get_db_all_rows_filter ("tusuario_perfil", array("id_perfil" => $id_profile[0], "id_grupo" => $id_group[0]));
$profile_data = db_get_all_rows_filter ("tusuario_perfil", array("id_perfil" => $id_profile[0], "id_grupo" => $id_group[0]));
echo json_encode (index_array ($profile_data, 'id_up', 'id_usuario'));
return;
@ -56,9 +57,9 @@ if ($delete_profiles) {
foreach($profiles_id as $profile) {
foreach($groups_id as $group) {
foreach($users_id as $id_up) {
$user = (string) get_db_value_filter ('id_usuario', 'tusuario_perfil', array('id_up' => $id_up));
$user = (string) db_get_value_filter ('id_usuario', 'tusuario_perfil', array('id_up' => $id_up));
pandora_audit("User management",
db_pandora_audit("User management",
"Deleted profile for user ".safe_input($user));
$result = delete_user_profile ($user, $id_up);
@ -68,11 +69,11 @@ if ($delete_profiles) {
}
if ($result) {
pandora_audit("Masive management", "Delete profile ", false, false,
db_pandora_audit("Masive management", "Delete profile ", false, false,
'Profiles: ' . json_encode($profiles_id) . ' Groups: ' . $groups_id . ' Users: ' . $users_id);
}
else {
pandora_audit("Masive management", "Fail try to delete profile", false, false,
db_pandora_audit("Masive management", "Fail try to delete profile", false, false,
'Profiles: ' . json_encode($profiles_id) . ' Groups: ' . $groups_id . ' Users: ' . $users_id);
}

View File

@ -17,7 +17,7 @@
check_login ();
if (! check_acl ($config['id_user'], 0, "AW")) {
pandora_audit("ACL Violation",
db_pandora_audit("ACL Violation",
"Trying to access massive agent deletion section");
require ("general/noaccess.php");
return;
@ -29,6 +29,7 @@ require_once ('include/functions_alerts.php');
require_once ('include/functions_modules.php');
require_once ('include/functions_servers.php');
require_once ('include/functions_gis.php');
require_once ('include/functions_users.php');
if (is_ajax ()) {
$get_n_conf_files = (bool) get_parameter ('get_n_conf_files');
@ -78,7 +79,7 @@ if ($update_agents) {
if (get_parameter ('delete_conf', 0) != 0)
$values['delete_conf'] = get_parameter('delete_conf');
$fields = get_db_all_fields_in_table('tagent_custom_fields');
$fields = db_get_all_fields_in_table('tagent_custom_fields');
if ($fields === false) $fields = array();
@ -108,10 +109,10 @@ if ($update_agents) {
if ($n_deleted > 0) {
pandora_audit("Masive management", "Delete conf file " . $id_agent);
db_pandora_audit("Masive management", "Delete conf file " . $id_agent);
}
else {
pandora_audit("Masive management", "Try to delete conf file " . $id_agent);
db_pandora_audit("Masive management", "Try to delete conf file " . $id_agent);
}
@ -128,7 +129,7 @@ if ($update_agents) {
$result = false;
foreach ($id_agents as $id_agent) {
if (!empty($values)) {
$result = process_sql_update ('tagente',
$result = db_process_sql_update ('tagente',
$values,
array ('id_agente' => $id_agent));
}
@ -139,15 +140,15 @@ if ($update_agents) {
$key = $field['id_field'];
$value = get_parameter_post ('customvalue_'.$field['id_field'], '');
$old_value = get_db_all_rows_filter('tagent_custom_data', array('id_agent' => $id_agent, 'id_field' => $key));
$old_value = db_get_all_rows_filter('tagent_custom_data', array('id_agent' => $id_agent, 'id_field' => $key));
if ($old_value === false) {
// Create custom field if not exist
$result = process_sql_insert ('tagent_custom_data',
$result = db_process_sql_insert ('tagent_custom_data',
array('id_field' => $key,'id_agent' => $id_agent, 'description' => $value));
}
else {
$result = process_sql_update ('tagent_custom_data',
$result = db_process_sql_update ('tagent_custom_data',
array('description' => $value),
array('id_field' => $key,'id_agent' => $id_agent));
}
@ -159,10 +160,10 @@ if ($update_agents) {
if ($result !== false) {
pandora_audit("Masive management", "Update agent " . $id_agent, false, false, json_encode($fields));
db_pandora_audit("Masive management", "Update agent " . $id_agent, false, false, json_encode($fields));
}
else {
pandora_audit("Masive management", "Try to update agent " . $id_agent, false, false, json_encode($fields));
db_pandora_audit("Masive management", "Try to update agent " . $id_agent, false, false, json_encode($fields));
}
@ -346,7 +347,7 @@ $table->style = array ();
$table->style[0] = 'font-weight: bold; width: 150px;';
$table->data = array ();
$fields = get_db_all_fields_in_table('tagent_custom_fields');
$fields = db_get_all_fields_in_table('tagent_custom_fields');
if ($fields === false) $fields = array();
@ -354,7 +355,7 @@ foreach ($fields as $field) {
$data[0] = '<b>'.$field['name'].'</b>';
$custom_value = get_db_value_filter('description', 'tagent_custom_data', array('id_field' => $field['id_field'], 'id_agent' => $id_agente));
$custom_value = db_get_value_filter('description', 'tagent_custom_data', array('id_field' => $field['id_field'], 'id_agent' => $id_agente));
if ($custom_value === false) {
$custom_value = '';

View File

@ -17,13 +17,16 @@
check_login ();
if (! check_acl ($config['id_user'], 0, "PM")) {
pandora_audit("ACL Violation",
db_pandora_audit("ACL Violation",
"Trying to access massive module update");
require ("general/noaccess.php");
return;
}
require_once ('include/functions_modules.php');
require_once($config['homedir'] . "/include/functions_agents.php");
require_once($config['homedir'] . "/include/functions_groups.php");
require_once($config['homedir'] . '/include/functions_users.php');
function process_manage_edit ($module_name, $agents_select = null) {
if (is_int ($module_name) && $module_name <= 0) {
@ -45,12 +48,12 @@ function process_manage_edit ($module_name, $agents_select = null) {
$values['history_data'] = get_parameter('history_data');
}
$modules = get_db_all_rows_filter ('tagente_modulo',
$modules = db_get_all_rows_filter ('tagente_modulo',
array ('id_agente' => $agents_select,
'nombre' => $module_name),
array ('id_agente_modulo'));
process_sql_begin ();
db_process_sql_begin ();
if ($modules === false)
return false;
@ -59,13 +62,13 @@ function process_manage_edit ($module_name, $agents_select = null) {
$result = update_agent_module ($module['id_agente_modulo'], $values, true);
if ($result === false) {
process_sql_rollback ();
db_process_sql_rollback ();
return false;
}
}
process_sql_commit ();
db_process_sql_commit ();
return true;
}
@ -119,11 +122,11 @@ if ($update) {
if($module_type != 0)
$condition = ' AND t2.id_tipo_modulo = '.$module_type;
$agents_ = get_db_all_rows_sql('SELECT DISTINCT(t1.id_agente)
$agents_ = db_get_all_rows_sql('SELECT DISTINCT(t1.id_agente)
FROM tagente t1, tagente_modulo t2
WHERE t1.id_agente = t2.id_agente');
foreach($agents_ as $id_agent) {
$module_name = get_db_all_rows_filter('tagente_modulo', array('id_agente' => $id_agent, 'id_tipo_modulo' => $module_type),'nombre');
$module_name = db_get_all_rows_filter('tagente_modulo', array('id_agente' => $id_agent, 'id_tipo_modulo' => $module_type),'nombre');
if($module_name == false) {
$module_name = array();
@ -138,7 +141,7 @@ if ($update) {
else if($force == 'group') {
$agents_ = array_keys (get_group_agents ($group_select, false, "none"));
foreach($agents_ as $id_agent) {
$module_name = get_db_all_rows_filter('tagente_modulo', array('id_agente' => $id_agent),'nombre');
$module_name = db_get_all_rows_filter('tagente_modulo', array('id_agente' => $id_agent),'nombre');
if($module_name == false) {
$module_name = array();
}
@ -173,10 +176,10 @@ if ($update) {
$info = 'Modules: ' . json_encode($modules_) . ' Agents: ' . json_encode($agents_);
if ($success > 0) {
pandora_audit("Masive management", "Edit module", false, false, $info);
db_pandora_audit("Masive management", "Edit module", false, false, $info);
}
else {
pandora_audit("Masive management", "Fail try to edit module", false, false, $info);
db_pandora_audit("Masive management", "Fail try to edit module", false, false, $info);
}
}
@ -203,7 +206,7 @@ if (! $module_type) {
$table->rowstyle['edit7'] = 'display: none';
}
$agents = get_group_agents (array_keys (get_user_groups ()), false, "none");
$module_types = get_db_all_rows_filter ('tagente_modulo,ttipo_modulo',
$module_types = db_get_all_rows_filter ('tagente_modulo,ttipo_modulo',
array ('tagente_modulo.id_tipo_modulo = ttipo_modulo.id_tipo',
'id_agente' => array_keys ($agents),
'disabled' => 0,

View File

@ -18,7 +18,7 @@
check_login ();
if (! check_acl ($config['id_user'], 0, "AW")) {
pandora_audit("ACL Violation",
db_pandora_audit("ACL Violation",
"Trying to access massive alert deletion");
require ("general/noaccess.php");
return;
@ -26,6 +26,7 @@ if (! check_acl ($config['id_user'], 0, "AW")) {
require_once ('include/functions_agents.php');
require_once ('include/functions_alerts.php');
require_once ('include/functions_users.php');
if (is_ajax ()) {
$get_alerts = (bool) get_parameter ('get_alerts');
@ -76,10 +77,10 @@ switch($action) {
$info = 'Alert: ' . json_encode($id_disabled_alerts);
if ($result) {
pandora_audit("Masive management", "Enable alert", false, false, $info);
db_pandora_audit("Masive management", "Enable alert", false, false, $info);
}
else {
pandora_audit("Masive management", "Fail try to enable alert", false, false, $info);
db_pandora_audit("Masive management", "Fail try to enable alert", false, false, $info);
}
break;
case 'disable_alerts':
@ -94,10 +95,10 @@ switch($action) {
$info = 'Alert: ' . json_encode($id_disabled_alerts);
if ($result) {
pandora_audit("Masive management", "Disaable alert", false, false, $info);
db_pandora_audit("Masive management", "Disaable alert", false, false, $info);
}
else {
pandora_audit("Masive management", "Fail try to Disable alert", false, false, $info);
db_pandora_audit("Masive management", "Fail try to Disable alert", false, false, $info);
}
break;
default:

View File

@ -17,7 +17,7 @@
check_login ();
if (! check_acl ($config['id_user'], 0, "AW")) {
pandora_audit("ACL Violation",
db_pandora_audit("ACL Violation",
"Trying to access massive operation section");
require ("general/noaccess.php");
return;

View File

@ -18,7 +18,7 @@
check_login ();
if (! check_acl ($config['id_user'], 0, "AW")) {
pandora_audit("ACL Violation",
db_pandora_audit("ACL Violation",
"Trying to access massive alert deletion");
require ("general/noaccess.php");
return;
@ -26,6 +26,7 @@ if (! check_acl ($config['id_user'], 0, "AW")) {
require_once ('include/functions_agents.php');
require_once ('include/functions_alerts.php');
require_once ('include/functions_users.php');
if (is_ajax ()) {
$get_alerts = (bool) get_parameter ('get_alerts');
@ -77,10 +78,10 @@ switch($action) {
$info = 'Alert: ' . json_encode($id_standby_alerts);
if ($result) {
pandora_audit("Masive management", "Set off standby alerts", false, false, $info);
db_pandora_audit("Masive management", "Set off standby alerts", false, false, $info);
}
else {
pandora_audit("Masive management", "Fail try to set off standby alerts", false, false, $info);
db_pandora_audit("Masive management", "Fail try to set off standby alerts", false, false, $info);
}
break;
case 'set_standby_alerts':
@ -95,10 +96,10 @@ switch($action) {
$info = 'Alert: ' . json_encode($id_not_standby_alerts);
if ($result) {
pandora_audit("Masive management", "Set on standby alerts", false, false, $info);
db_pandora_audit("Masive management", "Set on standby alerts", false, false, $info);
}
else {
pandora_audit("Masive management", "Fail try to set on standby alerts", false, false, $info);
db_pandora_audit("Masive management", "Fail try to set on standby alerts", false, false, $info);
}
break;
default:

View File

@ -19,7 +19,7 @@ global $config;
check_login ();
if (! check_acl ($config['id_user'], 0, "PM")) {
pandora_audit("ACL Violation",
db_pandora_audit("ACL Violation",
"Trying to access SNMP Group Management");
require ("general/noaccess.php");
return;
@ -41,7 +41,7 @@ if ($create) {
$name = (string) get_parameter ('name');
$parent = (int) get_parameter ('parent');
$result = process_sql_insert ('tnetwork_component_group',
$result = db_process_sql_insert ('tnetwork_component_group',
array ('name' => $name,
'parent' => $parent));
ui_print_result_message ($result,
@ -53,7 +53,7 @@ if ($update) {
$name = (string) get_parameter ('name');
$parent = (int) get_parameter ('parent');
$result = process_sql_update ('tnetwork_component_group',
$result = db_process_sql_update ('tnetwork_component_group',
array ('name' => $name,
'parent' => $parent),
array ('id_sg' => $id));
@ -63,7 +63,7 @@ if ($update) {
}
if ($delete) {
$result = process_sql_delete ('tnetwork_component_group',
$result = db_process_sql_delete ('tnetwork_component_group',
array ('id_sg' => $id));
ui_print_result_message ($result,
__('Successfully deleted'),
@ -100,14 +100,14 @@ $table->size[1] = '50%';
$table->size[2] = '40px';
$table->data = array ();
$total_groups = get_db_all_rows_filter ('tnetwork_component_group', false, 'COUNT(*) AS total');
$total_groups = db_get_all_rows_filter ('tnetwork_component_group', false, 'COUNT(*) AS total');
$total_groups = $total_groups[0]['total'];
$filter = array ();
$filter['offset'] = (int) get_parameter ('offset');
$filter['limit'] = (int) $config['block_size'];
$groups = get_db_all_rows_filter ('tnetwork_component_group', $filter);
$groups = db_get_all_rows_filter ('tnetwork_component_group', $filter);
if ($groups === false)
$groups = array ();

View File

@ -19,7 +19,7 @@ global $config;
check_login ();
if (! check_acl ($config['id_user'], 0, "PM")) {
pandora_audit("ACL Violation",
db_pandora_audit("ACL Violation",
"Trying to access SNMO Groups Management");
require ("general/noaccess.php");
exit;

View File

@ -19,7 +19,7 @@ global $config;
check_login ();
if (! check_acl ($config['id_user'], 0, "PM")) {
pandora_audit("ACL Violation",
db_pandora_audit("ACL Violation",
"Trying to access Agent Management");
require ("general/noaccess.php");
exit;

View File

@ -19,7 +19,7 @@ global $config;
check_login ();
if (! check_acl ($config['id_user'], 0, "PM")) {
pandora_audit("ACL Violation",
db_pandora_audit("ACL Violation",
"Trying to access Agent Management");
require ("general/noaccess.php");
exit;

View File

@ -16,7 +16,7 @@
global $config;
if (! check_acl ($config['id_user'], 0, "PM")) {
pandora_audit("ACL Violation",
db_pandora_audit("ACL Violation",
"Trying to access Agent Management");
require ("general/noaccess.php");
return;

View File

@ -19,7 +19,7 @@ global $config;
check_login ();
if (! check_acl ($config['id_user'], 0, "PM")) {
pandora_audit("ACL Violation",
db_pandora_audit("ACL Violation",
"Trying to access Agent Management");
require ("general/noaccess.php");
return;

View File

@ -20,12 +20,14 @@ global $config;
check_login ();
if (! check_acl ($config['id_user'], 0, "PM")) {
pandora_audit("ACL Violation",
db_pandora_audit("ACL Violation",
"Trying to access Agent Management");
require ("general/noaccess.php");
return;
}
include_once($config['homedir'] . "/include/functions_modules.php");
echo "<h3>".__('WMI component management').'</h3>';
$data = array ();
@ -90,7 +92,7 @@ echo '<td class="datos2">';
echo '<select name="tipo">';
echo '<option value="' . $type . '">' . get_moduletype_name ($type);
$rows = get_db_all_rows_sql('SELECT id_tipo, nombre
$rows = db_get_all_rows_sql('SELECT id_tipo, nombre
FROM ttipo_modulo WHERE categoria IN (0,1,2) ORDER BY nombre;');
if ($rows === false) {
$rows = array();
@ -117,7 +119,7 @@ if ($id) {
echo '<option value="' . $id_module_group . '">' . get_modulegroup_name($id_module_group);
}
$rows = get_db_all_rows_in_table('tmodule_group');
$rows = db_get_all_rows_in_table('tmodule_group');
if ($rows === false) {
$rows = array();
}

View File

@ -20,7 +20,7 @@ global $config;
check_login ();
if (! check_acl ($config['id_user'], 0, "PM")) {
pandora_audit("ACL Violation",
db_pandora_audit("ACL Violation",
"Trying to access Network Profile Management");
require ("general/noaccess.php");
return;
@ -93,7 +93,7 @@ if ($export_profile) {
break;
}
$components = get_db_all_rows_sql ($sql);
$components = db_get_all_rows_sql ($sql);
$row_names = array ();
$inv_names = array ();
@ -133,7 +133,7 @@ if ($export_profile) {
exit;
}
$result = get_db_all_rows_in_table ("tnetwork_profile", "name");
$result = db_get_all_rows_in_table ("tnetwork_profile", "name");
$table->cellpadding = 4;
$table->cellspacing = 4;

View File

@ -20,13 +20,14 @@ check_login ();
if (! check_acl ($config['id_user'], 0, "PM")) {
pandora_audit("ACL Violation",
db_pandora_audit("ACL Violation",
"Trying to access Network Profile Management");
require ("general/noaccess.php");
exit;
}
require_once ('include/functions_network_components.php');
require_once ("include/functions_modules.php");
ui_print_page_header (__('Module management')." &raquo; ".__('Module template management'), "", false, "", true);
@ -41,7 +42,7 @@ if (isset ($_GET["delete_module"])) {
$where = array(
'id_np' => $id_np,
'id_nc' => $component);
$result = process_sql_delete('tnetwork_profile_component', $where);
$result = db_process_sql_delete('tnetwork_profile_component', $where);
if ($result === false) {
$errors++;
@ -57,7 +58,7 @@ elseif (isset ($_GET["add_module"])) {
$errors = 0;
foreach ($id_nc as $component) {
$values = array('id_np' => $id_np, 'id_nc' => $component);
$result = process_sql_insert('tnetwork_profile_component', $values);
$result = db_process_sql_insert('tnetwork_profile_component', $values);
if ($result === false) {
$errors++;
@ -79,7 +80,7 @@ if (isset ($_GET["create"]) || isset ($_GET["update"])) {
$values = array(
'name' => $name,
'description' => $description);
$result = process_sql_update('tnetwork_profile', $values, array('id_np' => $id_np));
$result = db_process_sql_update('tnetwork_profile', $values, array('id_np' => $id_np));
ui_print_result_message ($result !== false,
__('Successfully updated network profile'),
@ -88,7 +89,7 @@ if (isset ($_GET["create"]) || isset ($_GET["update"])) {
else {
//Profile doesn't exist
$values = array('name' => $name, 'description' => $description);
$result = process_sql_insert('tnetwork_profile', $values);
$result = db_process_sql_insert('tnetwork_profile', $values);
ui_print_result_message ($result,
__('Successfully added network profile'),
@ -99,7 +100,7 @@ if (isset ($_GET["create"]) || isset ($_GET["update"])) {
}
elseif ($id_np > 0) {
//Profile exists
$row = get_db_row ("tnetwork_profile", "id_np", $id_np);
$row = db_get_row ("tnetwork_profile", "id_np", $id_np);
$description = $row["description"];
$name = $row["name"];
@ -158,7 +159,7 @@ if ($id_np > 0) {
break;
}
$result = get_db_all_rows_sql ($sql);
$result = db_get_all_rows_sql ($sql);
if (empty ($result)) {
echo '<div style="width:550px;" class="error">' . __("No modules for this profile") . '</div>';
@ -208,7 +209,7 @@ if ($id_np > 0) {
//The form to submit when adding a list of components
echo '<form name="filter_group" method="post" action="index.php?sec=gmodules&sec2=godmode/modules/manage_network_templates_form&id_np='.$id_np.'#filter">';
echo '<div style="width:540px"><a name="filter"></a>';
$result = get_db_all_rows_in_table ("tnetwork_component_group","name");
$result = db_get_all_rows_in_table ("tnetwork_component_group","name");
//2 arrays. 1 with the groups, 1 with the groups by parent
$groups = array ();
@ -239,7 +240,7 @@ if ($id_np > 0) {
$sql = "SELECT id_nc, name, id_group FROM tnetwork_component ORDER BY name";
}
$result = get_db_all_rows_sql ($sql);
$result = db_get_all_rows_sql ($sql);
$components = array ();
if ($result === false)
$result = array ();

View File

@ -19,7 +19,7 @@ global $config;
check_login ();
if (! check_acl ($config['id_user'], 0, "PM")) {
pandora_audit("ACL Violation","Trying to access module management");
db_pandora_audit("ACL Violation","Trying to access module management");
require ("general/noaccess.php");
exit;
}
@ -44,7 +44,7 @@ if ($update_module) {
'icon' => $icon
);
$result = process_sql_update('ttipo_modulo', $values, array('id_tipo' => $id_type));
$result = db_process_sql_update('ttipo_modulo', $values, array('id_tipo' => $id_type));
if (! $result)
echo "<h3 class='error'>".__('Problem modifying module')."</h3>";
@ -59,7 +59,7 @@ echo "<th>".__('ID')."</th>";
echo "<th>".__('Name')."</th>";
echo "<th>".__('Description')."</th>";
$rows = get_db_all_rows_sql('SELECT * FROM ttipo_modulo ORDER BY nombre');
$rows = db_get_all_rows_sql('SELECT * FROM ttipo_modulo ORDER BY nombre');
if ($rows === false) {
$rows = array();
}

View File

@ -18,12 +18,16 @@ global $config;
check_login ();
if (! check_acl ($config['id_user'], 0, "IW")) {
pandora_audit("ACL Violation",
db_pandora_audit("ACL Violation",
"Trying to access graph builder");
include ("general/noaccess.php");
exit;
}
require_once($config['homedir'] . "/include/functions_agents.php");
require_once($config['homedir'] . "/include/functions_modules.php");
require_once($config['homedir'] . "/include/functions_groups.php");
$editGraph = (bool) get_parameter('edit_graph', 0);
if (isset ($_GET["get_agent"])) {
@ -33,7 +37,7 @@ if (isset ($_GET["get_agent"])) {
}
if ($editGraph) {
$graphRows = get_db_all_rows_sql("SELECT t1.*,
$graphRows = db_get_all_rows_sql("SELECT t1.*,
(SELECT t3.nombre
FROM tagente AS t3
WHERE t3.id_agente =
@ -58,7 +62,7 @@ if ($editGraph) {
$agent_array[] = $graphRow['agent_name'];
}
$graphInTgraph = get_db_row_sql("SELECT * FROM tgraph WHERE id_graph = " . $id);
$graphInTgraph = db_get_row_sql("SELECT * FROM tgraph WHERE id_graph = " . $id);
$stacked = $graphInTgraph['stacked'];
$events = $graphInTgraph['events'];
$period = $graphInTgraph['period'];

View File

@ -47,14 +47,14 @@ if (is_ajax ()) {
check_login ();
if (! check_acl ($config['id_user'], 0, "IW")) {
pandora_audit("ACL Violation",
db_pandora_audit("ACL Violation",
"Trying to access graph builder");
include ("general/noaccess.php");
exit;
}
if ($edit_graph) {
$graphInTgraph = get_db_row_sql("SELECT * FROM tgraph WHERE id_graph = " . $id_graph);
$graphInTgraph = db_get_row_sql("SELECT * FROM tgraph WHERE id_graph = " . $id_graph);
$stacked = $graphInTgraph['stacked'];
$events = $graphInTgraph['events'];
$period = $graphInTgraph['period'];

View File

@ -47,7 +47,7 @@ if (is_ajax ()) {
check_login ();
if (! check_acl ($config['id_user'], 0, "IW")) {
pandora_audit("ACL Violation",
db_pandora_audit("ACL Violation",
"Trying to access graph builder");
include ("general/noaccess.php");
exit;
@ -79,7 +79,7 @@ if ($add_graph) {
'stacked' => $stacked);
if (trim($name) != "") {
$id_graph = process_sql_insert('tgraph', $values);
$id_graph = db_process_sql_insert('tgraph', $values);
} else {
$id_graph = false;
}
@ -102,7 +102,7 @@ if ($update_graph) {
if (trim($name) != "") {
$success = process_sql_update('tgraph',
$success = db_process_sql_update('tgraph',
array('name' => $name, 'id_group' => $id_group, 'description' => $description, 'width' => $width, 'height' => $height, 'period' => $period, 'stacked' => $stacked, 'events' => $events),
array('id_graph' => $id_graph));
} else {
@ -121,7 +121,7 @@ if ($add_module) {
$id_agents = get_parameter('id_agents');
$weight = get_parameter('weight');
$id_agent_modules = get_db_all_rows_sql("SELECT id_agente_modulo FROM tagente_modulo WHERE id_agente IN (".
$id_agent_modules = db_get_all_rows_sql("SELECT id_agente_modulo FROM tagente_modulo WHERE id_agente IN (".
implode(',', $id_agents).
") AND nombre IN ('".
implode("','", $id_modules).
@ -129,7 +129,7 @@ if ($add_module) {
if (count($id_agent_modules) > 0 && $id_agent_modules != '') {
foreach($id_agent_modules as $id_agent_module)
$result = process_sql_insert('tgraph_source', array('id_graph' => $id_graph, 'id_agent_module' => $id_agent_module['id_agente_modulo'], 'weight' => $weight));
$result = db_process_sql_insert('tgraph_source', array('id_graph' => $id_graph, 'id_agent_module' => $id_agent_module['id_agente_modulo'], 'weight' => $weight));
}
else
$result = false;
@ -137,13 +137,13 @@ if ($add_module) {
if ($delete_module) {
$deleteGraph = get_parameter('delete');
$result = process_sql_delete('tgraph_source', array('id_gs' => $deleteGraph));
$result = db_process_sql_delete('tgraph_source', array('id_gs' => $deleteGraph));
}
if($change_weight){
$weight = get_parameter ('weight');
$id_gs = get_parameter ('graph');
process_sql_update('tgraph_source',
db_process_sql_update('tgraph_source',
array('weight' => $weight),
array('id_gs' => $id_gs));
}
@ -163,7 +163,7 @@ if($edit_graph) {
$buttons[$active_tab]['active'] = true;
$graphInTgraph = get_db_row_sql("SELECT name FROM tgraph WHERE id_graph = " . $id_graph);
$graphInTgraph = db_get_row_sql("SELECT name FROM tgraph WHERE id_graph = " . $id_graph);
$name = $graphInTgraph['name'];
}
else {

View File

@ -49,7 +49,7 @@ if (is_ajax ()) {
check_login ();
if (! check_acl ($config['id_user'], 0, "IW")) {
pandora_audit("ACL Violation",
db_pandora_audit("ACL Violation",
"Trying to access graph builder");
include ("general/noaccess.php");
exit;
@ -58,10 +58,10 @@ if (! check_acl ($config['id_user'], 0, "IW")) {
$id = (integer) get_parameter('id');
$sql="SELECT * FROM tgraph_source WHERE id_graph = $id_graph";
$sources = get_db_all_rows_sql($sql);
$sources = db_get_all_rows_sql($sql);
$sql="SELECT * FROM tgraph WHERE id_graph = $id_graph";
$graph = get_db_row_sql($sql);
$graph = db_get_row_sql($sql);
$id_user = $graph["id_user"];
$private = $graph["private"];
@ -106,7 +106,7 @@ if ($stacked == -1)
$name = $graph["name"];
$graphRows = get_db_all_rows_sql("SELECT t1.*,
$graphRows = db_get_all_rows_sql("SELECT t1.*,
(SELECT t3.nombre
FROM tagente AS t3
WHERE t3.id_agente =

View File

@ -21,7 +21,7 @@ require_once ('include/functions_custom_graphs.php');
check_login ();
if (! check_acl ($config['id_user'], 0, "IW")) {
pandora_audit("ACL Violation",
db_pandora_audit("ACL Violation",
"Trying to access Inventory Module Management");
require ("general/noaccess.php");
return;
@ -37,14 +37,14 @@ ui_print_page_header (__('Graphs management'), "", false, "", true);
// Delete module SQL code
if ($delete_graph) {
if (check_acl ($config['id_user'], 0, "AW")) {
$result = process_sql_delete("tgraph_source", array('id_graph' =>$id));
$result = db_process_sql_delete("tgraph_source", array('id_graph' =>$id));
if ($result)
$result = "<h3 class=suc>".__('Successfully deleted')."</h3>";
else
$result = "<h3 class=error>".__('Not deleted. Error deleting data')."</h3>";
$result = process_sql_delete("tgraph", array('id_graph' =>$id));
$result = db_process_sql_delete("tgraph", array('id_graph' =>$id));
if ($result)
$result = "<h3 class=suc>".__('Successfully deleted')."</h3>";
@ -54,7 +54,7 @@ if ($delete_graph) {
echo $result;
}
else {
pandora_audit("ACL Violation","Trying to delete a graph from access graph builder");
db_pandora_audit("ACL Violation","Trying to delete a graph from access graph builder");
include ("general/noaccess.php");
exit;
}

View File

@ -24,11 +24,11 @@ $copy_layout = (bool) get_parameter ('copy_layout');
$delete_layout = (bool) get_parameter ('delete_layout');
if ($delete_layout) {
process_sql_delete ('tlayout_data', array ('id_layout' => $id_layout));
$result = process_sql_delete ('tlayout', array ('id' => $id_layout));
db_process_sql_delete ('tlayout_data', array ('id_layout' => $id_layout));
$result = db_process_sql_delete ('tlayout', array ('id' => $id_layout));
if ($result) {
echo '<h3 class="suc">'.__('Successfully deleted').'</h3>';
clean_cache();
db_clean_cache();
} else {
echo '<h3 class="error">'.__('Not deleted. Error deleting data').'</h3>';
}
@ -40,7 +40,7 @@ if ($copy_layout) {
$ninsert = (int) 0;
// Return from DB the source layout
$layout_src = get_db_all_rows_filter ("tlayout","id = " . $id_layout);
$layout_src = db_get_all_rows_filter ("tlayout","id = " . $id_layout);
// Name of dst
$name_dst = get_parameter ("name_dst", $layout_src[0]['name'] . " copy");
@ -53,7 +53,7 @@ if ($copy_layout) {
$visualConsoleName = $name_dst;
$values = array('name' => $visualConsoleName, 'id_group' => $idGroup, 'background' => $background, 'height' => $height, 'width' => $width);
$result = process_sql_insert('tlayout', $values);
$result = db_process_sql_insert('tlayout', $values);
$idNewVisualConsole = $result;
@ -61,7 +61,7 @@ if ($copy_layout) {
$ninsert = 1;
// Return from DB the items of the source layout
$data_layout_src = get_db_all_rows_filter ("tlayout_data", "id_layout = " . $id_layout);
$data_layout_src = db_get_all_rows_filter ("tlayout_data", "id_layout = " . $id_layout);
if(!empty($data_layout_src)){
for ($a=0;$a < count($data_layout_src); $a++) {
@ -73,7 +73,7 @@ if ($copy_layout) {
unset($data_layout_src[$a]['id']);
// Configure the cloned Console
$result = process_sql_insert('tlayout_data', $data_layout_src[$a]);
$result = db_process_sql_insert('tlayout_data', $data_layout_src[$a]);
if($result)
$ninsert++;
@ -84,7 +84,7 @@ if ($copy_layout) {
// If the number of inserts is correct, the copy is completed
if ($ninsert == $inserts) {
echo '<h3 class="suc">'.__('Successfully copied').'</h3>';
clean_cache();
db_clean_cache();
} else {
echo '<h3 class="error">'.__('Not copied. Error copying data').'</h3>';
}
@ -92,7 +92,7 @@ if ($copy_layout) {
else{
// If the array is empty the copy is completed
echo '<h3 class="suc">'.__('Successfully copied').'</h3>';
clean_cache();
db_clean_cache();
}
}
else {
@ -131,7 +131,7 @@ if (!$maps) {
$data[0] = '<a href="index.php?sec=gmap&sec2=godmode/reporting/visual_console_builder&tab=data&amp;action=edit&amp;id_visual_console='.$map['id'].'">'.$map['name'].'</a>';
$data[1] = ui_print_group_icon ($map['id_group'], true);
$data[2] = get_db_sql ("SELECT COUNT(*) FROM tlayout_data WHERE id_layout = ".$map['id']);
$data[2] = db_get_sql ("SELECT COUNT(*) FROM tlayout_data WHERE id_layout = ".$map['id']);
$data[3] = '<a href="index.php?sec=gmap&amp;sec2=godmode/reporting/map_builder&amp;id_layout='.$map['id'].'&amp;copy_layout=1">'.print_image ("images/copy.png", true).'</a>';
$data[4] = '<a href="index.php?sec=gmap&amp;sec2=godmode/reporting/map_builder&amp;id_layout='.$map['id'].'&amp;delete_layout=1">'.print_image ("images/cross.png", true).'</a>';

View File

@ -17,7 +17,7 @@ global $config;
check_login ();
if (! check_acl ($config['id_user'], 0, "IW")) {
pandora_audit("ACL Violation",
db_pandora_audit("ACL Violation",
"Trying to access report builder");
require ("general/noaccess.php");
exit;
@ -28,6 +28,7 @@ $show_graph_options[1] = __('Table & Graph');
$show_graph_options[2] = __('Only graph');
enterprise_include('/godmode/reporting/reporting_builder.item_editor.php');
require_once ($config['homedir'].'/include/functions_agents.php');
switch ($action) {
case 'new':
@ -69,7 +70,7 @@ switch ($action) {
break;
default:
$actionParameter = 'update';
$item = get_db_row_filter('treport_content', array('id_rc' => $idItem));
$item = db_get_row_filter('treport_content', array('id_rc' => $idItem));
$style = json_decode(safe_output($item['style']), true);
$show_in_two_columns = $style['show_in_two_columns'];
@ -81,13 +82,13 @@ switch ($action) {
$period = $item['period'];
$description = $item['description'];
$idAgentModule = $item['id_agent_module'];
$idAgent = get_db_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule));
$idAgent = db_get_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule));
break;
case 'simple_baseline_graph':
case 'simple_graph':
$description = $item['description'];
$idAgentModule = $item['id_agent_module'];
$idAgent = get_db_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule));
$idAgent = db_get_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule));
$period = $item['period'];
break;
case 'custom_graph':
@ -113,35 +114,35 @@ switch ($action) {
case 'monitor_report':
$description = $item['description'];
$idAgentModule = $item['id_agent_module'];
$idAgent = get_db_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule));
$idAgent = db_get_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule));
$idAgentModule = $item['id_agent_module'];
$period = $item['period'];
break;
case 'avg_value':
$description = $item['description'];
$idAgentModule = $item['id_agent_module'];
$idAgent = get_db_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule));
$idAgent = db_get_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule));
$idAgentModule = $item['id_agent_module'];
$period = $item['period'];
break;
case 'max_value':
$description = $item['description'];
$idAgentModule = $item['id_agent_module'];
$idAgent = get_db_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule));
$idAgent = db_get_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule));
$idAgentModule = $item['id_agent_module'];
$period = $item['period'];
break;
case 'min_value':
$description = $item['description'];
$idAgentModule = $item['id_agent_module'];
$idAgent = get_db_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule));
$idAgent = db_get_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule));
$idAgentModule = $item['id_agent_module'];
$period = $item['period'];
break;
case 'sumatory':
$description = $item['description'];
$idAgentModule = $item['id_agent_module'];
$idAgent = get_db_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule));
$idAgent = db_get_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule));
$idAgentModule = $item['id_agent_module'];
$period = $item['period'];
break;
@ -177,7 +178,7 @@ switch ($action) {
case 'database_serialized':
$description = $item['description'];
$idAgentModule = $item['id_agent_module'];
$idAgent = get_db_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule));
$idAgent = db_get_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule));
$header = $item['header_definition'];
$field = $item['column_separator'];
$line = $item['line_separator'];
@ -186,31 +187,31 @@ switch ($action) {
case 'TTRT':
$description = $item['description'];
$idAgentModule = $item['id_agent_module'];
$idAgent = get_db_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule));
$idAgent = db_get_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule));
$period = $item['period'];
break;
case 'TTO':
$description = $item['description'];
$idAgentModule = $item['id_agent_module'];
$idAgent = get_db_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule));
$idAgent = db_get_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule));
$period = $item['period'];
break;
case 'MTBF':
$description = $item['description'];
$idAgentModule = $item['id_agent_module'];
$idAgent = get_db_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule));
$idAgent = db_get_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule));
$period = $item['period'];
break;
case 'MTTR':
$description = $item['description'];
$idAgentModule = $item['id_agent_module'];
$idAgent = get_db_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule));
$idAgent = db_get_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule));
$period = $item['period'];
break;
case 'alert_report_module':
$description = $item['description'];
$idAgentModule = $item['id_agent_module'];
$idAgent = get_db_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule));
$idAgent = db_get_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule));
$period = $item['period'];
break;
case 'alert_report_agent':
@ -231,7 +232,7 @@ switch ($action) {
case 'event_report_module':
$description = $item['description'];
$idAgentModule = $item['id_agent_module'];
$idAgent = get_db_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule));
$idAgent = db_get_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule));
$period = $item['period'];
break;
case 'general':
@ -542,14 +543,14 @@ function print_SLA_list($width, $action, $idItem = null) {
case 'update':
case 'edit':
echo '<tbody id="list_sla">';
$itemsSLA = get_db_all_rows_filter('treport_content_sla_combined', array('id_report_content' => $idItem));
$itemsSLA = db_get_all_rows_filter('treport_content_sla_combined', array('id_report_content' => $idItem));
if ($itemsSLA === false) {
$itemsSLA = array();
}
foreach ($itemsSLA as $item) {
$idAgent = get_db_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $item['id_agent_module']));
$idAgent = db_get_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $item['id_agent_module']));
$nameAgent = get_agent_name ($idAgent);
$nameModule = get_db_value_filter('nombre', 'tagente_modulo', array('id_agente_modulo' => $item['id_agent_module']));
$nameModule = db_get_value_filter('nombre', 'tagente_modulo', array('id_agente_modulo' => $item['id_agent_module']));
echo '<tr id="sla_' . $item['id'] . '" style="" class="datos">
<td>' . printSmallFont($nameAgent) . '</td>
@ -620,14 +621,14 @@ function print_General_list($width, $action, $idItem = null) {
case 'update':
case 'edit':
echo '<tbody id="list_general">';
$itemsGeneral = get_db_all_rows_filter('treport_content_item', array('id_report_content' => $idItem));
$itemsGeneral = db_get_all_rows_filter('treport_content_item', array('id_report_content' => $idItem));
if ($itemsGeneral === false) {
$itemsGeneral = array();
}
foreach ($itemsGeneral as $item) {
$idAgent = get_db_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $item['id_agent_module']));
$idAgent = db_get_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $item['id_agent_module']));
$nameAgent = get_agent_name ($idAgent);
$nameModule = get_db_value_filter('nombre', 'tagente_modulo', array('id_agente_modulo' => $item['id_agent_module']));
$nameModule = db_get_value_filter('nombre', 'tagente_modulo', array('id_agente_modulo' => $item['id_agent_module']));
echo '<tr id="general_' . $item['id'] . '" style="" class="datos">
<td>' . printSmallFont($nameAgent) . '</td>

View File

@ -17,14 +17,16 @@ global $config;
check_login ();
if (! check_acl ($config['id_user'], 0, "IW")) {
pandora_audit("ACL Violation",
db_pandora_audit("ACL Violation",
"Trying to access report builder");
require ("general/noaccess.php");
exit;
}
include_once($config['homedir'] . "/include/functions_agents.php");
//FORM FILTER
$rows = get_db_all_rows_sql('
$rows = db_get_all_rows_sql('
SELECT t5.nombre, t5.id_agente
FROM
(
@ -46,7 +48,7 @@ foreach ($rows as $row) {
$agents[$row['id_agente']] = $row['nombre'];
}
$rows = get_db_all_rows_sql('
$rows = db_get_all_rows_sql('
SELECT t1.id_agent_module, t2.nombre
FROM treport_content AS t1
INNER JOIN tagente_modulo AS t2
@ -61,7 +63,7 @@ foreach ($rows as $row) {
$modules[$row['id_agent_module']] = $row['nombre'];
}
$rows = get_db_all_rows_sql('
$rows = db_get_all_rows_sql('
SELECT DISTINCT(type)
FROM treport_content
WHERE id_report = ' . $idReport);
@ -122,14 +124,14 @@ if($moduleFilter != 0) {
switch ($config["dbtype"]) {
case "mysql":
$items = get_db_all_rows_sql('SELECT *
$items = db_get_all_rows_sql('SELECT *
FROM treport_content
WHERE ' . $where . ' AND id_report = ' . $idReport . '
ORDER BY `order`
LIMIT ' . $offset . ', ' . $config["block_size"]);
break;
case "postgresql":
$items = get_db_all_rows_sql('SELECT *
$items = db_get_all_rows_sql('SELECT *
FROM treport_content
WHERE ' . $where . ' AND id_report = ' . $idReport . '
ORDER BY "order"
@ -146,7 +148,7 @@ switch ($config["dbtype"]) {
}
break;
}
$countItems = get_db_sql('SELECT COUNT(id_rc) FROM treport_content WHERE ' . $where . ' AND id_report = ' . $idReport);
$countItems = db_get_sql('SELECT COUNT(id_rc) FROM treport_content WHERE ' . $where . ' AND id_report = ' . $idReport);
$table = null;
if ($items){
@ -225,7 +227,7 @@ foreach ($items as $item) {
}
else {
$row[2] = ui_print_truncate_text(get_agent_name(get_agent_module_id($item['id_agent_module'])), 20);
$row[3] = ui_print_truncate_text(get_db_value_filter('nombre', 'tagente_modulo', array('id_agente_modulo' => $item['id_agent_module'])), 20);
$row[3] = ui_print_truncate_text(db_get_value_filter('nombre', 'tagente_modulo', array('id_agente_modulo' => $item['id_agent_module'])), 20);
}
}
else {
@ -235,7 +237,7 @@ foreach ($items as $item) {
$row [3] = '-';
}
else {
$row[3] = ui_print_truncate_text(get_db_value_filter('nombre', 'tagente_modulo', array('id_agente_modulo' => $item['id_agent_module'])),20);
$row[3] = ui_print_truncate_text(db_get_value_filter('nombre', 'tagente_modulo', array('id_agente_modulo' => $item['id_agent_module'])),20);
}
}

View File

@ -17,12 +17,14 @@ global $config;
check_login ();
if (! check_acl ($config['id_user'], 0, "IW")) {
pandora_audit("ACL Violation",
db_pandora_audit("ACL Violation",
"Trying to access report builder");
require ("general/noaccess.php");
exit;
}
require_once ($config['homedir'].'/include/functions_users.php');
$groups = get_user_groups ();
switch ($action) {

Some files were not shown because too many files have changed in this diff Show More