From 0ff25032407c59ca41bc0b7dc98681e588ddb396 Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Thu, 4 Jul 2024 18:01:50 -0600 Subject: [PATCH] Update index.php Minor changes. Use the provision array to get the cidr details. --- app/provision/index.php | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/app/provision/index.php b/app/provision/index.php index 048d765ba7..68a6eeb00c 100644 --- a/app/provision/index.php +++ b/app/provision/index.php @@ -213,13 +213,13 @@ http_error('404'); } -//keep backwards compatibility - $provision_cidrs = $settings->get('provision','cidr', []); +//get all provision settings + $provision = $settings->get('provision', null, []); //check the cidr range - if (!empty($provision_cidrs)) { + if (!empty($provision['cidr'])) { $found = false; - foreach($provision_cidrs as $cidr) { + foreach($provision['cidr'] as $cidr) { if (check_cidr($cidr, $_SERVER['REMOTE_ADDR'])) { $found = true; break; @@ -231,10 +231,6 @@ } } -//get all provision settings - $provision = $settings->get('provision', null, []); - $auth_passwords = $settings->get('provision', 'http_auth_password', []); - //http authentication - digest if (!empty($provision["http_auth_username"]) && empty($provision["http_auth_type"])) { $provision["http_auth_type"] = "digest"; } if (!empty($provision["http_auth_username"]) && $provision["http_auth_type"] === "digest" && !empty($provision["http_auth_enabled"]) && $provision["http_auth_enabled"] === "true") { @@ -321,6 +317,7 @@ } else { $authorized = false; + $auth_passwords = $settings->get('provision', 'http_auth_password', []); foreach ($auth_passwords as $password) { if ($_SERVER['PHP_AUTH_PW'] == $password) { $authorized = true; @@ -343,7 +340,7 @@ } } -//if password was defined in the Default Settings page then require the password. +//if the password was defined in the settings then require the password. if (!empty($provision['password'])) { //deny access if the password doesn't match if ($provision['password'] != check_str($_REQUEST['password'])) {