From 2ac763f68e0c14e4405113bc4779873e4cfb6291 Mon Sep 17 00:00:00 2001
From: esanchezm <noreply@pandorafms.org>
Date: Wed, 4 Mar 2009 11:56:22 +0000
Subject: [PATCH] 2009-03-04  Esteban Sanchez  <estebans@artica.es>

        * godmode/agentes/configurar_agente.php: Fixed module interval update.
        Fixed a bug that shows an error message when updating a module.

        * include/functions_html.php: Fixed a little bug in print_input_text()
        that avoided showing a "0" as a value. Renamed a variable to avoid
        parameter collisions.




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1505 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
---
 pandora_console/ChangeLog                             | 9 +++++++++
 pandora_console/godmode/agentes/configurar_agente.php | 5 ++---
 pandora_console/include/functions_html.php            | 9 +++++----
 3 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog
index 3822901402..50e15474fb 100644
--- a/pandora_console/ChangeLog
+++ b/pandora_console/ChangeLog
@@ -1,3 +1,12 @@
+2009-03-04  Esteban Sanchez  <estebans@artica.es>
+
+	* godmode/agentes/configurar_agente.php: Fixed module interval update.
+	Fixed a bug that shows an error message when updating a module.
+
+	* include/functions_html.php: Fixed a little bug in print_input_text()
+	that avoided showing a "0" as a value. Renamed a variable to avoid
+	parameter collisions.
+
 2009-03-04  Esteban Sanchez  <estebans@artica.es>
 
 	* godmode/agentes/module_manager_editor.php: Fixed filter field on
diff --git a/pandora_console/godmode/agentes/configurar_agente.php b/pandora_console/godmode/agentes/configurar_agente.php
index 68469ccf36..22a2c8150f 100644
--- a/pandora_console/godmode/agentes/configurar_agente.php
+++ b/pandora_console/godmode/agentes/configurar_agente.php
@@ -378,7 +378,7 @@ if ($update_module || $create_module) {
 	$max_timeout = (int) get_parameter ('max_timeout');
 	$minvalue = (int) get_parameter_post ("minvalue");
 	$maxvalue = (int) get_parameter ('maxvalue');
-	$interval = (int) get_parameter ("interval", 300);
+	$interval = (int) get_parameter ('module_interval', $intervalo);
 	$id_prediction_module = (int) get_parameter ('id_prediction_module');
 	$id_plugin = (int) get_parameter ('id_plugin');
 	$id_export = (int) get_parameter ('id_export');
@@ -409,7 +409,7 @@ if ($update_module || $create_module) {
 if ($update_module) {
 	$id_agent_module = (int) get_parameter ('id_agent_module');
 	
-	process_sql_update ('tagente_modulo',
+	$result = process_sql_update ('tagente_modulo',
 		array ('descripcion' => $description,
 			'id_module_group' => $id_module_group, 'nombre' => $name,
 			'max' => $maxvalue, 'min' => $minvalue, 'module_interval' => $interval,
@@ -428,7 +428,6 @@ if ($update_module) {
 			'min_ff_event' => $ff_event
 		),
 		'id_agente_modulo = '.$id_agent_module);
-	$result = process_sql ($sql);
 	
 	if ($result === false) {
 		echo '<h3 class="error">'.__('There was a problem updating module').'</h3>';
diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php
index 517cbe6bf8..2d0d68a02b 100644
--- a/pandora_console/include/functions_html.php
+++ b/pandora_console/include/functions_html.php
@@ -173,11 +173,11 @@ function print_input_text_extended ($name, $value, $id, $alt, $size, $maxlength,
 	}
 				
 	if (is_array ($attributes)) {
-		foreach ($attributes as $attribute => $value) {
-			if (!in_array ($valid_attrs)) {
+		foreach ($attributes as $attribute => $attr_value) {
+			if (! in_array ($valid_attrs)) {
 				continue;
 			}
-			$output .= $attribute.'="'.$value.'" ';
+			$output .= $attribute.'="'.$attr_value.'" ';
 		}
 	} else {
 		$output .= trim ($attributes)." ";
@@ -192,7 +192,8 @@ function print_input_text_extended ($name, $value, $id, $alt, $size, $maxlength,
 			continue;
 		} //If the attribute was already processed, skip
 		
-		if ($$attribute) {
+		/* Exact operator because we want to show "0" on the value */
+		if ($$attribute !== '') {
 			$output .= $attribute.'="'.$$attribute.'" ';
 		} elseif ($default != '') {
 			$output .= $attribute.'="'.$default.'" ';