Code changes to get the code closer to consistent with the FusionPBX code base.
Still needs the following. - Only show the current domain - Use the text from app languages to support multi-lingual.
This commit is contained in:
+44
-63
@@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
The Initial Developer of the Original Code is
|
The Initial Developer of the Original Code is
|
||||||
Mark J Crane <markjcrane@fusionpbx.com>
|
Mark J Crane <markjcrane@fusionpbx.com>
|
||||||
Portions created by the Initial Developer are Copyright (C) 2008-2021
|
Portions created by the Initial Developer are Copyright (C) 2021
|
||||||
the Initial Developer. All Rights Reserved.
|
the Initial Developer. All Rights Reserved.
|
||||||
|
|
||||||
Contributor(s):
|
Contributor(s):
|
||||||
@@ -47,38 +47,7 @@
|
|||||||
$object = new token;
|
$object = new token;
|
||||||
$token = $object->create($_SERVER['PHP_SELF']);
|
$token = $object->create($_SERVER['PHP_SELF']);
|
||||||
|
|
||||||
//additional includes
|
//get fax extensions
|
||||||
$document['title'] = 'Fax Outbox';
|
|
||||||
require_once "resources/header.php";
|
|
||||||
|
|
||||||
//show the content
|
|
||||||
echo "<div class='action_bar' id='action_bar'>\n";
|
|
||||||
echo " <div class='heading'><b>Fax Outbox</b></div>\n";
|
|
||||||
echo " <div style='clear: both;'></div>\n";
|
|
||||||
echo "</div>\n";
|
|
||||||
|
|
||||||
echo "This is the Fax Outbox\n";
|
|
||||||
echo "<br /><br />\n";
|
|
||||||
|
|
||||||
//echo "<form id='form_list' method='post'>\n";
|
|
||||||
echo "<form id='form_list' onsubmit='mySubmit()' method='post'>\n";
|
|
||||||
echo "<input type='hidden' id='action' name='action' value=''>\n";
|
|
||||||
echo "<input type='hidden' name='search' value=\"".escape($search)."\">\n";
|
|
||||||
|
|
||||||
echo "<input type='hidden' id='myId' name='myId' value='' />";
|
|
||||||
|
|
||||||
echo "<table class='list'>\n";
|
|
||||||
echo "<tr class='list-header'>\n";
|
|
||||||
|
|
||||||
echo " <th>Destination</th>";
|
|
||||||
echo " <th>Status</th>";
|
|
||||||
echo " <th>Preview</th>";
|
|
||||||
echo " <th>Path</th>";
|
|
||||||
|
|
||||||
echo "</tr>\n";
|
|
||||||
|
|
||||||
|
|
||||||
//get fax extension
|
|
||||||
if (is_uuid($_REQUEST["id"])) {
|
if (is_uuid($_REQUEST["id"])) {
|
||||||
$fax_uuid = $_REQUEST["id"];
|
$fax_uuid = $_REQUEST["id"];
|
||||||
if (permission_exists('fax_extension_view_domain')) {
|
if (permission_exists('fax_extension_view_domain')) {
|
||||||
@@ -105,7 +74,7 @@
|
|||||||
if (is_array($row) && @sizeof($row) != 0) {
|
if (is_array($row) && @sizeof($row) != 0) {
|
||||||
//set database fields as variables
|
//set database fields as variables
|
||||||
$fax_name = $row["fax_name"];
|
$fax_name = $row["fax_name"];
|
||||||
$faxext = $row["fax_extension"];
|
$fax_extension = $row["fax_extension"];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (!permission_exists('fax_extension_view_domain')) {
|
if (!permission_exists('fax_extension_view_domain')) {
|
||||||
@@ -116,10 +85,6 @@
|
|||||||
unset($sql, $parameters, $row);
|
unset($sql, $parameters, $row);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$myId = $_SESSION['/var/lib/freeswitch/storage/fax/'.$_SESSION['domain_name'].'/'.$faxext.'/temp'];
|
|
||||||
|
|
||||||
$sql = "select * from v_fax_files ";
|
$sql = "select * from v_fax_files ";
|
||||||
$sql .= "where fax_uuid = :fax_uuid ";
|
$sql .= "where fax_uuid = :fax_uuid ";
|
||||||
$sql .= "and domain_uuid = :domain_uuid ";
|
$sql .= "and domain_uuid = :domain_uuid ";
|
||||||
@@ -130,9 +95,7 @@
|
|||||||
$fax_files = $database->select($sql, $parameters, 'all');
|
$fax_files = $database->select($sql, $parameters, 'all');
|
||||||
unset($sql, $parameters);
|
unset($sql, $parameters);
|
||||||
|
|
||||||
|
//check if currently sending a fax
|
||||||
//Test if currently sending:
|
|
||||||
//set the command
|
|
||||||
$switch_cmd = 'show channels as json';
|
$switch_cmd = 'show channels as json';
|
||||||
|
|
||||||
//create the event socket connection
|
//create the event socket connection
|
||||||
@@ -141,61 +104,79 @@
|
|||||||
//send the event socket command and get the array
|
//send the event socket command and get the array
|
||||||
if ($fp) {
|
if ($fp) {
|
||||||
$json = trim(event_socket_request($fp, 'api '.$switch_cmd));
|
$json = trim(event_socket_request($fp, 'api '.$switch_cmd));
|
||||||
|
|
||||||
$results = json_decode($json, "true");
|
$results = json_decode($json, "true");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($results["rows"])) {
|
//additional includes
|
||||||
|
$document['title'] = 'Fax Outbox';
|
||||||
|
require_once "resources/header.php";
|
||||||
|
|
||||||
|
//show the content
|
||||||
|
echo "<div class='action_bar' id='action_bar'>\n";
|
||||||
|
echo " <div class='heading'><b>Fax Outbox</b></div>\n";
|
||||||
|
echo " <div style='clear: both;'></div>\n";
|
||||||
|
echo "</div>\n";
|
||||||
|
|
||||||
|
echo "Show active faxes that are currently sending.\n";
|
||||||
|
echo "<br /><br />\n";
|
||||||
|
|
||||||
|
//echo "<form id='form_list' method='post'>\n";
|
||||||
|
echo "<form id='form_list' onsubmit='' method='post'>\n";
|
||||||
|
echo " <input type='hidden' id='action' name='action' value=''>\n";
|
||||||
|
echo " <input type='hidden' name='search' value=\"".escape($search)."\">\n";
|
||||||
|
//echo " <input type='hidden' id='my_id' name='my_id' value='' />";
|
||||||
|
|
||||||
|
echo " <table class='list'>\n";
|
||||||
|
echo " <tr class='list-header'>\n";
|
||||||
|
echo " <th>Destination</th>";
|
||||||
|
echo " <th>Status</th>";
|
||||||
|
echo " <th>Preview</th>";
|
||||||
|
echo " <th>Path</th>";
|
||||||
|
echo " </tr>\n";
|
||||||
|
|
||||||
|
//loop through the faxes
|
||||||
|
if (isset($results["rows"])) {
|
||||||
if (is_array($results["rows"]) && @sizeof($results["rows"]) != 0) {
|
if (is_array($results["rows"]) && @sizeof($results["rows"]) != 0) {
|
||||||
$x = 0;
|
$x = 0;
|
||||||
foreach ($results["rows"] as $row) {
|
foreach ($results["rows"] as $row) {
|
||||||
|
|
||||||
$file = basename($row['application_data']);
|
$file = basename($row['application_data']);
|
||||||
if (strtolower(substr($file, -3)) == "tif" || strtolower(substr($file, -3)) == "pdf") {
|
if (strtolower(substr($file, -3)) == "tif" || strtolower(substr($file, -3)) == "pdf") {
|
||||||
$file_name = substr($file, 0, (strlen($file) -4));
|
$file_name = substr($file, 0, (strlen($file) -4));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (strlen($row['fax_base64']) <= 0) {
|
if (strlen($row['fax_base64']) <= 0) {
|
||||||
echo " <tr class='list-row' >\n";
|
echo " <tr class='list-row' >\n";
|
||||||
|
echo " <td>".escape($row['dest'])."</td>";
|
||||||
echo "<td>".$row['dest']."</td>";
|
|
||||||
echo " <td>Sending...</td>";
|
echo " <td>Sending...</td>";
|
||||||
echo "<td><a href='https://dev.auravoice.us/app/fax/fax_files.php?id=".$_REQUEST["id"]."&a=download&type=fax_sent&t=bin&ext=".$faxext."&filename=".$file_name.".tif'>Fax PDF - ".$file_name."</a></td>";
|
echo " <td>\n";
|
||||||
echo "<td>".$row['application_data']."</td>";
|
echo " <a href='/app/fax/fax_files.php?id=".urlencode($_REQUEST["id"])."&a=download&type=fax_sent&t=bin&ext=".urlencode($fax_extension)."&filename=".urlencode($file_name).".tif'>Fax PDF - ".urlencode($file_name)."</a>\n";
|
||||||
|
echo " </td>\n";
|
||||||
|
echo " <td>".escape($row['application_data'])."</td>";
|
||||||
echo " </tr>\n";
|
echo " </tr>\n";
|
||||||
}
|
}
|
||||||
$x++;
|
$x++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
echo " </table>\n";
|
echo " </table>\n";
|
||||||
echo " <br />\n";
|
echo " <br />\n";
|
||||||
|
|
||||||
echo " <input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
|
echo " <input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
|
||||||
|
|
||||||
echo "</form>\n";
|
echo "</form>\n";
|
||||||
|
|
||||||
|
|
||||||
echo "<span id='output'></span>\n";
|
echo "<span id='output'></span>\n";
|
||||||
echo "<script type='text/javascript'>\n";
|
echo "<script type='text/javascript'>\n";
|
||||||
echo " function AutoRefresh( t ) { setTimeout('location.reload(true);', t); }";
|
echo " function AutoRefresh( t ) { setTimeout('location.reload(true);', t); }";
|
||||||
echo " AutoRefresh(10000);";
|
echo " AutoRefresh(10000);";
|
||||||
|
|
||||||
echo "</script>\n";
|
echo "</script>\n";
|
||||||
|
|
||||||
|
//$my_id = $_SESSION['/var/lib/freeswitch/storage/fax/'.$_SESSION['domain_name'].'/'.$fax_extension.'/temp'];
|
||||||
|
//if (file_exists('/var/lib/freeswitch/storage/fax/'.$_SESSION['domain_name'].'/'.$fax_extension.'/temp/'.$my_id.'.tif')) {
|
||||||
|
// rename('/var/lib/freeswitch/storage/fax/'.$_SESSION['domain_name'].'/'.$fax_extension.'/temp/'.$my_id.'.tif', '/var/lib/freeswitch/storage/fax/'.$_SESSION['domain_name'].'/'.$fax_extension.'/sent/'.$my_id.'.tif');
|
||||||
|
//}
|
||||||
|
|
||||||
if (file_exists('/var/lib/freeswitch/storage/fax/'.$_SESSION['domain_name'].'/'.$faxext.'/temp/'.$myId.'.tif')) {
|
//if (file_exists('/var/lib/freeswitch/storage/fax/'.$_SESSION['domain_name'].'/'.$fax_extension.'/temp/'.$my_id.'.pdf')) {
|
||||||
rename('/var/lib/freeswitch/storage/fax/'.$_SESSION['domain_name'].'/'.$faxext.'/temp/'.$myId.'.tif', '/var/lib/freeswitch/storage/fax/'.$_SESSION['domain_name'].'/'.$faxext.'/sent/'.$myId.'.tif');
|
// rename('/var/lib/freeswitch/storage/fax/'.$_SESSION['domain_name'].'/'.$fax_extension.'/temp/'.$my_id.'.pdf', '/var/lib/freeswitch/storage/fax/'.$_SESSION['domain_name'].'/'.$fax_extension.'/sent/'.$my_id.'.pdf');
|
||||||
}
|
//}
|
||||||
|
|
||||||
if (file_exists('/var/lib/freeswitch/storage/fax/'.$_SESSION['domain_name'].'/'.$faxext.'/temp/'.$myId.'.pdf')) {
|
|
||||||
rename('/var/lib/freeswitch/storage/fax/'.$_SESSION['domain_name'].'/'.$faxext.'/temp/'.$myId.'.pdf', '/var/lib/freeswitch/storage/fax/'.$_SESSION['domain_name'].'/'.$faxext.'/sent/'.$myId.'.pdf');
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//include the footer
|
//include the footer
|
||||||
require_once "resources/footer.php";
|
require_once "resources/footer.php";
|
||||||
|
|||||||
Reference in New Issue
Block a user