From bbf07927b856d81570dd4c769fa02b88dcc778eb Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Wed, 31 Aug 2011 16:42:56 +0000 Subject: [PATCH] 2011-08-31 Miguel de Dios * include/functions_agents.php: fixed the fields as sql operations as field. Fixes: #3400237 git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 6 +++ pandora_console/include/functions_agents.php | 51 ++++++++++++-------- 2 files changed, 37 insertions(+), 20 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index ea9b73a0ae..ea1521c1e9 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,9 @@ +2011-08-31 Miguel de Dios + + * include/functions_agents.php: fixed the fields as sql operations as field. + + Fixes: #3400237 + 2011-08-31 Juan Manuel Ramon * include/functions_alerts.php: Fixed alerts_get_agents_with_alert_template diff --git a/pandora_console/include/functions_agents.php b/pandora_console/include/functions_agents.php index a03d91ebc1..01b072129e 100644 --- a/pandora_console/include/functions_agents.php +++ b/pandora_console/include/functions_agents.php @@ -540,7 +540,7 @@ function agents_process_manage_config ($source_id_agent, $destiny_id_agents, $co echo '

'.__('Successfully copied').'

'; switch ($config['dbtype']) { case "mysql": - case "postgresql": + case "postgresql": db_process_sql ('COMMIT'); break; case "oracle": @@ -592,15 +592,15 @@ function agents_get_next_contact($idAgent, $maxModules = false) { * @param bool Wheter to return the modules indexed by the id_agente_modulo or * not. Default is indexed. * Example: - -Both are similars: -$modules = agents_get_modules ($id_agent, false, array ('disabled' => 0)); -$modules = agents_get_modules ($id_agent, false, 'disabled = 0'); + + Both are similars: + $modules = agents_get_modules ($id_agent, false, array ('disabled' => 0)); + $modules = agents_get_modules ($id_agent, false, 'disabled = 0'); -Both are similars: -$modules = agents_get_modules ($id_agent, '*', array ('disabled' => 0, 'history_data' => 0)); -$modules = agents_get_modules ($id_agent, '*', 'disabled = 0 AND history_data = 0'); - + Both are similars: + $modules = agents_get_modules ($id_agent, '*', array ('disabled' => 0, 'history_data' => 0)); + $modules = agents_get_modules ($id_agent, '*', 'disabled = 0 AND history_data = 0'); + * * @return array An array with all modules in the agent. * If multiple rows are selected, they will be in an array @@ -617,7 +617,7 @@ function agents_common_modules_with_alerts ($id_agent, $filter = false, $indexed WHERE t4.id_agent_module = t3.id_agente_modulo AND delete_pending = 0 AND t1.nombre = t3.nombre AND id_agente IN (%s)) = (%s)', implode (",", (array) $id_agent), implode (",", (array) $id_agent), count($id_agent)); } - + if (! empty ($filter)) { $where .= ' AND '; if (is_array ($filter)) { @@ -668,15 +668,15 @@ function agents_common_modules_with_alerts ($id_agent, $filter = false, $indexed * @param bool Wheter to return the modules indexed by the id_agente_modulo or * not. Default is indexed. * Example: - -Both are similars: -$modules = agents_get_modules ($id_agent, false, array ('disabled' => 0)); -$modules = agents_get_modules ($id_agent, false, 'disabled = 0'); + + Both are similars: + $modules = agents_get_modules ($id_agent, false, array ('disabled' => 0)); + $modules = agents_get_modules ($id_agent, false, 'disabled = 0'); -Both are similars: -$modules = agents_get_modules ($id_agent, '*', array ('disabled' => 0, 'history_data' => 0)); -$modules = agents_get_modules ($id_agent, '*', 'disabled = 0 AND history_data = 0'); - + Both are similars: + $modules = agents_get_modules ($id_agent, '*', array ('disabled' => 0, 'history_data' => 0)); + $modules = agents_get_modules ($id_agent, '*', 'disabled = 0 AND history_data = 0'); + * * @return array An array with all modules in the agent. * If multiple rows are selected, they will be in an array @@ -1010,6 +1010,17 @@ function agents_get_modules ($id_agent = null, $details = false, $filter = false break; } } + else if (strstr($value, '666=666', true) == '') { + switch ($config['dbtype']) { + case "mysql": + case "postgresql": + array_push ($fields, ' '.$value); + break; + case "oracle": + array_push ($fields, ' '.$value); + break; + } + } else { switch ($config["dbtype"]) { case "mysql": @@ -1018,7 +1029,7 @@ function agents_get_modules ($id_agent = null, $details = false, $filter = false case "postgresql": array_push ($fields, $field.' = \''.$value.'\''); break; - case "oracle": + case "oracle": if (is_int ($value) ||is_float ($value)||is_double ($value)) array_push ($fields, $field.' = '.$value.''); else @@ -1262,7 +1273,7 @@ function agents_give_agentmodule_flag ($id_agent_module) { * @param string IP address to assign */ function agents_add_address ($id_agent, $ip_address) { - global $config; + global $config; // Check if already is attached to agent switch ($config["dbtype"]) {