$error_message = ""; // if is postback (form sended) and import needed if (@$_POST["a"] == "added") { $value = postvalue("value_ImportFileName" . $id); $type = postvalue("type_ImportFileName" . $id); $importfile = getImportTableName("file_ImportFileName" . $id); //check the file extension $pos = strrpos($value, "."); $ext = strtoupper(substr($value, $pos)); if ($eventObj->exists('BeforeImport')) { if ($eventObj->BeforeImport() === false) { exit(0); } } if ($ext == ".XLS" || $ext == ".XLSX") { ImportFromExcel($importfile); } else { ImportFromCSV($importfile); } if ($eventObj->exists('AfterImport')) { $eventObj->AfterImport($goodlines, $total_records - $goodlines); } if ($goodlines == $total_records) { $error_message = "<font size=2>" . $goodlines . " records were imported</font><br>"; $error_message .= "<font size=2>To back to your list click on the <b>Back to list</b> button.</font>"; } else { $error_message .= "Number of records: " . $total_records . "<br>"; $error_message .= "Imported: " . $goodlines . "<br>"; $error_message .= "Not imported: "; $error_message .= $total_records - $goodlines . "<br>"; }
//check the file extension $pos = strrpos($value,"."); $ext = strtoupper(substr($value,$pos)); if ($eventObj->exists('BeforeImport')) { if ($eventObj->BeforeImport($pageObject) === false) { exit(0); } } if($ext==".XLS" || $ext==".XLSX") { ImportFromExcel($importfile, $strOriginalTableName, $ext, $keys, $keys_present, $total_records, $error_message, $goodlines, $pageObject, $cipherer); } else { ImportFromCSV($importfile, $strOriginalTableName, $ext, $keys, $keys_present, $total_records, $error_message, $goodlines, $pageObject, $cipherer); } if($message != "") // if error happened in ImportFromExcel or ImportFromCSV { $error_message .= "<br>".$message."<br><br>"; } else if ($eventObj->exists('AfterImport')) { $eventObj->AfterImport($goodlines, $total_records-$goodlines, $pageObject); }