diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index 747b5d0a..9e234b24 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -20,9 +20,9 @@ $finder = PhpCsFixer\Finder::create() $config = new PhpCsFixer\Config(); $config ->setRules(array( - '@PSR12' => true, '@PhpCsFixer' => true, 'array_syntax' => array('syntax' => 'long'), + 'blank_line_before_statement' => array('statements' => array('break', 'case', 'continue', 'declare', 'default', 'exit', 'goto', 'phpdoc', 'return', 'switch', 'throw', 'try', 'yield', 'yield_from')), )) ->setFinder($finder) ; diff --git a/api.php b/api.php index dcbb17b8..7176e243 100644 --- a/api.php +++ b/api.php @@ -8,13 +8,9 @@ */ $api = true; - require_once 'scripts/pi-hole/php/FTL.php'; - require_once 'scripts/pi-hole/php/password.php'; - require_once 'scripts/pi-hole/php/database.php'; - require_once 'scripts/pi-hole/php/auth.php'; check_cors(); @@ -117,18 +113,15 @@ if (isset($_GET['enable']) && $auth) { // Set POST parameters and invoke script to add domain to list $_POST['domain'] = $_GET['add']; $_POST['action'] = 'add_domain'; - require 'scripts/pi-hole/php/groups.php'; } elseif (isset($_GET['sub'])) { // Set POST parameters and invoke script to remove domain from list $_POST['domain'] = $_GET['sub']; $_POST['action'] = 'delete_domain_string'; - require 'scripts/pi-hole/php/groups.php'; } else { // Set POST parameters and invoke script to get all domains $_POST['action'] = 'get_domains'; - require 'scripts/pi-hole/php/groups.php'; } diff --git a/api_db.php b/api_db.php index cf367aac..1ab47ff1 100644 --- a/api_db.php +++ b/api_db.php @@ -9,13 +9,9 @@ $api = true; header('Content-type: application/json'); - require 'scripts/pi-hole/php/database.php'; - require 'scripts/pi-hole/php/password.php'; - require 'scripts/pi-hole/php/auth.php'; - require_once 'scripts/pi-hole/php/func.php'; check_cors(); diff --git a/index.php b/index.php index 971d394c..8db55d00 100644 --- a/index.php +++ b/index.php @@ -8,9 +8,7 @@ */ $indexpage = true; - require 'scripts/pi-hole/php/header.php'; - require_once 'scripts/pi-hole/php/gravity.php'; ?> diff --git a/scripts/pi-hole/php/api_token.php b/scripts/pi-hole/php/api_token.php index 00829f45..39c43214 100644 --- a/scripts/pi-hole/php/api_token.php +++ b/scripts/pi-hole/php/api_token.php @@ -1,6 +1,5 @@ @@ -34,7 +33,6 @@ body { if ($auth) { if (strlen($pwhash) > 0) { echo '
'; - require_once '../../vendor/qrcode.php'; $qr = QRCode::getMinimumQRCode($pwhash, QR_ERROR_CORRECT_LEVEL_Q); // The size of each block (in pixels) should be an integer diff --git a/scripts/pi-hole/php/customcname.php b/scripts/pi-hole/php/customcname.php index a00a5ca4..d43f2791 100644 --- a/scripts/pi-hole/php/customcname.php +++ b/scripts/pi-hole/php/customcname.php @@ -1,7 +1,6 @@ getMessage(); @@ -154,7 +153,6 @@ function add_to_table($db, $table, $domains, $comment = null, $wildcardstyle = f if ($returnnum) { return $num; } - if (1 === $num) { $plural = ''; } else { @@ -172,7 +170,6 @@ function add_to_table($db, $table, $domains, $comment = null, $wildcardstyle = f if ($returnnum) { return $num; } - $finalcount = intval($db->querySingle($countquery)); $modified = $finalcount - $initialcount; @@ -256,7 +253,6 @@ function remove_from_table($db, $table, $domains, $returnnum = false, $type = -1 if ($returnnum) { return $num; } - if (1 === $num) { $plural = ''; } else { @@ -274,7 +270,6 @@ function remove_from_table($db, $table, $domains, $returnnum = false, $type = -1 if ($returnnum) { return $num; } - if (1 === $num) { $plural = ''; } else { diff --git a/scripts/pi-hole/php/debug.php b/scripts/pi-hole/php/debug.php index 70564aa6..a994feee 100644 --- a/scripts/pi-hole/php/debug.php +++ b/scripts/pi-hole/php/debug.php @@ -7,7 +7,6 @@ header('Content-Type: text/event-stream'); header('Cache-Control: no-cache'); require 'password.php'; - require 'auth.php'; if (!$auth) { diff --git a/scripts/pi-hole/php/func.php b/scripts/pi-hole/php/func.php index 562f8526..11a1af72 100644 --- a/scripts/pi-hole/php/func.php +++ b/scripts/pi-hole/php/func.php @@ -108,7 +108,6 @@ function checkfile($filename) if (is_readable($filename)) { return $filename; } - // substitute dummy file return '/dev/null'; } diff --git a/scripts/pi-hole/php/gravity.php b/scripts/pi-hole/php/gravity.php index 8bb1d32b..c2d0ee82 100644 --- a/scripts/pi-hole/php/gravity.php +++ b/scripts/pi-hole/php/gravity.php @@ -18,7 +18,6 @@ function gravity_last_update($raw = false) // Array output return array('file_exists' => false); } - // String output return 'Gravity database not available'; } diff --git a/scripts/pi-hole/php/groups.php b/scripts/pi-hole/php/groups.php index e7a4e97e..7615df09 100644 --- a/scripts/pi-hole/php/groups.php +++ b/scripts/pi-hole/php/groups.php @@ -8,9 +8,7 @@ */ require_once 'auth.php'; - require_once 'func.php'; - require_once 'database.php'; // Authentication checks diff --git a/scripts/pi-hole/php/header.php b/scripts/pi-hole/php/header.php index 5513f59f..b518352c 100644 --- a/scripts/pi-hole/php/header.php +++ b/scripts/pi-hole/php/header.php @@ -8,13 +8,9 @@ */ 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() : ''; diff --git a/scripts/pi-hole/php/message.php b/scripts/pi-hole/php/message.php index e74c6662..fb919c2e 100644 --- a/scripts/pi-hole/php/message.php +++ b/scripts/pi-hole/php/message.php @@ -8,9 +8,7 @@ */ require_once 'auth.php'; - require_once 'func.php'; - require_once 'database.php'; // Authentication checks diff --git a/scripts/pi-hole/php/network.php b/scripts/pi-hole/php/network.php index 63c74ee6..42335f85 100644 --- a/scripts/pi-hole/php/network.php +++ b/scripts/pi-hole/php/network.php @@ -8,9 +8,7 @@ */ require_once 'auth.php'; - require_once 'func.php'; - require_once 'database.php'; // Authentication checks diff --git a/scripts/pi-hole/php/savesettings.php b/scripts/pi-hole/php/savesettings.php index df8a66ac..73356175 100644 --- a/scripts/pi-hole/php/savesettings.php +++ b/scripts/pi-hole/php/savesettings.php @@ -63,7 +63,8 @@ function readStaticLeasesFile($origin_file = '/etc/dnsmasq.d/04-pihole-static-dh } elseif (0 == strlen($two)) { // dhcp-host=mac,hostname - no IP array_push($dhcp_static_leases, array('hwaddr' => $mac, 'IP' => '', 'host' => $one)); - } else { // dhcp-host=mac,IP,hostname + } else { + // dhcp-host=mac,IP,hostname array_push($dhcp_static_leases, array('hwaddr' => $mac, 'IP' => $one, 'host' => $two)); } } elseif (validIP($one) && validDomain($mac)) { diff --git a/scripts/pi-hole/php/teleporter.php b/scripts/pi-hole/php/teleporter.php index 095990e7..b52be01b 100644 --- a/scripts/pi-hole/php/teleporter.php +++ b/scripts/pi-hole/php/teleporter.php @@ -8,11 +8,8 @@ */ require 'password.php'; - require 'auth.php'; // Also imports func.php - require 'database.php'; - require 'savesettings.php'; if ('cli' !== php_sapi_name()) { diff --git a/settings.php b/settings.php index 0f32e17e..0e569d1a 100644 --- a/settings.php +++ b/settings.php @@ -9,9 +9,7 @@ */ require 'scripts/pi-hole/php/header.php'; - require 'scripts/pi-hole/php/savesettings.php'; - require_once 'scripts/pi-hole/php/FTL.php'; // Reread ini file as things might have been changed @@ -544,8 +542,16 @@ if (0 !== $FTLpid) {
-
checked disabled
-
checked disabled
+
checked disabled +> 
+
checked disabled +> 
@@ -556,7 +562,7 @@ if (0 !== $FTLpid) {