mirror of
https://github.com/pi-hole/web.git
synced 2026-04-26 11:50:09 +01:00
252
api_FTL.php
252
api_FTL.php
@@ -8,47 +8,47 @@
|
||||
*/
|
||||
|
||||
if (!isset($api)) {
|
||||
die("Direct call to api_FTL.php is not allowed!");
|
||||
exit('Direct call to api_FTL.php is not allowed!');
|
||||
}
|
||||
|
||||
if (isset($_GET['type'])) {
|
||||
$data["type"] = "FTL";
|
||||
$data['type'] = 'FTL';
|
||||
}
|
||||
|
||||
if (isset($_GET['version'])) {
|
||||
$data["version"] = 3;
|
||||
$data['version'] = 3;
|
||||
}
|
||||
|
||||
if (isset($_GET['status'])) {
|
||||
$return = callFTLAPI("stats");
|
||||
if (array_key_exists("FTLnotrunning", $return)) {
|
||||
$data = array("FTLnotrunning" => true);
|
||||
$return = callFTLAPI('stats');
|
||||
if (array_key_exists('FTLnotrunning', $return)) {
|
||||
$data = array('FTLnotrunning' => true);
|
||||
} else {
|
||||
if (in_array("status enabled", $return)) {
|
||||
$data = array_merge($data, array("status" => "enabled"));
|
||||
if (in_array('status enabled', $return)) {
|
||||
$data = array_merge($data, array('status' => 'enabled'));
|
||||
} else {
|
||||
$data = array_merge($data, array("status" => "disabled"));
|
||||
$data = array_merge($data, array('status' => 'disabled'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_GET['summary']) || isset($_GET['summaryRaw']) || !count($_GET)) {
|
||||
require_once("scripts/pi-hole/php/gravity.php");
|
||||
require_once 'scripts/pi-hole/php/gravity.php';
|
||||
|
||||
$return = callFTLAPI("stats");
|
||||
if (array_key_exists("FTLnotrunning", $return)) {
|
||||
$data = array("FTLnotrunning" => true);
|
||||
$return = callFTLAPI('stats');
|
||||
if (array_key_exists('FTLnotrunning', $return)) {
|
||||
$data = array('FTLnotrunning' => true);
|
||||
} else {
|
||||
$stats = [];
|
||||
$stats = array();
|
||||
foreach ($return as $line) {
|
||||
$tmp = explode(" ",$line);
|
||||
$tmp = explode(' ', $line);
|
||||
|
||||
if ($tmp[0] === "domains_being_blocked" && !is_numeric($tmp[1]) || $tmp[0] === "status") {
|
||||
if ('domains_being_blocked' === $tmp[0] && !is_numeric($tmp[1]) || 'status' === $tmp[0]) {
|
||||
// Expect string response
|
||||
$stats[$tmp[0]] = $tmp[1];
|
||||
} elseif (isset($_GET['summary'])) {
|
||||
// "summary" expects a formmated string response
|
||||
if ($tmp[0] !== "ads_percentage_today") {
|
||||
if ('ads_percentage_today' !== $tmp[0]) {
|
||||
$stats[$tmp[0]] = number_format($tmp[1]);
|
||||
} else {
|
||||
$stats[$tmp[0]] = number_format($tmp[1], 1, '.', '');
|
||||
@@ -57,43 +57,42 @@ if (isset($_GET['summary']) || isset($_GET['summaryRaw']) || !count($_GET)) {
|
||||
// Expect float response
|
||||
$stats[$tmp[0]] = floatval($tmp[1]);
|
||||
}
|
||||
|
||||
}
|
||||
$stats['gravity_last_updated'] = gravity_last_update(true);
|
||||
$data = array_merge($data,$stats);
|
||||
$data = array_merge($data, $stats);
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_GET["getMaxlogage"]) && $auth) {
|
||||
$return = callFTLAPI("maxlogage");
|
||||
if (array_key_exists("FTLnotrunning", $return)) {
|
||||
$data = array("FTLnotrunning" => true);
|
||||
if (isset($_GET['getMaxlogage']) && $auth) {
|
||||
$return = callFTLAPI('maxlogage');
|
||||
if (array_key_exists('FTLnotrunning', $return)) {
|
||||
$data = array('FTLnotrunning' => true);
|
||||
} else {
|
||||
// Convert seconds to hours and rounds to one decimal place.
|
||||
$ret = round(intval($return[0]) / 3600, 1);
|
||||
// Return 24h if value is 0, empty, null or non numeric.
|
||||
$ret = $ret ?: 24;
|
||||
|
||||
$data = array_merge($data, array("maxlogage" => $ret));
|
||||
$data = array_merge($data, array('maxlogage' => $ret));
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_GET['overTimeData10mins'])) {
|
||||
$return = callFTLAPI("overTime");
|
||||
if (array_key_exists("FTLnotrunning", $return)) {
|
||||
$data = array("FTLnotrunning" => true);
|
||||
$return = callFTLAPI('overTime');
|
||||
if (array_key_exists('FTLnotrunning', $return)) {
|
||||
$data = array('FTLnotrunning' => true);
|
||||
} else {
|
||||
$domains_over_time = array();
|
||||
$ads_over_time = array();
|
||||
foreach ($return as $line) {
|
||||
$tmp = explode(" ",$line);
|
||||
$tmp = explode(' ', $line);
|
||||
$domains_over_time[intval($tmp[0])] = intval($tmp[1]);
|
||||
$ads_over_time[intval($tmp[0])] = intval($tmp[2]);
|
||||
}
|
||||
|
||||
$result = array(
|
||||
'domains_over_time' => $domains_over_time,
|
||||
'ads_over_time' => $ads_over_time
|
||||
'ads_over_time' => $ads_over_time,
|
||||
);
|
||||
|
||||
$data = array_merge($data, $result);
|
||||
@@ -101,45 +100,45 @@ if (isset($_GET['overTimeData10mins'])) {
|
||||
}
|
||||
|
||||
if (isset($_GET['topItems']) && $auth) {
|
||||
if ($_GET['topItems'] === "audit") {
|
||||
$return = callFTLAPI("top-domains for audit");
|
||||
if ('audit' === $_GET['topItems']) {
|
||||
$return = callFTLAPI('top-domains for audit');
|
||||
} elseif (is_numeric($_GET['topItems'])) {
|
||||
$return = callFTLAPI("top-domains (".$_GET['topItems'].")");
|
||||
$return = callFTLAPI('top-domains ('.$_GET['topItems'].')');
|
||||
} else {
|
||||
$return = callFTLAPI("top-domains");
|
||||
$return = callFTLAPI('top-domains');
|
||||
}
|
||||
|
||||
if (array_key_exists("FTLnotrunning", $return)) {
|
||||
$data = array("FTLnotrunning" => true);
|
||||
if (array_key_exists('FTLnotrunning', $return)) {
|
||||
$data = array('FTLnotrunning' => true);
|
||||
} else {
|
||||
$top_queries = array();
|
||||
foreach ($return as $line) {
|
||||
$tmp = explode(" ",$line);
|
||||
if (count($tmp) == 2) {
|
||||
$tmp[2]="";
|
||||
$tmp = explode(' ', $line);
|
||||
if (2 == count($tmp)) {
|
||||
$tmp[2] = '';
|
||||
}
|
||||
$domain = utf8_encode($tmp[2]);
|
||||
$top_queries[$domain] = intval($tmp[1]);
|
||||
}
|
||||
}
|
||||
|
||||
if ($_GET['topItems'] === "audit") {
|
||||
$return = callFTLAPI("top-ads for audit");
|
||||
if ('audit' === $_GET['topItems']) {
|
||||
$return = callFTLAPI('top-ads for audit');
|
||||
} elseif (is_numeric($_GET['topItems'])) {
|
||||
$return = callFTLAPI("top-ads (".$_GET['topItems'].")");
|
||||
$return = callFTLAPI('top-ads ('.$_GET['topItems'].')');
|
||||
} else {
|
||||
$return = callFTLAPI("top-ads");
|
||||
$return = callFTLAPI('top-ads');
|
||||
}
|
||||
|
||||
if (array_key_exists("FTLnotrunning", $return)) {
|
||||
$data = array("FTLnotrunning" => true);
|
||||
if (array_key_exists('FTLnotrunning', $return)) {
|
||||
$data = array('FTLnotrunning' => true);
|
||||
} else {
|
||||
$top_ads = array();
|
||||
foreach ($return as $line) {
|
||||
$tmp = explode(" ",$line);
|
||||
$tmp = explode(' ', $line);
|
||||
$domain = utf8_encode($tmp[2]);
|
||||
if (count($tmp) > 3) {
|
||||
$top_ads[$domain." (".$tmp[3].")"] = intval($tmp[1]);
|
||||
$top_ads[$domain.' ('.$tmp[3].')'] = intval($tmp[1]);
|
||||
} else {
|
||||
$top_ads[$domain] = intval($tmp[1]);
|
||||
}
|
||||
@@ -147,7 +146,7 @@ if (isset($_GET['topItems']) && $auth) {
|
||||
|
||||
$result = array(
|
||||
'top_queries' => $top_queries,
|
||||
'top_ads' => $top_ads
|
||||
'top_ads' => $top_ads,
|
||||
);
|
||||
|
||||
$data = array_merge($data, $result);
|
||||
@@ -155,7 +154,6 @@ if (isset($_GET['topItems']) && $auth) {
|
||||
}
|
||||
|
||||
if ((isset($_GET['topClients']) || isset($_GET['getQuerySources'])) && $auth) {
|
||||
|
||||
if (isset($_GET['topClients'])) {
|
||||
$number = $_GET['topClients'];
|
||||
} elseif (isset($_GET['getQuerySources'])) {
|
||||
@@ -163,20 +161,20 @@ if ((isset($_GET['topClients']) || isset($_GET['getQuerySources'])) && $auth) {
|
||||
}
|
||||
|
||||
if (is_numeric($number)) {
|
||||
$return = callFTLAPI("top-clients (".$number.")");
|
||||
$return = callFTLAPI('top-clients ('.$number.')');
|
||||
} else {
|
||||
$return = callFTLAPI("top-clients");
|
||||
$return = callFTLAPI('top-clients');
|
||||
}
|
||||
if (array_key_exists("FTLnotrunning", $return)) {
|
||||
$data = array("FTLnotrunning" => true);
|
||||
if (array_key_exists('FTLnotrunning', $return)) {
|
||||
$data = array('FTLnotrunning' => true);
|
||||
} else {
|
||||
$top_clients = array();
|
||||
foreach ($return as $line) {
|
||||
$tmp = explode(" ",$line);
|
||||
$tmp = explode(' ', $line);
|
||||
$clientip = utf8_encode($tmp[2]);
|
||||
if (count($tmp) > 3 && strlen($tmp[3]) > 0) {
|
||||
$clientname = utf8_encode($tmp[3]);
|
||||
$top_clients[$clientname."|".$clientip] = intval($tmp[1]);
|
||||
$top_clients[$clientname.'|'.$clientip] = intval($tmp[1]);
|
||||
} else {
|
||||
$top_clients[$clientip] = intval($tmp[1]);
|
||||
}
|
||||
@@ -188,26 +186,25 @@ if ((isset($_GET['topClients']) || isset($_GET['getQuerySources'])) && $auth) {
|
||||
}
|
||||
|
||||
if (isset($_GET['topClientsBlocked']) && $auth) {
|
||||
|
||||
if (isset($_GET['topClientsBlocked'])) {
|
||||
$number = $_GET['topClientsBlocked'];
|
||||
}
|
||||
|
||||
if (is_numeric($number)) {
|
||||
$return = callFTLAPI("top-clients blocked (".$number.")");
|
||||
$return = callFTLAPI('top-clients blocked ('.$number.')');
|
||||
} else {
|
||||
$return = callFTLAPI("top-clients blocked");
|
||||
$return = callFTLAPI('top-clients blocked');
|
||||
}
|
||||
if (array_key_exists("FTLnotrunning", $return)) {
|
||||
$data = array("FTLnotrunning" => true);
|
||||
if (array_key_exists('FTLnotrunning', $return)) {
|
||||
$data = array('FTLnotrunning' => true);
|
||||
} else {
|
||||
$top_clients = array();
|
||||
foreach ($return as $line) {
|
||||
$tmp = explode(" ",$line);
|
||||
$tmp = explode(' ', $line);
|
||||
$clientip = utf8_encode($tmp[2]);
|
||||
if (count($tmp) > 3 && strlen($tmp[3]) > 0) {
|
||||
$clientname = utf8_encode($tmp[3]);
|
||||
$top_clients[$clientname."|".$clientip] = intval($tmp[1]);
|
||||
$top_clients[$clientname.'|'.$clientip] = intval($tmp[1]);
|
||||
} else {
|
||||
$top_clients[$clientip] = intval($tmp[1]);
|
||||
}
|
||||
@@ -219,21 +216,21 @@ if (isset($_GET['topClientsBlocked']) && $auth) {
|
||||
}
|
||||
|
||||
if (isset($_GET['getForwardDestinations']) && $auth) {
|
||||
if ($_GET['getForwardDestinations'] === "unsorted") {
|
||||
$return = callFTLAPI("forward-dest unsorted");
|
||||
if ('unsorted' === $_GET['getForwardDestinations']) {
|
||||
$return = callFTLAPI('forward-dest unsorted');
|
||||
} else {
|
||||
$return = callFTLAPI("forward-dest");
|
||||
$return = callFTLAPI('forward-dest');
|
||||
}
|
||||
if (array_key_exists("FTLnotrunning", $return)) {
|
||||
$data = array("FTLnotrunning" => true);
|
||||
if (array_key_exists('FTLnotrunning', $return)) {
|
||||
$data = array('FTLnotrunning' => true);
|
||||
} else {
|
||||
$forward_dest = array();
|
||||
foreach ($return as $line) {
|
||||
$tmp = explode(" ",$line);
|
||||
$tmp = explode(' ', $line);
|
||||
$forwardip = utf8_encode($tmp[2]);
|
||||
if (count($tmp) > 3 && strlen($tmp[3]) > 0) {
|
||||
$forwardname = utf8_encode($tmp[3]);
|
||||
$forward_dest[$forwardname."|".$forwardip] = floatval($tmp[1]);
|
||||
$forward_dest[$forwardname.'|'.$forwardip] = floatval($tmp[1]);
|
||||
} else {
|
||||
$forward_dest[$forwardip] = floatval($tmp[1]);
|
||||
}
|
||||
@@ -245,13 +242,13 @@ if (isset($_GET['getForwardDestinations']) && $auth) {
|
||||
}
|
||||
|
||||
if (isset($_GET['getQueryTypes']) && $auth) {
|
||||
$return = callFTLAPI("querytypes");
|
||||
if (array_key_exists("FTLnotrunning", $return)) {
|
||||
$data = array("FTLnotrunning" => true);
|
||||
$return = callFTLAPI('querytypes');
|
||||
if (array_key_exists('FTLnotrunning', $return)) {
|
||||
$data = array('FTLnotrunning' => true);
|
||||
} else {
|
||||
$querytypes = array();
|
||||
foreach ($return as $ret) {
|
||||
$tmp = explode(": ",$ret);
|
||||
$tmp = explode(': ', $ret);
|
||||
// Reply cannot contain non-ASCII characters
|
||||
$querytypes[$tmp[0]] = floatval($tmp[1]);
|
||||
}
|
||||
@@ -262,13 +259,13 @@ if (isset($_GET['getQueryTypes']) && $auth) {
|
||||
}
|
||||
|
||||
if (isset($_GET['getCacheInfo']) && $auth) {
|
||||
$return = callFTLAPI("cacheinfo");
|
||||
if (array_key_exists("FTLnotrunning", $return)) {
|
||||
$data = array("FTLnotrunning" => true);
|
||||
$return = callFTLAPI('cacheinfo');
|
||||
if (array_key_exists('FTLnotrunning', $return)) {
|
||||
$data = array('FTLnotrunning' => true);
|
||||
} else {
|
||||
$cacheinfo = array();
|
||||
foreach ($return as $ret) {
|
||||
$tmp = explode(": ",$ret);
|
||||
$tmp = explode(': ', $ret);
|
||||
// Reply cannot contain non-ASCII characters
|
||||
$cacheinfo[$tmp[0]] = floatval($tmp[1]);
|
||||
}
|
||||
@@ -279,33 +276,33 @@ if (isset($_GET['getCacheInfo']) && $auth) {
|
||||
}
|
||||
|
||||
if (isset($_GET['getAllQueries']) && $auth) {
|
||||
if (isset($_GET['from']) && isset($_GET['until'])) {
|
||||
if (isset($_GET['from'], $_GET['until'])) {
|
||||
// Get limited time interval
|
||||
$return = callFTLAPI("getallqueries-time ".$_GET['from']." ".$_GET['until']);
|
||||
$return = callFTLAPI('getallqueries-time '.$_GET['from'].' '.$_GET['until']);
|
||||
} elseif (isset($_GET['domain'])) {
|
||||
// Get specific domain only
|
||||
$return = callFTLAPI("getallqueries-domain ".$_GET['domain']);
|
||||
} elseif (isset($_GET['client']) && (isset($_GET['type']) && $_GET['type'] === "blocked")) {
|
||||
$return = callFTLAPI('getallqueries-domain '.$_GET['domain']);
|
||||
} elseif (isset($_GET['client']) && (isset($_GET['type']) && 'blocked' === $_GET['type'])) {
|
||||
// Get specific client only
|
||||
$return = callFTLAPI("getallqueries-client-blocked ".$_GET['client']);
|
||||
$return = callFTLAPI('getallqueries-client-blocked '.$_GET['client']);
|
||||
} elseif (isset($_GET['client'])) {
|
||||
// Get specific client only
|
||||
$return = callFTLAPI("getallqueries-client ".$_GET['client']);
|
||||
$return = callFTLAPI('getallqueries-client '.$_GET['client']);
|
||||
} elseif (isset($_GET['querytype'])) {
|
||||
// Get specific query type only
|
||||
$return = callFTLAPI("getallqueries-qtype ".$_GET['querytype']);
|
||||
$return = callFTLAPI('getallqueries-qtype '.$_GET['querytype']);
|
||||
} elseif (isset($_GET['forwarddest'])) {
|
||||
// Get specific forward destination only
|
||||
$return = callFTLAPI("getallqueries-forward ".$_GET['forwarddest']);
|
||||
$return = callFTLAPI('getallqueries-forward '.$_GET['forwarddest']);
|
||||
} elseif (is_numeric($_GET['getAllQueries'])) {
|
||||
$return = callFTLAPI("getallqueries (".$_GET['getAllQueries'].")");
|
||||
$return = callFTLAPI('getallqueries ('.$_GET['getAllQueries'].')');
|
||||
} else {
|
||||
// Get all queries
|
||||
$return = callFTLAPI("getallqueries");
|
||||
$return = callFTLAPI('getallqueries');
|
||||
}
|
||||
|
||||
if (array_key_exists("FTLnotrunning", $return)) {
|
||||
$data = array("FTLnotrunning" => true);
|
||||
if (array_key_exists('FTLnotrunning', $return)) {
|
||||
$data = array('FTLnotrunning' => true);
|
||||
} else {
|
||||
// Set the header
|
||||
header('Content-type: application/json');
|
||||
@@ -314,49 +311,49 @@ if (isset($_GET['getAllQueries']) && $auth) {
|
||||
echo '{"data":[';
|
||||
$first = true;
|
||||
|
||||
foreach($return as $line) {
|
||||
foreach ($return as $line) {
|
||||
// Insert a comma before the next record (except on the first one)
|
||||
if (!$first) {
|
||||
echo ",";
|
||||
echo ',';
|
||||
} else {
|
||||
$first = false;
|
||||
}
|
||||
|
||||
$row = str_getcsv($line," ");
|
||||
$row = str_getcsv($line, ' ');
|
||||
// UTF-8 encode domain
|
||||
$domain = utf8_encode(str_replace("~"," ",$row[2]));
|
||||
$domain = utf8_encode(str_replace('~', ' ', $row[2]));
|
||||
// UTF-8 encode client host name
|
||||
$client = utf8_encode($row[3]);
|
||||
|
||||
// Insert into array and output it in JSON format
|
||||
// array: time type domain client status dnssecStatus reply response_time CNAMEDomain regexID upstream destination EDE
|
||||
echo json_encode([$row[0], $row[1], $domain, $client, $row[4], $row[5], $row[6], $row[7], $row[8], $row[9], $row[10], $row[11]]);
|
||||
echo json_encode(array($row[0], $row[1], $domain, $client, $row[4], $row[5], $row[6], $row[7], $row[8], $row[9], $row[10], $row[11]));
|
||||
}
|
||||
// Finish the JSON string
|
||||
echo ']}';
|
||||
// exit at the end
|
||||
exit();
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_GET["recentBlocked"]) && $auth) {
|
||||
die(utf8_encode(callFTLAPI("recentBlocked")[0]));
|
||||
if (isset($_GET['recentBlocked']) && $auth) {
|
||||
exit(utf8_encode(callFTLAPI('recentBlocked')[0]));
|
||||
unset($data);
|
||||
}
|
||||
|
||||
if (isset($_GET['getForwardDestinationNames']) && $auth) {
|
||||
$return = callFTLAPI("forward-names");
|
||||
$return = callFTLAPI('forward-names');
|
||||
|
||||
if (array_key_exists("FTLnotrunning", $return)) {
|
||||
$data = array("FTLnotrunning" => true);
|
||||
if (array_key_exists('FTLnotrunning', $return)) {
|
||||
$data = array('FTLnotrunning' => true);
|
||||
} else {
|
||||
$forward_dest = array();
|
||||
foreach ($return as $line) {
|
||||
$tmp = explode(" ",$line);
|
||||
$tmp = explode(' ', $line);
|
||||
$forwardip = utf8_encode($tmp[2]);
|
||||
if (count($tmp) > 3) {
|
||||
$forwardname = utf8_encode($tmp[3]);
|
||||
$forward_dest[$forwardname."|".$forwardip] = floatval($tmp[1]);
|
||||
$forward_dest[$forwardname.'|'.$forwardip] = floatval($tmp[1]);
|
||||
} else {
|
||||
$forward_dest[$forwardip] = floatval($tmp[1]);
|
||||
}
|
||||
@@ -368,15 +365,15 @@ if (isset($_GET['getForwardDestinationNames']) && $auth) {
|
||||
}
|
||||
|
||||
if (isset($_GET['overTimeDataQueryTypes']) && $auth) {
|
||||
$return = callFTLAPI("QueryTypesoverTime");
|
||||
if (array_key_exists("FTLnotrunning", $return)) {
|
||||
$data = array("FTLnotrunning" => true);
|
||||
$return = callFTLAPI('QueryTypesoverTime');
|
||||
if (array_key_exists('FTLnotrunning', $return)) {
|
||||
$data = array('FTLnotrunning' => true);
|
||||
} else {
|
||||
$over_time = array();
|
||||
foreach ($return as $line) {
|
||||
$tmp = explode(" ",$line);
|
||||
for ($i=0; $i < count($tmp)-1; $i++) {
|
||||
$over_time[intval($tmp[0])][$i] = floatval($tmp[$i+1]);
|
||||
$tmp = explode(' ', $line);
|
||||
for ($i = 0; $i < count($tmp) - 1; ++$i) {
|
||||
$over_time[intval($tmp[0])][$i] = floatval($tmp[$i + 1]);
|
||||
}
|
||||
}
|
||||
$result = array('over_time' => $over_time);
|
||||
@@ -385,16 +382,16 @@ if (isset($_GET['overTimeDataQueryTypes']) && $auth) {
|
||||
}
|
||||
|
||||
if (isset($_GET['getClientNames']) && $auth) {
|
||||
$return = callFTLAPI("client-names");
|
||||
if (array_key_exists("FTLnotrunning", $return)) {
|
||||
$data = array("FTLnotrunning" => true);
|
||||
$return = callFTLAPI('client-names');
|
||||
if (array_key_exists('FTLnotrunning', $return)) {
|
||||
$data = array('FTLnotrunning' => true);
|
||||
} else {
|
||||
$client_names = array();
|
||||
foreach ($return as $line) {
|
||||
$tmp = explode(" ", $line);
|
||||
$tmp = explode(' ', $line);
|
||||
$client_names[] = array(
|
||||
"name" => utf8_encode($tmp[0]),
|
||||
"ip" => utf8_encode($tmp[1])
|
||||
'name' => utf8_encode($tmp[0]),
|
||||
'ip' => utf8_encode($tmp[1]),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -404,16 +401,16 @@ if (isset($_GET['getClientNames']) && $auth) {
|
||||
}
|
||||
|
||||
if (isset($_GET['overTimeDataClients']) && $auth) {
|
||||
$return = callFTLAPI("ClientsoverTime");
|
||||
$return = callFTLAPI('ClientsoverTime');
|
||||
|
||||
if (array_key_exists("FTLnotrunning", $return)) {
|
||||
$data = array("FTLnotrunning" => true);
|
||||
if (array_key_exists('FTLnotrunning', $return)) {
|
||||
$data = array('FTLnotrunning' => true);
|
||||
} else {
|
||||
$over_time = array();
|
||||
foreach ($return as $line) {
|
||||
$tmp = explode(" ",$line);
|
||||
for ($i=0; $i < count($tmp)-1; $i++) {
|
||||
$over_time[intval($tmp[0])][$i] = floatval($tmp[$i+1]);
|
||||
$tmp = explode(' ', $line);
|
||||
for ($i = 0; $i < count($tmp) - 1; ++$i) {
|
||||
$over_time[intval($tmp[0])][$i] = floatval($tmp[$i + 1]);
|
||||
}
|
||||
}
|
||||
$result = array('over_time' => $over_time);
|
||||
@@ -422,20 +419,19 @@ if (isset($_GET['overTimeDataClients']) && $auth) {
|
||||
}
|
||||
|
||||
if (isset($_GET['delete_lease']) && $auth) {
|
||||
$return = callFTLAPI("delete-lease ".$_GET['delete_lease']);
|
||||
if (array_key_exists("FTLnotrunning", $return)) {
|
||||
$data = array("FTLnotrunning" => true);
|
||||
$return = callFTLAPI('delete-lease '.$_GET['delete_lease']);
|
||||
if (array_key_exists('FTLnotrunning', $return)) {
|
||||
$data = array('FTLnotrunning' => true);
|
||||
} else {
|
||||
$data["delete_lease"] = $return[0];
|
||||
$data['delete_lease'] = $return[0];
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_GET['dns-port']) && $auth) {
|
||||
$return = callFTLAPI("dns-port");
|
||||
if (array_key_exists("FTLnotrunning", $return)) {
|
||||
$data = array("FTLnotrunning" => true);
|
||||
$return = callFTLAPI('dns-port');
|
||||
if (array_key_exists('FTLnotrunning', $return)) {
|
||||
$data = array('FTLnotrunning' => true);
|
||||
} else {
|
||||
$data["dns-port"] = $return[0];
|
||||
$data['dns-port'] = $return[0];
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user