diff --git a/login.php b/login.php index 126dd779..e837e336 100644 --- a/login.php +++ b/login.php @@ -9,7 +9,6 @@ */ $wrongpassword = false; -require_once 'func.php'; require 'scripts/pi-hole/php/theme.php'; require 'scripts/pi-hole/php/header.php'; @@ -27,7 +26,7 @@ require 'scripts/pi-hole/php/header.php';
- + -
- - -
diff --git a/scripts/pi-hole/php/auth.php b/scripts/pi-hole/php/auth.php deleted file mode 100644 index 113fe072..00000000 --- a/scripts/pi-hole/php/auth.php +++ /dev/null @@ -1,134 +0,0 @@ -= 0; --$i) { - $ret |= ord($res[$i]); - } - - return !$ret; - } -} - -function returnSuccess($message = '', $json = true) -{ - if ($json) { - return array('success' => true, 'message' => $message); - } - echo $message.'
'; - - return true; -} - -function returnError($message = '', $json = true) -{ - $message = htmlentities($message); - if ($json) { - return array('success' => false, 'message' => $message); - } - echo $message.'
'; - - return false; -} - -function getQueryTypeStr($querytype) -{ - $qtypes = array('A', 'AAAA', 'ANY', 'SRV', 'SOA', 'PTR', 'TXT', 'NAPTR', 'MX', 'DS', 'RRSIG', 'DNSKEY', 'NS', 'OTHER', 'SVCB', 'HTTPS'); - $qtype = intval($querytype); - if ($qtype > 0 && $qtype <= count($qtypes)) { - return $qtypes[$qtype - 1]; - } - - return 'TYPE'.($qtype - 100); -} - -// Functions to return Alert messages (success, error, warning) in JSON format. -// Used in multiple pages. - -// Return Success message in JSON format -function JSON_success($message = null) -{ - /* header('Content-type: application/json'); */ - echo json_encode(array('success' => true, 'message' => $message)); -} - -// Return Error message in JSON format -function JSON_error($message = null) -{ - /* header('Content-type: application/json'); */ - $response = array('success' => false, 'message' => $message); - if (isset($_POST['action'])) { - array_push($response, array('action' => $_POST['action'])); - } - echo json_encode($response); -} - -// Return Warning message in JSON format. -// - sends "success", because it wasn't a failure. -// - sends "warning" to use the correct alert type. -function JSON_warning($message = null) -{ - /* header('Content-type: application/json'); */ - echo json_encode(array( - 'success' => true, - 'warning' => true, - 'message' => $message, - )); -} - -// Try to convert possible IDNA domain to Unicode -function convertIDNAToUnicode($IDNA) -{ - if (extension_loaded('intl')) { - // we try the UTS #46 standard first - // as this is the new default, see https://sourceforge.net/p/icu/mailman/message/32980778/ - // We know that this fails for some Google domains violating the standard - // see https://github.com/pi-hole/AdminLTE/issues/1223 - if (defined('INTL_IDNA_VARIANT_UTS46')) { - // We have to use the option IDNA_NONTRANSITIONAL_TO_ASCII here - // to ensure sparkasse-gießen.de is not converted into - // sparkass-giessen.de but into xn--sparkasse-gieen-2ib.de - // as mandated by the UTS #46 standard - $unicode = idn_to_utf8($IDNA, IDNA_NONTRANSITIONAL_TO_ASCII, INTL_IDNA_VARIANT_UTS46); - } elseif (defined('INTL_IDNA_VARIANT_2003')) { - // If conversion failed, try with the (deprecated!) IDNA 2003 variant - // We have to check for its existence as support of this variant is - // scheduled for removal with PHP 8.0 - // see https://wiki.php.net/rfc/deprecate-and-remove-intl_idna_variant_2003 - $unicode = idn_to_utf8($IDNA, IDNA_DEFAULT, INTL_IDNA_VARIANT_2003); - } - } - - // if the conversion failed (e.g. domain to long) return the original domain - if ($unicode == false) { - return $IDNA; - } else { - return $unicode; - } -} - -// Convert a given (unicode) domain to IDNA ASCII -function convertUnicodeToIDNA($unicode) -{ - if (extension_loaded('intl')) { - // Be prepared that this may fail and see our comments about convertIDNAToUnicode() - if (defined('INTL_IDNA_VARIANT_UTS46')) { - $IDNA = idn_to_ascii($unicode, IDNA_NONTRANSITIONAL_TO_ASCII, INTL_IDNA_VARIANT_UTS46); - } elseif (defined('INTL_IDNA_VARIANT_2003')) { - $IDNA = idn_to_ascii($unicode, IDNA_DEFAULT, INTL_IDNA_VARIANT_2003); - } - } - - // if the conversion failed (e.g. domain to long) return the original domain - if ($IDNA == false) { - return $unicode; - } else { - return $IDNA; - } -} - -// Get FTL process information (used in settings.php) -function get_FTL_data($FTLpid, $arg) -{ - return trim(exec('ps -p '.$FTLpid.' -o '.$arg)); -} - -// Convert seconds into readable time (used in settings.php) -function convertseconds($argument) -{ - $seconds = round($argument); - if ($seconds < 60) { - return sprintf('%ds', $seconds); - } - if ($seconds < 3600) { - return sprintf('%dm %ds', $seconds / 60, $seconds % 60); - } - if ($seconds < 86400) { - return sprintf('%dh %dm %ds', $seconds / 3600 % 24, $seconds / 60 % 60, $seconds % 60); - } - - return sprintf('%dd %dh %dm %ds', $seconds / 86400, $seconds / 3600 % 24, $seconds / 60 % 60, $seconds % 60); -} - -function start_php_session() -{ - // Prevent Session ID from being passed through URLs - /* ini_set('session.use_only_cookies', 1); */ - /* session_start(); */ - // HttpOnly: Prevents javascript XSS attacks aimed to steal the session ID - // - // SameSite=Strict: Allows servers to assert that a cookie ought not to be - // sent along with cross-site requests. This assertion allows user agents to - // mitigate the risk of cross-origin information leakage, and provides some - // protection against cross-site request forgery attacks. - // Direct support of Samesite has been added to PHP only in version 7.3 - // We manually set the cookie option ourselves to ensure backwards compatibility - /* header('Set-Cookie: PHPSESSID='.session_id().'; path=/; HttpOnly; SameSite=Strict'); */ -} diff --git a/scripts/pi-hole/php/header_authenticated.php b/scripts/pi-hole/php/header_authenticated.php index c586b1cf..c7b1cdfc 100644 --- a/scripts/pi-hole/php/header_authenticated.php +++ b/scripts/pi-hole/php/header_authenticated.php @@ -8,12 +8,7 @@ * Please see LICENSE file for your rights under this license. */ -require 'scripts/pi-hole/php/auth.php'; -require_once 'scripts/pi-hole/php/func.php'; require 'scripts/pi-hole/php/theme.php'; - -check_cors(); - require 'header.php'; ?> diff --git a/scripts/pi-hole/php/sidebar.php b/scripts/pi-hole/php/sidebar.php index 6d43f9b2..96f50faa 100644 --- a/scripts/pi-hole/php/sidebar.php +++ b/scripts/pi-hole/php/sidebar.php @@ -86,8 +86,8 @@ Adists - - + + diff --git a/style/pi-hole.css b/style/pi-hole.css index bbdb06af..6bb79a3c 100644 --- a/style/pi-hole.css +++ b/style/pi-hole.css @@ -582,7 +582,6 @@ td.details-control { .login-options div:last-child { margin-right: 2px; margin-bottom: 0 !important; - flex: 0 1 auto; font-size: 95%; }