// // 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"); use OpenEMR\Common\Csrf\CsrfUtils; use OpenEMR\Core\Header; $faxstats = array( 'B' => xl('Blocked'), 'D' => xl('Sent successfully'), 'F' => xl('Failed'), 'P' => xl('Pending'), 'R' => xl('Send in progress'), 'S' => xl('Sleeping'), 'T' => xl('Suspended'), 'W' => xl('Waiting') ); $mlines = array(); $dlines = array(); $slines = array(); if ($GLOBALS['enable_hylafax']) { // Get the recvq entries, parse and sort by filename. $statlines = array(); exec("faxstat -r -l -h " . escapeshellarg($GLOBALS['hylafax_server']), $statlines); foreach ($statlines as $line) { // This gets pagecount, sender, time, filename. We are expecting the // string to start with "-rw-rw-" so as to exclude faxes not yet fully // received, for which permissions are "-rw----". if (preg_match('/^-r\S\Sr\S\S\s+(\d+)\s+\S+\s+(.+)\s+(\S+)\s+(\S+)\s*$/', $line, $matches)) { $mlines[$matches[4]] = $matches; } } ksort($mlines); // Get the doneq entries, parse and sort by job ID /* for example: JID Pri S Owner Number Pages Dials TTS Status 155 123 D nobody 6158898622 1:1 5:12 153 124 D nobody 6158896439 1:1 4:12 154 124 F nobody 6153551807 0:1 4:12 No carrier detected */ $donelines = array(); exec("faxstat -s -d -l -h " . escapeshellarg($GLOBALS['hylafax_server']), $donelines); foreach ($donelines as $line) { // This gets jobid, priority, statchar, owner, phone, pages, dials and tts/status. if (preg_match('/^(\d+)\s+(\d+)\s+(\S)\s+(\S+)\s+(\S+)\s+(\d+:\d+)\s+(\d+:\d+)(.*)$/', $line, $matches)) { $dlines[$matches[1]] = $matches; } } ksort($dlines); } $scandir = $GLOBALS['scanner_output_directory']; if ($scandir && $GLOBALS['enable_scanner']) { // Get the directory entries, parse and sort by date and time. $dh = opendir($scandir); if (! $dh) { die("Cannot read " . text($scandir)); } while (false !== ($sfname = readdir($dh))) { if (substr($sfname, 0, 1) == '.') { continue; } $tmp = stat("$scandir/$sfname"); $tmp[0] = $sfname; // put filename in slot 0 which we don't otherwise need $slines[$tmp[9] . $tmp[1]] = $tmp; // key is file mod time and inode number } closedir($dh); ksort($slines); } ?>
style='color: var(--danger); border-right: 2px solid var(--black); border-bottom: 2px solid transparent;' style='color: var(--gray); border-right: 2px solid var(--black); border-bottom: 2px solid var(--black); cursor: pointer; display:none;' onclick='tabclick("faxin")'> | style='color: var(--gray); border-right: 2px solid var(--black); border-bottom: 2px solid var(--black); cursor: pointer;' style='color: var(--gray); border-right: 2px solid var(--black); border-bottom: 2px solid var(--black); cursor: pointer; display:none;' onclick='tabclick("faxout")'> | style='color: var(--gray); border-bottom: 2px solid var(--black); cursor: pointer;' style='color: var(--danger); border-bottom: 2px solid transparent; display:none;' onclick='tabclick("scanin")'> |