Add a missing file sip_profile_copy.php to the dev branch.
This commit is contained in:
@@ -0,0 +1,190 @@
|
||||
<?php
|
||||
//application details
|
||||
$apps[$x]['name'] = "Fax";
|
||||
$apps[$x]['uuid'] = '24108154-4ac3-1db6-1551-4731703a4440';
|
||||
$apps[$x]['category'] = 'Switch';
|
||||
$apps[$x]['subcategory'] = '';
|
||||
$apps[$x]['version'] = '';
|
||||
$apps[$x]['license'] = 'Mozilla Public License 1.1';
|
||||
$apps[$x]['url'] = 'http://www.fusionpbx.com';
|
||||
$apps[$x]['description']['en'] = 'To receive a FAX setup a fax extension and then direct the incoming FAX with a dedicated number or you can detect the FAX tone by using on the Public tab.';
|
||||
|
||||
//menu details
|
||||
$apps[$x]['menu'][0]['title']['en'] = 'Fax Server';
|
||||
$apps[$x]['menu'][0]['uuid'] = '9c9642e4-2b9b-2785-18d0-6c0a4ede2b2f';
|
||||
$apps[$x]['menu'][0]['parent_uuid'] = 'fd29e39c-c936-f5fc-8e2b-611681b266b5';
|
||||
$apps[$x]['menu'][0]['category'] = 'internal';
|
||||
$apps[$x]['menu'][0]['path'] = '/app/fax/v_fax.php';
|
||||
$apps[$x]['menu'][0]['groups'][] = 'user';
|
||||
$apps[$x]['menu'][0]['groups'][] = 'admin';
|
||||
$apps[$x]['menu'][0]['groups'][] = 'superadmin';
|
||||
|
||||
//permission details
|
||||
$apps[$x]['permissions'][0]['name'] = 'fax_extension_view';
|
||||
$apps[$x]['permissions'][0]['groups'][] = 'user';
|
||||
$apps[$x]['permissions'][0]['groups'][] = 'admin';
|
||||
$apps[$x]['permissions'][0]['groups'][] = 'superadmin';
|
||||
|
||||
$apps[$x]['permissions'][1]['name'] = 'fax_extension_add';
|
||||
$apps[$x]['permissions'][1]['groups'][] = 'admin';
|
||||
$apps[$x]['permissions'][1]['groups'][] = 'superadmin';
|
||||
|
||||
$apps[$x]['permissions'][2]['name'] = 'fax_extension_edit';
|
||||
$apps[$x]['permissions'][2]['groups'][] = 'user';
|
||||
$apps[$x]['permissions'][2]['groups'][] = 'admin';
|
||||
$apps[$x]['permissions'][2]['groups'][] = 'superadmin';
|
||||
|
||||
$apps[$x]['permissions'][3]['name'] = 'fax_extension_delete';
|
||||
$apps[$x]['permissions'][3]['groups'][] = 'admin';
|
||||
$apps[$x]['permissions'][3]['groups'][] = 'superadmin';
|
||||
|
||||
$apps[$x]['permissions'][4]['name'] = 'fax_inbox_view';
|
||||
$apps[$x]['permissions'][4]['groups'][] = 'user';
|
||||
$apps[$x]['permissions'][4]['groups'][] = 'admin';
|
||||
$apps[$x]['permissions'][4]['groups'][] = 'superadmin';
|
||||
|
||||
$apps[$x]['permissions'][5]['name'] = 'fax_inbox_delete';
|
||||
$apps[$x]['permissions'][5]['groups'][] = 'user';
|
||||
$apps[$x]['permissions'][5]['groups'][] = 'admin';
|
||||
$apps[$x]['permissions'][5]['groups'][] = 'superadmin';
|
||||
|
||||
$apps[$x]['permissions'][6]['name'] = 'fax_sent_view';
|
||||
$apps[$x]['permissions'][6]['groups'][] = 'user';
|
||||
$apps[$x]['permissions'][6]['groups'][] = 'admin';
|
||||
$apps[$x]['permissions'][6]['groups'][] = 'superadmin';
|
||||
|
||||
$apps[$x]['permissions'][7]['name'] = 'fax_sent_delete';
|
||||
$apps[$x]['permissions'][7]['groups'][] = 'user';
|
||||
$apps[$x]['permissions'][7]['groups'][] = 'admin';
|
||||
$apps[$x]['permissions'][7]['groups'][] = 'superadmin';
|
||||
|
||||
$apps[$x]['permissions'][8]['name'] = 'fax_send';
|
||||
$apps[$x]['permissions'][8]['groups'][] = 'user';
|
||||
$apps[$x]['permissions'][8]['groups'][] = 'admin';
|
||||
$apps[$x]['permissions'][8]['groups'][] = 'superadmin';
|
||||
|
||||
//schema details
|
||||
$y = 0; //table array index
|
||||
$z = 0; //field array index
|
||||
$apps[$x]['db'][$y]['table'] = 'v_fax';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'id';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'fax_id';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'serial';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'integer';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'INT NOT NULL AUTO_INCREMENT';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['deprecated'] = 'true';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'fax_uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'primary';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'domain_uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = 'v_domains';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = 'domain_uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'dialplan_uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = 'v_dialplans';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = 'dialplan_uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'v_id';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['deprecated'] = 'true';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'fax_extension';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'faxextension';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'fax_name';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'faxname';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'fax_email';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'faxemail';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'fax_pin_number';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'fax_caller_id_name';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'fax_caller_id_number';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'fax_user_list';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['deprecated'] = 'true';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'fax_forward_number';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'numeric';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'fax_description';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'faxdescription';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
|
||||
$y = 1; //table array index
|
||||
$z = 0; //field array index
|
||||
$apps[$x]['db'][$y]['table'] = 'v_fax_users';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'id';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'serial';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'integer';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'INT NOT NULL AUTO_INCREMENT';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['deprecated'] = 'true';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'fax_user_uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'primary';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'domain_uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = 'v_domains';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = 'domain_uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'fax_uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = 'v_fax';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = 'fax_uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'user_uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
?>
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
/*
|
||||
FusionPBX
|
||||
Version: MPL 1.1
|
||||
|
||||
The contents of this file are subject to the Mozilla Public License Version
|
||||
1.1 (the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS" basis,
|
||||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
for the specific language governing rights and limitations under the
|
||||
License.
|
||||
|
||||
The Original Code is FusionPBX
|
||||
|
||||
The Initial Developer of the Original Code is
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
|
||||
// make sure the PATH_SEPARATOR is defined
|
||||
if (!defined("PATH_SEPARATOR")) {
|
||||
if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); }
|
||||
}
|
||||
|
||||
// make sure the document_root is set
|
||||
$_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]);
|
||||
$_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]);
|
||||
$_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]);
|
||||
//echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."<br />\n";
|
||||
//echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."<br />\n";
|
||||
//echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."<br />\n";
|
||||
|
||||
// if the project directory exists then add it to the include path otherwise add the document root to the include path
|
||||
if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){
|
||||
if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); }
|
||||
set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' );
|
||||
}
|
||||
else {
|
||||
if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); }
|
||||
set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] );
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,180 @@
|
||||
<?php
|
||||
/*
|
||||
FusionPBX
|
||||
Version: MPL 1.1
|
||||
|
||||
The contents of this file are subject to the Mozilla Public License Version
|
||||
1.1 (the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS" basis,
|
||||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
for the specific language governing rights and limitations under the
|
||||
License.
|
||||
|
||||
The Original Code is FusionPBX
|
||||
|
||||
The Initial Developer of the Original Code is
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
include "root.php";
|
||||
require_once "includes/require.php";
|
||||
require_once "includes/checkauth.php";
|
||||
if (permission_exists('fax_extension_view')) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
require_once "includes/header.php";
|
||||
require_once "includes/paging.php";
|
||||
|
||||
//get the http get values and set them as php variables
|
||||
$order_by = check_str($_GET["order_by"]);
|
||||
$order = check_str($_GET["order"]);
|
||||
|
||||
//show the content
|
||||
echo "<div align='center'>";
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='2'>\n";
|
||||
echo "<tr class='border'>\n";
|
||||
echo " <td align=\"center\">\n";
|
||||
echo " <br>";
|
||||
echo " <table width=\"100%\" border=\"0\" cellpadding=\"6\" cellspacing=\"0\">\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td align='left'>\n";
|
||||
echo " <p><span class=\"vexpl\"><span class=\"red\"><strong>FAX<br></strong></span>\n";
|
||||
echo " To receive a FAX setup a fax extension and then direct the incoming to it.\n";
|
||||
echo " </p>\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo " </table>\n";
|
||||
echo " <br />";
|
||||
|
||||
if (if_group("superadmin") || if_group("admin")) {
|
||||
//show all fax extensions
|
||||
$sql = "select count(*) as num_rows from v_fax ";
|
||||
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
|
||||
}
|
||||
else {
|
||||
//show only assigned fax extensions
|
||||
$sql = "select count(*) as num_rows from v_fax as f, v_fax_users as u ";
|
||||
$sql .= "where f.fax_uuid = u.fax_uuid ";
|
||||
$sql .= "and f.domain_uuid = '".$_SESSION['domain_uuid']."' ";
|
||||
$sql .= "and u.user_uuid = '".$_SESSION['user_uuid']."' ";
|
||||
}
|
||||
if ($prep_statement) {
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
|
||||
if ($row['num_rows'] > 0) {
|
||||
$num_rows = $row['num_rows'];
|
||||
}
|
||||
else {
|
||||
$num_rows = '0';
|
||||
}
|
||||
}
|
||||
unset($prep_statement, $result);
|
||||
|
||||
$rows_per_page = 150;
|
||||
$param = "";
|
||||
$page = check_str($_GET['page']);
|
||||
if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; }
|
||||
list($paging_controls, $rows_per_page, $var_3) = paging($num_rows, $param, $rows_per_page);
|
||||
$offset = $rows_per_page * $page;
|
||||
|
||||
if (if_group("superadmin") || if_group("admin")) {
|
||||
//show all fax extensions
|
||||
$sql = "select * from v_fax ";
|
||||
$sql .= "where domain_uuid = '$domain_uuid' ";
|
||||
}
|
||||
else {
|
||||
//show only assigned fax extensions
|
||||
$sql = "select * from v_fax as f, v_fax_users as u ";
|
||||
$sql .= "where f.fax_uuid = u.fax_uuid ";
|
||||
$sql .= "and f.domain_uuid = '".$_SESSION['domain_uuid']."' ";
|
||||
$sql .= "and u.user_uuid = '".$_SESSION['user_uuid']."' ";
|
||||
}
|
||||
if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; }
|
||||
$sql .= " limit $rows_per_page offset $offset ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_ASSOC);
|
||||
$result_count = count($result);
|
||||
unset ($prep_statement, $sql);
|
||||
|
||||
$c = 0;
|
||||
$row_style["0"] = "row_style0";
|
||||
$row_style["1"] = "row_style1";
|
||||
|
||||
echo "<div align='center'>\n";
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
echo "<tr>\n";
|
||||
echo th_order_by('fax_extension', 'Extension', $order_by, $order);
|
||||
echo th_order_by('fax_name', 'Name', $order_by, $order);
|
||||
echo th_order_by('fax_email', 'Email', $order_by, $order);
|
||||
echo th_order_by('fax_description', 'Description', $order_by, $order);
|
||||
echo "<td align='right' width='42'>\n";
|
||||
if (permission_exists('fax_extension_add')) {
|
||||
echo " <a href='v_fax_edit.php' alt='add'>$v_link_label_add</a>\n";
|
||||
}
|
||||
echo "</td>\n";
|
||||
echo "<tr>\n";
|
||||
|
||||
if ($result_count > 0) {
|
||||
foreach($result as $row) {
|
||||
echo "<tr >\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".$row['fax_extension']."</td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".$row['fax_name']."</td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".$row['fax_email']." </td>\n";
|
||||
echo " <td valign='top' class='row_stylebg' width='35%'>".$row['fax_description']." </td>\n";
|
||||
echo " <td valign='top' align='right'>\n";
|
||||
if (permission_exists('fax_extension_edit')) {
|
||||
echo " <a href='v_fax_view.php?id=".$row['fax_uuid']."' alt='edit'>$v_link_label_edit</a>\n";
|
||||
}
|
||||
if (permission_exists('fax_extension_delete')) {
|
||||
echo " <a href='v_fax_delete.php?id=".$row['fax_uuid']."' alt='delete' onclick=\"return confirm('Do you really want to delete this?')\">$v_link_label_delete</a>\n";
|
||||
}
|
||||
echo " </td>\n";
|
||||
echo "</tr>\n";
|
||||
if ($c==0) { $c=1; } else { $c=0; }
|
||||
} //end foreach
|
||||
unset($sql, $result, $row_count);
|
||||
} //end if results
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td colspan='5'>\n";
|
||||
echo " <table width='100%' cellpadding='0' cellspacing='0'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td width='33.3%' nowrap> </td>\n";
|
||||
echo " <td width='33.3%' align='center' nowrap>$paging_controls</td>\n";
|
||||
echo " <td width='33.3%' align='right'>\n";
|
||||
if (permission_exists('fax_extension_add')) {
|
||||
echo " <a href='v_fax_edit.php' alt='add'>$v_link_label_add</a>\n";
|
||||
}
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo " </table>\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "</table>";
|
||||
echo "</div>";
|
||||
echo "<br><br>";
|
||||
echo "<br><br>";
|
||||
|
||||
echo "</td>";
|
||||
echo "</tr>";
|
||||
echo "</table>";
|
||||
echo "</div>";
|
||||
echo "<br><br>";
|
||||
|
||||
//show the footer
|
||||
require_once "includes/footer.php";
|
||||
?>
|
||||
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
/*
|
||||
FusionPBX
|
||||
Version: MPL 1.1
|
||||
|
||||
The contents of this file are subject to the Mozilla Public License Version
|
||||
1.1 (the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS" basis,
|
||||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
for the specific language governing rights and limitations under the
|
||||
License.
|
||||
|
||||
The Original Code is FusionPBX
|
||||
|
||||
The Initial Developer of the Original Code is
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
include "root.php";
|
||||
require_once "includes/require.php";
|
||||
require_once "includes/checkauth.php";
|
||||
if (permission_exists('fax_extension_delete')) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
|
||||
//get the http get value and set it as a php variable
|
||||
if (count($_GET)>0) {
|
||||
$fax_uuid = check_str($_GET["id"]);
|
||||
}
|
||||
|
||||
//delete the fax extension
|
||||
if (strlen($fax_uuid)>0) {
|
||||
|
||||
//get the dialplan uuid
|
||||
$sql = "select * from v_fax ";
|
||||
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
|
||||
$sql .= "and fax_uuid = '$fax_uuid' ";
|
||||
$prep_statement = $db->prepare($sql);
|
||||
$prep_statement->execute();
|
||||
while($row = $prep_statement->fetch(PDO::FETCH_ASSOC)) {
|
||||
$dialplan_uuid = $row['dialplan_uuid'];
|
||||
}
|
||||
|
||||
//delete the fax entry
|
||||
$sql = "";
|
||||
$sql .= "delete from v_fax ";
|
||||
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
|
||||
$sql .= "and fax_uuid = '$fax_uuid' ";
|
||||
$db->query($sql);
|
||||
unset($sql);
|
||||
|
||||
//delete the dialplan entry
|
||||
$sql = "";
|
||||
$sql .= "delete from v_dialplans ";
|
||||
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
|
||||
$sql .= "and dialplan_uuid = '$dialplan_uuid' ";
|
||||
//echo $sql."<br>\n";
|
||||
$db->query($sql);
|
||||
unset($sql);
|
||||
|
||||
//delete the dialplan details
|
||||
$sql = "";
|
||||
$sql .= "delete from v_dialplan_details ";
|
||||
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
|
||||
$sql .= "and dialplan_uuid = '$dialplan_uuid' ";
|
||||
//echo $sql."<br>\n";
|
||||
$db->query($sql);
|
||||
unset($sql);
|
||||
|
||||
//syncrhonize configuration
|
||||
save_dialplan_xml();
|
||||
|
||||
//apply settings reminder
|
||||
$_SESSION["reload_xml"] = true;
|
||||
}
|
||||
|
||||
//redirect the user
|
||||
require_once "includes/header.php";
|
||||
echo "<meta http-equiv=\"refresh\" content=\"2;url=v_fax.php\">\n";
|
||||
echo "<div align='center'>\n";
|
||||
echo "Delete Complete\n";
|
||||
echo "</div>\n";
|
||||
require_once "includes/footer.php";
|
||||
return;
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,631 @@
|
||||
<?php
|
||||
/*
|
||||
FusionPBX
|
||||
Version: MPL 1.1
|
||||
|
||||
The contents of this file are subject to the Mozilla Public License Version
|
||||
1.1 (the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS" basis,
|
||||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
for the specific language governing rights and limitations under the
|
||||
License.
|
||||
|
||||
The Original Code is FusionPBX
|
||||
|
||||
The Initial Developer of the Original Code is
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
include "root.php";
|
||||
require_once "includes/require.php";
|
||||
require_once "includes/checkauth.php";
|
||||
if (permission_exists('fax_extension_add') || permission_exists('fax_extension_edit') || permission_exists('fax_extension_delete')) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
|
||||
//get the fax_extension and save it as a variable
|
||||
if (strlen($_REQUEST["fax_extension"]) > 0) {
|
||||
$fax_extension = check_str($_REQUEST["fax_extension"]);
|
||||
}
|
||||
|
||||
//set the fax directory
|
||||
if (count($_SESSION["domains"]) > 1) {
|
||||
$v_fax_dir = $_SESSION['switch']['storage']['dir'].'/fax/'.$_SESSION['domain_name'];
|
||||
}
|
||||
else {
|
||||
$v_fax_dir = $_SESSION['switch']['storage']['dir'].'/fax';
|
||||
}
|
||||
|
||||
//get the fax extension
|
||||
if (strlen($fax_extension) > 0) {
|
||||
//set the fax directories. example /usr/local/freeswitch/storage/fax/329/inbox
|
||||
$dir_fax_inbox = $v_fax_dir.'/'.$fax_extension.'/inbox';
|
||||
$dir_fax_sent = $v_fax_dir.'/'.$fax_extension.'/sent';
|
||||
$dir_fax_temp = $v_fax_dir.'/'.$fax_extension.'/temp';
|
||||
|
||||
//make sure the directories exist
|
||||
if (!is_dir($_SESSION['switch']['storage']['dir'])) {
|
||||
mkdir($_SESSION['switch']['storage']['dir']);
|
||||
chmod($dir_fax_sent,0774);
|
||||
}
|
||||
if (!is_dir($v_fax_dir.'/'.$fax_extension)) {
|
||||
mkdir($v_fax_dir.'/'.$fax_extension,0774,true);
|
||||
chmod($v_fax_dir.'/'.$fax_extension,0774);
|
||||
}
|
||||
if (!is_dir($dir_fax_inbox)) {
|
||||
mkdir($dir_fax_inbox,0774,true);
|
||||
chmod($dir_fax_inbox,0774);
|
||||
}
|
||||
if (!is_dir($dir_fax_sent)) {
|
||||
mkdir($dir_fax_sent,0774,true);
|
||||
chmod($dir_fax_sent,0774);
|
||||
}
|
||||
if (!is_dir($dir_fax_temp)) {
|
||||
mkdir($dir_fax_temp,0774,true);
|
||||
chmod($dir_fax_temp,0774);
|
||||
}
|
||||
}
|
||||
|
||||
//set the action as an add or an update
|
||||
if (isset($_REQUEST["id"])) {
|
||||
$action = "update";
|
||||
$fax_uuid = check_str($_REQUEST["id"]);
|
||||
$dialplan_uuid = check_str($_REQUEST["dialplan_uuid"]);
|
||||
}
|
||||
else {
|
||||
$action = "add";
|
||||
}
|
||||
|
||||
//get the http post values and set them as php variables
|
||||
if (count($_POST)>0) {
|
||||
$fax_name = check_str($_POST["fax_name"]);
|
||||
$fax_email = check_str($_POST["fax_email"]);
|
||||
$fax_pin_number = check_str($_POST["fax_pin_number"]);
|
||||
$fax_caller_id_name = check_str($_POST["fax_caller_id_name"]);
|
||||
$fax_caller_id_number = check_str($_POST["fax_caller_id_number"]);
|
||||
$fax_forward_number = check_str($_POST["fax_forward_number"]);
|
||||
if (strlen($fax_forward_number) > 0) {
|
||||
$fax_forward_number = preg_replace("~[^0-9]~", "",$fax_forward_number);
|
||||
}
|
||||
$fax_description = check_str($_POST["fax_description"]);
|
||||
}
|
||||
|
||||
//delete the user from the v_fax_users
|
||||
if ($_GET["a"] == "delete" && permission_exists("fax_extension_delete")) {
|
||||
//set the variables
|
||||
$user_uuid = check_str($_REQUEST["user_uuid"]);
|
||||
$fax_uuid = check_str($_REQUEST["id"]);
|
||||
//delete the group from the users
|
||||
$sql = "delete from v_fax_users ";
|
||||
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
|
||||
$sql .= "and fax_uuid = '".$fax_uuid."' ";
|
||||
$sql .= "and user_uuid = '".$user_uuid."' ";
|
||||
$db->exec(check_sql($sql));
|
||||
//redirect the browser
|
||||
require_once "includes/header.php";
|
||||
echo "<meta http-equiv=\"refresh\" content=\"2;url=v_fax_edit.php?id=$fax_uuid\">\n";
|
||||
echo "<div align='center'>Delete Complete</div>";
|
||||
require_once "includes/footer.php";
|
||||
return;
|
||||
}
|
||||
|
||||
//add the user to the v_fax_users
|
||||
if (strlen($_REQUEST["user_uuid"]) > 0 && strlen($_REQUEST["id"]) > 0 && $_GET["a"] != "delete") {
|
||||
//set the variables
|
||||
$user_uuid = check_str($_REQUEST["user_uuid"]);
|
||||
$fax_uuid = check_str($_REQUEST["id"]);
|
||||
//assign the user to the fax extension
|
||||
$sql_insert = "insert into v_fax_users ";
|
||||
$sql_insert .= "(";
|
||||
$sql_insert .= "fax_user_uuid, ";
|
||||
$sql_insert .= "domain_uuid, ";
|
||||
$sql_insert .= "fax_uuid, ";
|
||||
$sql_insert .= "user_uuid ";
|
||||
$sql_insert .= ")";
|
||||
$sql_insert .= "values ";
|
||||
$sql_insert .= "(";
|
||||
$sql_insert .= "'".uuid()."', ";
|
||||
$sql_insert .= "'".$_SESSION['domain_uuid']."', ";
|
||||
$sql_insert .= "'".$fax_uuid."', ";
|
||||
$sql_insert .= "'".$user_uuid."' ";
|
||||
$sql_insert .= ")";
|
||||
$db->exec($sql_insert);
|
||||
//redirect the browser
|
||||
require_once "includes/header.php";
|
||||
echo "<meta http-equiv=\"refresh\" content=\"2;url=v_fax_edit.php?id=$fax_uuid\">\n";
|
||||
echo "<div align='center'>Add Complete</div>";
|
||||
require_once "includes/footer.php";
|
||||
return;
|
||||
}
|
||||
|
||||
//clear file status cache
|
||||
clearstatcache();
|
||||
|
||||
if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
|
||||
$msg = '';
|
||||
if ($action == "update" && permission_exists('fax_extension_edit')) {
|
||||
$fax_uuid = check_str($_POST["fax_uuid"]);
|
||||
}
|
||||
|
||||
//check for all required data
|
||||
if (strlen($fax_extension) == 0) { $msg .= "Please provide: Extension<br>\n"; }
|
||||
if (strlen($fax_name) == 0) { $msg .= "Please provide: A file to Fax<br>\n"; }
|
||||
//if (strlen($fax_email) == 0) { $msg .= "Please provide: Email<br>\n"; }
|
||||
//if (strlen($fax_pin_number) == 0) { $msg .= "Please provide: Pin Number<br>\n"; }
|
||||
//if (strlen($fax_caller_id_name) == 0) { $msg .= "Please provide: Caller ID Name<br>\n"; }
|
||||
//if (strlen($fax_caller_id_number) == 0) { $msg .= "Please provide: Caller ID Number<br>\n"; }
|
||||
//if (strlen($fax_forward_number) == 0) { $msg .= "Please provide: Forward Number<br>\n"; }
|
||||
//if (strlen($fax_description) == 0) { $msg .= "Please provide: Description<br>\n"; }
|
||||
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
require_once "includes/header.php";
|
||||
require_once "includes/persistformvar.php";
|
||||
echo "<div align='center'>\n";
|
||||
echo "<table><tr><td>\n";
|
||||
echo $msg."<br />";
|
||||
echo "</td></tr></table>\n";
|
||||
persistformvar($_POST);
|
||||
echo "</div>\n";
|
||||
require_once "includes/footer.php";
|
||||
return;
|
||||
}
|
||||
|
||||
//set the PHP_BIN
|
||||
if (file_exists(PHP_BINDIR."/php")) { define(PHP_BIN, 'php'); }
|
||||
if (file_exists(PHP_BINDIR."/php.exe")) { define(PHP_BIN, 'php.exe'); }
|
||||
|
||||
//add or update the database
|
||||
if ($_POST["persistformvar"] != "true") {
|
||||
if ($action == "add" && permission_exists('fax_extension_add')) {
|
||||
//prepare the unique identifiers
|
||||
$fax_uuid = uuid();
|
||||
$dialplan_uuid = uuid();
|
||||
|
||||
//add the fax extension to the database
|
||||
$sql = "insert into v_fax ";
|
||||
$sql .= "(";
|
||||
$sql .= "domain_uuid, ";
|
||||
$sql .= "fax_uuid, ";
|
||||
$sql .= "dialplan_uuid, ";
|
||||
$sql .= "fax_extension, ";
|
||||
$sql .= "fax_name, ";
|
||||
$sql .= "fax_email, ";
|
||||
$sql .= "fax_pin_number, ";
|
||||
$sql .= "fax_caller_id_name, ";
|
||||
$sql .= "fax_caller_id_number, ";
|
||||
if (strlen($fax_forward_number) > 0) {
|
||||
$sql .= "fax_forward_number, ";
|
||||
}
|
||||
$sql .= "fax_description ";
|
||||
$sql .= ")";
|
||||
$sql .= "values ";
|
||||
$sql .= "(";
|
||||
$sql .= "'".$_SESSION['domain_uuid']."', ";
|
||||
$sql .= "'$fax_uuid', ";
|
||||
$sql .= "'$dialplan_uuid', ";
|
||||
$sql .= "'$fax_extension', ";
|
||||
$sql .= "'$fax_name', ";
|
||||
$sql .= "'$fax_email', ";
|
||||
$sql .= "'$fax_pin_number', ";
|
||||
$sql .= "'$fax_caller_id_name', ";
|
||||
$sql .= "'$fax_caller_id_number', ";
|
||||
if (strlen($fax_forward_number) > 0) {
|
||||
$sql .= "'$fax_forward_number', ";
|
||||
}
|
||||
$sql .= "'$fax_description' ";
|
||||
$sql .= ")";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
//create the dialplan entry for fax
|
||||
$dialplan_name = $fax_name;
|
||||
$dialplan_order ='333';
|
||||
$dialplan_context = $_SESSION['context'];
|
||||
$dialplan_enabled = 'true';
|
||||
$dialplan_description = $fax_description;
|
||||
$app_uuid = '24108154-4ac3-1db6-1551-4731703a4440';
|
||||
dialplan_add($_SESSION['domain_uuid'], $dialplan_uuid, $dialplan_name, $dialplan_order, $dialplan_context, $dialplan_enabled, $dialplan_description, $app_uuid);
|
||||
|
||||
//<!-- default ${domain_name} -->
|
||||
//<condition field="destination_number" expression="^\*9978$">
|
||||
$dialplan_detail_tag = 'condition'; //condition, action, antiaction
|
||||
$dialplan_detail_type = 'destination_number';
|
||||
$dialplan_detail_data = '^'.$fax_extension.'$';
|
||||
$dialplan_detail_order = '000';
|
||||
$dialplan_detail_group = '';
|
||||
dialplan_detail_add($_SESSION['domain_uuid'], $dialplan_uuid, $dialplan_detail_tag, $dialplan_detail_order, $dialplan_detail_group, $dialplan_detail_type, $dialplan_detail_data);
|
||||
|
||||
//<action application="system" data="$switch_scripts_dir/emailfax.sh USER DOMAIN {$_SESSION['switch']['scripts']['dir']}/fax/inbox/9872/${last_fax}.tif"/>
|
||||
$dialplan_detail_tag = 'action'; //condition, action, antiaction
|
||||
$dialplan_detail_type = 'set';
|
||||
$dialplan_detail_data = "api_hangup_hook=system ".PHP_BINDIR."/".PHP_BIN." ".$_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/secure/fax_to_email.php ";
|
||||
$dialplan_detail_data .= "email=".$fax_email." ";
|
||||
$dialplan_detail_data .= "extension=".$fax_extension." ";
|
||||
$dialplan_detail_data .= "name=\\\\\\\${last_fax} ";
|
||||
$dialplan_detail_data .= "messages='result: \\\\\\\${fax_result_text} sender:\\\\\\\${fax_remote_station_id} pages:\\\\\\\${fax_document_total_pages}' ";
|
||||
$dialplan_detail_data .= "domain=".$_SESSION['domain_name']." ";
|
||||
$dialplan_detail_data .= "caller_id_name='\\\\\\\${caller_id_name}' ";
|
||||
$dialplan_detail_data .= "caller_id_number=\\\\\\\${caller_id_number} ";
|
||||
|
||||
$dialplan_detail_order = '010';
|
||||
dialplan_detail_add($_SESSION['domain_uuid'], $dialplan_uuid, $dialplan_detail_tag, $dialplan_detail_order, $dialplan_detail_group, $dialplan_detail_type, $dialplan_detail_data);
|
||||
|
||||
//<action application="answer" />
|
||||
$dialplan_detail_tag = 'action'; //condition, action, antiaction
|
||||
$dialplan_detail_type = 'answer';
|
||||
$dialplan_detail_data = '';
|
||||
$dialplan_detail_order = '010';
|
||||
dialplan_detail_add($_SESSION['domain_uuid'], $dialplan_uuid, $dialplan_detail_tag, $dialplan_detail_order, $dialplan_detail_group, $dialplan_detail_type, $dialplan_detail_data);
|
||||
|
||||
////<action application="set" data="fax_enable_t38=true"/>
|
||||
$dialplan_detail_tag = 'action'; //condition, action, antiaction
|
||||
$dialplan_detail_type = 'set';
|
||||
$dialplan_detail_data = 'fax_enable_t38=true';
|
||||
$dialplan_detail_order = '015';
|
||||
dialplan_detail_add($_SESSION['domain_uuid'], $dialplan_uuid, $dialplan_detail_tag, $dialplan_detail_order, $dialplan_detail_group, $dialplan_detail_type, $dialplan_detail_data);
|
||||
|
||||
////<action application="set" data="fax_enable_t38_request=true"/>
|
||||
$dialplan_detail_tag = 'action'; //condition, action, antiaction
|
||||
$dialplan_detail_type = 'set';
|
||||
$dialplan_detail_data = 'fax_enable_t38_request=true';
|
||||
$dialplan_detail_order = '020';
|
||||
dialplan_detail_add($_SESSION['domain_uuid'], $dialplan_uuid, $dialplan_detail_tag, $dialplan_detail_order, $dialplan_detail_group, $dialplan_detail_type, $dialplan_detail_data);
|
||||
|
||||
//<action application="set" data="last_fax=${caller_id_number}-${strftime(%Y-%m-%d-%H-%M-%S)}"/>
|
||||
$dialplan_detail_tag = 'action'; //condition, action, antiaction
|
||||
$dialplan_detail_type = 'set';
|
||||
$dialplan_detail_data = 'last_fax=${caller_id_number}-${strftime(%Y-%m-%d-%H-%M-%S)}';
|
||||
$dialplan_detail_order = '025';
|
||||
dialplan_detail_add($_SESSION['domain_uuid'], $dialplan_uuid, $dialplan_detail_tag, $dialplan_detail_order, $dialplan_detail_group, $dialplan_detail_type, $dialplan_detail_data);
|
||||
|
||||
//<action application="playback" data="silence_stream://2000"/>
|
||||
$dialplan_detail_tag = 'action'; //condition, action, antiaction
|
||||
$dialplan_detail_type = 'playback';
|
||||
$dialplan_detail_data = 'silence_stream://2000';
|
||||
$dialplan_detail_order = '030';
|
||||
dialplan_detail_add($_SESSION['domain_uuid'], $dialplan_uuid, $dialplan_detail_tag, $dialplan_detail_order, $dialplan_detail_group, $dialplan_detail_type, $dialplan_detail_data);
|
||||
|
||||
//<action application="rxfax" data="$switch_storage_dir/fax/inbox/${last_fax}.tif"/>
|
||||
$dialplan_detail_tag = 'action'; //condition, action, antiaction
|
||||
$dialplan_detail_type = 'rxfax';
|
||||
if (count($_SESSION["domains"]) > 1) {
|
||||
$dialplan_detail_data = $_SESSION['switch']['storage']['dir'].'/fax/'.$_SESSION['domain_name'].'/'.$fax_extension.'/inbox/${last_fax}.tif';
|
||||
}
|
||||
else {
|
||||
$dialplan_detail_data = $_SESSION['switch']['storage']['dir'].'/fax/'.$fax_extension.'/inbox/${last_fax}.tif';
|
||||
}
|
||||
$dialplan_detail_order = '035';
|
||||
dialplan_detail_add($_SESSION['domain_uuid'], $dialplan_uuid, $dialplan_detail_tag, $dialplan_detail_order, $dialplan_detail_group, $dialplan_detail_type, $dialplan_detail_data);
|
||||
|
||||
//<action application="hangup"/>
|
||||
$dialplan_detail_tag = 'action'; //condition, action, antiaction
|
||||
$dialplan_detail_type = 'hangup';
|
||||
$dialplan_detail_data = '';
|
||||
$dialplan_detail_order = '040';
|
||||
dialplan_detail_add($_SESSION['domain_uuid'], $dialplan_uuid, $dialplan_detail_tag, $dialplan_detail_order, $dialplan_detail_group, $dialplan_detail_type, $dialplan_detail_data);
|
||||
|
||||
//save the xml
|
||||
save_dialplan_xml();
|
||||
|
||||
//apply settings reminder
|
||||
$_SESSION["reload_xml"] = true;
|
||||
|
||||
//redirect the browser
|
||||
require_once "includes/header.php";
|
||||
echo "<meta http-equiv=\"refresh\" content=\"2;url=v_fax.php\">\n";
|
||||
echo "<div align='center'>\n";
|
||||
echo "Add Complete\n";
|
||||
echo "</div>\n";
|
||||
require_once "includes/footer.php";
|
||||
return;
|
||||
} //if ($action == "add")
|
||||
|
||||
if ($action == "update" && permission_exists('fax_extension_edit')) {
|
||||
//update the fax extension in the database
|
||||
$sql = "update v_fax set ";
|
||||
$sql .= "fax_extension = '$fax_extension', ";
|
||||
$sql .= "fax_name = '$fax_name', ";
|
||||
$sql .= "fax_email = '$fax_email', ";
|
||||
$sql .= "fax_pin_number = '$fax_pin_number', ";
|
||||
$sql .= "fax_caller_id_name = '$fax_caller_id_name', ";
|
||||
$sql .= "fax_caller_id_number = '$fax_caller_id_number', ";
|
||||
if (strlen($fax_forward_number) > 0) {
|
||||
$sql .= "fax_forward_number = '$fax_forward_number', ";
|
||||
}
|
||||
else {
|
||||
$sql .= "fax_forward_number = null, ";
|
||||
}
|
||||
$sql .= "fax_description = '$fax_description' ";
|
||||
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
|
||||
$sql .= "and fax_uuid = '$fax_uuid' ";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
//udpate the fax dialplan
|
||||
$sql = "update v_dialplans set ";
|
||||
$sql .= "dialplan_name = '$fax_name', ";
|
||||
if (strlen($dialplan_order) > 0) {
|
||||
$sql .= "dialplan_order = '333', ";
|
||||
}
|
||||
$sql .= "dialplan_context = '".$_SESSION['context']."', ";
|
||||
$sql .= "dialplan_enabled = 'true', ";
|
||||
$sql .= "dialplan_description = '$fax_description' ";
|
||||
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
|
||||
$sql .= "and dialplan_uuid = '$dialplan_uuid' ";
|
||||
$db->query($sql);
|
||||
unset($sql);
|
||||
|
||||
//update dialplan detail condition
|
||||
$sql = "";
|
||||
$sql = "update v_dialplan_details set ";
|
||||
$sql .= "dialplan_detail_data = '^".$fax_extension."$' ";
|
||||
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
|
||||
$sql .= "and dialplan_detail_tag = 'condition' ";
|
||||
$sql .= "and dialplan_detail_type = 'destination_number' ";
|
||||
$sql .= "and dialplan_uuid = '$dialplan_uuid' ";
|
||||
$db->query($sql);
|
||||
unset($sql);
|
||||
|
||||
//update dialplan detail action
|
||||
if (count($_SESSION["domains"]) > 1) {
|
||||
$dialplan_detail_data = $_SESSION['switch']['storage']['dir'].'/fax/'.$_SESSION['domain_name'].'/'.$fax_extension.'/inbox/${last_fax}.tif';
|
||||
}
|
||||
else {
|
||||
$dialplan_detail_data = $_SESSION['switch']['storage']['dir'].'/fax/'.$fax_extension.'/inbox/${last_fax}.tif';
|
||||
}
|
||||
$sql = "";
|
||||
$sql = "update v_dialplan_details set ";
|
||||
$sql .= "dialplan_detail_data = '".$dialplan_detail_data."' ";
|
||||
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
|
||||
$sql .= "and dialplan_detail_tag = 'action' ";
|
||||
$sql .= "and dialplan_detail_type = 'rxfax' ";
|
||||
$sql .= "and dialplan_uuid = '$dialplan_uuid' ";
|
||||
$db->query($sql);
|
||||
|
||||
//update dialplan detail action
|
||||
$dialplan_detail_tag = 'action'; //condition, action, antiaction
|
||||
$dialplan_detail_type = 'set';
|
||||
$dialplan_detail_data = "api_hangup_hook=system ".PHP_BINDIR."/".PHP_BIN." ".$_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/secure/fax_to_email.php ";
|
||||
$dialplan_detail_data .= "email=".$fax_email." ";
|
||||
$dialplan_detail_data .= "extension=".$fax_extension." ";
|
||||
$dialplan_detail_data .= "name=\\\\\\\${last_fax} ";
|
||||
$dialplan_detail_data .= "messages='result: \\\\\\\${fax_result_text} sender:\\\\\\\${fax_remote_station_id} pages:\\\\\\\${fax_document_total_pages}' ";
|
||||
$dialplan_detail_data .= "domain=".$_SESSION['domain_name']." ";
|
||||
$dialplan_detail_data .= "caller_id_name='\\\\\\\${caller_id_name}' ";
|
||||
$dialplan_detail_data .= "caller_id_number=\\\\\\\${caller_id_number} ";
|
||||
$sql = "update v_dialplan_details set ";
|
||||
$sql .= "dialplan_detail_data = '".check_str($dialplan_detail_data)."' ";
|
||||
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
|
||||
$sql .= "and dialplan_detail_tag = 'action' ";
|
||||
$sql .= "and dialplan_detail_type = 'set' ";
|
||||
$sql .= "and dialplan_uuid = '$dialplan_uuid' ";
|
||||
$sql .= "and dialplan_detail_data like 'api_hangup_hook=%' ";
|
||||
$db->query(check_sql($sql));
|
||||
|
||||
//save the xml
|
||||
save_dialplan_xml();
|
||||
|
||||
//apply settings reminder
|
||||
$_SESSION["reload_xml"] = true;
|
||||
|
||||
//redirect the browser
|
||||
require_once "includes/header.php";
|
||||
echo "<meta http-equiv=\"refresh\" content=\"2;url=v_fax.php\">\n";
|
||||
echo "<div align='center'>\n";
|
||||
echo "Update Complete\n";
|
||||
echo "</div>\n";
|
||||
require_once "includes/footer.php";
|
||||
return;
|
||||
} //if ($action == "update")
|
||||
} //if ($_POST["persistformvar"] != "true")
|
||||
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
|
||||
|
||||
//pre-populate the form
|
||||
if (strlen($_GET['id']) > 0 && $_POST["persistformvar"] != "true") {
|
||||
$fax_uuid = check_str($_GET["id"]);
|
||||
$sql = "";
|
||||
$sql .= "select * from v_fax ";
|
||||
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
|
||||
$sql .= "and fax_uuid = '$fax_uuid' ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
if (count($result) == 0) {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
foreach ($result as &$row) {
|
||||
$dialplan_uuid = $row["dialplan_uuid"];
|
||||
$fax_extension = $row["fax_extension"];
|
||||
$fax_name = $row["fax_name"];
|
||||
$fax_email = $row["fax_email"];
|
||||
$fax_pin_number = $row["fax_pin_number"];
|
||||
$fax_caller_id_name = $row["fax_caller_id_name"];
|
||||
$fax_caller_id_number = $row["fax_caller_id_number"];
|
||||
$fax_forward_number = $row["fax_forward_number"];
|
||||
$fax_description = $row["fax_description"];
|
||||
}
|
||||
unset ($prep_statement);
|
||||
}
|
||||
|
||||
//show the header
|
||||
require_once "includes/header.php";
|
||||
|
||||
//fax extension form
|
||||
echo "<div align='center'>";
|
||||
echo "<form method='post' name='frm' action=''>\n";
|
||||
echo "<table width='100%' border='0' cellpadding='6' cellspacing='0'>\n";
|
||||
echo "<tr>\n";
|
||||
if ($action == "add") {
|
||||
echo "<td align='left' width='30%' nowrap><b>Fax Add</b></td>\n";
|
||||
}
|
||||
if ($action == "update") {
|
||||
echo "<td align='left' width='30%' nowrap><b>Fax Edit</b></td>\n";
|
||||
}
|
||||
echo "<td width='70%' align='right'><input type='button' class='btn' name='' alt='back' onclick=\"window.location='v_fax.php'\" value='Back'></td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
|
||||
echo " Name:\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='fax_name' maxlength='255' value=\"$fax_name\">\n";
|
||||
echo "<br />\n";
|
||||
echo "Enter the name here.\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
|
||||
echo " Extension:\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='fax_extension' maxlength='255' value=\"$fax_extension\">\n";
|
||||
echo "<br />\n";
|
||||
echo "Enter the fax extension here.\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
|
||||
echo " Email:\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='fax_email' maxlength='255' value=\"$fax_email\">\n";
|
||||
echo "<br />\n";
|
||||
echo " Enter the email address to send the FAX to.\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
|
||||
echo " PIN Number:\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='fax_pin_number' maxlength='255' value=\"$fax_pin_number\">\n";
|
||||
echo "<br />\n";
|
||||
echo "Enter the PIN number here.\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
|
||||
echo " Caller ID Name:\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='fax_caller_id_name' maxlength='255' value=\"$fax_caller_id_name\">\n";
|
||||
echo "<br />\n";
|
||||
echo "Enter the Caller ID name here.\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
|
||||
echo " Caller ID Number:\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='fax_caller_id_number' maxlength='255' value=\"$fax_caller_id_number\">\n";
|
||||
echo "<br />\n";
|
||||
echo "Enter the Caller ID number here.\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
|
||||
echo " Forward Number:\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='fax_forward_number' maxlength='255' value=\"".format_phone($fax_forward_number)."\">\n";
|
||||
echo "<br />\n";
|
||||
echo "Enter the forward number here. Used to forward the fax to a registered extension or external number.\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
if (if_group("admin") || if_group("superadmin")) {
|
||||
if ($action == "update") {
|
||||
echo " <tr>";
|
||||
echo " <td class='vncell' valign='top'>User List:</td>";
|
||||
echo " <td class='vtable'>";
|
||||
|
||||
echo " <table width='52%'>\n";
|
||||
$sql = "SELECT * FROM v_fax_users as e, v_users as u ";
|
||||
$sql .= "where e.user_uuid = u.user_uuid ";
|
||||
$sql .= "and e.domain_uuid = '".$_SESSION['domain_uuid']."' ";
|
||||
$sql .= "and e.fax_uuid = '".$fax_uuid."' ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_ASSOC);
|
||||
$result_count = count($result);
|
||||
foreach($result as $field) {
|
||||
echo " <tr>\n";
|
||||
echo " <td class='vtable'>".$field['username']."</td>\n";
|
||||
echo " <td>\n";
|
||||
echo " <a href='v_fax_edit.php?id=".$fax_uuid."&domain_uuid=".$_SESSION['domain_uuid']."&user_uuid=".$field['user_uuid']."&a=delete' alt='delete' onclick=\"return confirm('Do you really want to delete this?')\">$v_link_label_delete</a>\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
}
|
||||
echo " </table>\n";
|
||||
|
||||
echo " <br />\n";
|
||||
$sql = "SELECT * FROM v_users ";
|
||||
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
echo " <select name=\"user_uuid\" class='frm'>\n";
|
||||
echo " <option value=\"\"></option>\n";
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
foreach($result as $field) {
|
||||
echo " <option value='".$field['user_uuid']."'>".$field['username']."</option>\n";
|
||||
}
|
||||
echo " </select>";
|
||||
echo " <input type=\"submit\" class='btn' value=\"Add\">\n";
|
||||
unset($sql, $result);
|
||||
echo " <br>\n";
|
||||
echo " Assign the users that are can manage this fax extension.\n";
|
||||
echo " <br />\n";
|
||||
echo " </td>";
|
||||
echo " </tr>";
|
||||
}
|
||||
}
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
|
||||
echo " Description:\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='fax_description' maxlength='255' value=\"$fax_description\">\n";
|
||||
echo "<br />\n";
|
||||
echo "Enter the description here.\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td colspan='2' align='right'>\n";
|
||||
if ($action == "update") {
|
||||
echo " <input type='hidden' name='fax_uuid' value='$fax_uuid'>\n";
|
||||
echo " <input type='hidden' name='dialplan_uuid' value='$dialplan_uuid'>\n";
|
||||
}
|
||||
echo " <input type='submit' name='submit' class='btn' value='Save'>\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>";
|
||||
echo "</table>";
|
||||
echo "</form>";
|
||||
echo "</div>";
|
||||
|
||||
echo "<br />\n";
|
||||
echo "<br />\n";
|
||||
|
||||
//show the footer
|
||||
require_once "includes/footer.php";
|
||||
?>
|
||||
@@ -0,0 +1,725 @@
|
||||
<?php
|
||||
/*
|
||||
FusionPBX
|
||||
Version: MPL 1.1
|
||||
|
||||
The contents of this file are subject to the Mozilla Public License Version
|
||||
1.1 (the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS" basis,
|
||||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
for the specific language governing rights and limitations under the
|
||||
License.
|
||||
|
||||
The Original Code is FusionPBX
|
||||
|
||||
The Initial Developer of the Original Code is
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
include "root.php";
|
||||
require_once "includes/require.php";
|
||||
require_once "includes/checkauth.php";
|
||||
if (permission_exists('fax_extension_view')) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
|
||||
//get the fax_extension and save it as a variable
|
||||
if (strlen($_REQUEST["fax_extension"]) > 0) {
|
||||
$fax_extension = check_str($_REQUEST["fax_extension"]);
|
||||
}
|
||||
|
||||
//pre-populate the form
|
||||
if (strlen($_GET['id']) > 0 && $_POST["persistformvar"] != "true") {
|
||||
$fax_uuid = check_str($_GET["id"]);
|
||||
if (if_group("superadmin") || if_group("admin")) {
|
||||
//show all fax extensions
|
||||
$sql = "select * from v_fax ";
|
||||
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
|
||||
$sql .= "and fax_uuid = '$fax_uuid' ";
|
||||
}
|
||||
else {
|
||||
//show only assigned fax extensions
|
||||
$sql = "select * from v_fax as f, v_fax_users as u ";
|
||||
$sql .= "where f.fax_uuid = u.fax_uuid ";
|
||||
$sql .= "and f.domain_uuid = '".$_SESSION['domain_uuid']."' ";
|
||||
$sql .= "and f.fax_uuid = '$fax_uuid' ";
|
||||
$sql .= "and u.user_uuid = '".$_SESSION['user_uuid']."' ";
|
||||
}
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
if (count($result) == 0) {
|
||||
if (if_group("superadmin") || if_group("admin")) {
|
||||
//allow access
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
}
|
||||
foreach ($result as &$row) {
|
||||
//set database fields as variables
|
||||
$fax_extension = $row["fax_extension"];
|
||||
$fax_name = $row["fax_name"];
|
||||
$fax_email = $row["fax_email"];
|
||||
$fax_pin_number = $row["fax_pin_number"];
|
||||
$fax_caller_id_name = $row["fax_caller_id_name"];
|
||||
$fax_caller_id_number = $row["fax_caller_id_number"];
|
||||
$fax_forward_number = $row["fax_forward_number"];
|
||||
$fax_description = $row["fax_description"];
|
||||
//limit to one row
|
||||
break;
|
||||
}
|
||||
unset ($prep_statement);
|
||||
}
|
||||
|
||||
//set the fax directory
|
||||
if (count($_SESSION["domains"]) > 1) {
|
||||
$v_fax_dir = $_SESSION['switch']['storage']['dir'].'/fax/'.$_SESSION['domain_name'];
|
||||
}
|
||||
else {
|
||||
$v_fax_dir = $_SESSION['switch']['storage']['dir'].'/fax';
|
||||
}
|
||||
|
||||
//delete a fax
|
||||
if ($_GET['a'] == "del" && permission_exists('fax_inbox_delete')) {
|
||||
$file_name = substr(check_str($_GET['filename']), 0, -4);
|
||||
$file_ext = substr(check_str($_GET['filename']), -3);
|
||||
if ($_GET['type'] == "fax_inbox") {
|
||||
unlink($v_fax_dir.'/'.$fax_extension.'/inbox/'.$file_name.".tif");
|
||||
unlink($v_fax_dir.'/'.$fax_extension.'/inbox/'.$file_name.".pdf");
|
||||
}
|
||||
if ($_GET['type'] == "fax_sent") {
|
||||
unlink($v_fax_dir.'/'.$fax_extension.'/sent/'.$file_name.".tif");
|
||||
unlink($v_fax_dir.'/'.$fax_extension.'/sent/'.$file_name.".pdf");
|
||||
}
|
||||
unset($file_name);
|
||||
unset($file_ext);
|
||||
}
|
||||
|
||||
//download a fax
|
||||
if ($_GET['a'] == "download") {
|
||||
session_cache_limiter('public');
|
||||
//test to see if it is in the inbox or sent directory.
|
||||
if ($_GET['type'] == "fax_inbox") {
|
||||
if (file_exists($v_fax_dir.'/'.check_str($_GET['ext']).'/inbox/'.check_str($_GET['filename']))) {
|
||||
$tmp_faxdownload_file = "".$v_fax_dir.'/'.check_str($_GET['ext']).'/inbox/'.check_str($_GET['filename']);
|
||||
}
|
||||
}
|
||||
else if ($_GET['type'] == "fax_sent") {
|
||||
if (file_exists($v_fax_dir.'/'.check_str($_GET['ext']).'/sent/'.check_str($_GET['filename']))) {
|
||||
$tmp_faxdownload_file = "".$v_fax_dir.'/'.check_str($_GET['ext']).'/sent/'.check_str($_GET['filename']);
|
||||
}
|
||||
}
|
||||
//let's see if we found it.
|
||||
if (strlen($tmp_faxdownload_file) > 0) {
|
||||
$fd = fopen($tmp_faxdownload_file, "rb");
|
||||
if ($_GET['t'] == "bin") {
|
||||
header("Content-Type: application/force-download");
|
||||
header("Content-Type: application/octet-stream");
|
||||
header("Content-Type: application/download");
|
||||
header("Content-Description: File Transfer");
|
||||
header('Content-Disposition: attachment; filename="'.check_str($_GET['filename']).'"');
|
||||
}
|
||||
else {
|
||||
$file_ext = substr(check_str($_GET['filename']), -3);
|
||||
if ($file_ext == "tif") {
|
||||
header("Content-Type: image/tiff");
|
||||
}
|
||||
else if ($file_ext == "png") {
|
||||
header("Content-Type: image/png");
|
||||
}
|
||||
else if ($file_ext == "jpg") {
|
||||
header('Content-Type: image/jpeg');
|
||||
}
|
||||
else if ($file_ext == "pdf") {
|
||||
header("Content-Type: application/pdf");
|
||||
}
|
||||
}
|
||||
header('Accept-Ranges: bytes');
|
||||
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
|
||||
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // date in the past
|
||||
header("Content-Length: " . filesize($tmp_faxdownload_file));
|
||||
fpassthru($fd);
|
||||
}
|
||||
else {
|
||||
echo "File not found.";
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
||||
//get the fax extension
|
||||
if (strlen($fax_extension) > 0) {
|
||||
//set the fax directories. example /usr/local/freeswitch/storage/fax/329/inbox
|
||||
$dir_fax_inbox = $v_fax_dir.'/'.$fax_extension.'/inbox';
|
||||
$dir_fax_sent = $v_fax_dir.'/'.$fax_extension.'/sent';
|
||||
$dir_fax_temp = $v_fax_dir.'/'.$fax_extension.'/temp';
|
||||
|
||||
//make sure the directories exist
|
||||
if (!is_dir($_SESSION['switch']['storage']['dir'])) {
|
||||
mkdir($_SESSION['switch']['storage']['dir']);
|
||||
chmod($dir_fax_sent,0774);
|
||||
}
|
||||
if (!is_dir($v_fax_dir.'/'.$fax_extension)) {
|
||||
mkdir($v_fax_dir.'/'.$fax_extension,0774,true);
|
||||
chmod($v_fax_dir.'/'.$fax_extension,0774);
|
||||
}
|
||||
if (!is_dir($dir_fax_inbox)) {
|
||||
mkdir($dir_fax_inbox,0774,true);
|
||||
chmod($dir_fax_inbox,0774);
|
||||
}
|
||||
if (!is_dir($dir_fax_sent)) {
|
||||
mkdir($dir_fax_sent,0774,true);
|
||||
chmod($dir_fax_sent,0774);
|
||||
}
|
||||
if (!is_dir($dir_fax_temp)) {
|
||||
mkdir($dir_fax_temp,0774,true);
|
||||
chmod($dir_fax_temp,0774);
|
||||
}
|
||||
}
|
||||
|
||||
//set the action as an add or an update
|
||||
if (isset($_REQUEST["id"])) {
|
||||
$action = "update";
|
||||
$fax_uuid = check_str($_REQUEST["id"]);
|
||||
}
|
||||
else {
|
||||
$action = "add";
|
||||
}
|
||||
|
||||
//get the http post values and set them as php variables
|
||||
if (count($_POST)>0) {
|
||||
$fax_name = check_str($_POST["fax_name"]);
|
||||
$fax_email = check_str($_POST["fax_email"]);
|
||||
$fax_pin_number = check_str($_POST["fax_pin_number"]);
|
||||
$fax_caller_id_name = check_str($_POST["fax_caller_id_name"]);
|
||||
$fax_caller_id_number = check_str($_POST["fax_caller_id_number"]);
|
||||
$fax_forward_number = check_str($_POST["fax_forward_number"]);
|
||||
if (strlen($fax_forward_number) > 0) {
|
||||
$fax_forward_number = preg_replace("~[^0-9]~", "",$fax_forward_number);
|
||||
}
|
||||
$fax_description = check_str($_POST["fax_description"]);
|
||||
}
|
||||
|
||||
//clear file status cache
|
||||
clearstatcache();
|
||||
|
||||
//upload and send the fax
|
||||
if (($_POST['type'] == "fax_send") && is_uploaded_file($_FILES['fax_file']['tmp_name'])) {
|
||||
|
||||
$fax_number = check_str($_POST['fax_number']);
|
||||
if (strlen($fax_number) > 0) {
|
||||
$fax_number = preg_replace("~[^0-9]~", "",$fax_number);
|
||||
}
|
||||
$fax_name = $_FILES['fax_file']['name'];
|
||||
$fax_name = str_replace(" ", "_", $fax_name);
|
||||
$fax_name = str_replace(".tif", "", $fax_name);
|
||||
$fax_name = str_replace(".tiff", "", $fax_name);
|
||||
$fax_name = str_replace(".pdf", "", $fax_name);
|
||||
$provider_type = check_str($_POST['provider_type']);
|
||||
$fax_uuid = check_str($_POST["id"]);
|
||||
|
||||
$fax_caller_id_name = check_str($_POST['fax_caller_id_name']);
|
||||
$fax_caller_id_number = check_str($_POST['fax_caller_id_number']);
|
||||
$fax_forward_number = check_str($_POST['fax_forward_number']);
|
||||
if (strlen($fax_forward_number) > 0) {
|
||||
$fax_forward_number = preg_replace("~[^0-9]~", "",$fax_forward_number);
|
||||
}
|
||||
|
||||
//get the fax file extension
|
||||
$fax_file_extension = substr($dir_fax_temp.'/'.$_FILES['fax_file']['name'], -4);
|
||||
if ($fax_file_extension == "tiff") { $fax_file_extension = ".tif"; }
|
||||
|
||||
//upload the file
|
||||
move_uploaded_file($_FILES['fax_file']['tmp_name'], $dir_fax_temp.'/'.$fax_name.$fax_file_extension);
|
||||
|
||||
if ($fax_file_extension == ".pdf") {
|
||||
chdir($dir_fax_temp);
|
||||
exec("gs -q -sDEVICE=tiffg3 -r204x98 -dNOPAUSE -sOutputFile=".$fax_name.".tif -- ".$fax_name.".pdf -c quit");
|
||||
//exec("rm ".$dir_fax_temp.'/'.$fax_name.".pdf");
|
||||
}
|
||||
|
||||
//send the fax
|
||||
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
|
||||
if ($fp) {
|
||||
//prepare the fax originate command
|
||||
$route_array = outbound_route_to_bridge($fax_number);
|
||||
$fax_file = $dir_fax_temp."/".$fax_name.".tif";
|
||||
if (count($route_array) == 0) {
|
||||
//send the internal call to the registered extension
|
||||
$fax_uri = "user/".$fax_number."@".$_SESSION['domain_name'];
|
||||
$t38 = "";
|
||||
}
|
||||
else {
|
||||
//send the external call
|
||||
$fax_uri = $route_array[0];
|
||||
$t38 = "fax_enable_t38=true,fax_enable_t38_request=true,";
|
||||
}
|
||||
$cmd = "api originate {origination_caller_id_name='".$fax_caller_id_name."',origination_caller_id_number='".$fax_caller_id_number."',fax_ident='".$fax_caller_id_number."',fax_header='".$fax_caller_id_name."',fax_uri=".$fax_uri.",fax_file='".$fax_file."',fax_retry_attempts=1,fax_retry_limit=20,fax_retry_sleep=180,fax_verbose=true,fax_use_ecm=off,".$t38."api_hangup_hook='lua fax_retry.lua'}".$fax_uri." &txfax('".$fax_file."')";
|
||||
//send the command to event socket
|
||||
$response = event_socket_request($fp, $cmd);
|
||||
$response = str_replace("\n", "", $response);
|
||||
$uuid = str_replace("+OK ", "", $response);
|
||||
fclose($fp);
|
||||
}
|
||||
|
||||
//wait for a few seconds
|
||||
sleep(5);
|
||||
|
||||
//copy the .tif to the sent directory
|
||||
exec("cp ".$dir_fax_temp.'/'.$fax_name.".tif ".$dir_fax_sent.'/'.$fax_name.".tif");
|
||||
|
||||
//convert the tif to pdf
|
||||
chdir($dir_fax_sent);
|
||||
exec("gs -q -sDEVICE=tiffg3 -g1728x1078 -dNOPAUSE -sOutputFile=".$fax_name.".pdf -- ".$fax_name.".tif -c quit");
|
||||
|
||||
//delete the .tif from the temp directory
|
||||
//exec("rm ".$dir_fax_temp.'/'.$fax_name.".tif");
|
||||
|
||||
//convert the tif to pdf and png
|
||||
chdir($dir_fax_sent);
|
||||
//which tiff2pdf
|
||||
if (is_file("/usr/local/bin/tiff2png")) {
|
||||
exec($_SESSION['switch']['bin']['dir']."/tiff2png ".$dir_fax_sent.$fax_name.".tif");
|
||||
exec($_SESSION['switch']['bin']['dir']."/tiff2pdf -f -o ".$fax_name.".pdf ".$dir_fax_sent.$fax_name.".tif");
|
||||
}
|
||||
|
||||
header("Location: v_fax_view.php?id=".$fax_uuid."&msg=".$response);
|
||||
exit;
|
||||
} //end upload and send fax
|
||||
|
||||
//delete the fax
|
||||
if ($_GET['a'] == "del") {
|
||||
$fax_extension = check_str($_GET["fax_extension"]);
|
||||
if ($_GET['type'] == "fax_inbox" && permission_exists('fax_inbox_delete')) {
|
||||
unlink($v_fax_dir.'/'.$fax_extension.'/inbox/'.check_str($_GET['filename']));
|
||||
}
|
||||
if ($_GET['type'] == "fax_sent" && permission_exists('fax_sent_delete')) {
|
||||
unlink($v_fax_dir.'/'.$fax_extension.'/sent/'.check_str($_GET['filename']));
|
||||
}
|
||||
}
|
||||
|
||||
//download the fax
|
||||
if ($_GET['a'] == "download") {
|
||||
session_cache_limiter('public');
|
||||
//test to see if it is in the inbox or sent directory.
|
||||
if ($_GET['type'] == "fax_inbox" && permission_exists('fax_inbox_view')) {
|
||||
if (file_exists($v_fax_dir.'/'.check_str($_GET['ext']).'/inbox/'.check_str($_GET['filename']))) {
|
||||
$tmp_faxdownload_file = "".$v_fax_dir.'/'.check_str($_GET['ext']).'/inbox/'.check_str($_GET['filename']);
|
||||
}
|
||||
}else if ($_GET['type'] == "fax_sent" && permission_exists('fax_sent_view')) {
|
||||
if (file_exists($v_fax_dir.'/'.check_str($_GET['ext']).'/sent/'.check_str($_GET['filename']))) {
|
||||
$tmp_faxdownload_file = "".$v_fax_dir.'/'.check_str($_GET['ext']).'/sent/'.check_str($_GET['filename']);
|
||||
}
|
||||
}
|
||||
//check to see if it was found.
|
||||
if (strlen($tmp_faxdownload_file) > 0) {
|
||||
$fd = fopen($tmp_faxdownload_file, "rb");
|
||||
if ($_GET['t'] == "bin") {
|
||||
header("Content-Type: application/force-download");
|
||||
header("Content-Type: application/octet-stream");
|
||||
header("Content-Type: application/download");
|
||||
header("Content-Description: File Transfer");
|
||||
header('Content-Disposition: attachment; filename="'.check_str($_GET['filename']).'"');
|
||||
}
|
||||
else {
|
||||
$file_ext = substr(check_str($_GET['filename']), -3);
|
||||
if ($file_ext == "tif") {
|
||||
header("Content-Type: image/tiff");
|
||||
} else if ($file_ext == "png") {
|
||||
header("Content-Type: image/png");
|
||||
} else if ($file_ext == "jpg") {
|
||||
header('Content-Type: image/jpeg');
|
||||
} else if ($file_ext == "pdf") {
|
||||
header("Content-Type: application/pdf");
|
||||
}
|
||||
}
|
||||
header('Accept-Ranges: bytes');
|
||||
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
|
||||
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past
|
||||
header("Content-Length: " . filesize($tmp_faxdownload_file));
|
||||
fpassthru($fd);
|
||||
}
|
||||
else {
|
||||
echo "File not found.";
|
||||
}
|
||||
//exit the code execution
|
||||
exit;
|
||||
}
|
||||
|
||||
//show the header
|
||||
require_once "includes/header.php";
|
||||
|
||||
//fax extension form
|
||||
echo "<div align='center'>";
|
||||
echo "<table border='0' cellpadding='0' cellspacing='2'>\n";
|
||||
echo "<tr class='border'>\n";
|
||||
echo " <td align=\"left\">\n";
|
||||
echo " <br>";
|
||||
|
||||
echo "<div align='center'>\n";
|
||||
echo "<table width='100%' border='0' cellpadding='6' cellspacing='0'>\n";
|
||||
echo "<tr>\n";
|
||||
echo " <td align='left' width='30%'>\n";
|
||||
echo " <span class=\"vexpl\"><span class=\"red\"><strong>Fax Server</strong></span>\n";
|
||||
echo " </td>\n";
|
||||
echo " <td width='70%' align='right'>\n";
|
||||
if (permission_exists('fax_extension_add') || permission_exists('fax_extension_edit')) {
|
||||
echo " <input type='button' class='btn' name='' alt='settings' onclick=\"window.location='v_fax_edit.php?id=$fax_uuid'\" value='Settings'>\n";
|
||||
}
|
||||
echo " <input type='button' class='btn' name='' alt='back' onclick=\"window.location='v_fax.php'\" value='Back'>\n";
|
||||
echo " </td>\n";
|
||||
echo "</tr>\n";
|
||||
echo "</table>\n";
|
||||
echo "</div>\n";
|
||||
|
||||
echo "<form action=\"\" method=\"POST\" enctype=\"multipart/form-data\" name=\"frmUpload\" onSubmit=\"\">\n";
|
||||
echo "<div align='center'>\n";
|
||||
echo "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"3\">\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td colspan='2' align='left'>\n";
|
||||
//pkg_add -r ghostscript8-nox11; rehash
|
||||
echo " To send a fax you can upload a .tif file or if ghost script has been installed then you can also send a fax by uploading a PDF. \n";
|
||||
echo " When sending a fax you can view status of the transmission by viewing the logs from the Status tab or by watching the response from the console.\n";
|
||||
echo " <br /><br />\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
|
||||
echo " Fax Number:\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input type=\"text\" name=\"fax_number\" class='formfld' style='' value=\"\">\n";
|
||||
echo "<br />\n";
|
||||
echo "Enter the Number here.\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
|
||||
echo " Upload:\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input name=\"id\" type=\"hidden\" value=\"\$id\">\n";
|
||||
echo " <input name=\"type\" type=\"hidden\" value=\"fax_send\">\n";
|
||||
echo " <input name=\"fax_file\" type=\"file\" class=\"btn\" id=\"fax_file\">\n";
|
||||
echo " <br />\n";
|
||||
echo " Select the file to upload and send as a fax.\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo " <tr>\n";
|
||||
echo " <td colspan='2' align='right'>\n";
|
||||
echo " <input type=\"hidden\" name=\"fax_caller_id_name\" value=\"".$fax_caller_id_name."\">\n";
|
||||
echo " <input type=\"hidden\" name=\"fax_caller_id_number\" value=\"".$fax_caller_id_number."\">\n";
|
||||
echo " <input type=\"hidden\" name=\"fax_extension\" value=\"".$fax_extension."\">\n";
|
||||
echo " <input type=\"hidden\" name=\"id\" value=\"".$fax_uuid."\">\n";
|
||||
echo " <input name=\"submit\" type=\"submit\" class=\"btn\" id=\"upload\" value=\"Send\">\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>";
|
||||
echo "</table>";
|
||||
echo "</div>\n";
|
||||
echo "</form>\n";
|
||||
|
||||
//show the inbox
|
||||
if (permission_exists('fax_inbox_view')) {
|
||||
echo "\n";
|
||||
echo "\n";
|
||||
echo " <br />\n";
|
||||
echo "\n";
|
||||
echo " <table width=\"100%\" border=\"0\" cellpadding=\"5\" cellspacing=\"0\">\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td align='left'>\n";
|
||||
echo " <span class=\"vexpl\"><span class=\"red\"><strong>Inbox $fax_extension</strong></span>\n";
|
||||
echo " </td>\n";
|
||||
echo " <td align='right'>";
|
||||
if ($v_path_show) {
|
||||
echo "<b>location:</b> ";
|
||||
echo $dir_fax_inbox." ";
|
||||
}
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo " </table>\n";
|
||||
echo "\n";
|
||||
|
||||
$c = 0;
|
||||
$row_style["0"] = "row_style0";
|
||||
$row_style["1"] = "row_style1";
|
||||
|
||||
echo " <div id=\"\">\n";
|
||||
echo " <table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n";
|
||||
echo " <tr>\n";
|
||||
echo " <th width=\"60%\" class=\"listhdrr\">File Name (download)</td>\n";
|
||||
echo " <th width=\"10%\" class=\"listhdrr\">View</td>\n";
|
||||
echo " <th width=\"20%\" class=\"listhdr\">Last Modified</td>\n";
|
||||
echo " <th width=\"10%\" class=\"listhdr\" nowrap>Size</td>\n";
|
||||
echo " </tr>";
|
||||
|
||||
|
||||
if ($handle = opendir($dir_fax_inbox)) {
|
||||
//build an array of the files in the inbox
|
||||
$i = 0;
|
||||
$files = array();
|
||||
while (false !== ($file = readdir($handle))) {
|
||||
if ($file != "." && $file != ".." && is_file($dir_fax_inbox.'/'.$file)) {
|
||||
$file_path = $dir_fax_inbox.'/'.$file;
|
||||
$modified = filemtime($file_path);
|
||||
$index = $modified.$file;
|
||||
$files[$index]['file'] = $file;
|
||||
$files[$index]['name'] = substr($file, 0, -4);
|
||||
$files[$index]['ext'] = substr($file, -3);
|
||||
//$files[$index]['path'] = $file_path;
|
||||
$files[$index]['size'] = filesize($file_path);
|
||||
$files[$index]['size_bytes'] = byte_convert(filesize($file_path));
|
||||
$files[$index]['modified'] = filemtime($file_path);
|
||||
$file_name_array[$i++] = $index;
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
//order the index array
|
||||
sort($file_name_array,SORT_STRING);
|
||||
|
||||
//loop through the file array
|
||||
foreach($file_name_array as $i) {
|
||||
if (strtolower($files[$i]['ext']) == "tif") {
|
||||
$file = $files[$i]['file'];
|
||||
$file_name = $files[$i]['name'];
|
||||
$file_ext = $files[$i]['ext'];
|
||||
$file_modified = $files[$i]['modified'];
|
||||
$file_size_bytes = byte_convert($files[$i]['size']);
|
||||
if (!file_exists($dir_fax_inbox.'/'.$file_name.".pdf")) {
|
||||
//convert the tif to pdf
|
||||
chdir($dir_fax_inbox);
|
||||
if (is_file("/usr/local/bin/tiff2pdf")) {
|
||||
exec("/usr/local/bin/tiff2pdf -f -o ".$file_name.".pdf ".$dir_fax_inbox.'/'.$file_name.".tif");
|
||||
}
|
||||
if (is_file("/usr/bin/tiff2pdf")) {
|
||||
exec("/usr/bin/tiff2pdf -f -o ".$file_name.".pdf ".$dir_fax_inbox.'/'.$file_name.".tif");
|
||||
}
|
||||
}
|
||||
//if (!file_exists($dir_fax_inbox.'/'.$file_name.".jpg")) {
|
||||
// //convert the tif to jpg
|
||||
// chdir($dir_fax_inbox);
|
||||
// if (is_file("/usr/local/bin/tiff2rgba")) {
|
||||
// exec("/usr/local/bin/tiff2rgba ".$file_name.".tif ".$dir_fax_inbox.'/'.$file_name.".jpg");
|
||||
// }
|
||||
// if (is_file("/usr/bin/tiff2rgba")) {
|
||||
// exec("/usr/bin/tiff2rgba ".$file_name.".tif ".$dir_fax_inbox.'/'.$file_name.".jpg");
|
||||
// }
|
||||
//}
|
||||
echo "<tr>\n";
|
||||
echo " <td class='".$row_style[$c]."' ondblclick=\"\">\n";
|
||||
echo " <a href=\"v_fax_view.php?id=".$fax_uuid."&a=download&type=fax_inbox&t=bin&ext=".urlencode($fax_extension)."&filename=".urlencode($file)."\">\n";
|
||||
echo " $file_name";
|
||||
echo " </a>";
|
||||
echo " </td>\n";
|
||||
|
||||
echo " <td class='".$row_style[$c]."' ondblclick=\"\">\n";
|
||||
if (file_exists($dir_fax_inbox.'/'.$file_name.".pdf")) {
|
||||
echo " <a href=\"v_fax_view.php?id=".$fax_uuid."&a=download&type=fax_inbox&t=bin&ext=".urlencode($fax_extension)."&filename=".urlencode($file_name).".pdf\">\n";
|
||||
echo " PDF";
|
||||
echo " </a>";
|
||||
}
|
||||
else {
|
||||
echo " \n";
|
||||
}
|
||||
echo " </td>\n";
|
||||
|
||||
//echo " <td class='".$row_style[$c]."' ondblclick=\"\">\n";
|
||||
//if (file_exists($dir_fax_inbox.'/'.$file_name.".jpg")) {
|
||||
// echo " <a href=\"v_fax_view.php?id=".$fax_uuid."&a=download&type=fax_inbox&t=jpg&ext=".$fax_extension."&filename=".$file_name.".jpg\" target=\"_blank\">\n";
|
||||
// echo " jpg";
|
||||
// echo " </a>";
|
||||
//}
|
||||
//else {
|
||||
// echo " \n";
|
||||
//}
|
||||
//echo " </td>\n";
|
||||
|
||||
echo " <td class='".$row_style[$c]."' ondblclick=\"\">\n";
|
||||
echo " ".date("F d Y H:i:s", $file_modified);
|
||||
echo " </td>\n";
|
||||
|
||||
echo " <td class='".$row_style[$c]."' ondblclick=\"\">\n";
|
||||
echo " ".$file_size_bytes;
|
||||
echo " </td>\n";
|
||||
|
||||
echo " <td valign=\"middle\" nowrap class=\"list\">\n";
|
||||
echo " <table border=\"0\" cellspacing=\"0\" cellpadding=\"1\">\n";
|
||||
echo " <tr>\n";
|
||||
if (permission_exists('fax_inbox_delete')) {
|
||||
echo " <td><a href=\"v_fax_view.php?id=".$fax_uuid."&type=fax_inbox&a=del&fax_extension=".urlencode($fax_extension)."&filename=".urlencode($file)."\" onclick=\"return confirm('Do you really want to delete this file?')\">$v_link_label_delete</a></td>\n";
|
||||
}
|
||||
echo " </tr>\n";
|
||||
echo " </table>\n";
|
||||
echo " </td>\n";
|
||||
echo "</tr>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
echo " <tr>\n";
|
||||
echo " <td class=\"list\" colspan=\"3\"></td>\n";
|
||||
echo " <td class=\"list\"></td>\n";
|
||||
echo " </tr>\n";
|
||||
echo " </table>\n";
|
||||
echo "\n";
|
||||
echo " <br />\n";
|
||||
echo " <br />\n";
|
||||
echo "\n";
|
||||
}
|
||||
|
||||
//show the sent box
|
||||
if (permission_exists('fax_sent_view')) {
|
||||
echo " <table width=\"100%\" border=\"0\" cellpadding=\"5\" cellspacing=\"0\">\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td align='left'>\n";
|
||||
echo " <span class=\"vexpl\"><span class=\"red\"><strong>Sent</strong></span>\n";
|
||||
echo " </td>\n";
|
||||
echo " <td align='right'>\n";
|
||||
if ($v_path_show) {
|
||||
echo "<b>location: </b>\n";
|
||||
echo $dir_fax_sent." \n";
|
||||
}
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo " </table>\n";
|
||||
echo "\n";
|
||||
echo " <table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n";
|
||||
echo " <tr>\n";
|
||||
echo " <th width=\"60%\">File Name (download)</td>\n";
|
||||
echo " <th width=\"10%\">View</td>\n";
|
||||
echo " <th width=\"20%\">Last Modified</td>\n";
|
||||
echo " <th width=\"10%\" nowrap>Size</td>\n";
|
||||
echo " </tr>";
|
||||
|
||||
if ($handle = opendir($dir_fax_sent)) {
|
||||
//build an array of the files in the inbox
|
||||
$i = 0;
|
||||
$files = array();
|
||||
while (false !== ($file = readdir($handle))) {
|
||||
if ($file != "." && $file != ".." && is_file($dir_fax_sent.'/'.$file)) {
|
||||
$file_path = $dir_fax_sent.'/'.$file;
|
||||
$modified = filemtime($file_path);
|
||||
$index = $modified.$file;
|
||||
$files[$index]['file'] = $file;
|
||||
$files[$index]['name'] = substr($file, 0, -4);
|
||||
$files[$index]['ext'] = substr($file, -3);
|
||||
//$files[$index]['path'] = $file_path;
|
||||
$files[$index]['size'] = filesize($file_path);
|
||||
$files[$index]['size_bytes'] = byte_convert(filesize($file_path));
|
||||
$files[$index]['modified'] = filemtime($file_path);
|
||||
$file_name_array[$i++] = $index;
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
//order the index array
|
||||
sort($file_name_array,SORT_STRING);
|
||||
|
||||
//loop through the file array
|
||||
foreach($file_name_array as $i) {
|
||||
if (strtolower($files[$i]['ext']) == "tif") {
|
||||
$file = $files[$i]['file'];
|
||||
$file_name = $files[$i]['name'];
|
||||
$file_ext = $files[$i]['ext'];
|
||||
$file_modified = $files[$i]['modified'];
|
||||
$file_size_bytes = byte_convert($files[$i]['size']);
|
||||
|
||||
if (!file_exists($dir_fax_sent.'/'.$file_name.".pdf")) {
|
||||
//convert the tif to pdf
|
||||
chdir($dir_fax_sent);
|
||||
if (is_file("/usr/local/bin/tiff2pdf")) {
|
||||
exec("/usr/local/bin/tiff2pdf -f -o ".$file_name.".pdf ".$dir_fax_sent.'/'.$file_name.".tif");
|
||||
}
|
||||
if (is_file("/usr/bin/tiff2pdf")) {
|
||||
exec("/usr/bin/tiff2pdf -f -o ".$file_name.".pdf ".$dir_fax_sent.'/'.$file_name.".tif");
|
||||
}
|
||||
}
|
||||
if (!file_exists($dir_fax_sent.'/'.$file_name.".jpg")) {
|
||||
//convert the tif to jpg
|
||||
//chdir($dir_fax_sent);
|
||||
//if (is_file("/usr/local/bin/tiff2rgba")) {
|
||||
// exec("/usr/local/bin/tiff2rgba -c jpeg -n ".$file_name.".tif ".$dir_fax_sent.'/'.$file_name.".jpg");
|
||||
//}
|
||||
//if (is_file("/usr/bin/tiff2rgba")) {
|
||||
// exec("/usr/bin/tiff2rgba -c lzw -n ".$file_name.".tif ".$dir_fax_sent.'/'.$file_name.".jpg");
|
||||
//}
|
||||
}
|
||||
echo "<tr>\n";
|
||||
echo " <td class='".$row_style[$c]."' ondblclick=\"\">\n";
|
||||
echo " <a href=\"v_fax_view.php?id=".$fax_uuid."&a=download&type=fax_sent&t=bin&ext=".urlencode($fax_extension)."&filename=".urlencode($file)."\">\n";
|
||||
echo " $file";
|
||||
echo " </a>";
|
||||
echo " </td>\n";
|
||||
echo " <td class='".$row_style[$c]."' ondblclick=\"\">\n";
|
||||
if (file_exists($dir_fax_sent.'/'.$file_name.".pdf")) {
|
||||
echo " <a href=\"v_fax_view.php?id=".$fax_uuid."&a=download&type=fax_sent&t=bin&ext=".urlencode($fax_extension)."&filename=".urlencode($file_name).".pdf\">\n";
|
||||
echo " PDF";
|
||||
echo " </a>";
|
||||
}
|
||||
else {
|
||||
echo " \n";
|
||||
}
|
||||
echo " </td>\n";
|
||||
//echo " <td class='".$row_style[$c]."' ondblclick=\"\">\n";
|
||||
//if (file_exists($dir_fax_sent.'/'.$file_name.".jpg")) {
|
||||
// echo " <a href=\"v_fax_view.php?id=".$fax_uuid."&a=download&type=fax_sent&t=jpg&ext=".$fax_extension."&filename=".$file_name.".jpg\" target=\"_blank\">\n";
|
||||
// echo " jpg";
|
||||
// echo " </a>";
|
||||
//}
|
||||
//else {
|
||||
// echo " \n";
|
||||
//}
|
||||
//echo " </td>\n";
|
||||
echo " <td class='".$row_style[$c]."' ondblclick=\"\">\n";
|
||||
echo " ".date("F d Y H:i:s", $file_modified);
|
||||
echo " </td>\n";
|
||||
|
||||
echo " <td class=\"".$row_style[$c]."\" ondblclick=\"list\">\n";
|
||||
echo " ".$file_size_bytes;
|
||||
echo " </td>\n";
|
||||
|
||||
echo " <td class='' valign=\"middle\" nowrap>\n";
|
||||
echo " <table border=\"0\" cellspacing=\"0\" cellpadding=\"1\">\n";
|
||||
echo " <tr>\n";
|
||||
if (permission_exists('fax_sent_delete')) {
|
||||
echo " <td><a href=\"v_fax_view.php?id=".$fax_uuid."&type=fax_sent&a=del&fax_extension=".urlencode($fax_extension)."&filename=".urlencode($file)."\" onclick=\"return confirm('Do you really want to delete this file?')\">$v_link_label_delete</a></td>\n";
|
||||
}
|
||||
echo " </tr>\n";
|
||||
echo " </table>\n";
|
||||
echo " </td>\n";
|
||||
echo "</tr>\n";
|
||||
if ($c==0) { $c=1; } else { $c=0; }
|
||||
} //check if the file is a .tif file
|
||||
}
|
||||
}
|
||||
echo " <tr>\n";
|
||||
echo " <td class=\"list\" colspan=\"3\"></td>\n";
|
||||
echo " <td class=\"list\"></td>\n";
|
||||
echo " </tr>\n";
|
||||
echo " </table>\n";
|
||||
echo "\n";
|
||||
echo " <br />\n";
|
||||
echo " <br />\n";
|
||||
echo " <br />\n";
|
||||
echo " <br />\n";
|
||||
}
|
||||
echo " </td>";
|
||||
echo " </tr>";
|
||||
echo "</table>";
|
||||
echo "</div>";
|
||||
|
||||
//show the footer
|
||||
require_once "includes/footer.php";
|
||||
?>
|
||||
Reference in New Issue
Block a user