From 874077107e00ae2f65378f4246cae27d244c1bf4 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Wed, 20 Sep 2017 22:09:11 +0200 Subject: [PATCH] Have API return floats instead of ints for the values that are percentages computed by FTL --- api_FTL.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/api_FTL.php b/api_FTL.php index 55d8a17e..7e259a69 100644 --- a/api_FTL.php +++ b/api_FTL.php @@ -179,11 +179,11 @@ if (isset($_GET['getForwardDestinations']) && $auth) $tmp = explode(" ",$line); if(count($tmp) == 4) { - $forward_dest[$tmp[3]."|".$tmp[2]] = intval($tmp[1]); + $forward_dest[$tmp[3]."|".$tmp[2]] = floatval($tmp[1]); } else { - $forward_dest[$tmp[2]] = intval($tmp[1]); + $forward_dest[$tmp[2]] = floatval($tmp[1]); } } @@ -199,7 +199,7 @@ if (isset($_GET['getQueryTypes']) && $auth) foreach($return as $ret) { $tmp = explode(": ",$ret); - $querytypes[$tmp[0]] = intval($tmp[1]); + $querytypes[$tmp[0]] = floatval($tmp[1]); } $result = array('querytypes' => $querytypes); @@ -257,7 +257,7 @@ if (isset($_GET['overTimeDataForwards']) && $auth) { $tmp = explode(" ",$line); for ($i=0; $i < count($tmp)-1; $i++) { - $over_time[intval($tmp[0])][$i] = intval($tmp[$i+1]); + $over_time[intval($tmp[0])][$i] = floatval($tmp[$i+1]); } } $result = array('over_time' => $over_time); @@ -274,11 +274,11 @@ if (isset($_GET['getForwardDestinationNames']) && $auth) $tmp = explode(" ",$line); if(count($tmp) == 4) { - $forward_dest[$tmp[3]."|".$tmp[2]] = intval($tmp[1]); + $forward_dest[$tmp[3]."|".$tmp[2]] = floatval($tmp[1]); } else { - $forward_dest[$tmp[2]] = intval($tmp[1]); + $forward_dest[$tmp[2]] = floatval($tmp[1]); } } @@ -296,7 +296,7 @@ if (isset($_GET['overTimeDataQueryTypes']) && $auth) { $tmp = explode(" ",$line); for ($i=0; $i < count($tmp)-1; $i++) { - $over_time[intval($tmp[0])][$i] = intval($tmp[$i+1]); + $over_time[intval($tmp[0])][$i] = floatval($tmp[$i+1]); } } $result = array('over_time' => $over_time);