Merge pull request #4095 from jbaez/ft-3896

Fix error trying to access undefined variables on splash page.
This commit is contained in:
Adam Warner 2021-04-12 20:41:25 +01:00 committed by GitHub
commit ea451e3c22
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -58,20 +58,20 @@ if ($serverName === "pi.hole"
// When directly browsing via IP or authorized hostname
// Render splash/landing page based off presence of $landPage file
// Unset variables so as to not be included in $landPage or $splashPage
unset($serverName, $svPasswd, $svEmail, $authorizedHosts, $validExtTypes, $currentUrlExt, $viewPort);
unset($svPasswd, $svEmail, $authorizedHosts, $validExtTypes, $currentUrlExt);
// If $landPage file is present
if (is_file(getcwd()."/$landPage")) {
unset($serverName, $viewPort); // unset extra variables not to be included in $landpage
include $landPage;
exit();
}
// If $landPage file was not present, Set Splash Page output
$splashPage = "
$splashPage = <<<EOT
<!doctype html>
<html lang='en'>
<head>
<meta charset='utf-8'>
$viewPort
<meta name="viewport" content="width=device-width, initial-scale=1">
<title> $serverName</title>
<link rel='stylesheet' href='pihole/blockingpage.css'>
<link rel='shortcut icon' href='admin/img/favicons/favicon.ico' type='image/x-icon'>
@ -84,7 +84,7 @@ if ($serverName === "pi.hole"
</div>
</body>
</html>
";
EOT;
exit($splashPage);
} elseif ($currentUrlExt === "js") {
// Serve Pi-hole JavaScript for blocked domains requesting JS