function _install()
 {
     global $db;
     $db->execute(CREATE_CSV_FORMAT_TYPES);
     $db->execute(CREATE_CSV_FORMATS);
     $db->execute(CREATE_CSV_COLUMNS);
     $db->execute(CREATE_CSV_FORMAT_COLUMNS);
     $insert_sql = sprintf(INSERT_CSV_FORMAT_TYPES, MODULE_PRODUCT_CSV_FORMAT_TYPES_1, MODULE_PRODUCT_CSV_FORMAT_TYPES_2, MODULE_PRODUCT_CSV_FORMAT_TYPES_3);
     $db->execute($insert_sql);
     foreach ($GLOBALS['MODULE_PRODUCT_CSV_COLUMNS'] as $val) {
         if (preg_match('/:LANGUAGE_ID/', $val['name'])) {
             zen_set_column_with_language(INSERT_CSV_COLUMNS, $val);
             continue;
         }
         $insert_sql = sprintf(INSERT_CSV_COLUMNS, $val['column_id'], $val['type_id'], $val['name'], $val['validate'], $val['dbtable'], $val['dbcolumn']);
         $db->execute($insert_sql);
     }
     $ProductCSV = new ProductCSV();
     for ($i = 1; $i <= 3; $i++) {
         $columns = $ProductCSV->getFormatColumns($i);
         $count = 0;
         $values = array();
         foreach ($columns as $val) {
             $count++;
             $values[$count] = $val['id'];
         }
         switch ($i) {
             case 1:
                 $name = MODULE_PRODUCT_CSV_FORMAT_PRODUCT_ALL;
                 break;
             case 2:
                 $name = MODULE_PRODUCT_CSV_FORMAT_CATEGORY_ALL;
                 break;
             case 3:
                 $name = MODULE_PRODUCT_CSV_FORMAT_OPTION_ALL;
                 break;
         }
         $ProductCSV->setFormat($i, $name, $values);
     }
 }
                $validate = $validate && checkSequential($_POST['csv_format_column'], $ProductCSV->getFormatColumns($_POST['csv_format_type_id']));
                $validate = $validate && checkDepth($_POST['csv_format_column'], $ProductCSV->getFormatColumns($_POST['csv_format_type_id']));
                break;
            case 3:
                $validate = $validate && checkNecessityOption($_POST['csv_format_column'], $ProductCSV->getFormatColumns($_POST['csv_format_type_id']));
                $validate = $validate && checkDuplicate($_POST['csv_format_column'], $ProductCSV->getFormatColumns($_POST['csv_format_type_id']), $ProductCSV->getFormatColumnIgnore($_POST['csv_format_type_id']));
                break;
        }
    }
    if (!isset($_POST['csv_format_column']) || $validate) {
        if (isset($_POST['fID'])) {
            $csv_format_id = $_POST['fID'];
        } else {
            $csv_format_id = false;
        }
        $ProductCSV->setFormat($_POST['csv_format_type_id'], $_POST['csv_format_name'], $_POST['csv_format_column'], $csv_format_id);
        if (isset($_SESSION['product_csv']['upfile'])) {
            unlink($_SESSION['product_csv']['upfile']);
            unset($_SESSION['product_csv']['upfile']);
        }
        zen_redirect(zen_href_link(FILENAME_ADDON_MODULES_ADMIN, 'module=product_csv/csv_format'));
    }
}
// create, edit, and upload
if ($action == 'new' || $action == 'edit' || $action == 'save') {
    $name_csv_format_name = 'csv_format_name';
    $name_csv_format_type_id = 'csv_format_type_id';
    $csv_format_name = '';
    $csv_format_type_id = '';
    $hidden_field = '';
    $setting_now = '';