Sofia Global Settings: Updates for PHP 8.1

This commit is contained in:
fusionate
2023-06-09 18:06:02 +00:00
parent 3f94d93411
commit 4ba06c5335
2 changed files with 29 additions and 5 deletions

View File

@@ -220,7 +220,7 @@ if (!class_exists('sofia_global_settings')) {
//add copy to the description
$array[$this->table][$x][$this->name.'_uuid'] = uuid();
$array[$this->table][$x]['global_setting_enabled'] = $row['global_setting_enabled'];
$array[$this->table][$x][$this->description_field] = trim($row[$this->description_field]).' ('.$text['label-copy'].')';
$array[$this->table][$x][$this->description_field] = trim($row[$this->description_field] ?? '').trim(' ('.$text['label-copy'].')');
//increment the id
$x++;
@@ -249,4 +249,4 @@ if (!class_exists('sofia_global_settings')) {
}
}
?>
?>

View File

@@ -1,4 +1,28 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2021-2023
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
//set the include path
$conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE);
@@ -41,7 +65,7 @@
if (!empty($_POST)) {
$global_setting_name = $_POST["global_setting_name"];
$global_setting_value = $_POST["global_setting_value"];
$global_setting_enabled = $_POST["global_setting_enabled"];
$global_setting_enabled = $_POST["global_setting_enabled"] ?? "false";
$global_setting_description = $_POST["global_setting_description"];
}
@@ -158,7 +182,7 @@
}
//set the defaults
if (empty($global_setting_enabled)) { $global_setting_enabled = true; }
if (empty($global_setting_enabled)) { $global_setting_enabled = 'true'; }
//create token
$object = new token;
@@ -232,7 +256,7 @@
echo "<td class='vtable' style='position: relative;' align='left'>\n";
if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') {
echo " <label class='switch'>\n";
echo " <input type='checkbox' id='global_setting_enabled' name='global_setting_enabled' value='true' ".($global_setting_enabled == true ? "checked='checked'" : null).">\n";
echo " <input type='checkbox' id='global_setting_enabled' name='global_setting_enabled' value='true' ".(!empty($global_setting_enabled) && $global_setting_enabled == 'true' ? "checked='checked'" : null).">\n";
echo " <span class='slider'></span>\n";
echo " </label>\n";
}