Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
openemr/interface/fax/fax_view.php /
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
74 lines (62 sloc)
2.09 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // Copyright (C) 2006 Rod Roark <rod@sunsetsystems.com> | |
| // | |
| // This program is free software; you can redistribute it and/or | |
| // modify it under the terms of the GNU General Public License | |
| // as published by the Free Software Foundation; either version 2 | |
| // of the License, or (at your option) any later version. | |
| require_once("../globals.php"); | |
| $ffname = ''; | |
| $jobid = $_GET['jid']; | |
| if ($jobid) { | |
| $jfname = $GLOBALS['hylafax_basedir'] . "/sendq/q$jobid"; | |
| if (!file_exists($jfname)) { | |
| $jfname = $GLOBALS['hylafax_basedir'] . "/doneq/q$jobid"; | |
| } | |
| $jfhandle = fopen($jfname, 'r'); | |
| if (!$jfhandle) { | |
| echo "I am in these groups: "; | |
| passthru("groups"); | |
| echo "<br />"; | |
| die(xl("Cannot open ") . $jfname); | |
| } | |
| while (!feof($jfhandle)) { | |
| $line = trim(fgets($jfhandle)); | |
| if (substr($line, 0, 12) == '!postscript:') { | |
| $ffname = $GLOBALS['hylafax_basedir'] . '/' . | |
| substr($line, strrpos($line, ':') + 1); | |
| break; | |
| } | |
| } | |
| fclose($jfhandle); | |
| if (!$ffname) { | |
| die(xl("Cannot find postscript document reference in ") . $jfname); | |
| } | |
| } else if ($_GET['scan']) { | |
| $ffname = $GLOBALS['scanner_output_directory'] . '/' . $_GET['scan']; | |
| } else { | |
| $ffname = $GLOBALS['hylafax_basedir'] . '/recvq/' . $_GET['file']; | |
| } | |
| if (!file_exists($ffname)) { | |
| die(xl("Cannot find ") . $ffname); | |
| } | |
| if (!is_readable($ffname)) { | |
| die(xl("I do not have permission to read ") . $ffname); | |
| } | |
| ob_start(); | |
| $ext = substr($ffname, strrpos($ffname, '.')); | |
| if ($ext == '.ps') { | |
| passthru("TMPDIR=/tmp ps2pdf '$ffname' -"); | |
| } else if ($ext == '.pdf' || $ext == '.PDF') { | |
| readfile($ffname); | |
| } else { | |
| passthru("tiff2pdf '$ffname'"); | |
| } | |
| header("Pragma: public"); | |
| header("Expires: 0"); | |
| header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); | |
| header("Content-Type: application/pdf"); | |
| header("Content-Length: " . ob_get_length()); | |
| header("Content-Disposition: inline; filename=" . basename($ffname, $ext) . '.pdf'); | |
| ob_end_flush(); | |
| exit; |