Skip to content

Commit

Permalink
Use piholeStatus() in header.php (#2062)
Browse files Browse the repository at this point in the history
* Use piholeStatus() in header.php

Signed-off-by: Christian König <ckoenig@posteo.de>

* Remove check for null

Signed-off-by: Christian König <ckoenig@posteo.de>
  • Loading branch information
yubiuser committed Jan 11, 2022
1 parent c09a9e2 commit d4415f2
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions scripts/pi-hole/php/header.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
require "scripts/pi-hole/php/auth.php";
require "scripts/pi-hole/php/password.php";
require_once "scripts/pi-hole/php/FTL.php";
require_once "scripts/pi-hole/php/func.php";
require "scripts/pi-hole/php/theme.php";
$scriptname = basename($_SERVER['SCRIPT_FILENAME']);
$hostname = gethostname() ? gethostname() : "";
Expand Down Expand Up @@ -333,19 +334,14 @@ function pidofFTL()
<div class="pull-left info">
<p>Status</p>
<?php
$pistatus = pihole_execute('status web');
if (isset($pistatus[0])) {
$pistatus = intval($pistatus[0]);
} else {
$pistatus = null;
}
$pistatus = piholeStatus();
if ($pistatus == 53) {
echo '<span id="status"><i class="fa fa-w fa-circle text-green-light"></i> Active</span>';
} elseif ($pistatus == 0) {
echo '<span id="status"><i class="fa fa-w fa-circle text-red"></i> Offline</span>';
} elseif ($pistatus == -1) {
echo '<span id="status"><i class="fa fa-w fa-circle text-red"></i> DNS service not running</span>';
} elseif ($pistatus == -2 || is_null($pistatus)) {
} elseif ($pistatus == -2) {
echo '<span id="status"><i class="fa fa-w fa-circle text-red"></i> Unknown</span>';
} else {
echo '<span id="status"><i class="fa fa-w fa-circle text-orange"></i> DNS service on port '.$pistatus.'</span>';
Expand Down

0 comments on commit d4415f2

Please sign in to comment.