diff --git a/api_FTL.php b/api_FTL.php index b58a3eda..b7bcf9fe 100644 --- a/api_FTL.php +++ b/api_FTL.php @@ -61,6 +61,16 @@ else $data = array_merge($data,$stats); } + if (isset($_GET["getMaxlogage"]) && $auth) { + sendRequestFTL("maxlogage"); + // Convert seconds to hours and rounds to one decimal place. + $ret = round(intval(getResponseFTL()[0]) / 3600, 1); + // Return 24h if value is 0, empty, null or non numeric. + $ret = $ret ?: 24; + + $data = array_merge($data, array("maxlogage" => $ret)); + } + if (isset($_GET['overTimeData10mins'])) { sendRequestFTL("overTime"); diff --git a/index.php b/index.php index 90402817..8adb2101 100644 --- a/index.php +++ b/index.php @@ -5,19 +5,10 @@ * * This file is copyright under the latest version of the EUPL. * Please see LICENSE file for your rights under this license. */ + $indexpage = true; require "scripts/pi-hole/php/header.php"; require_once "scripts/pi-hole/php/gravity.php"; - -function getinterval() -{ - global $piholeFTLConf; - if (isset($piholeFTLConf["MAXLOGAGE"])) { - return min(round(floatval($piholeFTLConf["MAXLOGAGE"]), 1), 24); - } else { - return "24"; - } -} ?> @@ -84,7 +75,7 @@ function getinterval()