Exemplo n.º 1
0
    $fh = fopen($tmp_file_name, "r");
    $content = fread($fh, filesize($tmp_file_name));
    fclose($fh);
    if (function_exists("mb_convert_encoding")) {
        $content = mb_convert_encoding($content, 'UTF-8', $_REQUEST["format"]);
    } else {
        $content = iconv('UTF-8', $_REQUEST["format"], $content);
    }
    $fh = fopen($tmp_file_name, "w");
    fwrite($fh, $content);
    fclose($fh);
}
// Now parse the file and look for errors
$ret_value = 0;
if ($_REQUEST['source'] == 'act') {
    $ret_value = parse_import_act($tmp_file_name, $delimiter, $max_lines, $has_header);
} else {
    $ret_value = parse_import($tmp_file_name, $delimiter, $max_lines, $has_header);
}
if ($ret_value == -1) {
    show_error_import($mod_strings['LBL_CANNOT_OPEN']);
    exit;
} else {
    if ($ret_value == -2) {
        show_error_import($mod_strings['LBL_NOT_SAME_NUMBER']);
        exit;
    } else {
        if ($ret_value == -3) {
            show_error_import($mod_strings['LBL_NO_LINES']);
            exit;
        }
Exemplo n.º 2
0
    }
}
p("field_to_pos");
$adb->println($field_to_pos);
p("col_pos_to_field");
$adb->println($col_pos_to_field);
$max_lines = -1;
$ret_value = 0;
if (isset($_REQUEST['tmp_file'])) {
    $_SESSION['tmp_file'] = vtlib_purify($_REQUEST['tmp_file']);
} else {
    $_REQUEST['tmp_file'] = vtlib_purify($_SESSION['tmp_file']);
}
// End
if ($_REQUEST['source'] == 'act') {
    $ret_value = parse_import_act($_REQUEST['tmp_file'], $delimiter, $max_lines, $has_header);
} else {
    $ret_value = parse_import($_REQUEST['tmp_file'], $delimiter, $max_lines, $has_header);
}
$datarows = $ret_value['rows'];
$ret_field_count = $ret_value['field_count'];
//we have to get all picklist entries and add with the corresponding picklist table
if (isset($datarows) && is_array($datarows)) {
    //This file will be included only once at the first time. Will not be included when we redirect from ImportSave
    include "modules/Import/picklist_addition.php";
}
$saved_ids = array();
$firstrow = 0;
if (!isset($datarows)) {
    $error = $mod_strings['LBL_FILE_ALREADY_BEEN_OR'];
    $datarows = array();