6 * @link http://www.open-emr.org
7 * @author Rod Roark <rod@sunsetsystems.com>
8 * @author Brady Miller <brady.g.miller@gmail.com>
9 * @copyright Copyright (c) 2006-2010 Rod Roark <rod@sunsetsystems.com>
10 * @copyright Copyright (c) 2017-2018 Brady Miller <brady.g.miller@gmail.com>
11 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
15 require_once("../globals.php");
16 require_once("$srcdir/patient.inc");
17 require_once("$srcdir/pnotes.inc");
18 require_once("$srcdir/forms.inc");
19 require_once("$srcdir/options.inc.php");
20 require_once("$srcdir/gprelations.inc.php");
22 use OpenEMR\Core\Header
;
26 $filename = $_GET['file'];
28 // ensure the file variable has no illegal characters
29 check_file_dir_name($filename);
31 $filepath = $GLOBALS['hylafax_basedir'] . '/recvq/' . $filename;
32 } else if ($_GET['scan']) {
34 $filename = $_GET['scan'];
36 // ensure the file variable has no illegal characters
37 check_file_dir_name($filename);
39 $filepath = $GLOBALS['scanner_output_directory'] . '/' . $filename;
41 die("No filename was given.");
44 $ext = substr($filename, strrpos($filename, '.'));
45 $filebase = basename("/$filename", $ext);
46 $faxcache = $GLOBALS['OE_SITE_DIR'] . "/faxcache/$mode/$filebase";
50 // This function builds an array of document categories recursively.
51 // Kittens are the children of cats, you know. :-)getKittens
53 function getKittens($catid, $catstring, &$categories)
55 $cres = sqlStatement("SELECT id, name FROM categories " .
56 "WHERE parent = $catid ORDER BY name");
58 while ($crow = sqlFetchArray($cres)) {
60 getKittens($crow['id'], ($catstring ?
"$catstring / " : "") .
61 ($catid ?
$crow['name'] : ''), $categories);
64 // If no kitties, then this is a leaf node and should be listed.
66 $categories[$catid] = $catstring;
70 // This merges the tiff files for the selected pages into one tiff file.
79 // form_images are the checkboxes to the right of the images.
80 foreach ($_POST['form_images'] as $inbase) {
81 $inames .= ' ' . escapeshellarg("$inbase.tif");
85 die(xl("Internal error - no pages were selected!"));
88 $tmp0 = exec("cd '$faxcache'; tiffcp $inames temp.tif", $tmp1, $tmp2);
90 $msg .= "tiffcp returned $tmp2: $tmp0 ";
96 // If we are submitting...
98 if ($_POST['form_save']) {
99 $action_taken = false;
103 if ($_POST['form_cb_copy']) {
104 $patient_id = (int) $_POST['form_pid'];
106 die(xl('Internal error - patient ID was not provided!'));
109 // Compute the name of the target directory and make sure it exists.
110 $docdir = $GLOBALS['OE_SITE_DIR'] . "/documents/$patient_id";
111 exec("mkdir -p '$docdir'");
113 // If copying to patient documents...
115 if ($_POST['form_cb_copy_type'] == 1) {
116 // Compute a target filename that does not yet exist.
117 $ffname = check_file_dir_name(trim($_POST['form_filename']));
118 $i = strrpos($ffname, '.');
120 $ffname = trim(substr($ffname, 0, $i));
129 // If the target filename exists, modify it until it doesn't.
131 while (is_file("$docdir/$ffname$ffmod$ffsuff")) {
136 $target = "$docdir/$ffname$ffmod$ffsuff";
137 $docdate = fixDate($_POST['form_docdate']);
139 // Create the target PDF. Note that we are relying on the .tif files for
140 // the individual pages to already exist in the faxcache directory.
142 $info_msg .= mergeTiffs();
143 // The -j option here requires that libtiff is configured with libjpeg.
144 // It could be omitted, but the output PDFs would then be quite large.
145 $tmp0 = exec("tiff2pdf -j -p letter -o '$target' '$faxcache/temp.tif'", $tmp1, $tmp2);
148 $info_msg .= "tiff2pdf returned $tmp2: $tmp0 ";
150 $newid = generate_id();
151 $fsize = filesize($target);
152 $catid = (int) $_POST['form_category'];
153 // Update the database.
154 $query = "INSERT INTO documents ( " .
155 "id, type, size, date, url, mimetype, foreign_id, docdate" .
157 "'$newid', 'file_url', '$fsize', NOW(), 'file://$target', " .
158 "'application/pdf', $patient_id, '$docdate' " .
160 sqlStatement($query);
161 $query = "INSERT INTO categories_to_documents ( " .
162 "category_id, document_id" .
164 "'$catid', '$newid' " .
166 sqlStatement($query);
169 // If we are posting a note...
170 if ($_POST['form_cb_note'] && !$info_msg) {
171 // Build note text in a way that identifies the new document.
172 // See pnotes_full.php which uses this to auto-display the document.
173 $note = "$ffname$ffmod$ffsuff";
174 for ($tmp = $catid; $tmp;) {
175 $catrow = sqlQuery("SELECT name, parent FROM categories WHERE id = '$tmp'");
176 $note = $catrow['name'] . "/$note";
177 $tmp = $catrow['parent'];
180 $note = "New scanned document $newid: $note";
181 $form_note_message = trim($_POST['form_note_message']);
182 $form_note_message = strip_escape_custom($form_note_message);
183 if ($form_note_message) {
184 $note .= "\n" . $form_note_message;
187 // addPnote() will do its own addslashes().
193 $_POST['form_note_type'],
194 $_POST['form_note_to']
196 // Link the new patient note to the document.
197 setGpRelation(1, $newid, 6, $noteid);
198 } // end post patient note
199 } // end copy to documents
201 // Otherwise creating a scanned encounter note...
204 // Get desired $encounter_id.
206 if (empty($_POST['form_copy_sn_visit'])) {
207 $info_msg .= "This patient has no visits! ";
209 $encounter_id = 0 +
$_POST['form_copy_sn_visit'];
213 // Merge the selected pages.
214 $info_msg .= mergeTiffs();
215 $tmp_name = "$faxcache/temp.tif";
219 // The following is cloned from contrib/forms/scanned_notes/new.php:
221 $query = "INSERT INTO form_scanned_notes ( " .
224 "'" . $_POST['form_copy_sn_comments'] . "' " .
226 $formid = sqlInsert($query);
236 $imagedir = $GLOBALS['OE_SITE_DIR'] . "/documents/$patient_id/encounters";
237 $imagepath = "$imagedir/${encounter_id}_$formid.jpg";
238 if (! is_dir($imagedir)) {
239 $tmp0 = exec('mkdir -p "' . $imagedir . '"', $tmp1, $tmp2);
241 die("mkdir returned $tmp2: $tmp0");
244 exec("touch '$imagedir/index.html'");
247 if (is_file($imagepath)) {
251 // TBD: There may be a faster way to create this file, given that
252 // we already have a jpeg for each page in faxcache.
253 $cmd = "convert -resize 800 -density 96 '$tmp_name' -append '$imagepath'";
254 $tmp0 = exec($cmd, $tmp1, $tmp2);
256 die("\"$cmd\" returned $tmp2: $tmp0");
260 // If we are posting a patient note...
261 if ($_POST['form_cb_note'] && !$info_msg) {
262 $note = "New scanned encounter note for visit on " . substr($erow['date'], 0, 10);
263 $form_note_message = trim($_POST['form_note_message']);
264 $form_note_message = strip_escape_custom($form_note_message);
265 if ($form_note_message) {
266 $note .= "\n" . $form_note_message;
269 // addPnote() will do its own addslashes().
275 $_POST['form_note_type'],
276 $_POST['form_note_to']
278 } // end post patient note
281 $action_taken = true;
282 } // end copy to chart
284 if ($_POST['form_cb_forward']) {
285 $form_from = trim($_POST['form_from']);
286 $form_to = trim($_POST['form_to']);
287 $form_fax = trim($_POST['form_fax']);
288 $form_message = trim($_POST['form_message']);
289 $form_finemode = $_POST['form_finemode'] ?
'-m' : '-l';
291 $form_from = strip_escape_custom($form_from);
292 $form_to = strip_escape_custom($form_to);
293 $form_message = strip_escape_custom($form_message);
295 // Generate a cover page using enscript. This can be a cool thing
296 // to do, as enscript is very powerful.
300 $tmpfn1 = tempnam("/tmp", "fax1");
301 $tmpfn2 = tempnam("/tmp", "fax2");
302 $tmph = fopen($tmpfn1, "w");
304 $fh = fopen($GLOBALS['OE_SITE_DIR'] . "/faxcover.txt", 'r');
306 $cpstring .= fread($fh, 8192);
310 $cpstring = str_replace('{CURRENT_DATE}', date('F j, Y'), $cpstring);
311 $cpstring = str_replace('{SENDER_NAME}', $form_from, $cpstring);
312 $cpstring = str_replace('{RECIPIENT_NAME}', $form_to, $cpstring);
313 $cpstring = str_replace('{RECIPIENT_FAX}', $form_fax, $cpstring);
314 $cpstring = str_replace('{MESSAGE}', $form_message, $cpstring);
315 fwrite($tmph, $cpstring);
317 $tmp0 = exec("cd $webserver_root/custom; " . escapeshellcmd($GLOBALS['hylafax_enscript']) .
318 " -o $tmpfn2 $tmpfn1", $tmp1, $tmp2);
320 $info_msg .= "enscript returned $tmp2: $tmp0 ";
325 // Send the fax as the cover page followed by the selected pages.
326 $info_msg .= mergeTiffs();
328 "sendfax -A -n $form_finemode -d " .
329 escapeshellarg($form_fax) . " $tmpfn2 '$faxcache/temp.tif'",
334 $info_msg .= "sendfax returned $tmp2: $tmp0 ";
339 $action_taken = true;
342 $form_cb_delete = $_POST['form_cb_delete'];
344 // If deleting selected, do it and then check if any are left.
345 if ($form_cb_delete == '1' && !$info_msg) {
346 foreach ($_POST['form_images'] as $inbase) {
347 unlink("$faxcache/$inbase.jpg");
348 $action_taken = true;
351 // Check if any .jpg files remain... if not we'll clean up.
353 $dh = opendir($faxcache);
355 die("Cannot read $faxcache");
358 $form_cb_delete = '2';
359 while (false !== ($jfname = readdir($dh))) {
360 if (preg_match('/\.jpg$/', $jfname)) {
361 $form_cb_delete = '1';
369 if ($form_cb_delete == '2' && !$info_msg) {
370 // Delete the tiff file, with archiving if desired.
371 if ($GLOBALS['hylafax_archdir'] && $mode == 'fax') {
372 rename($filepath, $GLOBALS['hylafax_archdir'] . '/' . $filename);
378 if (is_dir($faxcache)) {
379 $dh = opendir($faxcache);
380 while (($tmp = readdir($dh)) !== false) {
381 if (is_file("$faxcache/$tmp")) {
382 unlink("$faxcache/$tmp");
390 $action_taken = true;
393 if (!$action_taken && !$info_msg) {
394 $info_msg = xl('You did not choose any actions.');
397 if ($info_msg ||
$form_cb_delete != '1') {
398 // Close this window and refresh the fax list.
399 echo "<html>\n<body>\n<script language='JavaScript'>\n";
401 echo " alert('$info_msg');\n";
404 echo " if (!opener.closed && opener.refreshme) opener.refreshme();\n";
405 echo " window.close();\n";
406 echo "</script>\n</body>\n</html>\n";
409 } // end submit logic
411 // If we get this far then we are displaying the form.
413 // Find out if the scanned_notes form is installed and active.
415 $tmp = sqlQuery("SELECT count(*) AS count FROM registry WHERE " .
416 "directory LIKE 'scanned_notes' AND state = 1 AND sql_run = 1");
417 $using_scanned_notes = $tmp['count'];
419 // If the image cache does not yet exist for this fax, build it.
420 // This will contain a .tif image as well as a .jpg image for each page.
422 if (! is_dir($faxcache)) {
423 $tmp0 = exec('mkdir -p "' . $faxcache . '"', $tmp1, $tmp2);
425 die("mkdir returned $tmp2: $tmp0");
428 if (strtolower($ext) != '.tif') {
429 // convert's default density for PDF-to-TIFF conversion is 72 dpi which is
430 // not very good, so we upgrade it to "fine mode" fax quality. It's really
431 // better and faster if the scanner produces TIFFs instead of PDFs.
432 $tmp0 = exec("convert -density 203x196 '$filepath' '$faxcache/deleteme.tif'", $tmp1, $tmp2);
434 die("convert returned $tmp2: $tmp0");
437 $tmp0 = exec("cd '$faxcache'; tiffsplit 'deleteme.tif'; rm -f 'deleteme.tif'", $tmp1, $tmp2);
439 die("tiffsplit/rm returned $tmp2: $tmp0");
442 $tmp0 = exec("cd '$faxcache'; tiffsplit '$filepath'", $tmp1, $tmp2);
444 die("tiffsplit returned $tmp2: $tmp0");
448 $tmp0 = exec("cd '$faxcache'; mogrify -resize 750x970 -format jpg *.tif", $tmp1, $tmp2);
450 die("mogrify returned $tmp2: $tmp0; ext is '$ext'; filepath is '$filepath'");
454 // Get the categories list.
455 $categories = array();
456 getKittens(0, '', $categories);
458 // Get the users list.
459 $ures = sqlStatement("SELECT username, fname, lname FROM users " .
460 "WHERE active = 1 AND ( info IS NULL OR info NOT LIKE '%Inactive%' ) " .
461 "ORDER BY lname, fname");
466 <?php Header
::setupHeader(['opener', 'datetime-picker', 'jquery-ui',]);?
>
467 <title
><?php
xl('Dispatch Received Document', 'e'); ?
></title
>
471 td
, input
, select
, textarea
{
482 border
-color
: #0000ff;
489 <script language
="JavaScript">
491 <?php
require($GLOBALS['srcdir'] . "/restoreSession.php"); ?
>
493 function divclick(cb
, divid
) {
494 var divstyle
= document
.getElementById(divid
).style
;
496 if (divid
== 'div_copy_doc') {
497 document
.getElementById('div_copy_sn').style
.display
= 'none';
499 else if (divid
== 'div_copy_sn') {
500 document
.getElementById('div_copy_doc').style
.display
= 'none';
502 divstyle
.display
= 'block';
504 divstyle
.display
= 'none';
509 // This is for callback by the find-patient popup.
510 function setpatient(pid
, lname
, fname
, dob
) {
511 var f
= document
.forms
[0];
512 f
.form_patient
.value
= lname +
', ' + fname
;
513 f
.form_pid
.value
= pid
;
514 <?php
if ($using_scanned_notes) { ?
>
515 // This loads the patient's list of recent encounters:
516 f
.form_copy_sn_visit
.options
.length
= 0;
517 f
.form_copy_sn_visit
.options
[0] = new Option('Loading...', '0');
518 $
.getScript("fax_dispatch_newpid.php?p=" + pid
);
522 // This invokes the find-patient popup.
523 function sel_patient() {
524 dlgopen('../main/calendar/find_patient_popup.php', '_blank', 750, 550, false, 'Select Patient');
527 // Check for errors when the form is submitted.
528 function validate() {
529 var f
= document
.forms
[0];
531 if (f
.form_cb_copy
.checked
) {
532 if (! f
.form_pid
.value
) {
533 alert('You have not selected a patient!');
538 if (f
.form_cb_forward
.checked
) {
539 var s
= f
.form_fax
.value
;
541 alert('A fax number is required!');
545 for (var i
= 0; i
< s
.length
; ++i
) {
547 if (c
>= '0' && c
<= '9') {
550 else if (digcount
== 0 || c
!= '-') {
551 alert('Invalid character(s) in fax number!');
556 if (s
.charAt(0) < '2') {
557 alert('Local phone number starts with an invalid digit!');
561 else if (digcount
== 11) {
562 if (s
.charAt(0) != '1') {
563 alert('11-digit number must begin with 1!');
567 else if (digcount
== 10) {
568 if (s
.charAt(0) < '2') {
569 alert('10-digit number starts with an invalid digit!');
572 f
.form_fax
.value
= '1' + s
;
575 alert('Invalid number of digits in fax telephone number!');
580 if (f
.form_cb_copy
.checked || f
.form_cb_forward
.checked
) {
582 for (var i
= 0; i
< f
.elements
.length
; ++i
) {
583 if (f
.elements
[i
].name
== 'form_images[]' && f
.elements
[i
].checked
)
586 if (check_count
== 0) {
587 alert('No pages have been selected!');
592 top
.restoreSession();
596 function allCheckboxes(issel
) {
597 var f
= document
.forms
[0];
598 for (var i
= 0; i
< f
.elements
.length
; ++i
) {
599 if (f
.elements
[i
].name
== 'form_images[]') f
.elements
[i
].checked
= issel
;
603 $
(document
).ready(function(){
604 $
('.datepicker').datetimepicker({
605 <?php
$datetimepicker_timepicker = false; ?
>
606 <?php
$datetimepicker_showseconds = false; ?
>
607 <?php
$datetimepicker_formatInput = false; ?
>
608 <?php
require($GLOBALS['srcdir'] . '/js/xl/jquery-datetimepicker-2-5-4.js.php'); ?
>
609 <?php
// can add any additional javascript settings to datetimepicker here; need to prepend first setting with a comma ?>
616 <body
class="body_top" onunload
='imclosing()'>
618 <center
><h2
><?php
xl('Dispatch Received Document', 'e'); ?
></h2
></center
>
620 <form method
='post' name
='theform'
621 action
='fax_dispatch.php?<?php echo ($mode == 'fax
') ? 'file
' : 'scan
'; ?>=<?php echo $filename ?>' onsubmit
='return validate()'>
623 <p
><input type
='checkbox' name
='form_cb_copy' value
='1'
624 onclick
='return divclick(this,"div_copy");' />
625 <b
><?php
xl('Copy Pages to Patient Chart', 'e'); ?
></b
></p
>
627 <div id
='div_copy' class='section' style
='display:none;'>
630 <td
class='itemtitle' width
='1%' nowrap
><?php
xl('Patient', 'e'); ?
></td
>
632 <input type
='text' size
='10' name
='form_patient' style
='width:100%'
633 value
=' (<?php xl('Click to select
'); ?>)' onclick
='sel_patient()'
634 title
='Click to select patient' readonly
/>
635 <input type
='hidden' name
='form_pid' value
='0' />
639 <td colspan
='2' style
='padding-top:0.5em;'>
640 <input type
='radio' name
='form_cb_copy_type' value
='1'
641 onclick
='return divclick(this,"div_copy_doc");' checked
/>
642 <b
><?php
xl('Patient Document', 'e'); ?
></b
> 
;
643 <?php
if ($using_scanned_notes) { ?
>
644 <input type
='radio' name
='form_cb_copy_type' value
='2'
645 onclick
='return divclick(this,"div_copy_sn");' />
646 <b
><?php
xl('Scanned Encounter Note', 'e'); ?
></b
>
648 <div id
='div_copy_doc' class='section' style
='margin-top:0.5em;'>
651 <td
class='itemtitle' nowrap
><?php
xl('Category', 'e'); ?
></td
>
653 <select name
='form_category' style
='width:100%'>
655 foreach ($categories as $catkey => $catname) {
656 echo " <option value='$catkey'";
657 echo ">$catname</option>\n";
664 <td
class='itemtitle' nowrap
><?php
xl('Filename', 'e'); ?
></td
>
666 <input type
='text' size
='10' name
='form_filename' style
='width:100%'
667 value
='<?php echo "$filebase.pdf" ?>'
668 title
='Name for this document in the patient chart' />
672 <td
class='itemtitle' nowrap
><?php
xl('Document Date', 'e'); ?
></td
>
674 <input type
='text' class='datepicker' size
='10' name
='form_docdate' id
='form_docdate'
675 value
='<?php echo date('Y
-m
-d
'); ?>'
676 title
='<?php xl('yyyy
-mm
-dd date associated with this document
', 'e
'); ?>' />
680 </div
><!-- end div_copy_doc
-->
681 <div id
='div_copy_sn' class='section' style
='display:none;margin-top:0.5em;'>
684 <td
class='itemtitle' width
='1%' nowrap
><?php
xl('Visit Date', 'e'); ?
></td
>
686 <select name
='form_copy_sn_visit' style
='width:100%'>
691 <td
class='itemtitle' width
='1%' nowrap
><?php
xl('Comments', 'e'); ?
></td
>
693 <textarea name
='form_copy_sn_comments' rows
='3' cols
='30' style
='width:100%'
694 title
='Comments associated with this scanned note'
699 </div
><!-- end div_copy_sn
-->
703 <td colspan
='2' style
='padding-top:0.5em;'>
704 <input type
='checkbox' name
='form_cb_note' value
='1'
705 onclick
='return divclick(this,"div_note");' />
706 <b
><?php
xl('Create Patient Note', 'e'); ?
></b
>
707 <div id
='div_note' class='section' style
='display:none;margin-top:0.5em;'>
710 <td
class='itemtitle' width
='1%' nowrap
><?php
xl('Type', 'e'); ?
></td
>
713 // Added 6/2009 by BM to incorporate the patient notes into the list_options listings
714 generate_form_field(array('data_type'=>1,'field_id'=>'note_type','list_id'=>'note_type','empty_title'=>'SKIP'), '');
719 <td
class='itemtitle' width
='1%' nowrap
>To
</td
>
721 <select name
='form_note_to' style
='width:100%'>
723 while ($urow = sqlFetchArray($ures)) {
724 echo " <option value='" . $urow['username'] . "'";
725 echo ">" . $urow['lname'];
726 if ($urow['fname']) {
727 echo ", " . $urow['fname'];
733 <option value
=''>** <?php
xl('Close', 'e'); ?
> **</option
>
738 <td
class='itemtitle' nowrap
><?php
xl('Message', 'e'); ?
></td
>
740 <textarea name
='form_note_message' rows
='3' cols
='30' style
='width:100%'
741 title
='Your comments' /></textarea
>
745 </div
><!-- end div_note
-->
749 </div
><!-- end div_copy
-->
751 <p
><input type
='checkbox' name
='form_cb_forward' value
='1'
752 onclick
='return divclick(this,"div_forward");' />
753 <b
><?php
xl('Forward Pages via Fax', 'e'); ?
></b
></p
>
755 <div id
='div_forward' class='section' style
='display:none;'>
758 <td
class='itemtitle' width
='1%' nowrap
><?php
xl('From', 'e'); ?
></td
>
760 <input type
='text' size
='10' name
='form_from' style
='width:100%'
761 title
='Type your name here' />
765 <td
class='itemtitle' nowrap
><?php
xl('To', 'e'); ?
></td
>
767 <input type
='text' size
='10' name
='form_to' style
='width:100%'
768 title
='Type the recipient name here' />
772 <td
class='itemtitle' nowrap
><?php
xl('Fax', 'e'); ?
></td
>
774 <input type
='text' size
='10' name
='form_fax' style
='width:100%'
775 title
='The fax phone number to send this to' />
779 <td
class='itemtitle' nowrap
><?php
xl('Message', 'e'); ?
></td
>
781 <textarea name
='form_message' rows
='3' cols
='30' style
='width:100%'
782 title
='Your comments to include with this message' /></textarea
>
786 <td
class='itemtitle' nowrap
><?php
xl('Quality', 'e'); ?
></td
>
788 <input type
='radio' name
='form_finemode' value
='' /><?php
xl('Normal', 'e'); ?
>  
;
789 <input type
='radio' name
='form_finemode' value
='1' checked
/><?php
xl('Fine', 'e'); ?
>  
;
793 </div
><!-- end div_forward
-->
795 <p
><b
><?php
xl('Delete Pages', 'e'); ?
>:</b
> 
;
796 <input type
='radio' name
='form_cb_delete' value
='2' />All
 
;
797 <input type
='radio' name
='form_cb_delete' value
='1' checked
/>Selected
 
;
798 <input type
='radio' name
='form_cb_delete' value
='0' />None
803 <input type
='submit' name
='form_save' value
='<?php xl('OK
', 'e
'); ?>' />
805 <input type
='button' value
='<?php xl('Cancel
', 'e
'); ?>' onclick
='window.close()' />
807 <input type
='button' value
='<?php xl('Select All
', 'e
'); ?>' onclick
='allCheckboxes(true)' />
809 <input type
='button' value
='<?php xl('Clear All
', 'e
'); ?>' onclick
='allCheckboxes(false)' />
812 <p
><br
/><b
><?php
xl('Please select the desired pages to copy or forward:', 'e'); ?
></b
></p
>
816 $dh = opendir($faxcache);
818 die("Cannot read $faxcache");
822 while (false !== ($jfname = readdir($dh))) {
823 if (preg_match("/^(.*)\.jpg/", $jfname, $matches)) {
824 $jpgarray[$matches[1]] = $jfname;
829 // readdir does not read in any particular order, we must therefore sort
830 // by filename so the display order matches the original document.
833 foreach ($jpgarray as $jfnamebase => $jfname) {
836 echo " <td valign='top'>\n";
837 echo " <img src='../../sites/" . $_SESSION['site_id'] . "/faxcache/$mode/$filebase/$jfname' />\n";
839 echo " <td align='center' valign='top'>\n";
840 echo " <input type='checkbox' name='form_images[]' value='$jfnamebase' checked />\n";
841 echo " <br />$page\n";