X-Git-Url: http://gitweb.hugovil.com/?a=blobdiff_plain;f=include%2Fimport.csv.php;fp=include%2Fimport.csv.php;h=4e1542cde0853b1d6af88887826f239d2949765f;hb=2f39180e450118c0bb6213a3cc2f37cf44a93d53;hp=4a0f5c788da5b190177c2ae1696857fefc9cfbcf;hpb=4acf917fa54f1fbf9be4b0bec3dcf4405a9bc975;p=php-addressbook.git diff --git a/include/import.csv.php b/include/import.csv.php index 4a0f5c7..4e1542c 100644 --- a/include/import.csv.php +++ b/include/import.csv.php @@ -31,26 +31,22 @@ class ImportCsv extends ImportDel { // $delim = maxChar($delims, $test_line); $quote = maxChar($quotes, $test_line); - - // - // Re-Conncat the file-lines - // - $input = implode("\n", $file_lines)."\n"; - - // - // Setup and run the parser - // - include "lib/parsecsv.lib.php"; - $csv = new parseCSV(); - $csv->delimiter = $delim; - $csv->enclosure = $quote; - $csv->file_data = &$input; - $this->data = $csv->parse_string(); + + $escape = '\\'; + + for($i = 0; $i < count($file_lines); $i++) { + // Skip the first line (header) + if ($i > 0) + { + $row = str_getcsv($file_lines[$i], $delim, $quote, $escape); + $this->data[] = $row; + } + } // // Convert the array to addresses - // - $this->convertToAddresses(); + // + $this->convertToAddresses(); // Will populate ab } } -?> \ No newline at end of file +?>