Skip to content

Commit

Permalink
minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
sunsetsystems committed Oct 13, 2006
1 parent 6d1b0e3 commit 45ba084
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions interface/fax/fax_dispatch.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,11 @@

if ($_GET['file']) {
$mode = 'fax';
// $filename = escapeshellcmd($_GET['file']);
$filename = $_GET['file'];
$filepath = $GLOBALS['hylafax_basedir'] . '/recvq/' . $filename;
}
else if ($_GET['scan']) {
$mode = 'scan';
// $filename = escapeshellcmd($_GET['scan']);
$filename = $_GET['scan'];
$filepath = $GLOBALS['scanner_output_directory'] . '/' . $filename;
}
Expand Down Expand Up @@ -81,15 +79,19 @@ function mergeTiffs() {
$docdir = "$webserver_root/documents/$patient_id";
exec("mkdir -p '$docdir'");
// Compute a target filename that does not yet exist.
$ffname = trim($_POST['form_filename']);
$i = strrpos($ffname, '.');
if ($i) $ffname = trim(substr($ffname, 0, $i));
if (!$ffname) $ffname = $filebase;
$ffmod = '';
$ffsuff = '.pdf';
// If the target filename exists, modify it until it doesn't.
$count = 0;
while (is_file("$docdir/$filebase$ffmod$ffsuff")) {
while (is_file("$docdir/$ffname$ffmod$ffsuff")) {
++$count;
$ffmod = "_$count";
}
$target = "$docdir/$filebase$ffmod$ffsuff";
$target = "$docdir/$ffname$ffmod$ffsuff";

// Create the target PDF.
$info_msg .= mergeTiffs();
Expand Down Expand Up @@ -120,7 +122,7 @@ function mergeTiffs() {
if ($_POST['form_cb_note']) {
// Build note text in a way that identifies the new document.
// See pnotes_full.php which uses this to auto-display the document.
$note = "$filebase$ffmod$ffsuff";
$note = "$ffname$ffmod$ffsuff";
for ($tmp = $catid; $tmp;) {
$catrow = sqlQuery("SELECT name, parent FROM categories WHERE id = '$tmp'");
$note = $catrow['name'] . "/$note";
Expand Down

0 comments on commit 45ba084

Please sign in to comment.