Hi,

This patch was not massively tested tho the fix seems simple enough ...

Thomas
diff -ur jffnms-0.8.2.org/docs/utils/import_custom.php jffnms-0.8.2/docs/utils/import_custom.php
--- jffnms-0.8.2.org/docs/utils/import_custom.php	2005-05-10 01:04:25.000000000 +0100
+++ jffnms-0.8.2/docs/utils/import_custom.php	2005-10-09 08:59:22.000000000 +0100
@@ -35,7 +35,8 @@
     }
 
     function next_value($table) {
-	return current(db_fetch_array(db_query("SELECT MAX(id) FROM ".$table)))+1;
+        $tmp_array = db_fetch_array(db_query("SELECT MAX(id) FROM ".$table));
+	return current($tmp_array)+1;
     }
     
     function regen_sql ($table, $rec) {
diff -ur jffnms-0.8.2.org/docs/utils/jffnms-snmp/jffnms-snmp.php jffnms-0.8.2/docs/utils/jffnms-snmp/jffnms-snmp.php
--- jffnms-0.8.2.org/docs/utils/jffnms-snmp/jffnms-snmp.php	2005-05-10 01:04:25.000000000 +0100
+++ jffnms-0.8.2/docs/utils/jffnms-snmp/jffnms-snmp.php	2005-10-09 09:18:36.000000000 +0100
@@ -29,7 +29,8 @@
 }
 
 function create_rama ($oid,$k,$data,$deep,&$tree) {
-    if (!is_numeric(current(array_keys($data)))) $data = array_values ($data);
+    $tmp_array = array_keys($data);
+    if (!is_numeric(current($tmp_array))) $data = array_values ($data);
 
     while (list ($k1,$item) = each ($data)) {
 	if (is_array($item)) create_rama ("$oid.$k",$k1,$item,++$deep,$tree);
diff -ur jffnms-0.8.2.org/docs/utils/satellite_sync.php jffnms-0.8.2/docs/utils/satellite_sync.php
--- jffnms-0.8.2.org/docs/utils/satellite_sync.php	2005-05-10 01:04:25.000000000 +0100
+++ jffnms-0.8.2/docs/utils/satellite_sync.php	2005-10-09 09:00:48.000000000 +0100
@@ -76,7 +76,8 @@
 		    unset($sat_id);
 		}
 	    } else { //if only one, continue directly
-		$sat_id = current(array_keys($distribution));
+                $tmp_array = array_keys($distribution);
+		$sat_id = current($tmp_array);
 		if (count($distribution[$sat_id]) > 0) $hosts_ids = join($distribution[$sat_id],",");
 	    }
 	}
@@ -141,7 +142,8 @@
 	    $interfaces_file = get_config_option("engine_temp_path")."/".uniqid("").".dat.list";
 	    $rsync = "rsync";
 	    $rrd_path = get_config_option("rrd_real_path");
-	    $satellite_data = current(satellite_get ($sat_id));
+            $tmp_sat = satellite_get ($sat_id);
+	    $satellite_data = current($tmp_sat);
 
 	    //generate file with all the interface's filenames
 	    $fp = fopen($interfaces_file,"w+");
