From d3f93f940840ff2b6005e2ebf57d7e32b175d94c Mon Sep 17 00:00:00 2001
From: guruevi <noreply@pandorafms.org>
Date: Fri, 22 Aug 2008 12:53:20 +0000
Subject: [PATCH] 2008-08-22  Evi Vanoost <vanooste@rcbi.rochester.edu>

        * include/functions_html.php: Fixes the bug if the table is not unset by referencing & blanking out the object from within the function

        * godmode/servers/modificar_server.php: Removed the unset() since it isn't necessary anymore.

git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1022 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
---
 .../godmode/servers/modificar_server.php        | 17 ++++++++---------
 pandora_console/include/functions_html.php      |  9 ++++++++-
 2 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/pandora_console/godmode/servers/modificar_server.php b/pandora_console/godmode/servers/modificar_server.php
index 9888059fdd..00fe0c2fbf 100644
--- a/pandora_console/godmode/servers/modificar_server.php
+++ b/pandora_console/godmode/servers/modificar_server.php
@@ -66,14 +66,15 @@ if (isset($_GET["server"])) {
 	$table->data[] = array (__('Name'),print_input_text ('name',$row["name"],'',50,0,true));
 	$table->data[] = array (__('IP Address'),print_input_text ('address',$row["ip_address"],'',50,0,true));
 	$table->data[] = array (__('Description'),print_input_text ('description',$row["description"],'',50,0,true));
-	
-	print_table($table);
-	unset ($table->data, $table->class);
 
+	print_table ($table);
+
+	$table->cellpadding=4;
+	$table->cellspacing=4;
+	$table->width=450;
 	$table->align=array ("right");
 	$table->data[] = array ('<input type="submit" class="sub upd" value="'.__('Update').'">');
-	print_table($table);
-	unset ($table);
+	print_table ($table2);
 } else {
 	$result = get_db_all_rows_in_table ("tserver");
 	echo "<h2>".__('Pandora servers')." &gt; ".__('Manage servers')."</h2>";
@@ -110,14 +111,13 @@ if (isset($_GET["server"])) {
 						$row["ip_address"],
 						substr($row["description"],0,25),
 						$server,
-						$LOCALE->fmt_time($row["laststart"],"MYSQL","DATE").' '.$LOCALE->fmt_time($row["laststart"],"MYSQL","LONGTIME"),
-						$LOCALE->fmt_time($row["keepalive"],"MYSQL","DATE").' '.$LOCALE->fmt_time($row["keepalive"],"MYSQL","LONGTIME"),
+						$LOCALE->fmt_time($row["laststart"],"MYSQL","DATE").' '.$LOCALE->fmt_time($row["laststart"],"MYSQL","TIME"),
+						$LOCALE->fmt_time($row["keepalive"],"MYSQL","DATE").' '.$LOCALE->fmt_time($row["keepalive"],"MYSQL","TIME"),
 						'<a href="index.php?sec=gservers&sec2=godmode/servers/modificar_server&server_del='.$row["id_server"].'&delete"><img src="images/cross.png" border="0">'
 					);
 		
 		}
 		print_table ($table);
-		unset ($table);
 		
 		//Lagend
 		$table->cellpadding = 2;
@@ -130,7 +130,6 @@ if (isset($_GET["server"])) {
 		  			'<span class="snmp">'.__('SNMP Console').'</span>'
 				);
 		print_table ($table);
-		unset ($table);
 	} else {
 		echo "<div class='nf'>".__('There are no servers configured into the database')."</div>";
 	}
diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php
index 0e01a7e2ef..3594ff4c8d 100644
--- a/pandora_console/include/functions_html.php
+++ b/pandora_console/include/functions_html.php
@@ -266,7 +266,7 @@ function print_textarea ($name, $rows, $columns, $value = '', $attributes = '',
  *     $table->class  - CSS table class
  * @param  bool $return whether to return an output string or echo now
  */
-function print_table ($table, $return = false) {
+function print_table (&$table, $return = false) {
 	$output = '';
 	static $table_count = 0;
 
@@ -415,6 +415,13 @@ function print_table ($table, $return = false) {
 		}
 	}
 	$output .= '</table>'."\n";
+
+	//if(isset($GLOBALS["table"]))
+	//	unset($GLOBALS["table"]);
+
+	$table->head = $table->align = $table->valign = $table->size = $table->wrap = $table->style = $table->rowstyle = $table->rowclass = $table->colspan = $table->data = array();
+	$table->width = $table->border = $table->tablealign = $table->cellpadding = $table->cellspacing = $table->class = false;
+		
 	if ($return) 
 		return $output;