mirror of
https://github.com/pi-hole/web.git
synced 2026-05-03 15:14:39 +01:00
FTL.php: parse port path from pihole-FTL.conf
Signed-off-by: Samu Voutilainen <smar@smar.fi>
This commit is contained in:
@@ -6,12 +6,37 @@
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
|
||||
$piholeFTLConfFile = "/etc/pihole/pihole-FTL.conf";
|
||||
|
||||
function piholeFTLConfig()
|
||||
{
|
||||
static $piholeFTLConfig;
|
||||
global $piholeFTLConfFile;
|
||||
|
||||
if(isset($piholeFTLConfig))
|
||||
{
|
||||
return $piholeFTLConfig;
|
||||
}
|
||||
|
||||
if(is_readable($piholeFTLConfFile))
|
||||
{
|
||||
$piholeFTLConfig = parse_ini_file($piholeFTLConfFile);
|
||||
}
|
||||
else
|
||||
{
|
||||
$piholeFTLConfig = array();
|
||||
}
|
||||
|
||||
return $piholeFTLConfig;
|
||||
}
|
||||
|
||||
function connectFTL($address, $port=4711)
|
||||
{
|
||||
if($address == "127.0.0.1")
|
||||
{
|
||||
$config = piholeFTLConfig();
|
||||
// Read port
|
||||
$portfile = file_get_contents("/var/run/pihole-FTL.port");
|
||||
$portfile = file_get_contents($config["PORTFILE"]);
|
||||
if(is_numeric($portfile))
|
||||
$port = intval($portfile);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user