diff -ur jffnms-0.8.2.org/docs/utils/tftp_put_host_config.php jffnms-0.8.2/docs/utils/tftp_put_host_config.php
--- jffnms-0.8.2.org/docs/utils/tftp_put_host_config.php	2005-05-10 01:04:25.000000000 +0100
+++ jffnms-0.8.2/docs/utils/tftp_put_host_config.php	2005-10-09 09:01:40.000000000 +0100
@@ -11,7 +11,8 @@
     $filename= $_SERVER[argv][2];
     
     if ($host_id && $filename) {
-	$host = current(hosts_list($host_id));
+        $hosts = hosts_list($host_id);
+	$host = current($hosts);
 
 	if ($host[tftp_mode]=="") $host[tftp_mode]=0; //default
 
diff -ur jffnms-0.8.2.org/engine/autodiscovery_network.php jffnms-0.8.2/engine/autodiscovery_network.php
--- jffnms-0.8.2.org/engine/autodiscovery_network.php	2005-05-10 01:04:25.000000000 +0100
+++ jffnms-0.8.2/engine/autodiscovery_network.php	2005-10-08 17:50:39.000000000 +0100
@@ -116,8 +116,9 @@
 	$nad_time_start = time();
 	$hosts_up = 0;
 	$hosts_unique = 0;
-	
-	$net_data = current(nad_load_networks($network));
+
+	$tmp_nad = nad_load_networks($network);	
+	$net_data = current($nad);
 	
 	if (!$output) ob_start();
 	
diff -ur jffnms-0.8.2.org/engine/consolidate/syslog.php jffnms-0.8.2/engine/consolidate/syslog.php
--- jffnms-0.8.2.org/engine/consolidate/syslog.php	2005-05-10 01:04:24.000000000 +0100
+++ jffnms-0.8.2/engine/consolidate/syslog.php	2005-10-09 09:02:37.000000000 +0100
@@ -95,8 +95,10 @@
 
 	    $result_router = db_query ($query_router) or die ("Query failed - SY4 - ".db_error());
 	    
-	    if (db_num_rows ($result_router) > 0) // there is a record
-		$host_id = current(db_fetch_array($result_router)); // use the first one
+	    if (db_num_rows ($result_router) > 0) { // there is a record
+                $tmp_array = db_fetch_array($result_router);
+		$host_id = current($tmp_array); // use the first one
+            }
 	    else {
 		$host_id = 1; //Unknown Host
 	
diff -ur jffnms-0.8.2.org/engine/consolidate/traps.php jffnms-0.8.2/engine/consolidate/traps.php
--- jffnms-0.8.2.org/engine/consolidate/traps.php	2005-05-10 01:04:24.000000000 +0100
+++ jffnms-0.8.2/engine/consolidate/traps.php	2005-10-09 09:05:47.000000000 +0100
@@ -23,7 +23,14 @@
 	    // Get Host ID
 	    $query_host="SELECT id FROM hosts WHERE hosts.ip = '".$trap["ip"]."' OR hosts.name = '".$trap["ip"]."'"; 
 	    $result_host = db_query ($query_host) or die ("Query failed - TA5 - ".db_error());
-	    $host_id = (db_num_rows ($result_host) > 0)?current(db_fetch_array($result_host)):1; //if not host is found use 1 (unknown)
+            if (db_num_rows ($result_host) > 0) {
+                $tmp_host = db_fetch_array($result_host);
+                $host_id = current($tmp_host);
+            }
+            else {
+                $host_id = 1; // mean unknown
+            }
+	    // $host_id = (db_num_rows ($result_host) > 0)?current(db_fetch_array($result_host)):1; //if not host is found use 1 (unknown)
 	    
     	    $query_varbinds = "SELECT trap_oid, value, oidid FROM traps_varbinds WHERE trapid = ".$trap["id"]." ORDER BY oidid";
 	    $result_varbinds = db_query($query_varbinds) or die ("Query failed (".$query_varbinds.") - get varbinds - ".db_error());
diff -ur jffnms-0.8.2.org/engine/discovery/apc.inc.php jffnms-0.8.2/engine/discovery/apc.inc.php
--- jffnms-0.8.2.org/engine/discovery/apc.inc.php	2005-05-10 01:04:24.000000000 +0100
+++ jffnms-0.8.2/engine/discovery/apc.inc.php	2005-10-09 09:07:08.000000000 +0100
@@ -11,7 +11,8 @@
 	list ($apc_oid) = explode(",",$param);
 
 	if ($ip && $hostid && $rocommunity) {
-    	    $system_oid = @current(snmp_walk($ip, $rocommunity, ".1.3.6.1.2.1.1.2")); // system.sysObjectID
+            $tmp_walk = snmp_walk($ip, $rocommunity, ".1.3.6.1.2.1.1.2");
+    	    $system_oid = @current($tmp_walk); // system.sysObjectID
 
 	    if (strpos($system_oid,$apc_oid)!==false) {
 		$aux = array();
diff -ur jffnms-0.8.2.org/engine/discovery/storage.inc.php jffnms-0.8.2/engine/discovery/storage.inc.php
--- jffnms-0.8.2.org/engine/discovery/storage.inc.php	2005-05-10 01:04:24.000000000 +0100
+++ jffnms-0.8.2/engine/discovery/storage.inc.php	2005-10-09 09:08:14.000000000 +0100
@@ -43,7 +43,8 @@
 
 			if ($device_type_ok==false) { //if we didnt get the name in the OID, use the RFC/MIB Values
 			    $aux1 = explode (".", $deviceType[$i]);
-			    $device_type_id = current(array_reverse($aux1)); //get the last value of the OID
+                            $tmp_rev = array_reverse($aux1);
+			    $device_type_id = current($tmp_rev); //get the last value of the OID
 			    switch ($device_type_id) {
 				case "1" :	$deviceType[$i]="Other"; $device_type_ok = true; break;	
 				case "2" :	$deviceType[$i]="Ram"; $device_type_ok = true; break;	
diff -ur jffnms-0.8.2.org/engine/handlers/tcp_ports.inc.php jffnms-0.8.2/engine/handlers/tcp_ports.inc.php
--- jffnms-0.8.2.org/engine/handlers/tcp_ports.inc.php	2005-05-10 01:04:25.000000000 +0100
+++ jffnms-0.8.2/engine/handlers/tcp_ports.inc.php	2005-10-09 09:09:11.000000000 +0100
@@ -15,7 +15,8 @@
 	if ($old_data["port"]!=$port) { //if the user is trying to change the port number
 	
 	    if ($id!==false) {
-		$aux = current(interfaces_list($id)); //Get the Host ID of the interface
+                $tmp_list = interfaces_list($id);
+		$aux = current($tmp_list); //Get the Host ID of the interface
 	        $host_id = $aux["host"];
 		unset ($aux);
 	    } else
diff -ur jffnms-0.8.2.org/engine/launcher.inc.php jffnms-0.8.2/engine/launcher.inc.php
--- jffnms-0.8.2.org/engine/launcher.inc.php	2005-05-10 01:04:25.000000000 +0100
+++ jffnms-0.8.2/engine/launcher.inc.php	2005-10-08 17:51:40.000000000 +0100
@@ -100,7 +100,8 @@
     }    
     
     function child_status ($child, $result) {
-	$status = (current(explode(" ",$result))=="OK")?true:false;
+	$tmp_exploded = explode(" ",$result);
+	$status = (current($tmp_exploded)=="OK")?true:false;
 
 	logger (str_pad("WORK",10)."Child ".str_pad($child["pid"],7)." ".
 	    ($status				
diff -ur jffnms-0.8.2.org/engine/poller_helper.php jffnms-0.8.2/engine/poller_helper.php
--- jffnms-0.8.2.org/engine/poller_helper.php	2005-05-10 01:04:25.000000000 +0100
+++ jffnms-0.8.2/engine/poller_helper.php	2005-10-08 17:52:23.000000000 +0100
@@ -36,7 +36,8 @@
 
 	unset ($interface_id);
 	foreach ( $alarms as $alarm ) { //get all the interface ids from this host
-	    $int = current(interfaces_list ($alarm["interface"]));
+            $tmp_list = interfaces_list ($alarm["interface"]);
+	    $int = current($tmp_list);
 	    if ($int["poll"] > 0)
 		$interface_id[]=$alarm["interface"];
 	}
diff -ur jffnms-0.8.2.org/engine/poller.php jffnms-0.8.2/engine/poller.php
--- jffnms-0.8.2.org/engine/poller.php	2005-05-10 01:04:25.000000000 +0100
+++ jffnms-0.8.2/engine/poller.php	2005-10-08 17:53:18.000000000 +0100
@@ -75,7 +75,8 @@
 		$working_paths[$master]=Array();
 		
 		foreach ($peers as $key=>$peer) { //test all peers to the master
-		    $sat = current(satellite_get($peer));
+                    $tmp_sat = satellite_get($peer);		
+		    $sat = current($tmp_sat);
 		    $ping = satellite_send_ping($sat,$master,"get","$my_sat_id-elect");
 		    if ($ping["result"]==true) //test if my peer can get to the master
 			$working_paths[$master][count($paths[$key])][$sat["id"]]=array("url"=>$sat["url"],"session"=>$ping["session"]);
diff -ur jffnms-0.8.2.org/engine/pollers/hostmib_perf.php jffnms-0.8.2/engine/pollers/hostmib_perf.php
--- jffnms-0.8.2.org/engine/pollers/hostmib_perf.php	2005-05-10 01:04:25.000000000 +0100
+++ jffnms-0.8.2/engine/pollers/hostmib_perf.php	2005-10-09 09:10:13.000000000 +0100
@@ -18,7 +18,8 @@
 	    $pids = $Apps[$options["host_id"]]["pids"][$options["interface"]];
 	    
 	    foreach ($pids as $pid)
-		$values[] = current(explode(" ",snmp_get($options["host_ip"], $options["ro_community"], $perf_oid.".$pid")));
+		$tmp_exploded = explode(" ",snmp_get($options["host_ip"], $options["ro_community"], $perf_oid.".$pid"));
+		$values[] = current($tmp_exploded);
 	    
 	    $value = array_sum($values);
 	
diff -ur jffnms-0.8.2.org/engine/pollers/udp_status.php jffnms-0.8.2/engine/pollers/udp_status.php
--- jffnms-0.8.2.org/engine/pollers/udp_status.php	2005-05-10 01:04:25.000000000 +0100
+++ jffnms-0.8.2/engine/pollers/udp_status.php	2005-10-09 09:11:03.000000000 +0100
@@ -32,7 +32,8 @@
 		    $data_line = substr($data[1],$pos1,strlen($data[1])-$pos1);
 		    $data_ports = explode(",",$data_line);
 		}
-		$time = current(array_slice(explode(" ",$data[2]),-2));
+                $tmp_array = array_slice(explode(" ",$data[2]),-2);
+		$time = current($tmp_array);
 	    }
 
 	    if (is_array($data_ports) && (count($data_ports) > 0))
diff -ur jffnms-0.8.2.org/engine/pollers/verify_tc_class_number.php jffnms-0.8.2/engine/pollers/verify_tc_class_number.php
--- jffnms-0.8.2.org/engine/pollers/verify_tc_class_number.php	2005-05-10 01:04:25.000000000 +0100
+++ jffnms-0.8.2/engine/pollers/verify_tc_class_number.php	2005-10-09 09:14:57.000000000 +0100
@@ -15,7 +15,8 @@
     if (is_array($GLOBALS["verify_tc_class_number_data"])) {
 	$class_name = substr($options["interface"],strpos($options["interface"],"/")+1,strlen($options["interface"]));
 	$oid_key = array_search($class_name,$GLOBALS["verify_tc_class_number_data"]);
-	$index_actual = current(array_reverse(explode (".",$oid_key)));
+        $tmp_array = array_reverse(explode (".",$oid_key));
+	$index_actual = current($tmp_array);
     }
 
     return $index_actual;		    
diff -ur jffnms-0.8.2.org/engine/rrd_analizer.php jffnms-0.8.2/engine/rrd_analizer.php
--- jffnms-0.8.2.org/engine/rrd_analizer.php	2005-05-10 01:04:25.000000000 +0100
+++ jffnms-0.8.2/engine/rrd_analizer.php	2005-10-08 17:54:06.000000000 +0100
@@ -37,7 +37,8 @@
 		    $result[$value_name] = get_average($value_data); //FIXME how to handle Last Value Deltas and 95th Percentile 
 	    
 	    $result["information"]=$values["information"];
-	    $result["information"]["measures"] = count ($values[current(array_keys($values))]);
+            $tmp_keys = array_keys($values);
+	    $result["information"]["measures"] = count ($values[current($tmp_keys)]);
 	    
 	    unset ($values);
 	    return $result;
diff -ur jffnms-0.8.2.org/engine/satellite_distribution.php jffnms-0.8.2/engine/satellite_distribution.php
--- jffnms-0.8.2.org/engine/satellite_distribution.php	2005-05-10 01:04:25.000000000 +0100
+++ jffnms-0.8.2/engine/satellite_distribution.php	2005-10-08 17:54:51.000000000 +0100
@@ -70,7 +70,8 @@
 		    unset($sat_id);
 		}
 	    } else { //if only one, continue directly
-		$sat_id = current(array_keys($distribution));
+                $tmp_keys = array_keys($distribution);
+		$sat_id = current($tmp_keys);
 		if (count($distribution[$sat_id]) > 0) $hosts_ids = join($distribution[$sat_id],",");
 	    }
 	}
diff -ur jffnms-0.8.2.org/engine/tftp_get_host_config.php jffnms-0.8.2/engine/tftp_get_host_config.php
--- jffnms-0.8.2.org/engine/tftp_get_host_config.php	2005-05-10 01:04:25.000000000 +0100
+++ jffnms-0.8.2/engine/tftp_get_host_config.php	2005-10-08 17:55:44.000000000 +0100
@@ -65,8 +65,8 @@
 
 		    if ($exist && ($size > 0)) { //if the file has contents 
 			$config_data = implode("", file($real_filename)); //get contents
-
-			$aux = current(hosts_config_list (NULL,$config["host_id"],NULL,1)); //get the old config from DB
+                        $tmp_list = hosts_config_list (NULL,$config["host_id"],NULL,1);
+			$aux = current($tmp_list); //get the old config from DB
 		        $config_data_old = $aux["config"];
 			$config_id_old = $aux["id"];
 			unset ($aux);
diff -ur jffnms-0.8.2.org/htdocs/admin/adm/adm_hosts.inc.php jffnms-0.8.2/htdocs/admin/adm/adm_hosts.inc.php
--- jffnms-0.8.2.org/htdocs/admin/adm/adm_hosts.inc.php	2005-05-10 01:04:24.000000000 +0100
+++ jffnms-0.8.2/htdocs/admin/adm/adm_hosts.inc.php	2005-10-08 16:54:41.000000000 +0100
@@ -69,7 +69,8 @@
 	$host_obj = $GLOBALS["jffnms"]->get("hosts");
 
 	//get host data
-	$host_db_data = current($host_obj->get_all($hostid));
+	$tmp_hosts = $host_obj->get_all($hostid);
+	$host_db_data = current($tmp_hosts);
 	
 	$types_obj->get(); //get pointer to interface types list
 	
diff -ur jffnms-0.8.2.org/htdocs/admin/adm/adm_nad.php jffnms-0.8.2/htdocs/admin/adm/adm_nad.php
--- jffnms-0.8.2.org/htdocs/admin/adm/adm_nad.php	2005-05-10 01:04:24.000000000 +0100
+++ jffnms-0.8.2/htdocs/admin/adm/adm_nad.php	2005-10-09 09:16:50.000000000 +0100
@@ -190,7 +190,8 @@
 	    break;
 		
 	    default:
-	        $ip = current(array_keys($host_ips));
+                $tmp_array = array_keys($host_ips);
+	        $ip = current($tmp_array);
 	    break;
 	}
 
diff -ur jffnms-0.8.2.org/htdocs/admin/adm/adm_satellites.inc.php jffnms-0.8.2/htdocs/admin/adm/adm_satellites.inc.php
--- jffnms-0.8.2.org/htdocs/admin/adm/adm_satellites.inc.php	2005-05-10 01:04:24.000000000 +0100
+++ jffnms-0.8.2/htdocs/admin/adm/adm_satellites.inc.php	2005-10-08 16:55:38.000000000 +0100
@@ -6,7 +6,8 @@
     function satellites_action_update() {
 	global $api, $description, $parent, $url, $sat_group, $sat_type;
 
-	$old_data = current($api->get_data($_POST["actionid"]));
+	$tmp_ids = $api->get_data($_POST["actionid"]);
+	$old_data = current($tmp_ids);
 
 	$my_sat_id = $api->get_id($GLOBALS["jffnms_satellite_uri"]);
 
diff -ur jffnms-0.8.2.org/htdocs/admin/adm/adm_standard.php jffnms-0.8.2/htdocs/admin/adm/adm_standard.php
--- jffnms-0.8.2.org/htdocs/admin/adm/adm_standard.php	2005-05-10 01:04:24.000000000 +0100
+++ jffnms-0.8.2/htdocs/admin/adm/adm_standard.php	2005-10-09 09:17:36.000000000 +0100
@@ -504,7 +504,8 @@
 	$ascii_table[3] = $ascii_table[0];
 	
 	if (is_array($ascii["data"])) {
-	    $id_field = current(array_keys($ascii["data"]));
+            $tmp_keys = array_keys($ascii["data"]);
+	    $id_field = current($tmp_keys);
 	
 	    foreach ($ascii["data"][$id_field] as $id) {
 		$row++;
diff -ur jffnms-0.8.2.org/htdocs/events.php jffnms-0.8.2/htdocs/events.php
--- jffnms-0.8.2.org/htdocs/events.php	2005-05-10 01:04:24.000000000 +0100
+++ jffnms-0.8.2/htdocs/events.php	2005-10-08 17:01:04.000000000 +0100
@@ -133,9 +133,10 @@
 
 	$journal = $jffnms->get("journal");
 	
-	if ($journal_id > 1) 
-	    $journal_active = current($journal->get_all($journal_id,1));
-	
+	if ($journal_id > 1) {
+            $tmp_ids = $journal->get_all($journal_id,1);
+	    $journal_active = current($tmp_ids);
+	}
 	$output .= 
 	    table("journal").
 	    table_row("Journal","title", 4, "", false).
@@ -455,10 +456,11 @@
 		td (show_journal($journal_id),"","",4, true).
 		tag_close("tr");
 
+            $tmp_events = event_table_header($refresh, $express_filter, $filter_id, $init, $span, $sound);
 	    echo 
 		tag_close("tbody").
 		(($view_mode=="normal")
-		    ?(current(event_table_header($refresh, $express_filter, $filter_id, $init, $span, $sound))):"").
+		    ?(current($tmp_events)):"").
 		table_close().
 		form_close();
 	} //html
Only in jffnms-0.8.2/htdocs: .events.php.swp
diff -ur jffnms-0.8.2.org/htdocs/view_performance.php jffnms-0.8.2/htdocs/view_performance.php
--- jffnms-0.8.2.org/htdocs/view_performance.php	2005-05-10 01:04:24.000000000 +0100
+++ jffnms-0.8.2/htdocs/view_performance.php	2005-10-09 08:55:49.000000000 +0100
@@ -364,7 +364,8 @@
 		    $link_url = $REQUEST_URI."&interface_id=".$graphic["id"]."&graph_type=".$graphic["graph_type"];
 		    
 		    if (($graphic["graph1"]) && ($ret1!==false)) {
-			$image = image($images_rel_path."/".$graphic["graph1"]["image"], 0, 0, current(explode("  ",$graphic["title"]))." / ".$scale_legend);
+                        $tmp_exploded = explode("  ",$graphic["title"]);
+			$image = image($images_rel_path."/".$graphic["graph1"]["image"], 0, 0, current($tmp_exploded)." / ".$scale_legend);
 			echo td(linktext($image, $link_url),
 			    "graph","",(!isset($graphic["graph2"])?"2":"1"));
 		    }
@@ -394,11 +395,12 @@
 		    	    $percentile = round((($ordered[$skip]*8)/1024/1024),2);
 			}
 			
+			$tmp_exploded = explode("  ",$graphic["title"]);
 			echo 
 			"\"Raw Data for the period starting ".date("Y-m-d H:i:s",$graph_time_start_unix).
 			" and ending ".date("Y-m-d H:i:s",$graph_time_stop_unix)."\"\r\n".
 			
-			"\"For Interface: ".current(explode("  ",$graphic["title"]))."\"\r\n".
+			"\"For Interface: ".current($tmp_exploded)."\"\r\n".
 			
 		        (is_numeric($graphic["percentile"])
 			    ?"\"".$graphic["percentile"]." Percentile for this period is ".$percentile." Mbits/s.\"\r\n":"").
diff -ur jffnms-0.8.2.org/lib/api.classes.inc.php jffnms-0.8.2/lib/api.classes.inc.php
--- jffnms-0.8.2.org/lib/api.classes.inc.php	2005-05-10 01:04:25.000000000 +0100
+++ jffnms-0.8.2/lib/api.classes.inc.php	2005-10-08 16:27:15.000000000 +0100
@@ -509,7 +509,8 @@
     
 	function get_empty_record () {
 	    //Get the 'Unknown' Record 1
-	    $aux = current(get_db_list(	$this->jffnms_class,	1, 	array($this->jffnms_class.".*"))); //table,ids,fields	
+            $tmp_list = get_db_list( $this->jffnms_class,1,array($this->jffnms_class.".*"));
+	    $aux = current($tmp_list); //table,ids,fields	
 
 	    foreach ($aux as $key=>$value) 	//fill the values with the default data
 		$aux[$key] = (isset($this->jffnms_insert[$key])?$this->jffnms_insert[$key]:$value);
diff -ur jffnms-0.8.2.org/lib/api.events.inc.php jffnms-0.8.2/lib/api.events.inc.php
--- jffnms-0.8.2.org/lib/api.events.inc.php	2005-05-10 01:04:25.000000000 +0100
+++ jffnms-0.8.2/lib/api.events.inc.php	2005-10-08 16:31:00.000000000 +0100
@@ -19,8 +19,8 @@
 	    $data = compact("date_start","date_stop","interface","type","active","referer_start","referer_stop");
 	    $id = db_insert("alarms",$data);
 	    logger( "New Alarm: $id := $date_start - $date_stop - $interface - $type - $active - $referer_start - $referer_stop\n");
-	    
-	    trigger_analize("alarm",current(alarms_list(NULL,array("alarm_id"=>$id)))); //analize alarm triggers
+	    $tmp_alarms = alarms_list(NULL,array("alarm_id"=>$id)); 
+	    trigger_analize("alarm",current($tmp_alarms)); //analize alarm triggers
 
 	    return $id;
     }
@@ -28,8 +28,8 @@
     function alarms_update($id,$data) {
         if (is_array($data))
 	    $result = db_update("alarms",$id,$data);
-
-	trigger_analize("alarm",current(alarms_list(NULL,array("alarm_id"=>$id)))); //analize alarm triggers
+        $tmp_alarms = alarms_list(NULL,array("alarm_id"=>$id));
+	trigger_analize("alarm",current($tmp_alarms)); //analize alarm triggers
 	
 	return $result;
     }
@@ -56,7 +56,10 @@
     function alarm_lookup ($alarm_description) {
 	$query = "SELECT state FROM alarm_states where description = '$alarm_description'";    
 	$result = db_query ($query) or die ("Query Failed - alarm_lookup($alarm_description) - ".db_error());
-	if (db_num_rows($result) == 1) return current(db_fetch_array($result));
+	if (db_num_rows($result) == 1) {
+		$tmp_array = db_fetch_array($result);
+		return current($tmp_array);
+	}
 	return NULL;
     }
 
@@ -141,7 +144,9 @@
 	if ($log_it == 1)
 	    logger("New Event ($id): $date - $type - $host - $interface - $state - $username - $info - $referer\n");
 
-        trigger_analize("event",current(events_list($id)),$log_it); //analize event triggers
+	$events = events_list($id);
+	$current = current($events);
+        trigger_analize("event",$current,$log_it); //analize event triggers
     
 	return $id;
     }
@@ -361,7 +366,8 @@
 
 
 function journal_update($id, $data, $comment_update = "") { //FIXME take care of ticket updating
-    $journal_data = current(journal_list($journal_id));
+    $tmp_list = journal_list($journal_id);
+    $journal_data = current($tmp_list);
     
     $new_comment = $journal_data[comment]."\n".$comment_update; //merge old and new comments
     if (!$data[comment]) $data[comment] = $new_comment;
@@ -381,7 +387,8 @@
 
 	if (file_exists($function_file) &&  (@include_once($function_file)) ) {
 	    if (function_exists($real_function)) {
-		    $journal_data = current(journal_list($journal_id));
+                    $tmp_list = journal_list($journal_id);
+                    $journal_data = current($tmp_list);
 
 		    if ($action=="create") { //find interfaces information to create ticket
 			$events = events_list (NULL,"",1,"",0,1,"",0,1, $journal_id);
diff -ur jffnms-0.8.2.org/lib/api.hosts.inc.php jffnms-0.8.2/lib/api.hosts.inc.php
--- jffnms-0.8.2.org/lib/api.hosts.inc.php	2005-05-10 01:04:25.000000000 +0100
+++ jffnms-0.8.2/lib/api.hosts.inc.php	2005-10-08 16:23:03.000000000 +0100
@@ -65,7 +65,9 @@
     }
 
     function hosts_count($ids = NULL, $zone_id = NULL, $where_special = NULL) {
-	return current(current(hosts_list($ids, $zone_id, $where_special, 1)))-1;
+	$tmp_hosts = hosts_list($ids, $zone_id, $where_special, 1);
+	$tmp_current = current($tmp_hosts);
+	return current($tmp_current)-1;
     }
     
     function adm_hosts_add($zone_id = 1) {
@@ -103,7 +105,8 @@
     }
 
     function hosts_dmii_interfaces_list ($host_id) {
-	$host_data = current(hosts_list($host_id));
+	$tmp_hosts = hosts_list($host_id);
+	$host_data = current($tmp_hosts);
 	$dmii = $host_data["dmii"];
 
 	if ($dmii[0]=="M") return array_keys(interfaces_list(NULL,array("map"=>substr($dmii,1))));
@@ -123,7 +126,8 @@
     }
 
     function hosts_status_dmii($host_id) {
-	$host_data = current(hosts_list($host_id));
+	$tmp_hosts = hosts_list($host_id);
+	$host_data = current($tmp_hosts);
 	$dmii = $host_data["dmii"];
 
 	if ($dmii[0]=="M") return hosts_dmii_if_all_down_list($host_id,substr($dmii,1)); //set to a map
@@ -216,8 +220,8 @@
     }
 
     function hosts_config_put($host_id,$filename) {
-	    
-	$host = current(hosts_list($host_id));
+	$tmp_hosts = hosts_list($host_id); 
+	$host = current($tmp_hosts);
 
 	if ($host[tftp_mode]==1) { //OLD-CISCO-SYS-MIB
 	    $oid = ".1.3.6.1.4.1.9.2.1.53.$host[tftp]";
diff -ur jffnms-0.8.2.org/lib/api.interface.inc.php jffnms-0.8.2/lib/api.interface.inc.php
--- jffnms-0.8.2.org/lib/api.interface.inc.php	2005-05-10 01:04:25.000000000 +0100
+++ jffnms-0.8.2/lib/api.interface.inc.php	2005-10-08 16:26:05.000000000 +0100
@@ -316,8 +316,11 @@
 
 	$result = get_db_list($from, $ids, $fields, $where, $order, $index);
     
-	if ($count) $result = current(current($result));
-	else 
+	if ($count) {
+		$tmp_result = current($result);
+		$result = current($tmp_result);
+	}
+	else
 	    if (count($result) > 0) {
 
 		array_key_sort(&$result,convert_sql_sort($fields, $order));
diff -ur jffnms-0.8.2.org/lib/api.nad.inc.php jffnms-0.8.2/lib/api.nad.inc.php
--- jffnms-0.8.2.org/lib/api.nad.inc.php	2005-05-10 01:04:25.000000000 +0100
+++ jffnms-0.8.2/lib/api.nad.inc.php	2005-10-08 16:32:07.000000000 +0100
@@ -55,7 +55,8 @@
 	$c = @current($b);
 	$bottom = $c;
 	if (empty($top)) $top = $ips[$bottom]["dns"];
-	$top = current(explode(".",$top));
+        $tmp_exploded = explode(".",$top);
+	$top = current($tmp_exploded);
 
 	if (empty($top)) $top = "Host";
 
diff -ur jffnms-0.8.2.org/lib/api.network.inc.php jffnms-0.8.2/lib/api.network.inc.php
--- jffnms-0.8.2.org/lib/api.network.inc.php	2005-05-10 01:04:25.000000000 +0100
+++ jffnms-0.8.2/lib/api.network.inc.php	2005-10-08 16:32:51.000000000 +0100
@@ -432,8 +432,8 @@
     }
     
     function satellite_call ($sat_id, $class, $method, $params = NULL) {
-
-        $sat_url = current(satellite_get ($sat_id));
+        $tmp_sat = satellite_get ($sat_id);
+        $sat_url = current($tmp_sat);
         $sat_url = $sat_url["url"];
 	
 	if (!is_array($params)) $params = array ($params);
diff -ur jffnms-0.8.2.org/lib/api.rrdtool.inc.php jffnms-0.8.2/lib/api.rrdtool.inc.php
--- jffnms-0.8.2.org/lib/api.rrdtool.inc.php	2005-05-10 01:04:25.000000000 +0100
+++ jffnms-0.8.2/lib/api.rrdtool.inc.php	2005-10-08 16:33:25.000000000 +0100
@@ -274,7 +274,8 @@
 	if (!is_array($dsnames)) $dsnames = array($dsnames);
 	
 	$file = $GLOBALS["rrd_real_path"]."/interface-$id.rrd";
-	$interface=current(interfaces_list($id));
+	$tmp_list = interfaces_list($id);
+	$interface=current($tmp_list);
 
 	$type_info = interface_get_type_info($id);
 	$all_dss = interface_parse_rrd_structure($type_info["rrd_structure_def"]);
diff -ur jffnms-0.8.2.org/lib/api.satellites.inc.php jffnms-0.8.2/lib/api.satellites.inc.php
--- jffnms-0.8.2.org/lib/api.satellites.inc.php	2005-05-10 01:04:25.000000000 +0100
+++ jffnms-0.8.2/lib/api.satellites.inc.php	2005-10-08 16:49:02.000000000 +0100
@@ -111,7 +111,8 @@
 	while ($aux = db_fetch_array($result)) {
 
 	    if (!$ids) { //avoid loop
-	    	$aux1 = current(satellites_list($aux["parent"]));
+                $tmp_sat = satellites_list($aux["parent"]);
+	    	$aux1 = current($tmp_sat);
 		$aux["parent_description"] = $aux1["description"];
 	    }
 
@@ -469,9 +470,11 @@
 	    $pos = array_search ($my_sat_id,$path);
 
 	    if  (($pos > 0) || ($pos===0))  	//i'm on the path
+                $tmp_src = satellite_get($path[$pos-1]);
+                $tmp_dst = satellite_get($path[$pos+1]);
 		$new_paths[]=array( 		
-		    source_sat=>current(satellite_get($path[$pos-1])),
-		    destination_sat=>current(satellite_get($path[$pos+1])),
+		    source_sat=>current($tmp_src),
+		    destination_sat=>current($tmp_dst),
 		    path=>$path);
 	}
 	
diff -ur jffnms-0.8.2.org/lib/api.triggers.inc.php jffnms-0.8.2/lib/api.triggers.inc.php
--- jffnms-0.8.2.org/lib/api.triggers.inc.php	2005-05-10 01:04:25.000000000 +0100
+++ jffnms-0.8.2/lib/api.triggers.inc.php	2005-10-09 08:57:14.000000000 +0100
@@ -72,11 +72,19 @@
 		unset($parameters_array);
 		unset($function_data);
 		
-		if ($data_type=="alarm") { 
-		    if ($data["interface"]) $function_data["interface"]=current(interfaces_list($data["interface"]));	
-		
-		    if ($data[referer_start]) $function_data[event][start]=current(events_list($data[referer_start]));
-		    if ($data[referer_stop]) $function_data[event][stop]=current(events_list($data[referer_stop]));
+		if ($data_type=="alarm") {
+		    if ($data["interface"]) {
+			$tmp_interfaces = interfaces_list($data["interface"]);
+			$function_data["interface"]=current($tmp_interfaces);	
+		    }
+		    if ($data[referer_start]) {
+			$tmp_events = events_list($data[referer_start]);
+			$function_data[event][start]=current($tmp_events);
+		    }
+		    if ($data[referer_stop]) {
+			$tmp_events = events_list($data[referer_stop]);
+			$function_data[event][stop]=current($tmp_events);
+		    }
 		    
 		    if ($function_data[event]) krsort($function_data[event]);
 		    
@@ -86,8 +94,10 @@
 		if ($data_type=="event") {
 		    $function_data[event][]=$data;
 		    
-		    if ($data[interface_id] > 1)
-			$function_data["interface"]=current(interfaces_list($data[interface_id]));
+		    if ($data[interface_id] > 1) {
+			$tmp_interfaces = interfaces_list($data[interface_id]);
+			$function_data["interface"]=current($tmp_interfaces);
+                    }
 		}
 		
 		$param_aux = explode(",",$parameters);
@@ -128,7 +138,8 @@
 		foreach ($user_ids as $user_id)
                         if ($user_id > 1) {
 				$user_id = $user_id[user_id];
-				$function_data[user] = current(users_list($user_id)); 	//get user data
+				$tmp_users = users_list($user_id);
+				$function_data[user] = current($tmp_users); 	//get user data
           
 				if (is_array($parameters_array)) {  	
 					$profile_options = profiles_list($user_id);

Reply via email to