$page_list[$file] = array('title' => constant('MODULE_IMPORT_BANK_TITLE'), 'structure' => load_module_xml('import_bank/file')); /*************** hook for custom actions ***************************/ $custom_path = DIR_FS_MODULES . 'import_bank/custom/pages/main/extra_actions.php'; if (file_exists($custom_path)) { include $custom_path; } /*************** Act on the action request *************************/ switch ($_REQUEST['action']) { case 'import_csv': if (!validate_upload('file_name', 'text', 'csv')) { break; } $result = bank_import_csv($page_list[$subject]['structure'], 'file_name', $bank_acct); break; case 'sample_csv': $output = build_sample_csv($page_list[$subject]['structure'], 'bank_import'); header("Content-type: application/csv"); header("Content-disposition: attachment; filename=sample_bank_import; size=" . strlen($output)); header('Pragma: cache'); header('Cache-Control: public, must-revalidate, max-age=0'); header('Connection: close'); header('Expires: ' . date('r', time() + 3600)); header('Last-Modified: ' . date('r')); print $output; exit; default: } /***************** prepare to display templates *************************/ $cash_chart = gen_coa_pull_down(2, false, true, false, $restrict_types = array(0)); // cash types only $include_header = true;
$custom_path = DIR_FS_MODULES . 'phreedom/custom/pages/import_export/extra_actions.php'; if (file_exists($custom_path)) { include $custom_path; } /*************** Act on the action request *************************/ switch ($_REQUEST['action']) { case 'sample_xml': case 'sample_csv': $type = $_REQUEST['action'] == 'sample_csv' ? 'csv' : 'xml'; switch ($type) { case 'xml': $output = build_sample_xml($page_list[$subject]['structure'], $db_table); header("Content-type: plain/txt"); break; case 'csv': $output = build_sample_csv($page_list[$subject]['structure'], $db_table); header("Content-type: application/csv"); break; } header("Content-disposition: attachment; filename=sample_{$db_table}.{$type}; size=" . strlen($output)); header('Pragma: cache'); header('Cache-Control: public, must-revalidate, max-age=0'); header('Connection: close'); header('Expires: ' . date('r', time() + 3600)); header('Last-Modified: ' . date('r')); print $output; exit; case 'import_table': $format = $_POST['import_format_' . $db_table]; switch ($format) { case 'xml':