diff --git a/app/destinations/destination_imports.php b/app/destinations/destination_imports.php index bf638b6aaa..3fa507ef93 100644 --- a/app/destinations/destination_imports.php +++ b/app/destinations/destination_imports.php @@ -58,14 +58,14 @@ } //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"]; - $destination_type = $_POST["destination_type"]; - $destination_action = $_POST["destination_action"]; - $destination_context = $_POST["destination_context"]; - $destination_record = $_POST["destination_record"]; + $action = $_POST["action"] ?? null; + $from_row = $_POST["from_row"] ?? null; + $delimiter = $_POST["data_delimiter"] ?? null; + $enclosure = $_POST["data_enclosure"] ?? null; + $destination_type = $_POST["destination_type"] ?? null; + $destination_action = $_POST["destination_action"] ?? null; + $destination_context = $_POST["destination_context"] ?? null; + $destination_record = $_POST["destination_record"] ?? null; //set the defaults if (empty($destination_type)) { $destination_type = 'inbound'; } @@ -84,7 +84,7 @@ //copy the csv file //$_POST['submit'] == "Upload" && - if (is_uploaded_file($_FILES['ulfile']['tmp_name']) && permission_exists('destination_upload')) { + if (!empty($_FILES['ulfile']['tmp_name']) && is_uploaded_file($_FILES['ulfile']['tmp_name']) && permission_exists('destination_upload')) { if ($_POST['type'] == 'csv') { 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']); @@ -103,9 +103,9 @@ //get the schema $x = 0; - include ("app/destinations/app_config.php"); + include "app/destinations/app_config.php"; $i = 0; - foreach($apps[0]['db'] as $table) { + foreach ($apps[0]['db'] as $table) { //get the table name and parent name $table_name = $table["table"]['name']; $parent_name = $table["table"]['parent']; @@ -122,8 +122,8 @@ if ($table_name == "destinations") { $schema[$i]['table'] = $table_name; $schema[$i]['parent'] = $parent_name; - foreach($table['fields'] as $row) { - if ($row['deprecated'] !== 'true') { + foreach ($table['fields'] as $row) { + if (empty($row['deprecated']) || (!empty($row['deprecated']) && $row['deprecated'] !== 'true')) { if (is_array($row['name'])) { $field_name = $row['name']['text']; } @@ -187,8 +187,8 @@ //get the table and field name $field_array = explode(".",$value); - $table_name = $field_array[0]; - $field_name = $field_array[1]; + $table_name = $field_array[0] ?? null; + $field_name = $field_array[1] ?? null; //get the parent table name $parent = get_parent($schema, $table_name); @@ -256,7 +256,7 @@ $array["dialplans"][$row_id]["app_uuid"] = "c03b422e-13a8-bd1b-e42b-b6b9b4d27ce4"; $array["dialplans"][$row_id]["dialplan_uuid"] = $dialplan_uuid; $array["dialplans"][$row_id]["domain_uuid"] = $domain_uuid; - $array["dialplans"][$row_id]["dialplan_name"] = ($dialplan_name != '') ? $dialplan_name : format_phone($destination_number); + $array["dialplans"][$row_id]["dialplan_name"] = !empty($dialplan_name) ? $dialplan_name : format_phone($destination_number); $array["dialplans"][$row_id]["dialplan_number"] = $destination_number; $array["dialplans"][$row_id]["dialplan_context"] = $destination_context; $array["dialplans"][$row_id]["dialplan_continue"] = "false"; @@ -289,7 +289,7 @@ } //build the xml dialplan - $array["dialplans"][$row_id]["dialplan_xml"] = "\n"; + $array["dialplans"][$row_id]["dialplan_xml"] = "\n"; $array["dialplans"][$row_id]["dialplan_xml"] .= " \n"; $array["dialplans"][$row_id]["dialplan_xml"] .= " \n"; $array["dialplans"][$row_id]["dialplan_xml"] .= " \n"; @@ -463,7 +463,7 @@ $y++; //set inline to true - if ($action_app == 'set' || $action_app == 'export') { + if (!empty($action_app) && ($action_app == 'set' || $action_app == 'export')) { $dialplan["dialplan_details"][$y]["dialplan_detail_inline"] = 'true'; } @@ -756,15 +756,13 @@ echo " \n"; echo " \n"; switch ($destination_type) { - case "inbound" : $selected[1] = "selected='selected'"; break; - case "outbound" : $selected[2] = "selected='selected'"; break; - //case "local" : $selected[2] = "selected='selected'"; break; + case "inbound": $selected[1] = "selected='selected'"; break; + case "outbound": $selected[2] = "selected='selected'"; break; + //case "local": $selected[2] = "selected='selected'"; break; } - echo " \n"; - echo " \n"; + echo " \n"; + echo " \n"; //echo " \n"; unset($selected); echo " \n"; @@ -809,12 +807,12 @@ case "true" : $selected[1] = "selected='selected'"; break; case "false" : $selected[2] = "selected='selected'"; break; } - echo " \n"; - echo " \n"; + echo " \n"; + echo " \n"; unset($selected); echo " \n"; echo "
\n"; - echo $text['description-destination_record']."\n"; + echo ($text['description-destination_record'] ?? null)."\n"; echo "\n"; echo "\n"; @@ -841,7 +839,7 @@ echo " \n"; echo " \n"; echo "
\n"; - echo $text['description-actions']."\n"; + echo ($text['description-actions'] ?? null)."\n"; echo "\n"; echo "\n"; @@ -882,16 +880,18 @@ echo "\n"; echo "\n"; echo " \n"; echo "
\n"; - echo $text['description-destination_enabled']."\n"; + echo ($text['description-destination_enabled'] ?? null)."\n"; echo "\n"; echo "\n"; @@ -950,7 +950,7 @@ echo " ".$text['label-import_data']."\n"; echo "\n"; echo "\n"; - echo " \n"; + echo " \n"; echo "
\n"; echo $text['description-import_data']."\n"; echo "\n"; @@ -1011,7 +1011,7 @@ echo "\n"; echo " \n"; echo "
\n"; - echo $text['description-import_file_upload']."\n"; + echo ($text['description-import_file_upload'] ?? null)."\n"; echo "\n"; echo "\n"; } @@ -1027,4 +1027,4 @@ //include the footer require_once "resources/footer.php"; -?> +?> \ No newline at end of file