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:
@@ -37,7 +37,7 @@
|
||||
//set the default template directory
|
||||
if (PHP_OS == "Linux") {
|
||||
//set the default template dir
|
||||
if (strlen($this->template_dir) == 0) {
|
||||
if (empty($this->template_dir)) {
|
||||
if (file_exists('/usr/share/fusionpbx/templates/provision')) {
|
||||
$this->template_dir = '/usr/share/fusionpbx/templates/provision';
|
||||
}
|
||||
@@ -51,7 +51,7 @@
|
||||
}
|
||||
elseif (PHP_OS == "FreeBSD") {
|
||||
//if the FreeBSD port is installed use the following paths by default.
|
||||
if (strlen($this->template_dir) == 0) {
|
||||
if (empty($this->template_dir)) {
|
||||
if (file_exists('/usr/local/share/fusionpbx/templates/provision')) {
|
||||
$this->template_dir = '/usr/local/share/fusionpbx/templates/provision';
|
||||
}
|
||||
@@ -65,19 +65,19 @@
|
||||
}
|
||||
else if (PHP_OS == "NetBSD") {
|
||||
//set the default template_dir
|
||||
if (strlen($this->template_dir) == 0) {
|
||||
if (empty($this->template_dir)) {
|
||||
$this->template_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/resources/templates/provision';
|
||||
}
|
||||
}
|
||||
else if (PHP_OS == "OpenBSD") {
|
||||
//set the default template_dir
|
||||
if (strlen($this->template_dir) == 0) {
|
||||
if (empty($this->template_dir)) {
|
||||
$this->template_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/resources/templates/provision';
|
||||
}
|
||||
}
|
||||
else {
|
||||
//set the default template_dir
|
||||
if (strlen($this->template_dir) == 0) {
|
||||
if (empty($this->template_dir)) {
|
||||
$this->template_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/resources/templates/provision';
|
||||
}
|
||||
}
|
||||
@@ -264,7 +264,7 @@
|
||||
$mac = strtolower($mac);
|
||||
|
||||
//get the device template
|
||||
//if (strlen($_REQUEST['template']) > 0) {
|
||||
//if (!empty($_REQUEST['template'])) {
|
||||
// $device_template = $_REQUEST['template'];
|
||||
// $search = array('..', '/./');
|
||||
// $device_template = str_replace($search, "", $device_template);
|
||||
@@ -276,7 +276,7 @@
|
||||
$file = str_replace($search, "", $file);
|
||||
|
||||
//get the domain_name
|
||||
if (strlen($domain_name) == 0) {
|
||||
if (empty($domain_name)) {
|
||||
$sql = "select domain_name from v_domains ";
|
||||
$sql .= "where domain_uuid = :domain_uuid ";
|
||||
$parameters['domain_uuid'] = $domain_uuid;
|
||||
@@ -309,7 +309,7 @@
|
||||
}
|
||||
|
||||
//check to see if the mac_address exists in devices
|
||||
//if (strlen($_REQUEST['user_id']) == 0 || strlen($_REQUEST['userid']) == 0) {
|
||||
//if (empty($_REQUEST['user_id']) || empty($_REQUEST['userid'])) {
|
||||
if ($this->mac_exists($mac)) {
|
||||
|
||||
//get the device_template
|
||||
@@ -359,7 +359,7 @@
|
||||
$device_user_uuid = $row["device_user_uuid"];
|
||||
$device_model = $row["device_model"];
|
||||
$device_firmware_version = $row["device_firmware_version"];
|
||||
if (strlen($row["device_vendor"]) > 0) {
|
||||
if (!empty($row["device_vendor"])) {
|
||||
$device_vendor = strtolower($row["device_vendor"]);
|
||||
}
|
||||
$device_location = $row["device_location"];
|
||||
@@ -369,7 +369,7 @@
|
||||
unset($row);
|
||||
|
||||
//find a template that was defined on another phone and use that as the default.
|
||||
if (strlen($device_template) == 0) {
|
||||
if (empty($device_template)) {
|
||||
$sql = "select * from v_devices ";
|
||||
$sql .= "where domain_uuid = :domain_uuid ";
|
||||
$sql .= "and device_enabled = 'true' ";
|
||||
@@ -546,7 +546,7 @@
|
||||
$database = new database;
|
||||
$database->app_name = 'devices';
|
||||
$database->app_uuid = '4efa1a1a-32e7-bf83-534b-6c8299958a8e';
|
||||
if (strlen($device_uuid) > 0) {
|
||||
if (!empty($device_uuid)) {
|
||||
$database->uuid($device_uuid);
|
||||
}
|
||||
$database->save($array);
|
||||
@@ -642,7 +642,7 @@
|
||||
}
|
||||
|
||||
//set the template directory
|
||||
if (strlen($provision["template_dir"]) > 0) {
|
||||
if (!empty($provision["template_dir"])) {
|
||||
$template_dir = $provision["template_dir"];
|
||||
}
|
||||
|
||||
@@ -653,7 +653,7 @@
|
||||
|
||||
//initialize a template object
|
||||
$view = new template();
|
||||
if (strlen($_SESSION['provision']['template_engine']['text']) > 0) {
|
||||
if (!empty($_SESSION['provision']['template_engine']['text'])) {
|
||||
$view->engine = $_SESSION['provision']['template_engine']['text']; //raintpl, smarty, twig
|
||||
}
|
||||
else {
|
||||
@@ -812,9 +812,9 @@
|
||||
$sip_port = $row['sip_port'];
|
||||
|
||||
//set defaults
|
||||
if (strlen($register_expires) == 0) { $register_expires = "120"; }
|
||||
if (strlen($sip_transport) == 0) { $sip_transport = "tcp"; }
|
||||
if (strlen($sip_port) == 0) {
|
||||
if (empty($register_expires)) { $register_expires = "120"; }
|
||||
if (empty($sip_transport)) { $sip_transport = "tcp"; }
|
||||
if (empty($sip_port)) {
|
||||
if ($line_number == "" || $line_number == "1") {
|
||||
$sip_port = "5060";
|
||||
}
|
||||
@@ -921,7 +921,7 @@
|
||||
//get the contact_uuid
|
||||
$uuid = $row['contact_uuid'];
|
||||
//get the names
|
||||
if (strlen($row['directory_first_name']) > 0) {
|
||||
if (!empty($row['directory_first_name'])) {
|
||||
$contact_name_given = $row['directory_first_name'];
|
||||
$contact_name_family = $row['directory_last_name'];
|
||||
} else {
|
||||
@@ -986,7 +986,7 @@
|
||||
foreach($variables as $name => $value) {
|
||||
if (is_array($device_keys)) {
|
||||
foreach($device_keys as $k => $field) {
|
||||
if (strlen($field['device_key_uuid']) > 0) {
|
||||
if (!empty($field['device_key_uuid'])) {
|
||||
if (isset($field['device_key_value'])) {
|
||||
$device_keys[$k]['device_key_value'] = str_replace("\${".$name."}", $value, $field['device_key_value']);
|
||||
}
|
||||
@@ -1088,7 +1088,7 @@
|
||||
}
|
||||
|
||||
//assign the variables
|
||||
if (strlen($device_key_category) == 0) {
|
||||
if (empty($device_key_category)) {
|
||||
$view->assign("key_id_".$device_key_id, $device_key_id);
|
||||
$view->assign("key_type_".$device_key_id, $device_key_type);
|
||||
$view->assign("key_line_".$device_key_id, $device_key_line);
|
||||
@@ -1114,7 +1114,7 @@
|
||||
$mac = $this->format_mac($mac, $device_vendor);
|
||||
|
||||
// set date/time for versioning provisioning templates
|
||||
if (strlen($_SESSION['provision']['version_format']['text']) > 0) {
|
||||
if (!empty($_SESSION['provision']['version_format']['text'])) {
|
||||
$time = date($_SESSION['provision']['version_format']['text']);
|
||||
}
|
||||
else {
|
||||
@@ -1152,7 +1152,7 @@
|
||||
|
||||
//get the time zone
|
||||
$time_zone_name = $_SESSION['domain']['time_zone']['name'];
|
||||
if (strlen($time_zone_name) > 0) {
|
||||
if (!empty($time_zone_name)) {
|
||||
$time_zone_offset_raw = get_time_zone_offset($time_zone_name)/3600;
|
||||
$time_zone_offset_hours = floor($time_zone_offset_raw);
|
||||
$time_zone_offset_minutes = ($time_zone_offset_raw - $time_zone_offset_hours) * 60;
|
||||
@@ -1187,7 +1187,7 @@
|
||||
}
|
||||
|
||||
//if $file is not provided then look for a default file that exists
|
||||
if (strlen($file) == 0) {
|
||||
if (empty($file)) {
|
||||
if (file_exists($template_dir."/".$device_template ."/{\$mac}")) {
|
||||
$file = "{\$mac}";
|
||||
}
|
||||
@@ -1250,7 +1250,7 @@
|
||||
}
|
||||
|
||||
//check either we have destination path to write files
|
||||
if (strlen($provision["path"]) == 0) {
|
||||
if (empty($provision["path"])) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1283,7 +1283,7 @@
|
||||
|
||||
//loop through the provision template directory
|
||||
$dir_array = array();
|
||||
if (strlen($device_template) > 0) {
|
||||
if (!empty($device_template)) {
|
||||
$template_path = path_join($this->template_dir, $device_template);
|
||||
$dir_list = opendir($template_path);
|
||||
if ($dir_list) {
|
||||
|
||||
Reference in New Issue
Block a user