Update user_imports.php for php 8.1

This commit is contained in:
FusionPBX 2023-05-13 17:02:48 -06:00 committed by GitHub
parent 04dc606831
commit 01c3ed5c48
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 9 deletions

View File

@ -17,7 +17,7 @@
The Initial Developer of the Original Code is The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com> Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2020 Portions created by the Initial Developer are Copyright (C) 2008-2023
the Initial Developer. All Rights Reserved. the Initial Developer. All Rights Reserved.
Contributor(s): Contributor(s):
@ -58,10 +58,10 @@
} }
//get the http get values and set them as php variables //get the http get values and set them as php variables
$action = $_POST["action"]; $action = $_POST["action"] ?? '';
$from_row = $_POST["from_row"]; $from_row = $_POST["from_row"] ?? '';
$delimiter = $_POST["data_delimiter"]; $delimiter = $_POST["data_delimiter"] ?? '';
$enclosure = $_POST["data_enclosure"]; $enclosure = $_POST["data_enclosure"] ?? '';
//save the data to the csv file //save the data to the csv file
if (isset($_POST['data'])) { if (isset($_POST['data'])) {
@ -73,8 +73,8 @@
//copy the csv file //copy the csv file
//$_POST['submit'] == "Upload" && //$_POST['submit'] == "Upload" &&
if (is_uploaded_file($_FILES['ulfile']['tmp_name']) && permission_exists('user_import')) { if (!empty($_FILES['ulfile']['tmp_name']) && is_uploaded_file($_FILES['ulfile']['tmp_name']) && permission_exists('user_import')) {
if ($_POST['type'] == 'csv') { if (!empty($_POST['type']) && $_POST['type'] == 'csv') {
$file = $_SESSION['server']['temp']['dir'].'/users-'.$_SESSION['domain_name'].'.csv'; $file = $_SESSION['server']['temp']['dir'].'/users-'.$_SESSION['domain_name'].'.csv';
if (move_uploaded_file($_FILES['ulfile']['tmp_name'], $file)) { if (move_uploaded_file($_FILES['ulfile']['tmp_name'], $file)) {
$_SESSION['file'] = $file; $_SESSION['file'] = $file;
@ -115,6 +115,7 @@
$schema[$i]['table'] = $table_name; $schema[$i]['table'] = $table_name;
$schema[$i]['parent'] = $parent_name; $schema[$i]['parent'] = $parent_name;
foreach($table['fields'] as $row) { foreach($table['fields'] as $row) {
$row['deprecated'] = $row['deprecated'] ?? '';
if ($row['deprecated'] !== 'true') { if ($row['deprecated'] !== 'true') {
if (is_array($row['name'])) { if (is_array($row['name'])) {
$field_name = $row['name']['text']; $field_name = $row['name']['text'];
@ -378,7 +379,7 @@
//exit; //exit;
//save to the data //save to the data
if (is_array($array)) { if (!empty($array)) {
$database = new database; $database = new database;
$database->app_name = 'users'; $database->app_name = 'users';
$database->app_uuid = '4efa1a1a-32e7-bf83-534b-6c8299958a8e'; $database->app_uuid = '4efa1a1a-32e7-bf83-534b-6c8299958a8e';
@ -423,7 +424,7 @@
echo " ".$text['label-import_data']."\n"; echo " ".$text['label-import_data']."\n";
echo "</td>\n"; echo "</td>\n";
echo "<td width='70%' class='vtable' align='left'>\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'></textarea>\n";
echo "<br />\n"; echo "<br />\n";
echo $text['description-import_data']."\n"; echo $text['description-import_data']."\n";
echo "</td>\n"; echo "</td>\n";