Update voicemail_imports.php (#6724)

* Update voicemail_imports.php
This commit is contained in:
Anthony
2023-05-26 16:25:07 -06:00
committed by GitHub
parent 164b8b842c
commit a001f27730
+10 -9
View File
@@ -61,10 +61,10 @@
ini_set('max_execution_time', 7200); ini_set('max_execution_time', 7200);
//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'])) {
@@ -75,7 +75,7 @@
//copy the csv file //copy the csv file
//$_POST['submit'] == "Upload" && //$_POST['submit'] == "Upload" &&
if (is_uploaded_file($_FILES['ulfile']['tmp_name']) && permission_exists('voicemail_import')) { if (!empty($_FILES['ulfile']['tmp_name']) && is_uploaded_file($_FILES['ulfile']['tmp_name']) && permission_exists('voicemail_import')) {
if ($_POST['type'] == 'csv') { if ($_POST['type'] == 'csv') {
move_uploaded_file($_FILES['ulfile']['tmp_name'], $_SESSION['server']['temp']['dir'].'/'.$_FILES['ulfile']['name']); move_uploaded_file($_FILES['ulfile']['tmp_name'], $_SESSION['server']['temp']['dir'].'/'.$_FILES['ulfile']['name']);
$save_msg = "Uploaded file to ".$_SESSION['server']['temp']['dir']."/". htmlentities($_FILES['ulfile']['name']); $save_msg = "Uploaded file to ".$_SESSION['server']['temp']['dir']."/". htmlentities($_FILES['ulfile']['name']);
@@ -108,10 +108,10 @@
//remove the v_ table prefix //remove the v_ table prefix
if (substr($table_name, 0, 2) == 'v_') { if (substr($table_name, 0, 2) == 'v_') {
$table_name = substr($table_name, 2); $table_name = substr($table_name, 2);
} }
if (substr($parent_name, 0, 2) == 'v_') { if (substr($parent_name, 0, 2) == 'v_') {
$parent_name = substr($parent_name, 2); $parent_name = substr($parent_name, 2);
} }
//filter for specific tables and build the schema array //filter for specific tables and build the schema array
@@ -119,6 +119,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'];
@@ -231,7 +232,7 @@
} }
//upload the csv //upload the csv
if (file_exists($_SESSION['file']) && $action == 'import') { if (file_exists($_SESSION['file'] ?? '') && $action == 'import') {
//validate the token //validate the token
$token = new token; $token = new token;
@@ -364,7 +365,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";