Populate $ipv4 and $ipv6 + fix small error that prevented blocking page from coming up at all. Fixes #1396

This commit is contained in:
DL6ER 2017-04-20 13:52:54 +02:00
parent d0f55e5125
commit f1f70133dc
No known key found for this signature in database
GPG key ID: 00135ACBD90B28DD

View file

@ -19,10 +19,15 @@ $uriExt = pathinfo($uri, PATHINFO_EXTENSION);
// Define which URL extensions get rendered as "Website Blocked" // Define which URL extensions get rendered as "Website Blocked"
$webExt = array('asp', 'htm', 'html', 'php', 'rss', 'xml'); $webExt = array('asp', 'htm', 'html', 'php', 'rss', 'xml');
// Get IPv4 and IPv6 addresses from setupVars.conf (if available)
$setupVars = parse_ini_file("/etc/pihole/setupVars.conf");
$ipv4 = isset($setupVars["IPV4_ADDRESS"]) ? explode("/", $setupVars["IPV4_ADDRESS"])[0] : $_SERVER['SERVER_ADDR'];
$ipv6 = isset($setupVars["IPV6_ADDRESS"]) ? explode("/", $setupVars["IPV6_ADDRESS"])[0] : $_SERVER['SERVER_ADDR'];
$AUTHORIZED_HOSTNAMES = array( $AUTHORIZED_HOSTNAMES = array(
$ipv4, $ipv4,
$ipv6, $ipv6,
str_replace(array("[","]"), array("",""), $_SERVER["SERVER_NAME"]), str_replace(array("[","]"), array("",""), $_SERVER["SERVER_ADDR"]),
"pi.hole", "pi.hole",
"localhost"); "localhost");
// Allow user set virtual hostnames // Allow user set virtual hostnames