mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2025-12-30 00:53:50 +00:00
Frytimo pr patches for php8.1 (#6630)
* Passing null to parameter #2 ($string) of type string is deprecated * Passing null to parameter #1 ($string) of type string is deprecated * php 8.1 fixes * php 8.1 fixes - replace strlen($var) > 0 with !empty($var) * php 8.1 fixes - replace ${var} with {$var} * php 8.1 fixes - replace ${var} with {$var} * php 8.1 fixes - replace ${var} with {$var} * php 8.1 fixes - replace ${var} with {$var} * php 8.1 fixes - strlower with null * php 8.1 fixes - strreplace with null * php 8.1 fixes - passing null to base64_decode * php 8.1 fixes - check for false and check for null on $this->dir * php 8.1 fixes - remove assignment of $db variable to modules object * php 8.1 fixes - avoid sending null to substr * php 8.1 fixes - change ${var} to {$var} * php 8.1 fixes - check for null before preg_replace * php 8.1 fixes - remove setting db variable on domains object * php 8.1 fixes - set empty string if $row['domain_setting_subcategory'] is null * php 8.1 fixes - set empty string if $_REQUEST['show'] is not available * php 8.1 fixes * php 8.1 fixes - correct $_POST checking syntax * php 8.1 fixes - correct $_POST variables * php 8.1 fixes * Use brackets consistently * Update user_setting_edit.php * Change to not empty * Update device.php * Update text.php --------- Co-authored-by: Tim Fry <tim@voipstratus.com> Co-authored-by: FusionPBX <markjcrane@gmail.com>
This commit is contained in:
@@ -45,7 +45,7 @@
|
||||
$mac = $_REQUEST['mac'];
|
||||
$file = $_REQUEST['file'];
|
||||
$ext = $_REQUEST['ext'];
|
||||
//if (strlen($_REQUEST['template']) > 0) {
|
||||
//if (!empty($_REQUEST['template'])) {
|
||||
// $device_template = $_REQUEST['template'];
|
||||
//}
|
||||
|
||||
@@ -191,7 +191,7 @@
|
||||
$name = $row['default_setting_name'];
|
||||
$category = $row['default_setting_category'];
|
||||
$subcategory = $row['default_setting_subcategory'];
|
||||
if (strlen($subcategory) == 0) {
|
||||
if (empty($subcategory)) {
|
||||
if ($name == "array") {
|
||||
$_SESSION[$category][] = $row['default_setting_value'];
|
||||
}
|
||||
@@ -236,7 +236,7 @@
|
||||
$name = $row['domain_setting_name'];
|
||||
$category = $row['domain_setting_category'];
|
||||
$subcategory = $row['domain_setting_subcategory'];
|
||||
if (strlen($subcategory) == 0) {
|
||||
if (empty($subcategory)) {
|
||||
//$$category[$name] = $row['domain_setting_value'];
|
||||
if ($name == "array") {
|
||||
$_SESSION[$category][] = $row['domain_setting_value'];
|
||||
@@ -260,11 +260,11 @@
|
||||
|
||||
//build the provision array
|
||||
foreach($_SESSION['provision'] as $key=>$val) {
|
||||
if (strlen($val['var']) > 0) { $value = $val['var']; }
|
||||
if (strlen($val['text']) > 0) { $value = $val['text']; }
|
||||
if (strlen($val['boolean']) > 0) { $value = $val['boolean']; }
|
||||
if (strlen($val['numeric']) > 0) { $value = $val['numeric']; }
|
||||
if (strlen($value) > 0) { $provision[$key] = $value; }
|
||||
if (!empty($val['var'])) { $value = $val['var']; }
|
||||
if (!empty($val['text'])) { $value = $val['text']; }
|
||||
if (!empty($val['boolean'])) { $value = $val['boolean']; }
|
||||
if (!empty($val['numeric'])) { $value = $val['numeric']; }
|
||||
if (!empty($value)) { $provision[$key] = $value; }
|
||||
unset($value);
|
||||
}
|
||||
|
||||
@@ -275,7 +275,7 @@
|
||||
}
|
||||
|
||||
//send a request to a remote server to validate the MAC address and secret
|
||||
if (strlen($_SERVER['auth_server']) > 0) {
|
||||
if (!empty($_SERVER['auth_server'])) {
|
||||
$result = send_http_request($_SERVER['auth_server'], 'mac='.check_str($_REQUEST['mac']).'&secret='.check_str($_REQUEST['secret']));
|
||||
if ($result == "false") {
|
||||
syslog(LOG_WARNING, '['.$_SERVER['REMOTE_ADDR']."] provision attempt but the remote auth server said no for ".check_str($_REQUEST['mac']));
|
||||
@@ -287,7 +287,7 @@
|
||||
$device_vendor = device::get_vendor($mac);
|
||||
|
||||
//keep backwards compatibility
|
||||
if (strlen($_SESSION['provision']["cidr"]["text"]) > 0) {
|
||||
if (!empty($_SESSION['provision']["cidr"]["text"])) {
|
||||
$_SESSION['provision']["cidr"][] = $_SESSION['provision']["cidr"]["text"];
|
||||
}
|
||||
|
||||
@@ -307,8 +307,8 @@
|
||||
}
|
||||
|
||||
//http authentication - digest
|
||||
if (strlen($provision["http_auth_username"]) > 0 && strlen($provision["http_auth_type"]) == 0) { $provision["http_auth_type"] = "digest"; }
|
||||
if (strlen($provision["http_auth_username"]) > 0 && $provision["http_auth_type"] === "digest" && $provision["http_auth_enabled"] === "true") {
|
||||
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" && $provision["http_auth_enabled"] === "true") {
|
||||
//function to parse the http auth header
|
||||
function http_digest_parse($txt) {
|
||||
//protect against missing data
|
||||
@@ -379,7 +379,7 @@
|
||||
}
|
||||
|
||||
//http authentication - basic
|
||||
if (strlen($provision["http_auth_username"]) > 0 && $provision["http_auth_type"] === "basic" && $provision["http_auth_enabled"] === "true") {
|
||||
if (!empty($provision["http_auth_username"]) && $provision["http_auth_type"] === "basic" && $provision["http_auth_enabled"] === "true") {
|
||||
if (!isset($_SERVER['PHP_AUTH_USER'])) {
|
||||
header('WWW-Authenticate: Basic realm="'.$_SESSION['domain_name'].'"');
|
||||
header('HTTP/1.0 401 Authorization Required');
|
||||
@@ -415,7 +415,7 @@
|
||||
}
|
||||
|
||||
//if password was defined in the system -> variables page then require the password.
|
||||
if (strlen($provision['password']) > 0) {
|
||||
if (!empty($provision['password'])) {
|
||||
//deny access if the password doesn't match
|
||||
if ($provision['password'] != check_str($_REQUEST['password'])) {
|
||||
//log the failed auth attempt to the system, to be available for fail2ban.
|
||||
|
||||
Reference in New Issue
Block a user