Device - Import: Updates for PHP 8.1

This commit is contained in:
fusionate 2023-05-24 21:22:16 +00:00
parent e0ccb81dd8
commit cc44fc47c9
No known key found for this signature in database
1 changed files with 8 additions and 8 deletions

View File

@ -17,7 +17,7 @@
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2018-2020
Portions created by the Initial Developer are Copyright (C) 2018-2023
the Initial Developer. All Rights Reserved.
Contributor(s):
@ -61,10 +61,10 @@
ini_set('max_execution_time',7200);
//get the http get values and set them as php variables
$action = $_POST["action"];
$from_row = $_POST["from_row"];
$delimiter = $_POST["data_delimiter"];
$enclosure = $_POST["data_enclosure"];
$action = $_POST["action"] ?? null;
$from_row = $_POST["from_row"] ?? null;
$delimiter = $_POST["data_delimiter"] ?? null;
$enclosure = $_POST["data_enclosure"] ?? null;
//save the data to the csv file
if (isset($_POST['data'])) {
@ -76,7 +76,7 @@
//copy the csv file
//$_POST['submit'] == "Upload" &&
if ( is_uploaded_file($_FILES['ulfile']['tmp_name']) && permission_exists('device_import')) {
if (!empty($_FILES['ulfile']['tmp_name']) && is_uploaded_file($_FILES['ulfile']['tmp_name']) && permission_exists('device_import')) {
if ($_POST['type'] == 'csv') {
$file = $_SESSION['server']['temp']['dir']."/devices-".$_SESSION['domain_name'].".csv";
if (move_uploaded_file($_FILES['ulfile']['tmp_name'], $file)) {
@ -114,7 +114,7 @@
$schema[$i]['table'] = $table_name;
$schema[$i]['parent'] = $parent_name;
foreach ($table['fields'] as $row) {
if ($row['deprecated'] !== 'true') {
if (empty($row['deprecated']) || $row['deprecated'] !== 'true') {
if (is_array($row['name'])) {
$field_name = $row['name']['text'];
}
@ -492,7 +492,7 @@
echo " ".$text['label-import_data']."\n";
echo "</td>\n";
echo "<td width='70%' class='vtable' align='left'>\n";
echo " <textarea name='data' id='data' class='formfld' style='width: 100%; min-height: 150px;' wrap='off'>$data</textarea>\n";
echo " <textarea name='data' id='data' class='formfld' style='width: 100%; min-height: 150px;' wrap='off'>".($data ?? '')."</textarea>\n";
echo "<br />\n";
echo $text['description-import_data']."\n";
echo "</td>\n";