restore links to billing output files
[openemr.git] / interface / billing / get_claim_file.php
blob8c7fa17617f13f61908b9900547efd6a33269566
1 <?php
2 require_once(dirname(__FILE__) . "/../globals.php");
3 require_once(dirname(__FILE__) . "/../../includes/config.php");
5 $fconfig = $GLOBALS['oer_config']['freeb'];
6 $content_type = "text/plain";
7 $claim_file_dir = "$webserver_root/edi/";
9 $fname = $_GET['key'];
10 $fname = preg_replace("[/]","",$fname);
11 $fname = preg_replace("[\.\.]","",$fname);
12 $fname = preg_replace("[\\\\]","",$fname);
14 if (strtolower(substr($fname,(strlen($fname)-4))) == ".pdf") {
15 $content_type = "application/pdf";
16 $claim_file_dir = $fconfig['claim_file_dir'];
19 $fname = $claim_file_dir . $fname;
21 if (!file_exists($fname)) {
22 echo xl("The claim file: ") . $_GET['key'] . xl(" could not be accessed.");
24 elseif ($_GET['action'] == "print") {
26 <html>
27 <head>
28 <link rel=stylesheet href="<?php echo $css_header;?>" type="text/css">
29 </head>
30 <body <?php echo $top_bg_line;?> topmargin=0 rightmargin=0 leftmargin=2 bottommargin=0 marginwidth=2 marginheight=0>
31 <br><p><h3><?php xl('Printing results:','e')?></h3><a href="billing_report.php"><?php xl('back','e')?></a><ul>
32 <?php
33 $estring = $fconfig['print_command'] . " -P " . $fconfig['printer_name'] . " " . $fconfig['printer_extras'] . " " . $fname;
34 $rstring = exec(escapeshellcmd($estring));
35 echo xl("Document") . $fname . xl("sent to printer.");
37 </ul>
38 </body>
39 </html>
40 <?php
42 else {
43 $fp = fopen($fname, 'r');
45 header("Pragma: public");
46 header("Expires: 0");
47 header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
48 header("Content-Type: $content_type");
49 header("Content-Length: " . filesize($fname));
50 header("Content-Disposition: attachment; filename=" . basename($fname));
52 // dump the picture and stop the script
53 fpassthru($fp);
55 exit;