Update contact_import.php

This commit is contained in:
FusionPBX 2018-10-17 02:25:28 -06:00 committed by GitHub
parent c0b8efa763
commit 0afb18c608
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 104 additions and 80 deletions

View File

@ -61,6 +61,7 @@
$action = check_str($_POST["action"]);
$order_by = check_str($_POST["order_by"]);
$order = check_str($_POST["order"]);
$from_row = check_str($_POST["from_row"]);
$delimiter = check_str($_POST["data_delimiter"]);
$enclosure = check_str($_POST["data_enclosure"]);
@ -200,6 +201,7 @@
echo " <tr>\n";
echo " <td colspan='2' valign='top' align='right' nowrap='nowrap'>\n";
echo " <input name='action' type='hidden' value='import'>\n";
echo " <input name='from_row' type='hidden' value='$from_row'>\n";
echo " <input name='data_delimiter' type='hidden' value='$delimiter'>\n";
echo " <input name='data_enclosure' type='hidden' value='$enclosure'>\n";
echo " <input type='submit' class='btn' id='import' value=\"".$text['button-import']."\">\n";
@ -256,15 +258,17 @@
$prep_statement->execute();
$users = $prep_statement->fetchAll(PDO::FETCH_ASSOC);
//get the contents of the csv file and convert them into an array
$handle = @fopen($_SESSION['file'], "r");
if ($handle) {
//set the row id
//pre-set the numbers
$row_number = 1;
$row_id = 0;
//loop through the array
while (($line = fgets($handle, 4096)) !== false) {
if ($from_row <= $row_number) {
//format the data
$y = 0;
foreach ($fields as $key => $value) {
@ -343,6 +347,8 @@
//increment row id
$row_id++;
} //if ($from_row <= $row_number)
$row_number++;
}
fclose($handle);
@ -450,6 +456,24 @@
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-from_row']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='from_row'>\n";
$i=1;
while($i<=99) {
$selected = ($i == $from_row) ? "selected" : null;
echo " <option value='$i' ".$selected.">$i</option>\n";
$i++;
}
echo " </select>\n";
echo "<br />\n";
echo $text['description-from_row']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-import_delimiter']."\n";